Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop in preparation for release #782

Merged
merged 33 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c5f0386
Add a string based search first pass
IanCa Sep 21, 2023
ab2a25c
Update schema validation and tests
IanCa Sep 28, 2023
c69b7f6
Bump spec_tests/hed-specification from `c47fff9` to `c1aad36`
dependabot[bot] Sep 29, 2023
561eeaf
Merge pull request #771 from IanCa/develop
VisLab Oct 1, 2023
00f5fae
Merge pull request #772 from hed-standard/dependabot/submodules/devel…
VisLab Oct 1, 2023
dfbbd64
Bump spec_tests/hed-specification from `c1aad36` to `7f3868b`
dependabot[bot] Oct 3, 2023
10d1a48
Merge pull request #773 from hed-standard/dependabot/submodules/devel…
VisLab Oct 5, 2023
0014ef4
Update basic_search to support words taht must not appear
IanCa Oct 5, 2023
f1edade
Merge pull request #774 from IanCa/develop
VisLab Oct 6, 2023
f02a121
Make validation row numbers 1 based, and account for header
IanCa Oct 11, 2023
97de1e3
Merge pull request #775 from IanCa/develop
VisLab Oct 11, 2023
6cb9603
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
VisLab Oct 12, 2023
e9e63e3
Corrected an error in the formatting of text output of validation sum…
VisLab Oct 12, 2023
665b993
Merge pull request #776 from VisLab/develop
VisLab Oct 12, 2023
06fd316
Try bumping python version/restricting non master tests
IanCa Oct 12, 2023
8c844f9
Use correct loop end word
IanCa Oct 12, 2023
97b8341
Don't use semi-deprecated style
IanCa Oct 12, 2023
3fe606b
Try to detect master differently
IanCa Oct 12, 2023
39c7487
don't treat 3.10 as 3.1
IanCa Oct 12, 2023
a762ba7
Maybe supress warning in 3.7 code
IanCa Oct 12, 2023
79f2d83
fix test case maybe
IanCa Oct 12, 2023
ced67c2
Merge pull request #777 from IanCa/develop
VisLab Oct 13, 2023
cf5cedc
Initial codespell commit
IanCa Oct 14, 2023
9afb7b6
Do spelling fixes, excluse spec tests folder
IanCa Oct 16, 2023
05aec79
Fix Monique noitced in documentation
IanCa Oct 16, 2023
dc9dfcd
Merge pull request #778 from IanCa/dev_codespell
VisLab Oct 17, 2023
04acff8
Improve toctree in documentation
IanCa Oct 20, 2023
1406760
Don't draw full titles. Full names are still drawn some other places
IanCa Oct 21, 2023
3291b4c
Bump actions/checkout from 3 to 4
dependabot[bot] Oct 23, 2023
2b9cf8b
Merge pull request #779 from IanCa/develop
VisLab Oct 23, 2023
e03efd1
Merge pull request #780 from hed-standard/dependabot/github_actions/d…
VisLab Oct 23, 2023
9814e4a
Updated the remodeling backup arguments
VisLab Oct 23, 2023
20bfa33
Merge pull request #781 from VisLab/develop
VisLab Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ on:
branches: ["*"]

jobs:
determine_version:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/master' ]]; then
# Push to master branch
echo 'matrix=["3.7", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ github.event.pull_request.base.ref }}" == 'master' ]]; then
# PR to master branch
echo 'matrix=["3.7", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT
else
echo 'matrix=["3.9"]' >> $GITHUB_OUTPUT
fi

build:
needs: determine_version
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [3.7, 3.9]
python-version: ${{fromJson(needs.determine_version.outputs.matrix)}}

runs-on: ${{ matrix.platform }}

Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [develop]
pull_request:
branches: [develop]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
34 changes: 0 additions & 34 deletions docs/source/_templates/autosummary/class.rst

This file was deleted.

68 changes: 39 additions & 29 deletions docs/source/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
{{ fullname | escape | underline}}
{{ fullname.split('.')[-1] | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:

{% block methods %}
.. automethod:: __init__

{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
.. autoclass:: {{ module }}.{{ objname }}
:noindex:

.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
{{ module }}.{{ objname }}.{{ item }}
{%- endfor %}

.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
{{ module }}.{{ 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 %}
.. _method-{{ item }}:

.. automethod:: {{ module }}.{{ objname }}.{{ item }}
{%- endfor %}

{% for item in attributes %}
.. _attribute-{{ item }}:

.. autoattribute:: {{ module }}.{{ objname }}.{{ item }}
{%- endfor %}
29 changes: 18 additions & 11 deletions docs/source/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{ fullname | escape | underline}}
{{ fullname.split('.')[-1] | escape | underline}}

.. currentmodule:: {{ module }}

.. automodule:: {{ fullname }}

Expand All @@ -14,17 +16,22 @@
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}
{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
.. autosummary::
{% for item in functions %}
{{ item }}
{% endfor %}

{% for item in functions %}
.. _{{ item }}:

.. autofunction:: {{ item }}
{% endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api2.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
HED API reference (Auto style)
==============================
HED API reference
=================

.. currentmodule:: hed

Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Hierarchical Event Descriptor (HED) Python Tools
Note: this is a work in progress. More information is coming.

.. toctree::
:maxdepth: 4
:maxdepth: 6
:caption: Contents:

introduction.md
user_guide.rst

.. toctree::
:maxdepth: 4
:maxdepth: 6
:caption: HED Python API:

api2.rst
Expand Down
11 changes: 7 additions & 4 deletions hed/errors/error_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class SidecarErrors:

class SchemaErrors:
SCHEMA_DUPLICATE_NODE = 'SCHEMA_DUPLICATE_NODE'
SCHEMA_ATTRIBUTE_INVALID = 'SCHEMA_ATTRIBUTE_INVALID'

SCHEMA_DUPLICATE_FROM_LIBRARY = "SCHEMA_LIBRARY_INVALID"


Expand All @@ -119,19 +119,22 @@ class SchemaWarnings:
SCHEMA_CHARACTER_INVALID = "SCHEMA_CHARACTER_INVALID"
SCHEMA_INVALID_CAPITALIZATION = 'invalidCaps'
SCHEMA_NON_PLACEHOLDER_HAS_CLASS = 'SCHEMA_NON_PLACEHOLDER_HAS_CLASS'
SCHEMA_INVALID_ATTRIBUTE = "SCHEMA_INVALID_ATTRIBUTE"


class SchemaAttributeErrors:
SCHEMA_ATTRIBUTE_INVALID = 'SCHEMA_ATTRIBUTE_INVALID'
SCHEMA_ATTRIBUTE_VALUE_INVALID = 'SCHEMA_ATTRIBUTE_VALUE_INVALID'
SCHEMA_DEPRECATED_INVALID = "SCHEMA_DEPRECATED_INVALID"
SCHEMA_SUGGESTED_TAG_INVALID = "SCHEMA_SUGGESTED_TAG_INVALID"
SCHEMA_RELATED_TAG_INVALID = "SCHEMA_RELATED_TAG_INVALID"

SCHEMA_UNIT_CLASS_INVALID = "SCHEMA_UNIT_CLASS_INVALID"
SCHEMA_VALUE_CLASS_INVALID = "SCHEMA_VALUE_CLASS_INVALID"
SCHEMA_ALLOWED_CHARACTERS_INVALID = "SCHEMA_ALLOWED_CHARACTERS_INVALID"
SCHEMA_IN_LIBRARY_INVALID = "SCHEMA_IN_LIBRARY_INVALID"

SCHEMA_DEFAULT_UNITS_INVALID = "SCHEMA_DEFAULT_UNITS_INVALID"
SCHEMA_CHILD_OF_DEPRECATED = "SCHEMA_CHILD_OF_DEPRECATED" # Reported as SCHEMA_DEPRECATED_INVALID
SCHEMA_CHILD_OF_DEPRECATED = "SCHEMA_CHILD_OF_DEPRECATED"
SCHEMA_CONVERSION_FACTOR_NOT_POSITIVE = "SCHEMA_CONVERSION_FACTOR_NOT_POSITIVE"


class DefinitionErrors:
Expand Down
17 changes: 9 additions & 8 deletions hed/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class HedExceptions:
INVALID_DATAFRAME = 'INVALID_DATAFRAME'
INVALID_FILE_FORMAT = 'INVALID_FILE_FORMAT'
# These are actual schema issues, not that the file cannot be found or parsed
SCHEMA_HEADER_MISSING = 'HED_SCHEMA_HEADER_INVALID'
HED_SCHEMA_HEADER_INVALID = 'HED_SCHEMA_HEADER_INVALID'
SCHEMA_HEADER_MISSING = 'SCHEMA_HEADER_INVALID'
SCHEMA_HEADER_INVALID = 'SCHEMA_HEADER_INVALID'
SCHEMA_UNKNOWN_HEADER_ATTRIBUTE = "SCHEMA_HEADER_INVALID"

SCHEMA_LIBRARY_INVALID = "SCHEMA_LIBRARY_INVALID"
BAD_HED_LIBRARY_NAME = 'SCHEMA_LIBRARY_INVALID'
Expand All @@ -26,14 +27,14 @@ class HedExceptions:
ROOTED_TAG_DOES_NOT_EXIST = "SCHEMA_LIBRARY_INVALID"
IN_LIBRARY_IN_UNMERGED = "SCHEMA_LIBRARY_INVALID"

HED_SCHEMA_VERSION_INVALID = 'HED_SCHEMA_VERSION_INVALID'
SCHEMA_START_MISSING = 'HED_WIKI_SEPARATOR_INVALID'
SCHEMA_END_INVALID = 'HED_WIKI_SEPARATOR_INVALID'
HED_END_INVALID = 'HED_WIKI_SEPARATOR_INVALID'
INVALID_SECTION_SEPARATOR = 'invalidSectionSeparator'
SCHEMA_VERSION_INVALID = 'SCHEMA_VERSION_INVALID'
SCHEMA_SECTION_MISSING = 'SCHEMA_SECTION_MISSING'

WIKI_SEPARATOR_INVALID = 'invalidSectionSeparator'

# This issue will contain a list of lines with issues.
HED_WIKI_DELIMITERS_INVALID = 'HED_WIKI_DELIMITERS_INVALID'
WIKI_DELIMITERS_INVALID = 'WIKI_DELIMITERS_INVALID'
WIKI_LINE_START_INVALID = 'WIKI_LINE_START_INVALID'
HED_SCHEMA_NODE_NAME_INVALID = 'HED_SCHEMA_NODE_NAME_INVALID'

SCHEMA_DUPLICATE_PREFIX = 'schemaDuplicatePrefix'
Expand Down
1 change: 1 addition & 0 deletions hed/errors/known_error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"schema_validation_errors": [
"SCHEMA_ATTRIBUTE_INVALID",
"SCHEMA_ATTRIBUTE_VALUE_INVALID",
"SCHEMA_CHARACTER_INVALID",
"SCHEMA_DUPLICATE_NODE",
"SCHEMA_HEADER_INVALID",
Expand Down
39 changes: 26 additions & 13 deletions hed/errors/schema_error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def schema_error_hed_duplicate_from_library(tag, duplicate_tag_list, section):
f"{tag_join_delimiter}{tag_join_delimiter.join(duplicate_tag_list)}"


@hed_error(SchemaErrors.SCHEMA_ATTRIBUTE_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_ATTRIBUTE_INVALID)
def schema_error_unknown_attribute(attribute_name, source_tag):
return f"Attribute '{attribute_name}' used by '{source_tag}' was not defined in the schema, " \
f"or was used outside of it's defined class."
Expand All @@ -40,45 +40,58 @@ def schema_warning_SCHEMA_INVALID_CAPITALIZATION(tag_name, problem_char, char_in
f"Found character '{problem_char}' in tag '{tag_name}' at position {char_index}."


@hed_error(SchemaWarnings.SCHEMA_NON_PLACEHOLDER_HAS_CLASS, default_severity=ErrorSeverity.WARNING)
@hed_error(SchemaWarnings.SCHEMA_NON_PLACEHOLDER_HAS_CLASS, default_severity=ErrorSeverity.WARNING,
actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_warning_non_placeholder_class(tag_name, invalid_attribute_name):
return "Only placeholder nodes('#') can have a unit class, value class, or takes value." + \
f"Found {invalid_attribute_name} on {tag_name}"


@hed_error(SchemaWarnings.SCHEMA_INVALID_ATTRIBUTE, default_severity=ErrorSeverity.ERROR)
def schema_error_SCHEMA_INVALID_ATTRIBUTE(tag_name, invalid_attribute_name):
return f"'{invalid_attribute_name}' should not be present in a loaded schema, found on '{tag_name}'." \
f"Something went very wrong."


@hed_error(SchemaAttributeErrors.SCHEMA_DEPRECATED_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_DEPRECATED_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_DEPRECATED_INVALID(tag_name, invalid_deprecated_version):
return f"'{tag_name}' has invalid or unknown value in attribute deprecatedFrom: '{invalid_deprecated_version}'."


@hed_error(SchemaAttributeErrors.SCHEMA_CHILD_OF_DEPRECATED,
actual_code=SchemaAttributeErrors.SCHEMA_DEPRECATED_INVALID)
actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_CHILD_OF_DEPRECATED(deprecated_tag, non_deprecated_child):
return f"Deprecated tag '{deprecated_tag}' has a child that is not deprecated: '{non_deprecated_child}'."


@hed_error(SchemaAttributeErrors.SCHEMA_SUGGESTED_TAG_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_SUGGESTED_TAG_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_SUGGESTED_TAG_INVALID(suggestedTag, invalidSuggestedTag, attribute_name):
return f"Tag '{suggestedTag}' has an invalid {attribute_name}: '{invalidSuggestedTag}'."


@hed_error(SchemaAttributeErrors.SCHEMA_UNIT_CLASS_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_UNIT_CLASS_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_UNIT_CLASS_INVALID(tag, unit_class, attribute_name):
return f"Tag '{tag}' has an invalid {attribute_name}: '{unit_class}'."


@hed_error(SchemaAttributeErrors.SCHEMA_VALUE_CLASS_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_VALUE_CLASS_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_VALUE_CLASS_INVALID(tag, unit_class, attribute_name):
return f"Tag '{tag}' has an invalid {attribute_name}: '{unit_class}'."


@hed_error(SchemaAttributeErrors.SCHEMA_DEFAULT_UNITS_INVALID)
@hed_error(SchemaAttributeErrors.SCHEMA_DEFAULT_UNITS_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_DEFAULT_UNITS_INVALID(tag, bad_unit, valid_units):
valid_units = ",".join(valid_units)
return f"Tag '{tag}' has an invalid defaultUnit '{bad_unit}'. Valid units are: '{valid_units}'."


@hed_error(SchemaAttributeErrors.SCHEMA_CONVERSION_FACTOR_NOT_POSITIVE, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_CONVERSION_FACTOR_NOT_POSITIVE(tag, conversion_factor):
return f"Tag '{tag}' has an invalid conversionFactor '{conversion_factor}'. Conversion factor must be positive."


@hed_error(SchemaAttributeErrors.SCHEMA_ALLOWED_CHARACTERS_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_ALLOWED_CHARACTERS_INVALID(tag, invalid_character):
return (f"Tag '{tag}' has an invalid allowedCharacter: '{invalid_character}'. "
f"Allowed characters are: a single character, "
f"or one of the following - letters, blank, digits, alphanumeric.")


@hed_error(SchemaAttributeErrors.SCHEMA_IN_LIBRARY_INVALID, actual_code=SchemaAttributeErrors.SCHEMA_ATTRIBUTE_VALUE_INVALID)
def schema_error_SCHEMA_IN_LIBRARY_INVALID(tag, bad_library):
return (f"Tag '{tag}' has an invalid inLibrary: '{bad_library}'. ")
2 changes: 1 addition & 1 deletion hed/models/base_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _indexed_dict_from_onsets(onsets):

@staticmethod
def _filter_by_index_list(original_series, indexed_dict):
new_series = ["n/a"] * len(original_series) # Initialize new_series with "n/a"
new_series = pd.Series(["n/a"] * len(original_series), dtype=str)

for onset, indices in indexed_dict.items():
if indices:
Expand Down
Loading