From f05139e0d486d7ac786cae6626b7e80280ff80d8 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 2 Jan 2024 15:51:52 -0600 Subject: [PATCH 1/8] add linkcheck to readthedocs --- readthedocs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readthedocs.yml b/readthedocs.yml index f7198138..d5458324 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -8,6 +8,9 @@ build: os: "ubuntu-22.04" tools: python: "3.7" + jobs: + pre_build: + - sphinx-build -W --keep-going -q -b linkcheck -d docs/_build/doctrees docs/ docs/_build/linkcheck # Build documentation in the docs/ directory with Sphinx sphinx: From 7bfc2acf2fc6ae03e283dfff1ae5a3a5c175f643 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 2 Jan 2024 15:56:00 -0600 Subject: [PATCH 2/8] Trigger webhook --- readthedocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/readthedocs.yml b/readthedocs.yml index d5458324..64f279cd 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -12,6 +12,7 @@ build: pre_build: - sphinx-build -W --keep-going -q -b linkcheck -d docs/_build/doctrees docs/ docs/_build/linkcheck + # Build documentation in the docs/ directory with Sphinx sphinx: builder: html From 60a512231c8a299b9ad138382f9f789a7462c054 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 2 Jan 2024 16:04:32 -0600 Subject: [PATCH 3/8] Update conf source file location --- readthedocs.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readthedocs.yml b/readthedocs.yml index 64f279cd..b20edf11 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -10,8 +10,7 @@ build: python: "3.7" jobs: pre_build: - - sphinx-build -W --keep-going -q -b linkcheck -d docs/_build/doctrees docs/ docs/_build/linkcheck - + - sphinx-build -W --keep-going -q -b linkcheck -d docs/_build/doctrees docs/source/ docs/_build/linkcheck # Build documentation in the docs/ directory with Sphinx sphinx: @@ -19,7 +18,6 @@ sphinx: configuration: docs/source/conf.py fail_on_warning: false - python: install: - requirements: docs/requirements.txt From 3246efd8fa537c380900f50546478940d0ac0b53 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 2 Jan 2024 16:10:14 -0600 Subject: [PATCH 4/8] Add bad URL to test --- docs/source/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/index.rst b/docs/source/index.rst index 3b82987d..c3e96e1e 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,6 +8,7 @@ Hierarchical Event Descriptor (HED) Python Tools .. sidebar:: **Links** * `PDF docs `_ + * `Bad URL `_ * `Source code `_ From 8517ea1563832bdd9faad09ed59b4be4de1ef323 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 2 Jan 2024 19:26:30 -0600 Subject: [PATCH 5/8] Clean up names/get rid of identifying thing errors --- .../_templates/custom-class-template.rst | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/docs/source/_templates/custom-class-template.rst b/docs/source/_templates/custom-class-template.rst index cf03326d..1039bc70 100644 --- a/docs/source/_templates/custom-class-template.rst +++ b/docs/source/_templates/custom-class-template.rst @@ -8,34 +8,24 @@ .. rubric:: {{ _('Methods') }} .. autosummary:: -{% for item in methods %} - {{ module }}.{{ objname }}.{{ item }} +{%- for item in methods %} + {{ objname }}.{{ item }} {%- endfor %} .. rubric:: {{ _('Attributes') }} .. autosummary:: -{% for item in attributes %} - {{ module }}.{{ objname }}.{{ item }} +{%- for item in attributes %} + {{ objname }}.{{ item }} {%- endfor %} -.. toctree:: - :hidden: - -{% for item in methods %} - {{ fullname }}#method-{{ item }} -{%- endfor %} -{% for item in attributes %} - {{ fullname }}#attribute-{{ item }} -{%- endfor %} - -{% for item in methods %} +{%- for item in methods %} .. _method-{{ item }}: .. automethod:: {{ module }}.{{ objname }}.{{ item }} {%- endfor %} -{% for item in attributes %} +{%- for item in attributes %} .. _attribute-{{ item }}: .. autoattribute:: {{ module }}.{{ objname }}.{{ item }} From 7f41ea2ab197f74f780f8a6a0c67f35033587a51 Mon Sep 17 00:00:00 2001 From: IanCa Date: Wed, 3 Jan 2024 14:13:17 -0600 Subject: [PATCH 6/8] Update doc strings to fix format errors. Update templates slightly --- docs/source/_templates/custom-module-template.rst | 2 +- docs/source/index.rst | 1 - hed/models/definition_dict.py | 10 ++++++---- hed/models/expression_parser.py | 2 +- hed/models/hed_tag.py | 1 + hed/schema/hed_schema_io.py | 2 +- hed/schema/schema_compare.py | 10 +++++----- hed/tools/analysis/hed_type_defs.py | 2 +- hed/tools/remodeling/backup_manager.py | 2 +- hed/validator/tag_util/group_util.py | 1 + 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/docs/source/_templates/custom-module-template.rst b/docs/source/_templates/custom-module-template.rst index 9e9c8a77..6062649d 100644 --- a/docs/source/_templates/custom-module-template.rst +++ b/docs/source/_templates/custom-module-template.rst @@ -38,7 +38,7 @@ .. rubric:: {{ _('Classes') }} .. autosummary:: - :toctree: + :toctree: _generated_classes :template: custom-class-template.rst {% for item in classes %} {{ item }} diff --git a/docs/source/index.rst b/docs/source/index.rst index c3e96e1e..3b82987d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -8,7 +8,6 @@ Hierarchical Event Descriptor (HED) Python Tools .. sidebar:: **Links** * `PDF docs `_ - * `Bad URL `_ * `Source code `_ diff --git a/hed/models/definition_dict.py b/hed/models/definition_dict.py index 0d689510..49edf9e8 100644 --- a/hed/models/definition_dict.py +++ b/hed/models/definition_dict.py @@ -30,12 +30,14 @@ def __init__(self, def_dicts=None, hed_schema=None): self.add_definitions(def_dicts, hed_schema) def add_definitions(self, def_dicts, hed_schema=None): - """ Add definitions from dict(s) to this dict. + """ Add definitions from dict(s) or strings(s) to this dict. Parameters: - def_dicts (list, DefinitionDict, or dict): DefinitionDict or list of DefinitionDicts/strings/dicts whose - definitions should be added. - Note dict form expects DefinitionEntries in the same form as a DefinitionDict + def_dicts (list, DefinitionDict, dict, or str): DefinitionDict or list of DefinitionDicts/strings/dicts whose + definitions should be added. + Note - dict form expects DefinitionEntries in the same form as a DefinitionDict + Note - str or list of strings will parse the strings using the hed_schema. + Note - You can mix and match types, eg [DefinitionDict, str, list of str] would be valid input. hed_schema(HedSchema or None): Required if passing strings or lists of strings, unused otherwise. :raises TypeError: diff --git a/hed/models/expression_parser.py b/hed/models/expression_parser.py index 736ff562..83e91adc 100644 --- a/hed/models/expression_parser.py +++ b/hed/models/expression_parser.py @@ -332,7 +332,7 @@ def __init__(self, expression_string): '"Event"' - Finds the Event tag, but not any descendent tags - 'Def/DefName/*' - Find Def/DefName instances with placeholders, regardless of the value of the placeholder + `Def/DefName/*` - Find Def/DefName instances with placeholders, regardless of the value of the placeholder 'Eve*' - Find any short tags that begin with Eve*, such as Event, but not Sensory-event diff --git a/hed/models/hed_tag.py b/hed/models/hed_tag.py index bdbfa852..db6dd7e8 100644 --- a/hed/models/hed_tag.py +++ b/hed/models/hed_tag.py @@ -499,6 +499,7 @@ def default_unit(self): """ Get the default unit class unit for this tag. Only a tag with a single unit class can have default units. + Returns: unit(UnitEntry or None): the default unit entry for this tag, or None """ diff --git a/hed/schema/hed_schema_io.py b/hed/schema/hed_schema_io.py index 326df76b..027c63d6 100644 --- a/hed/schema/hed_schema_io.py +++ b/hed/schema/hed_schema_io.py @@ -223,7 +223,7 @@ def load_schema_version(xml_version=None, xml_folder=None): An empty string returns the latest version A json str format is also supported, based on the output of HedSchema.get_formatted_version - Basic format: '[schema_namespace:][library_name_][X.Y.Z]'. + Basic format: `[schema_namespace:][library_name_][X.Y.Z]`. xml_folder (str): Path to a folder containing schema. Returns: diff --git a/hed/schema/schema_compare.py b/hed/schema/schema_compare.py index 1cd974c0..f128306d 100644 --- a/hed/schema/schema_compare.py +++ b/hed/schema/schema_compare.py @@ -176,14 +176,14 @@ def compare_schemas(schema1, schema2, attribute_filter=HedKey.InLibrary, section schema1 (HedSchema): The first schema to be compared. schema2 (HedSchema): The second schema to be compared. attribute_filter (str, optional): The attribute to filter entries by. - Entries without this attribute are skipped. - The most common use would be HedKey.InLibrary - If it evaluates to False, no filtering is performed. + Entries without this attribute are skipped. + The most common use would be HedKey.InLibrary + If it evaluates to False, no filtering is performed. sections(list): the list of sections to compare. By default, just the tags section. - If None, checks all sections including header, prologue, and epilogue. + If None, checks all sections including header, prologue, and epilogue. Returns: - tuple: A tuple containing four dictionaries: + tuple: A tuple containing four dictionaries: - matches(dict): Entries present in both schemas and are equal. - not_in_schema1(dict): Entries present in schema2 but not in schema1. - not_in_schema2(dict): Entries present in schema1 but not in schema2. diff --git a/hed/tools/analysis/hed_type_defs.py b/hed/tools/analysis/hed_type_defs.py index 988b4bda..fba665d7 100644 --- a/hed/tools/analysis/hed_type_defs.py +++ b/hed/tools/analysis/hed_type_defs.py @@ -11,7 +11,7 @@ class HedTypeDefs: def_map (dict): keys are definition names, values are dict {type_values, description, tags} Example: A definition 'famous-face-cond' with contents `(Condition-variable/Face-type,Description/A face that should be recognized by the - participants,(Image,(Face,Famous)))` + participants,(Image,(Face,Famous)))` would have type_values ['face_type']. All items are strings not objects. diff --git a/hed/tools/remodeling/backup_manager.py b/hed/tools/remodeling/backup_manager.py index 75c6f4f1..60ecf753 100644 --- a/hed/tools/remodeling/backup_manager.py +++ b/hed/tools/remodeling/backup_manager.py @@ -224,7 +224,7 @@ def get_task(task_names, file_path): """ Return the task if the file name contains a task_xxx where xxx is in task_names. Parameters: - task_names (list): List of task names (without the task_ prefix). + task_names (list): List of task names (without the `task_` prefix). file_path (str): Path of the filename to be tested. Returns: diff --git a/hed/validator/tag_util/group_util.py b/hed/validator/tag_util/group_util.py index 490f5668..b01a4f55 100644 --- a/hed/validator/tag_util/group_util.py +++ b/hed/validator/tag_util/group_util.py @@ -71,6 +71,7 @@ def check_tag_level_issue(original_tag_list, is_top_level, is_group): """ Report tags incorrectly positioned in hierarchy. Top-level groups can contain definitions, Onset, etc. tags. + Parameters: original_tag_list (list): HedTags containing the original tags. is_top_level (bool): If True, this group is a "top level tag group" From b9803356362813969f3c2d5e1496742323189ad7 Mon Sep 17 00:00:00 2001 From: IanCa Date: Wed, 3 Jan 2024 14:29:44 -0600 Subject: [PATCH 7/8] add missing change file --- hed/schema/schema_attribute_validators.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hed/schema/schema_attribute_validators.py b/hed/schema/schema_attribute_validators.py index c08a11a2..942c4167 100644 --- a/hed/schema/schema_attribute_validators.py +++ b/hed/schema/schema_attribute_validators.py @@ -1,13 +1,15 @@ """The built-in functions to validate known attributes. Template for the functions: -attribute_checker_template(hed_schema, tag_entry, attribute_name, possible_values): - hed_schema (HedSchema): The schema to use for validation - tag_entry (HedSchemaEntry): The schema entry for this tag. - attribute_name (str): The name of this attribute + +- ``attribute_checker_template(hed_schema, tag_entry, attribute_name)``: + - ``hed_schema (HedSchema)``: The schema to use for validation. + - ``tag_entry (HedSchemaEntry)``: The schema entry for this tag. + - ``attribute_name (str)``: The name of this attribute. + Returns: - bool -""" + - ``bool``: Description of the return value. + """ from hed.errors.error_types import SchemaWarnings, ValidationErrors, SchemaAttributeErrors from hed.errors.error_reporter import ErrorHandler From 68b2e94d39aeb01c6b02961ebf3be37737c685b2 Mon Sep 17 00:00:00 2001 From: IanCa Date: Wed, 3 Jan 2024 15:45:54 -0600 Subject: [PATCH 8/8] Remove autosectionlabel to stop duplicate errors --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 39ee127f..6d69ae7c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -39,7 +39,7 @@ "myst_parser", "sphinx.ext.autodoc", "sphinx.ext.autosummary", - "sphinx.ext.autosectionlabel", + # "sphinx.ext.autosectionlabel", "sphinx.ext.intersphinx", "sphinx.ext.coverage", "sphinx.ext.mathjax",