-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #979 from hed-standard/develop
Making sure NaN fixes Windows test failures
- Loading branch information
Showing
17 changed files
with
149 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["main", "master"] | ||
pull_request: | ||
branches: ["main", "master"] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
platform: [windows-latest] | ||
python-version: ["3.10"] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: false | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('docs/requirements.txt') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade --upgrade-strategy eager pip | ||
pip install -r requirements.txt | ||
- name: Test with unittest | ||
env: | ||
HED_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
python -m unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" | ||
Utilities to support HED searches based on strings. | ||
""" | ||
from hed.models.hed_string import HedString | ||
from hed.models.hed_tag import HedTag | ||
|
||
|
||
def convert_query(search_query, schema): | ||
"""Converts the given basic search query into a hed_string | ||
Parameters: | ||
search_query(str): The basic search query to convert. | ||
schema(HedSchema): The schema to use to convert tags | ||
Returns: | ||
long_query(str): The converted search query, in long form. | ||
""" | ||
input_tags = HedString.split_hed_string(search_query) | ||
output_string = "" | ||
skippable_prefix = ("@", "~") | ||
skippable_suffix = ("*", ) | ||
for is_hed_tag, (startpos, endpos) in input_tags: | ||
input_tag = search_query[startpos:endpos] | ||
add_suffix = "" | ||
if is_hed_tag: | ||
if input_tag.startswith(skippable_prefix): | ||
output_string += input_tag[:1] | ||
input_tag = input_tag[1:] | ||
|
||
if input_tag.endswith(skippable_suffix): | ||
add_suffix = input_tag[-1:] | ||
input_tag = input_tag[:-1] | ||
output_string += HedTag(input_tag, schema).long_tag | ||
output_string += add_suffix | ||
else: | ||
output_string += input_tag | ||
|
||
return output_string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule hed-examples
updated
69 files
Submodule hed-specification
updated
9 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import unittest | ||
from hed import load_schema_version | ||
from hed.models.basic_search_util import convert_query | ||
|
||
|
||
class TestConvertQueryToForm(unittest.TestCase): | ||
schema = load_schema_version("8.3.0") | ||
|
||
def test_basic_convert(self): | ||
input = "@Event, Head-part*, Time-interval/1" | ||
expected_output = "@Event, Item/Biological-item/Anatomical-item/Body-part/Head-part*, Property/Data-property/Data-value/Spatiotemporal-value/Temporal-value/Time-interval/1" | ||
|
||
actual_output = convert_query(input, self.schema) | ||
self.assertEqual(expected_output, actual_output) | ||
|
||
input = "@Head-part*, Event, Time-interval/1" | ||
expected_output = "@Item/Biological-item/Anatomical-item/Body-part/Head-part*, Event, Property/Data-property/Data-value/Spatiotemporal-value/Temporal-value/Time-interval/1" | ||
|
||
actual_output = convert_query(input, self.schema) | ||
self.assertEqual(expected_output, actual_output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters