Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from flojoy-ai/rename-textblob-string
Browse files Browse the repository at this point in the history
dx: rename TextBlob to String
  • Loading branch information
itsjoeoui authored Dec 4, 2023
2 parents 5f78a14 + 517e624 commit f4b3a18
Show file tree
Hide file tree
Showing 332 changed files with 1,306 additions and 1,308 deletions.
6 changes: 3 additions & 3 deletions blocks/AI_ML/AUDIO/SPEECH_2_TEXT/SPEECH_2_TEXT.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flojoy import flojoy, DataContainer, TextBlob, File
from flojoy import flojoy, DataContainer, String, File
from typing import Optional
from huggingsound import SpeechRecognitionModel

Expand All @@ -17,7 +17,7 @@ def SPEECH_2_TEXT(
Returns
-------
TextBlob
String
Filename and path of the recording.
"""
file_path = file_path.unwrap() if file_path else None
Expand All @@ -26,4 +26,4 @@ def SPEECH_2_TEXT(
audio_paths = [file_path]
transcriptions = model.transcribe(audio_paths)

return TextBlob(text_blob=transcriptions[0]["transcription"])
return String(s=transcriptions[0]["transcription"])
4 changes: 2 additions & 2 deletions blocks/AI_ML/AUDIO/SPEECH_2_TEXT/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -213,7 +213,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
2 changes: 1 addition & 1 deletion blocks/AI_ML/AUDIO/SPEECH_2_TEXT/block_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"returns": [
{
"name": null,
"type": "TextBlob",
"type": "String",
"description": "Filename and path of the recording."
}
]
Expand Down
6 changes: 3 additions & 3 deletions blocks/COMPUTER_VISION/EDGE_DETECTION/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "the DataContainer to be visualized in text format"
}
Expand Down Expand Up @@ -254,8 +254,8 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"desc": "text_blob: return the value being set in Parameters"
"type": "String",
"desc": "s: return the value being set in Parameters"
}
],
"path": "PYTHON/nodes/GENERATORS/SIMULATIONS/TEXT/TEXT.py",
Expand Down
2 changes: 1 addition & 1 deletion blocks/COMPUTER_VISION/IMAGE_SMOOTHING/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "If this input node is connected, the filename will be taken from\nthe output of the connected node. To be used in conjunction with batch processing"
}
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/AND/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -174,7 +174,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/EXCLUSIVE_OR/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -124,7 +124,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/IMPLIES/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -124,7 +124,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/NOT/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -80,7 +80,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/NOT_AND/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -80,7 +80,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/NOT_OR/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -80,7 +80,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
4 changes: 2 additions & 2 deletions blocks/CONTROL_FLOW/LOGICAL_OPERATORS/OR/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -80,7 +80,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
6 changes: 3 additions & 3 deletions blocks/CONTROL_FLOW/LOOPS/APPEND/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"desc": "text_blob: return the value being set in Parameters"
"type": "String",
"desc": "s: return the value being set in Parameters"
}
],
"path": "PYTHON/nodes/GENERATORS/SIMULATIONS/TEXT/TEXT.py",
Expand Down Expand Up @@ -495,7 +495,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "the DataContainer to be visualized in text format"
}
Expand Down
6 changes: 3 additions & 3 deletions blocks/CONTROL_FLOW/LOOP_TOOLS/BREAK/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"desc": "text_blob: return the value being set in Parameters"
"type": "String",
"desc": "s: return the value being set in Parameters"
}
],
"path": "PYTHON/nodes/GENERATORS/SIMULATIONS/TEXT/TEXT.py",
Expand Down Expand Up @@ -627,7 +627,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "the DataContainer to be visualized in text format"
}
Expand Down
6 changes: 3 additions & 3 deletions blocks/CONTROL_FLOW/LOOP_TOOLS/LOOP_INDEX/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "the DataContainer to be visualized in text format"
}
Expand Down Expand Up @@ -253,8 +253,8 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"desc": "text_blob: return the value being set in Parameters"
"type": "String",
"desc": "s: return the value being set in Parameters"
}
],
"path": "PYTHON/nodes/GENERATORS/SIMULATIONS/TEXT/TEXT.py",
Expand Down
4 changes: 2 additions & 2 deletions blocks/DATA/GENERATION/SIMULATIONS/BOOLEAN/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob|Boolean",
"type": "String|Boolean",
"multiple": false,
"desc": "The DataContainer to be visualized in text format"
}
Expand All @@ -80,7 +80,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"desc": "The DataContainer containing text data"
}
],
Expand Down
10 changes: 5 additions & 5 deletions blocks/DATA/GENERATION/SIMULATIONS/TEXT/TEXT.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from flojoy import TextBlob, flojoy, DataContainer
from flojoy import String, flojoy, DataContainer
from typing import Optional


@flojoy
def TEXT(
_: Optional[DataContainer] = None,
value: str = "Hello World!",
) -> TextBlob:
"""Return a TextBlob DataContainer with given input text.
) -> String:
"""Return a String DataContainer with given input text.
Parameters
----------
Expand All @@ -16,8 +16,8 @@ def TEXT(
Returns
-------
TextBlob
String
Return the value being set in Parameters.
"""

return TextBlob(text_blob=value)
return String(s=value)
2 changes: 1 addition & 1 deletion blocks/DATA/GENERATION/SIMULATIONS/TEXT/TEXT_test_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ def test_TEXT(mock_flojoy_decorator):
import TEXT

res = TEXT.TEXT(value="Hello World!")
assert "Hello World!" == res.text_blob
assert "Hello World!" == res.s
6 changes: 3 additions & 3 deletions blocks/DATA/GENERATION/SIMULATIONS/TEXT/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"desc": "text_blob: return the value being set in Parameters"
"type": "String",
"desc": "s: return the value being set in Parameters"
}
],
"path": "PYTHON/nodes/GENERATORS/SIMULATIONS/TEXT/TEXT.py",
Expand Down Expand Up @@ -60,7 +60,7 @@
{
"name": "default",
"id": "default",
"type": "TextBlob",
"type": "String",
"multiple": false,
"desc": "the DataContainer to be visualized in text format"
}
Expand Down
4 changes: 2 additions & 2 deletions blocks/DATA/GENERATION/SIMULATIONS/TEXT/block_data.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"docstring": {
"long_description": "",
"short_description": "Return a TextBlob DataContainer with given input text.",
"short_description": "Return a String DataContainer with given input text.",
"parameters": [
{
"name": "value",
Expand All @@ -12,7 +12,7 @@
"returns": [
{
"name": null,
"type": "TextBlob",
"type": "String",
"description": "Return the value being set in Parameters."
}
]
Expand Down
22 changes: 11 additions & 11 deletions blocks/DATA/VISUALIZATION/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pprint
from flojoy import flojoy, TextBlob, Boolean
from flojoy import flojoy, String, Boolean


@flojoy
def TEXT_VIEW(default: TextBlob | Boolean, prettify: bool = False) -> TextBlob:
"""The TEXT_VIEW node creates a text visualization for a given TextBlob DataContainer type.
def TEXT_VIEW(default: String | Boolean, prettify: bool = False) -> String:
"""The TEXT_VIEW node creates a text visualization for a given String DataContainer type.
Inputs
------
default : TextBlob | Boolean
default : String | Boolean
The DataContainer to be visualized in text format
Parameters
Expand All @@ -18,20 +18,20 @@ def TEXT_VIEW(default: TextBlob | Boolean, prettify: bool = False) -> TextBlob:
Returns
-------
TextBlob
String
The DataContainer containing text data
"""

match default:
case TextBlob():
s = default.text_blob
case String():
s = default.s

if prettify:
s = pprint.pformat(default.text_blob)
s = pprint.pformat(default.s)

return TextBlob(s)
return String(s)
case Boolean():
if default.b:
return TextBlob("True")
return String("True")

return TextBlob("False")
return String("False")
Loading

0 comments on commit f4b3a18

Please sign in to comment.