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

Preliminary merge of develop to adjust doc links #840

Closed
wants to merge 122 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
9dd6cea
add remodeler validator
monique2208 Oct 10, 2023
b634d07
Merge remote-tracking branch 'upstream/develop' into dev-schema
monique2208 Oct 10, 2023
402b44b
fix incorrect function call
monique2208 Oct 14, 2023
de3537d
Merge branch 'master' of https://github.com/hed-standard/hed-python i…
VisLab Oct 27, 2023
4a82b65
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
VisLab Oct 27, 2023
8c288ec
Merge branch 'master' of https://github.com/hed-standard/hed-python i…
VisLab Oct 27, 2023
2aced07
Enable word cloud tests. Improve error reporter tests
IanCa Oct 27, 2023
a0f19d8
replace operation parameter definitions
monique2208 Oct 30, 2023
79c0ca1
Bump spec_tests/hed-specification from `be850ba` to `23dfb19`
dependabot[bot] Oct 30, 2023
f4644a5
add operation name
monique2208 Oct 30, 2023
b2c754f
Merge hed validator and tag validator, then split out functionality t…
IanCa Nov 4, 2023
6454dd9
Merge pull request #796 from hed-standard/dependabot/submodules/devel…
VisLab Nov 11, 2023
35e3f99
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
VisLab Nov 11, 2023
51a0934
Add support for loading multiple library schemas with the same prefix
IanCa Nov 14, 2023
34723a7
Fix typo
IanCa Nov 14, 2023
4f3dfad
remove secret
IanCa Nov 14, 2023
1fe63e3
remove original validation functions and tests
monique2208 Nov 14, 2023
65fad2b
Merge pull request #798 from IanCa/develop
VisLab Nov 15, 2023
8cd48bd
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
VisLab Nov 15, 2023
73fe2f6
Modified the BIDS dataset to not include participants by default
VisLab Nov 15, 2023
cdc4844
Merge pull request #799 from VisLab/develop
VisLab Nov 15, 2023
80afa04
First pass validate bids examples
IanCa Nov 16, 2023
8c1b026
Tweak workflows to work
IanCa Nov 16, 2023
553abab
Merge pull request #800 from IanCa/develop
VisLab Nov 16, 2023
978613b
Update 'home' icon in docs to be HED icon
IanCa Nov 16, 2023
055be2f
Merge pull request #801 from IanCa/develop
VisLab Nov 17, 2023
5a624b6
Add a test for invalid header attributes
IanCa Nov 21, 2023
fd09c2c
change base op to abstract and write tests
monique2208 Nov 21, 2023
1e088d2
remove original schema
monique2208 Nov 21, 2023
cb65d75
Merge pull request #802 from IanCa/develop
VisLab Nov 21, 2023
b4767c4
reorder base_op methods
monique2208 Nov 27, 2023
f0a31cc
Raise exception if loading merged schemas with duplicate tags
IanCa Nov 29, 2023
5c83552
Bump spec_tests/hed-specification from `23dfb19` to `a9bf8b5`
dependabot[bot] Nov 29, 2023
df1162a
Merge pull request #803 from IanCa/develop
VisLab Nov 29, 2023
b6df3ea
Merge pull request #804 from hed-standard/dependabot/submodules/devel…
VisLab Nov 29, 2023
3633396
Fix bugs/improve unit and def validation code
IanCa Nov 30, 2023
3e2770c
Fix bug and spelling
IanCa Nov 30, 2023
a049bbe
Bump spec_tests/hed-specification from `a9bf8b5` to `38a5993`
dependabot[bot] Nov 30, 2023
a9a30ad
Merge pull request #805 from IanCa/develop
VisLab Nov 30, 2023
18626f2
Merge pull request #806 from hed-standard/dependabot/submodules/devel…
VisLab Nov 30, 2023
3242162
add to operation parameter specification
monique2208 Dec 5, 2023
9fd6d53
finish validator tests
monique2208 Dec 5, 2023
ffd74fc
update docstrings
monique2208 Dec 5, 2023
df018a3
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
monique2208 Dec 5, 2023
e1055ea
update doc + specification
monique2208 Dec 5, 2023
5a235bd
Bump wordcloud from 1.9.2 to 1.9.3
dependabot[bot] Dec 11, 2023
950f0d5
Bump actions/setup-python from 4 to 5
dependabot[bot] Dec 11, 2023
ff79911
update docs and json schema specification of operations
monique2208 Dec 12, 2023
63a168b
make compiled schema accessible in validator
monique2208 Dec 12, 2023
2eaebb8
Updated sequence map
VisLab Dec 14, 2023
7ba9438
Corrected sequence map tests
VisLab Dec 14, 2023
c25cf46
Merge pull request #809 from VisLab/develop
VisLab Dec 14, 2023
2d6708c
Merge pull request #807 from hed-standard/dependabot/pip/develop/word…
VisLab Dec 16, 2023
f6a97ca
Merge pull request #808 from hed-standard/dependabot/github_actions/d…
VisLab Dec 16, 2023
bdf2042
Bump actions/download-artifact from 3 to 4
dependabot[bot] Dec 18, 2023
8f0b6dd
Bump actions/upload-artifact from 3 to 4
dependabot[bot] Dec 18, 2023
07814d7
add dependency error message
monique2208 Dec 18, 2023
266e984
add dependency checks
monique2208 Dec 18, 2023
ad75733
correct some parameter specifications
monique2208 Dec 18, 2023
ee38d44
Merge pull request #811 from hed-standard/dependabot/github_actions/d…
VisLab Dec 18, 2023
37e91da
Merge pull request #812 from hed-standard/dependabot/github_actions/d…
VisLab Dec 18, 2023
c420ff9
Sequence map in process
VisLab Dec 24, 2023
8e0f6c2
Bump spec_tests/hed-specification from `38a5993` to `570ae3e`
dependabot[bot] Jan 1, 2024
0c2aef3
Bump spec_tests/hed-examples from `ae000a6` to `a4b0168`
dependabot[bot] Jan 1, 2024
f05139e
add linkcheck to readthedocs
IanCa Jan 2, 2024
7bfc2ac
Trigger webhook
IanCa Jan 2, 2024
60a5122
Update conf source file location
IanCa Jan 2, 2024
3246efd
Add bad URL to test
IanCa Jan 2, 2024
8517ea1
Clean up names/get rid of identifying thing errors
IanCa Jan 3, 2024
7f41ea2
Update doc strings to fix format errors. Update templates slightly
IanCa Jan 3, 2024
b980335
add missing change file
IanCa Jan 3, 2024
68b2e94
Remove autosectionlabel to stop duplicate errors
IanCa Jan 3, 2024
755a51a
Merge pull request #817 from IanCa/dev_docs
VisLab Jan 3, 2024
4191317
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
VisLab Jan 3, 2024
88374f5
Updated broken link in the docs
VisLab Jan 3, 2024
a0aef95
Merge pull request #815 from hed-standard/dependabot/submodules/devel…
VisLab Jan 3, 2024
971b9d7
Merge pull request #816 from hed-standard/dependabot/submodules/devel…
VisLab Jan 3, 2024
ef91120
Merge pull request #818 from VisLab/develop
VisLab Jan 3, 2024
516fbca
Bump spec_tests/hed-examples from `a4b0168` to `8a41e46`
dependabot[bot] Jan 5, 2024
3df10ac
remodel schema additional validation of input data
monique2208 Jan 5, 2024
d4a19e5
correct base class instantiation and summaries
monique2208 Jan 5, 2024
cb53d44
update tests
monique2208 Jan 5, 2024
e0f90ad
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
monique2208 Jan 5, 2024
8ba3319
Bump spec_tests/hed-specification from `570ae3e` to `9a22f15`
dependabot[bot] Jan 8, 2024
58d851f
Add support for saving/loading in various RDF formats
IanCa Jan 8, 2024
eda0e17
Fix typo, add rdflib to requirements
IanCa Jan 8, 2024
69ee4c7
Add a string test
IanCa Jan 8, 2024
e94036c
Bump spec/examples, see if it fixes issue
IanCa Jan 8, 2024
d2b0539
Show directory name for datasets in spec_tests
IanCa Jan 8, 2024
211a2a1
Merge pull request #822 from hed-standard/dependabot/submodules/devel…
VisLab Jan 8, 2024
14c0b6c
Merge pull request #824 from hed-standard/dependabot/submodules/devel…
VisLab Jan 8, 2024
639397d
Merge pull request #825 from IanCa/develop
VisLab Jan 8, 2024
5107fbc
Explicitly ban temporal tags when no onset column present
IanCa Jan 9, 2024
1030199
Bump spec_tests/hed-examples from `8a41e46` to `3508e5d`
dependabot[bot] Jan 9, 2024
73c2564
Merge pull request #826 from IanCa/develop
VisLab Jan 9, 2024
979bb31
Merge pull request #827 from hed-standard/dependabot/submodules/devel…
VisLab Jan 9, 2024
e9aa9f7
Merge branch 'develop' of https://github.com/hed-standard/hed-python …
monique2208 Jan 9, 2024
e2c7aef
Add rdflib to setup.cfg
IanCa Jan 9, 2024
6b6ed14
Merge pull request #828 from monique2208/dev-schema
VisLab Jan 9, 2024
adc4bca
Add installer test for 3.7 and 3.10
IanCa Jan 9, 2024
c97acf6
Merge pull request #830 from IanCa/dev_add_installer_test
VisLab Jan 9, 2024
60277f3
Updated test schema versions
VisLab Jan 10, 2024
7ef734c
Merge pull request #831 from VisLab/develop
VisLab Jan 10, 2024
75abb3a
Fix unit tests, add placeholder check for spaces in units
IanCa Jan 11, 2024
e94668b
Clean up test debugging code
IanCa Jan 11, 2024
6de556c
Replace carriage returns with new lines when reading schema as a string
IanCa Jan 11, 2024
8488682
Bump spec_tests/hed-examples from `3508e5d` to `98da8ed`
dependabot[bot] Jan 11, 2024
1d48e95
Merge pull request #832 from IanCa/develop
VisLab Jan 11, 2024
df75b54
Merge pull request #833 from hed-standard/dependabot/submodules/devel…
VisLab Jan 11, 2024
6a4e889
Added jsonschema to the docs requirements
VisLab Jan 19, 2024
2b8b467
Merge pull request #835 from VisLab/develop
VisLab Jan 19, 2024
82ee48a
Bump spec_tests/hed-examples from `98da8ed` to `bd1e089`
dependabot[bot] Jan 22, 2024
32c1ef9
Bump actions/cache from 3 to 4
dependabot[bot] Jan 22, 2024
0176068
Merge pull request #836 from hed-standard/dependabot/submodules/devel…
VisLab Jan 22, 2024
8ebd0a2
Merge pull request #837 from hed-standard/dependabot/github_actions/d…
VisLab Jan 22, 2024
47a18f5
Bump spec_tests/hed-examples from `bd1e089` to `79de656`
dependabot[bot] Jan 23, 2024
2062282
Merge pull request #838 from hed-standard/dependabot/submodules/devel…
VisLab Jan 23, 2024
8ebdb3d
Require a verison number when loading schemas
IanCa Jan 30, 2024
1952ab3
Fix test runner
IanCa Jan 30, 2024
14beefe
Merge pull request #841 from IanCa/develop
VisLab Jan 30, 2024
eacdb8e
Bump spec_tests/hed-examples from `79de656` to `c9a7eb6`
dependabot[bot] Jan 31, 2024
e6f5f1d
Merge pull request #842 from hed-standard/dependabot/submodules/devel…
VisLab Jan 31, 2024
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
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }}
Expand All @@ -69,10 +69,11 @@ jobs:

- name: Run spec_test coverage
run: HED_GITHUB_TOKEN=${{ secrets.HED_GITHUB_TOKEN }} coverage run --append -m unittest spec_tests/test_errors.py
continue-on-error: true

- name: Archive code coverage results
if: ${{matrix.python-version == '3.9'}}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: .coverage
Expand Down Expand Up @@ -102,11 +103,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }}
Expand All @@ -120,7 +121,7 @@ jobs:
pip install -r docs/requirements.txt

- name: Download a single artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: code-coverage-report

Expand Down
31 changes: 24 additions & 7 deletions .github/workflows/spec_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -31,13 +31,30 @@ jobs:
python -m pip install --upgrade --upgrade-strategy eager pip
pip install -r requirements.txt

- name: Test with unittest
- name: Spec Error Tests
id: spec_error_tests
continue-on-error: true
run: |
python -m unittest spec_tests/test_errors.py > test_results.txt
python -m unittest spec_tests/test_errors.py > error_results.txt

- name: Upload spec test results
uses: actions/upload-artifact@v3
- name: Bids Validation Test
id: bids_validation_test
continue-on-error: true
run: |
python -m unittest spec_tests/validate_bids.py > validate_bids_results.txt

- name: Upload error test results
uses: actions/upload-artifact@v4
with:
name: error-test-results
path: error_results.txt

- name: Upload bids test results
uses: actions/upload-artifact@v4
with:
name: spec-test-results
path: test_results.txt
name: bids-test-results
path: validate_bids_results.txt

- name: Fail if Tests Failed
if: steps.spec_error_tests.outcome == 'failure' || steps.bids_validation_test.outcome == 'failure'
run: exit 1
31 changes: 31 additions & 0 deletions .github/workflows/test_installer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches: [develop]
pull_request:
branches: [develop]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.7", "3.10"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Install package
run: |
pip install .
- name: Run post-installation test
run: |
python -c "import hed"
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
path = spec_tests/hed-specification
url = https://github.com/hed-standard/hed-specification/
branch = develop

[submodule "spec_tests/hed-examples"]
path = spec_tests/hed-examples
url = https://github.com/hed-standard/hed-examples/
branch = develop
4 changes: 3 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defusedxml>=0.7.1
inflect>=6.0.5
jsonschema>=4.17.3
numpy>=1.21.6
openpyxl>=3.1.0
pandas>=1.3.5
Expand All @@ -8,4 +9,5 @@ semantic_version>=2.10.0
myst-parser>=1.0.0
Sphinx>=5.2.2
sphinx_rtd_theme>=1.0.0
wordcloud==1.9.2
wordcloud==1.9.3
rdflib>=6
13 changes: 13 additions & 0 deletions docs/source/_static/customize_icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.icon-home:before {
content: '';
/* Other styles to adjust size, positioning, etc. */
display: inline-block;
width: 24px;
height: 24px;
background: url('images/croppedWideLogo.png') no-repeat center center;
background-size: contain;
}

.icon-home {
font-family: inherit;
}
22 changes: 6 additions & 16 deletions docs/source/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:toctree: _generated_classes
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
Expand Down
6 changes: 5 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -97,3 +97,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_css_files = [
'customize_icon.css',
]
4 changes: 0 additions & 4 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ Finding help

The `HED online tools <https://hedtools.org>`_ provide an easy-to-use interface that requires no programming.

:Mailing lists and forums:

* Don't hesitate to ask questions about the python hedtools on `NeuroStars
<https://neurostars.org/tags/hedtools>`_.

:Issues and problems:
* If you notice a bug in the python hedtools code or encounter other problems using the tools, please `open an issue`_ in the
Expand Down
17 changes: 14 additions & 3 deletions hed/errors/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def val_error_empty_group(tag):
return f"HED tags cannot be empty. Extra delimiters found: '{tag}'"


@hed_tag_error(OnsetErrors.HED_ONSET_WITH_NO_COLUMN, actual_code=ValidationErrors.ONSET_OFFSET_INSET_ERROR)
def val_error_hed_onset_with_no_column(tag):
return f"Cannot have Temporal tags without an 'Onset' column. Found tag: '{tag}'"



@hed_tag_error(ValidationErrors.TAG_EXTENDED, has_sub_tag=True, default_severity=ErrorSeverity.WARNING)
def val_error_tag_extended(tag, problem_tag):
return f"Hed tag is extended. '{problem_tag}' in {tag}"
Expand All @@ -39,7 +45,7 @@ def val_error_invalid_char(source_string, char_index):
@hed_tag_error(ValidationErrors.INVALID_TAG_CHARACTER, has_sub_tag=True,
actual_code=ValidationErrors.CHARACTER_INVALID)
def val_error_invalid_tag_character(tag, problem_tag):
return f"Invalid character '{problem_tag}' in {tag}"
return f"Invalid character '{problem_tag}' in tag '{tag}'"


@hed_error(ValidationErrors.TILDES_UNSUPPORTED)
Expand All @@ -48,6 +54,12 @@ def val_error_tildes_not_supported(source_string, char_index):
return f"Tildes not supported. Replace (a ~ b ~ c) with (a, (b, c)). '{character}' at index {char_index}'"


@hed_tag_error(ValidationErrors.CURLY_BRACE_UNSUPPORTED_HERE, has_sub_tag=True,
actual_code=SidecarErrors.SIDECAR_BRACES_INVALID)
def val_error_CURLY_BRACE_UNSUPPORTED_HERE(tag, problem_tag):
return (f"Curly braces are only permitted in sidecars, fully wrapping text in place of a tag. "
f"Invalid character '{problem_tag}' in tag '{tag}'")

@hed_error(ValidationErrors.COMMA_MISSING)
def val_error_comma_missing(tag):
return f"Comma missing after - '{tag}'"
Expand Down Expand Up @@ -227,7 +239,6 @@ def val_warning_capitalization(tag):

@hed_tag_error(ValidationErrors.UNITS_MISSING, default_severity=ErrorSeverity.WARNING)
def val_warning_default_units_used(tag, default_unit):
# todo: add a test case for no default unit.
if default_unit is None:
return f"No unit specified on - '{tag}'. No default unit is specified for type."
return f"No unit specified. Using '{default_unit}' as the default - '{tag}'"
Expand Down Expand Up @@ -383,7 +394,7 @@ def onset_wrong_placeholder(tag, has_placeholder):

@hed_error(ColumnErrors.INVALID_COLUMN_REF, actual_code=SidecarErrors.SIDECAR_BRACES_INVALID)
def invalid_column_ref(bad_ref):
return f"The column '{bad_ref}' is unknown.'"
return f"The column '{bad_ref}' is unknown or does not have HED annotations.'"


@hed_error(ColumnErrors.SELF_COLUMN_REF, actual_code=SidecarErrors.SIDECAR_BRACES_INVALID)
Expand Down
17 changes: 6 additions & 11 deletions hed/errors/error_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,9 @@ def format_error_from_context(error_type, error_context, *args, actual_error=Non
if not error_func:
error_object = ErrorHandler.val_error_unknown(*args, **kwargs)
error_object['code'] = error_type
ErrorHandler._add_context_to_errors(error_object, error_context)
return [error_object]
else:
error_object = error_func(*args, **kwargs)

error_object = error_func(*args, **kwargs)
if actual_error:
error_object['code'] = actual_error

Expand All @@ -321,8 +320,6 @@ def _add_context_to_errors(error_object, error_context_to_add):
list: A list of dict with needed context strings added at the beginning of the list.

"""
if error_object is None:
error_object = {}
for (context_type, context) in error_context_to_add:
error_object[context_type] = context

Expand All @@ -345,11 +342,7 @@ def _get_tag_span_to_error_object(error_object):
if ErrorContext.HED_STRING not in error_object:
return None, None

if 'char_index' in error_object:
char_index = error_object['char_index']
char_index_end = error_object.get('char_index_end', char_index + 1)
return char_index, char_index_end
elif 'source_tag' in error_object:
if 'source_tag' in error_object:
source_tag = error_object['source_tag']
if isinstance(source_tag, int):
return None, None
Expand All @@ -364,7 +357,9 @@ def _get_tag_span_to_error_object(error_object):
def _update_error_with_char_pos(error_object):
# This part is optional as you can always generate these as needed.
start, end = ErrorHandler._get_tag_span_to_error_object(error_object)
if start is not None and end is not None:
if start is not None:
# silence warning in pycharm
start = int(start)
source_tag = error_object.get('source_tag', None)
# Todo: Move this functionality somewhere more centralized.
# If the tag has been modified from the original, don't try to use sub indexing.
Expand Down
4 changes: 3 additions & 1 deletion hed/errors/error_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class ValidationErrors:

INVALID_TAG_CHARACTER = 'invalidTagCharacter'

CURLY_BRACE_UNSUPPORTED_HERE = "CURLY_BRACE_UNSUPPORTED_HERE"



class SidecarErrors:
Expand Down Expand Up @@ -164,7 +166,7 @@ class OnsetErrors:
ONSET_TAG_OUTSIDE_OF_GROUP = "ONSET_TAG_OUTSIDE_OF_GROUP"
INSET_BEFORE_ONSET = "INSET_BEFORE_ONSET"
ONSET_SAME_DEFS_ONE_ROW = "ONSET_SAME_DEFS_ONE_ROW"

HED_ONSET_WITH_NO_COLUMN = 'HED_ONSET_WITH_NO_COLUMN'

class ColumnErrors:
INVALID_COLUMN_REF = "INVALID_COLUMN_REF"
Expand Down
12 changes: 7 additions & 5 deletions hed/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class HedExceptions:
GENERIC_ERROR = 'GENERIC_ERROR'
# A list of all exceptions that can be generated by the hedtools.
URL_ERROR = "URL_ERROR"
FILE_NOT_FOUND = 'fileNotFound'
BAD_PARAMETERS = 'badParameters'
CANNOT_PARSE_XML = 'cannotParseXML'
Expand Down Expand Up @@ -40,8 +41,13 @@ class HedExceptions:
HED_SCHEMA_NODE_NAME_INVALID = 'HED_SCHEMA_NODE_NAME_INVALID'

SCHEMA_DUPLICATE_PREFIX = 'schemaDuplicatePrefix'
SCHEMA_DUPLICATE_LIBRARY = "SCHEMA_LIBRARY_INVALID"
BAD_COLUMN_NAMES = 'BAD_COLUMN_NAMES'

SCHEMA_DUPLICATE_NAMES = "SCHEMA_DUPLICATE_NAMES"

CANNOT_PARSE_RDF = "CANNOT_PARSE_RDF"


class HedFileError(Exception):
"""Exception raised when a file cannot be parsed due to being malformed, file IO, etc."""
Expand All @@ -51,8 +57,4 @@ def __init__(self, code, message, filename, issues=None):
self.filename = filename
self.issues = issues
if self.issues is None:
self.issues = [
{'message': message,
ErrorContext.FILE_NAME: filename,
'code': code}
]
self.issues = []
Loading
Loading