diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4cc133ec..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.sourceDirectory": "/home/granger/coding/dora/examples/cmake-dataflow" -} \ No newline at end of file diff --git a/binaries/cli/src/template/python/operator/operator-template.py b/binaries/cli/src/template/python/operator/operator-template.py index b3d13668..b2e4f55c 100644 --- a/binaries/cli/src/template/python/operator/operator-template.py +++ b/binaries/cli/src/template/python/operator/operator-template.py @@ -15,17 +15,19 @@ class Operator: send_output, ) -> DoraStatus: """TODO :Description. - - Args: - dora_event: Event containing an `id`, `data` and `metadata`. - send_output Callable[[str, bytes | pa.Array, Optional[dict]], None]: - Function for sending output to the dataflow: - - First argument is the `output_id` - - Second argument is the data as either bytes or `pa.Array` - - Third argument is dora metadata dict - e.g.: `send_output("bbox", pa.array([100], type=pa.uint8()), dora_event["metadata"])`. - - Returns: + + Parameters + ---------- + dora_event : dict + Event containing an `id`, `data`, and `metadata`. + send_output : Callable[[str, bytes | pa.Array, Optional[dict]], None] + Function for sending output to the dataflow. The first argument is the `output_id`, the second + argument is the data (either as bytes or a pa.Array), and the third argument is the dora metadata + dictionary. For example: + send_output("bbox", pa.array([100], type=pa.uint8()), dora_event["metadata"]). + + Returns + ------- DoraStatus: CONTINUE means that the operator will keep listening for further inputs. diff --git a/examples/python-operator-dataflow/llm_op.py b/examples/python-operator-dataflow/llm_op.py index 4bf088df..13664b7a 100644 --- a/examples/python-operator-dataflow/llm_op.py +++ b/examples/python-operator-dataflow/llm_op.py @@ -70,7 +70,8 @@ def extract_python_code_blocks(text): Parameters ---------- - - text: A string that may contain one or more Python code blocks. + text : str + A string that may contain one or more Python code blocks. Returns ------- @@ -94,11 +95,13 @@ def extract_json_code_blocks(text): Parameters ---------- - - text: A string that may contain one or more json code blocks. + text : str + A string that may contain one or more json code blocks. Returns ------- - - A list of strings, where each string is a block of json code extracted from the text. + list of str + A list of strings, where each string is a block of json code extracted from the text. """ pattern = r"```json\n(.*?)\n```" @@ -117,11 +120,13 @@ def remove_last_line(python_code): Parameters ---------- - - python_code: A string representing Python source code. + python_code : str + A string representing Python source code. Returns ------- - - A string with the last line removed. + str + A string with the last line removed. """ lines = python_code.split("\n") # Split the string into lines diff --git a/examples/reachy2/parse_bbox.py b/examples/reachy2/parse_bbox.py index 0edb66bc..ac69177b 100644 --- a/examples/reachy2/parse_bbox.py +++ b/examples/reachy2/parse_bbox.py @@ -17,7 +17,8 @@ def extract_bboxes(json_text): Parameters ---------- - json_text (str): JSON string containing bounding box data, including ```json markers. + json_text : str + JSON string containing bounding box data, including ```json markers. Returns ------- diff --git a/examples/reachy2/parse_bbox_minimal.py b/examples/reachy2/parse_bbox_minimal.py index d3800dd6..d270df36 100644 --- a/examples/reachy2/parse_bbox_minimal.py +++ b/examples/reachy2/parse_bbox_minimal.py @@ -17,7 +17,8 @@ def extract_bboxes(json_text) -> (np.ndarray, np.ndarray): Parameters ---------- - json_text (str): JSON string containing bounding box data, including ```json markers. + json_text : str + JSON string containing bounding box data, including ```json markers. Returns ------- diff --git a/examples/reachy2/pick_place.py b/examples/reachy2/pick_place.py index 93f178a8..5ec8519f 100644 --- a/examples/reachy2/pick_place.py +++ b/examples/reachy2/pick_place.py @@ -86,7 +86,8 @@ def extract_bboxes(json_text) -> (np.ndarray, np.ndarray): Parameters ---------- - json_text (str): JSON string containing bounding box data, including ```json markers. + json_text : str + JSON string containing bounding box data, including ```json markers. Returns ------- diff --git a/node-hub/llama-factory-recorder/llama_factory_recorder/main.py b/node-hub/llama-factory-recorder/llama_factory_recorder/main.py index 9e241b8a..57f13ea5 100644 --- a/node-hub/llama-factory-recorder/llama_factory_recorder/main.py +++ b/node-hub/llama-factory-recorder/llama_factory_recorder/main.py @@ -18,13 +18,19 @@ DEFAULT_QUESTION = os.getenv( def write_dict_to_json(file_path, key: str, new_data): """Write a dictionary to a JSON file. - - If the file already contains a list of entries,the new data will be appended to that list. Otherwise, it will create a new list. + + If the JSON file already contains an object with the given key mapping to a list of entries, + the new data will be appended to that list. Otherwise, a new key is created with a list + containing the provided dictionary. Parameters ---------- - - file_path: str, the path to the JSON file. - - new_data: dict, the dictionary to add to the JSON file. + file_path : str + The path to the JSON file. + key : str + The key under which the new dictionary entry will be stored. + new_data : dict + The dictionary to add to the JSON file. """ try: