From f2d31110040eedacae92fd04c6a56f1257882312 Mon Sep 17 00:00:00 2001 From: Kay Robbins <1189050+VisLab@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:20:09 -0500 Subject: [PATCH] Hopefully recovered from inadvertent rename of definition --- hed/models/base_input.py | 6 ++--- hed/models/column_mapper.py | 4 ++-- hed/models/def_expand_gather.py | 12 +++++----- hed/models/definition_dict.py | 22 +++++++++---------- hed/models/df_util.py | 12 +++++----- hed/models/hed_string.py | 4 ++-- hed/models/model_constants.py | 2 +- hed/models/sidecar.py | 12 +++++----- hed/models/tabular_input.py | 2 +- hed/models/timeseries_input.py | 2 +- hed/tools/analysis/analysis_util.py | 11 +++++----- hed/tools/analysis/event_manager.py | 2 +- hed/tools/analysis/hed_type.py | 4 ++-- hed/tools/analysis/hed_type_counts.py | 2 +- hed/tools/analysis/hed_type_defs.py | 4 ++-- hed/tools/analysis/hed_type_manager.py | 4 ++-- hed/tools/bids/bids_file_group.py | 4 ++-- hed/validator/def_validator.py | 4 ++-- hed/validator/hed_validator.py | 2 +- hed/validator/sidecar_validator.py | 4 ++-- hed/validator/spreadsheet_validator.py | 2 +- hed/validator/tag_validator.py | 4 ++-- spec_tests/test_errors.py | 2 +- tests/models/test_base_input.py | 2 +- tests/models/test_spreadsheet_input.py | 2 +- .../test_analysis_util_assemble_hed.py | 4 ++-- tests/validator/test_hed_validator.py | 2 +- 27 files changed, 68 insertions(+), 69 deletions(-) diff --git a/hed/models/base_input.py b/hed/models/base_input.py index 69c345958..0e7190498 100644 --- a/hed/models/base_input.py +++ b/hed/models/base_input.py @@ -172,7 +172,7 @@ def expand_defs(self, hed_schema, def_dict): Parameters: hed_schema (HedSchema or None): The schema to use to identify defs - def_dict (DefinitionDict): The type_defs to expand + def_dict (DefinitionDict): The definitions to expand """ from df_util import expand_defs expand_defs(self._dataframe, hed_schema=hed_schema, def_dict=def_dict, columns=self._mapper.get_tag_columns()) @@ -325,7 +325,7 @@ def validate(self, hed_schema, extra_def_dicts=None, name=None, error_handler=No Parameters: hed_schema(HedSchema): The schema to use for validation - extra_def_dicts(list of DefDict or DefDict): all type_defs to use for validation + extra_def_dicts(list of DefDict or DefDict): all definitions to use for validation name(str): The name to report errors from this file as error_handler (ErrorHandler): Error context to use. Creates a new one if None Returns: @@ -470,7 +470,7 @@ def get_def_dict(self, hed_schema, extra_def_dicts=None): Note: Baseclass implementation returns just extra_def_dicts. Parameters: - hed_schema(HedSchema): used to identify tags to find type_defs(if needed) + hed_schema(HedSchema): used to identify tags to find definitions(if needed) extra_def_dicts (list, DefinitionDict, or None): Extra dicts to add to the list. Returns: diff --git a/hed/models/column_mapper.py b/hed/models/column_mapper.py index 4cf66619f..761ab81a9 100644 --- a/hed/models/column_mapper.py +++ b/hed/models/column_mapper.py @@ -23,7 +23,7 @@ def __init__(self, sidecar=None, tag_columns=None, column_prefix_dictionary=None Parameters: sidecar (Sidecar): A sidecar to gather column data from. tag_columns: (list): A list of ints or strings containing the columns that contain the HED tags. - Sidecar column type_defs will take precedent if there is a conflict with tag_columns. + Sidecar column definitions will take precedent if there is a conflict with tag_columns. column_prefix_dictionary (dict): Dictionary with keys that are column numbers/names and values are HED tag prefixes to prepend to the tags in that column before processing. optional_tag_columns (list): A list of ints or strings containing the columns that contain @@ -383,7 +383,7 @@ def get_def_dict(self, hed_schema, extra_def_dicts=None): """ Return def dicts from every column description. Parameters: - hed_schema (Schema): A HED schema object to use for extracting type_defs. + hed_schema (Schema): A HED schema object to use for extracting definitions. extra_def_dicts (list, DefinitionDict, or None): Extra dicts to add to the list. Returns: diff --git a/hed/models/def_expand_gather.py b/hed/models/def_expand_gather.py index c3626a9a5..662ec2e54 100644 --- a/hed/models/def_expand_gather.py +++ b/hed/models/def_expand_gather.py @@ -81,14 +81,14 @@ def get_group(self): class DefExpandGatherer: - """Class for gathering type_defs from a series of def-expands, including possibly ambiguous ones""" + """Class for gathering definitions from a series of def-expands, including possibly ambiguous ones""" def __init__(self, hed_schema, known_defs=None, ambiguous_defs=None, errors=None): """Initialize the DefExpandGatherer class. Parameters: hed_schema (HedSchema): The HED schema to be used for processing. - known_defs (dict, optional): A dictionary of known type_defs. - ambiguous_defs (dict, optional): A dictionary of ambiguous def-expand type_defs. + known_defs (dict, optional): A dictionary of known definitions. + ambiguous_defs (dict, optional): A dictionary of ambiguous def-expand definitions. """ self.hed_schema = hed_schema @@ -101,10 +101,10 @@ def process_def_expands(self, hed_strings, known_defs=None): Parameters: hed_strings (pd.Series or list): A Pandas Series or list of HED strings to be processed. - known_defs (dict, optional): A dictionary of known type_defs to be added. + known_defs (dict, optional): A dictionary of known definitions to be added. Returns: - tuple: A tuple containing the DefinitionDict, ambiguous type_defs, and errors. + tuple: A tuple containing the DefinitionDict, ambiguous definitions, and errors. """ if not isinstance(hed_strings, pd.Series): hed_strings = pd.Series(hed_strings) @@ -120,7 +120,7 @@ def process_def_expands(self, hed_strings, known_defs=None): return self.def_dict, self.ambiguous_defs, self.errors def _process_def_expand(self, string): - """Process a single HED string to extract type_defs and handle known and ambiguous type_defs. + """Process a single HED string to extract definitions and handle known and ambiguous definitions. Parameters: string (str): The HED string to be processed. diff --git a/hed/models/definition_dict.py b/hed/models/definition_dict.py index fae257659..0d689510c 100644 --- a/hed/models/definition_dict.py +++ b/hed/models/definition_dict.py @@ -7,7 +7,7 @@ class DefinitionDict: - """ Gathers type_defs from a single source. + """ Gathers definitions from a single source. """ @@ -16,7 +16,7 @@ def __init__(self, def_dicts=None, hed_schema=None): Parameters: def_dicts (str or list or DefinitionDict): DefDict or list of DefDicts/strings or - a single string whose type_defs should be added. + a single string whose definitions should be added. hed_schema(HedSchema or None): Required if passing strings or lists of strings, unused otherwise. :raises TypeError: @@ -30,7 +30,7 @@ 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 type_defs from dict(s) to this dict. + """ Add definitions from dict(s) to this dict. Parameters: def_dicts (list, DefinitionDict, or dict): DefinitionDict or list of DefinitionDicts/strings/dicts whose @@ -63,7 +63,7 @@ def _add_definition(self, def_tag, def_value): self.defs[def_tag] = def_value def _add_definitions_from_dict(self, def_dict): - """ Add the type_defs found in the given definition dictionary to this mapper. + """ Add the definitions found in the given definition dictionary to this mapper. Parameters: def_dict (DefinitionDict or dict): DefDict whose definitions should be added. @@ -92,29 +92,29 @@ def __len__(self): return len(self.defs) def items(self): - """ Returns the dictionary of type_defs + """ Returns the dictionary of definitions Alias for .defs.items() Returns: - def_entries({str: DefinitionEntry}): A list of type_defs + def_entries({str: DefinitionEntry}): A list of definitions """ return self.defs.items() @property def issues(self): - """Returns issues about duplicate type_defs.""" + """Returns issues about duplicate definitions.""" return self._issues def check_for_definitions(self, hed_string_obj, error_handler=None): """ Check string for definition tags, adding them to self. Parameters: - hed_string_obj (HedString): A single hed string to gather type_defs from. - error_handler (ErrorHandler or None): Error context used to identify where type_defs are found. + hed_string_obj (HedString): A single hed string to gather definitions from. + error_handler (ErrorHandler or None): Error context used to identify where definitions are found. Returns: - list: List of issues encountered in checking for type_defs. Each issue is a dictionary. + list: List of issues encountered in checking for definitions. Each issue is a dictionary. """ def_issues = [] for definition_tag, group in hed_string_obj.find_top_level_tags(anchor_tags={DefTagNames.DEFINITION_KEY}): @@ -302,7 +302,7 @@ def get_as_strings(def_dict): """ Convert the entries to strings of the contents Parameters: - def_dict(DefinitionDict or dict): A dict of type_defs + def_dict(DefinitionDict or dict): A dict of definitions Returns: dict(str: str): definition name and contents diff --git a/hed/models/df_util.py b/hed/models/df_util.py index 34a891f84..0a9373d1e 100644 --- a/hed/models/df_util.py +++ b/hed/models/df_util.py @@ -29,7 +29,7 @@ def get_assembled(tabular_file, sidecar, hed_schema, extra_def_dicts=None, join_ Returns: tuple: hed_strings(list of HedStrings):A list of HedStrings or a list of lists of HedStrings - def_dict(DefinitionDict): The type_defs from this Sidecar + def_dict(DefinitionDict): The definitions from this Sidecar """ if isinstance(sidecar, str): sidecar = Sidecar(sidecar) @@ -105,7 +105,7 @@ def expand_defs(df, hed_schema, def_dict, columns=None): Parameters: df (pd.Dataframe or pd.Series): The dataframe or series to modify hed_schema (HedSchema or None): The schema to use to identify defs - def_dict (DefinitionDict): The type_defs to expand + def_dict (DefinitionDict): The definitions to expand columns (list or None): The columns to modify on the dataframe """ if isinstance(df, pd.Series): @@ -133,18 +133,18 @@ def _expand_defs(hed_string, hed_schema, def_dict): def process_def_expands(hed_strings, hed_schema, known_defs=None, ambiguous_defs=None): - """ Gather def-expand tags in the strings/compare with known type_defs to find any differences + """ Gather def-expand tags in the strings/compare with known definitions to find any differences Parameters: hed_strings (list or pd.Series): A list of HED strings to process. hed_schema (HedSchema): The schema to use known_defs (DefinitionDict or list or str or None): - A DefinitionDict or anything its constructor takes. These are the known type_defs going in, that must + A DefinitionDict or anything its constructor takes. These are the known definitions going in, that must match perfectly. - ambiguous_defs (dict): A dictionary containing ambiguous type_defs + ambiguous_defs (dict): A dictionary containing ambiguous definitions format TBD. Currently def name key: list of lists of HED tags values Returns: - tuple: A tuple containing the DefinitionDict, ambiguous type_defs, and errors. + tuple: A tuple containing the DefinitionDict, ambiguous definitions, and errors. """ from hed.models.def_expand_gather import DefExpandGatherer diff --git a/hed/models/hed_string.py b/hed/models/hed_string.py index 09b57019e..eaeb48371 100644 --- a/hed/models/hed_string.py +++ b/hed/models/hed_string.py @@ -114,7 +114,7 @@ def copy(self): def remove_definitions(self): """ Remove definition tags and groups from this string. - This does not validate type_defs and will blindly removing invalid ones as well. + This does not validate definitions and will blindly removing invalid ones as well. """ definition_groups = self.find_top_level_tags({DefTagNames.DEFINITION_KEY}, include_groups=1) if definition_groups: @@ -178,7 +178,7 @@ def split_into_groups(hed_string, hed_schema, def_dict=None): Parameters: hed_string (str): A hed string consisting of tags and tag groups to be processed. hed_schema (HedSchema): HED schema to use to identify tags. - def_dict(DefinitionDict): The type_defs to identify + def_dict(DefinitionDict): The definitions to identify Returns: list: A list of HedTag and/or HedGroup. diff --git a/hed/models/model_constants.py b/hed/models/model_constants.py index 3aed6608a..5fdb54cda 100644 --- a/hed/models/model_constants.py +++ b/hed/models/model_constants.py @@ -5,7 +5,7 @@ class DefTagNames: - """ Source names for type_defs, def labels, and expanded labels""" + """ Source names for definitions, def labels, and expanded labels""" DEF_ORG_KEY = 'Def' DEF_EXPAND_ORG_KEY = 'Def-expand' diff --git a/hed/models/sidecar.py b/hed/models/sidecar.py index be4ed9614..d7d77a09b 100644 --- a/hed/models/sidecar.py +++ b/hed/models/sidecar.py @@ -54,12 +54,12 @@ def all_hed_columns(self): @property def def_dict(self): - """This is the type_defs from this sidecar. + """This is the definitions from this sidecar. - Generally you should instead call get_def_dict to get the relevant type_defs + Generally you should instead call get_def_dict to get the relevant definitions Returns: - DefinitionDict: The type_defs for this sidecar + DefinitionDict: The definitions for this sidecar """ return self._def_dict @@ -76,7 +76,7 @@ def get_def_dict(self, hed_schema, extra_def_dicts=None): """ Returns the definition dict for this sidecar. Parameters: - hed_schema(HedSchema): used to identify tags to find type_defs + hed_schema(HedSchema): used to identify tags to find definitions extra_def_dicts (list, DefinitionDict, or None): Extra dicts to add to the list. Returns: @@ -192,14 +192,14 @@ def _load_json_file(self, fp): raise HedFileError(HedExceptions.CANNOT_PARSE_JSON, str(e), self.name) from e def extract_definitions(self, hed_schema, error_handler=None): - """ Gather and validate type_defs in metadata. + """ Gather and validate definitions in metadata. Parameters: hed_schema (HedSchema): The schema to used to identify tags. error_handler (ErrorHandler or None): The error handler to use for context, uses a default one if None. Returns: - DefinitionDict: Contains all the type_defs located in the sidecar. + DefinitionDict: Contains all the definitions located in the sidecar. """ if error_handler is None: diff --git a/hed/models/tabular_input.py b/hed/models/tabular_input.py index 4511f074f..92e63cdd5 100644 --- a/hed/models/tabular_input.py +++ b/hed/models/tabular_input.py @@ -58,7 +58,7 @@ def get_def_dict(self, hed_schema, extra_def_dicts=None): """ Returns the definition dict for this sidecar. Parameters: - hed_schema(HedSchema): used to identify tags to find type_defs + hed_schema(HedSchema): used to identify tags to find definitions extra_def_dicts (list, DefinitionDict, or None): Extra dicts to add to the list. Returns: diff --git a/hed/models/timeseries_input.py b/hed/models/timeseries_input.py index 125800d18..0b9cbee18 100644 --- a/hed/models/timeseries_input.py +++ b/hed/models/timeseries_input.py @@ -17,7 +17,7 @@ def __init__(self, file=None, sidecar=None, extra_def_dicts=None, name=None): name (str): The name to display for this file for error purposes. Notes: - - The extra_def_dicts are external type_defs that override the ones in the object. + - The extra_def_dicts are external definitions that override the ones in the object. """ diff --git a/hed/tools/analysis/analysis_util.py b/hed/tools/analysis/analysis_util.py index 475ca209c..144c360de 100644 --- a/hed/tools/analysis/analysis_util.py +++ b/hed/tools/analysis/analysis_util.py @@ -14,11 +14,11 @@ def assemble_hed(data_input, sidecar, schema, columns_included=None, expand_defs Parameters: data_input (TabularInput): The tabular input file whose HED annotations are to be assembled. - sidecar (Sidecar): Sidecar with type_defs. + sidecar (Sidecar): Sidecar with definitions. schema (HedSchema): Hed schema columns_included (list or None): A list of additional column names to include. If None, only the list of assembled tags is included. - expand_defs (bool): If True, type_defs are expanded when the events are assembled. + expand_defs (bool): If True, definitions are expanded when the events are assembled. Returns: DataFrame or None: A DataFrame with the assembled events. @@ -41,7 +41,6 @@ def assemble_hed(data_input, sidecar, schema, columns_included=None, expand_defs else: df = data_input.dataframe[eligible_columns].copy(deep=True) df['HED_assembled'] = hed_string_list - # type_defs = data_input.get_definitions().gathered_defs return df, definitions @@ -113,7 +112,7 @@ def search_strings(hed_strings, queries, query_names=None): # Parameters: # table (TabularInput): The input file to be searched. # hed_schema (HedSchema or HedschemaGroup): If provided the HedStrings are converted to canonical form. -# expand_defs (bool): If True, type_defs are expanded when the events are assembled. +# expand_defs (bool): If True, definitions are expanded when the events are assembled. # # Returns: # list: A list of HedString objects. @@ -139,7 +138,7 @@ def search_strings(hed_strings, queries, query_names=None): # """ # # eligible_columns, missing_columns = separate_values(list(data_input.dataframe.columns), columns_included) -# hed_list, type_defs = df_util.get_assembled(data_input, sidecar, hed_schema, extra_def_dicts=None, join_columns=True, +# hed_list, definitions = df_util.get_assembled(data_input, sidecar, hed_schema, extra_def_dicts=None, join_columns=True, # shrink_defs=False, expand_defs=True) # expression = QueryParser(query) # hed_tags = [] @@ -187,7 +186,7 @@ def search_strings(hed_strings, queries, query_names=None): # list: A list of the removed Defs. # # Notes: -# - the hed_string_obj passed in no longer has type_defs. +# - the hed_string_obj passed in no longer has definitions. # # """ # to_remove = [] diff --git a/hed/tools/analysis/event_manager.py b/hed/tools/analysis/event_manager.py index b64ac0409..c304cfacb 100644 --- a/hed/tools/analysis/event_manager.py +++ b/hed/tools/analysis/event_manager.py @@ -16,7 +16,7 @@ def __init__(self, input_data, hed_schema, extra_defs=None): Parameters: input_data (TabularInput): Represents an events file with its sidecar. hed_schema (HedSchema): HED schema used in this - extra_defs (DefinitionDict): Extra type_defs not included in the input_data information. + extra_defs (DefinitionDict): Extra definitions not included in the input_data information. :raises HedFileError: - if there are any unmatched offsets. diff --git a/hed/tools/analysis/hed_type.py b/hed/tools/analysis/hed_type.py index 6a3bdc270..fdd4abd96 100644 --- a/hed/tools/analysis/hed_type.py +++ b/hed/tools/analysis/hed_type.py @@ -16,7 +16,7 @@ def __init__(self, event_manager, name, type_tag="condition-variable"): type_tag (str): Lowercase short form of the tag to be managed. :raises HedFileError: - - On errors such as unmatched onsets or missing type_defs. + - On errors such as unmatched onsets or missing definitions. """ self.name = name @@ -59,7 +59,7 @@ def type_variables(self): return set(self._type_map.keys()) def get_type_def_names(self): - """ Return the type_defs """ + """ Return the type defs names """ tag_list = [] for variable, factor in self._type_map.items(): tag_list = tag_list + [key for key in factor.levels.keys()] diff --git a/hed/tools/analysis/hed_type_counts.py b/hed/tools/analysis/hed_type_counts.py index 056bd63d7..289c64013 100644 --- a/hed/tools/analysis/hed_type_counts.py +++ b/hed/tools/analysis/hed_type_counts.py @@ -118,7 +118,7 @@ def add_descriptions(self, type_defs): """ Update this summary based on the type variable map. Parameters: - type_defs (HedTypeDefinitions): Contains the information about the value of a type. + type_defs (HedTypeDefs): Contains the information about the value of a type. """ diff --git a/hed/tools/analysis/hed_type_defs.py b/hed/tools/analysis/hed_type_defs.py index b6a0b8ab1..988b4bdae 100644 --- a/hed/tools/analysis/hed_type_defs.py +++ b/hed/tools/analysis/hed_type_defs.py @@ -1,4 +1,4 @@ -""" Manages type_defs associated with a type such as condition-variable. """ +""" Manages definitions associated with a type such as condition-variable. """ from hed.models.hed_tag import HedTag from hed.models.definition_dict import DefinitionDict @@ -84,7 +84,7 @@ def _extract_def_map(self): return def_map def _extract_type_map(self): - """ Extract the type_defs associated with each type value and add them to the dictionary. """ + """ Extract the definitions associated with each type value and add them to the dictionary. """ type_map = {} for def_name, def_values in self.def_map.items(): diff --git a/hed/tools/analysis/hed_type_manager.py b/hed/tools/analysis/hed_type_manager.py index 9960d31ec..5c42c9539 100644 --- a/hed/tools/analysis/hed_type_manager.py +++ b/hed/tools/analysis/hed_type_manager.py @@ -1,4 +1,4 @@ -""" Manager for type factors and type type_defs. """ +""" Manager for type factors and type definitions. """ import pandas as pd import json @@ -14,7 +14,7 @@ def __init__(self, event_manager): event_manager (EventManager): an event manager for the tabular file. :raises HedFileError: - - On errors such as unmatched onsets or missing type_defs. + - On errors such as unmatched onsets or missing definitions. """ diff --git a/hed/tools/bids/bids_file_group.py b/hed/tools/bids/bids_file_group.py index 5a47da6ef..f14733776 100644 --- a/hed/tools/bids/bids_file_group.py +++ b/hed/tools/bids/bids_file_group.py @@ -117,7 +117,7 @@ def validate_sidecars(self, hed_schema, extra_def_dicts=None, check_for_warnings Parameters: hed_schema (HedSchema): HED schema for validation. - extra_def_dicts (DefinitionDict): Extra type_defs + extra_def_dicts (DefinitionDict): Extra definitions check_for_warnings (bool): If True, include warnings in the check. Returns: @@ -140,7 +140,7 @@ def validate_datafiles(self, hed_schema, extra_def_dicts=None, check_for_warning Parameters: hed_schema (HedSchema): Schema to apply to the validation. - extra_def_dicts (DefinitionDict): Extra type_defs that come from outside. + extra_def_dicts (DefinitionDict): Extra definitions that come from outside. check_for_warnings (bool): If True, include warnings in the check. keep_contents (bool): If True, the underlying data files are read and their contents retained. diff --git a/hed/validator/def_validator.py b/hed/validator/def_validator.py index c615f6edc..fcafcf87b 100644 --- a/hed/validator/def_validator.py +++ b/hed/validator/def_validator.py @@ -10,10 +10,10 @@ class DefValidator(DefinitionDict): """ def __init__(self, def_dicts=None, hed_schema=None): - """ Initialize for type_defs in hed strings. + """ Initialize for definitions in hed strings. Parameters: - def_dicts (list or DefinitionDict or str): DefinitionDicts containing the type_defs to pass to baseclass + def_dicts (list or DefinitionDict or str): DefinitionDicts containing the definitions to pass to baseclass hed_schema(HedSchema or None): Required if passing strings or lists of strings, unused otherwise. """ super().__init__(def_dicts, hed_schema=hed_schema) diff --git a/hed/validator/hed_validator.py b/hed/validator/hed_validator.py index 0f4c4bd56..a3293dc4f 100644 --- a/hed/validator/hed_validator.py +++ b/hed/validator/hed_validator.py @@ -25,7 +25,7 @@ def __init__(self, hed_schema, def_dicts=None, run_full_onset_checks=True, defin hed_schema (HedSchema or HedSchemaGroup): HedSchema object to use for validation. def_dicts(DefinitionDict or list or dict): the def dicts to use for validation run_full_onset_checks(bool): If True, check for matching onset/offset tags - definitions_allowed(bool): If False, flag type_defs found as errors + definitions_allowed(bool): If False, flag definitions found as errors """ super().__init__() self._tag_validator = None diff --git a/hed/validator/sidecar_validator.py b/hed/validator/sidecar_validator.py index becbcd109..9e6f222fd 100644 --- a/hed/validator/sidecar_validator.py +++ b/hed/validator/sidecar_validator.py @@ -10,7 +10,7 @@ from hed.errors.error_reporter import check_for_any_errors -# todo: Add/improve validation for type_defs being in known columns(right now it just assumes they aren't) +# todo: Add/improve validation for definitions being in known columns(right now it just assumes they aren't) class SidecarValidator: reserved_column_names = ["HED"] reserved_category_values = ["n/a"] @@ -255,7 +255,7 @@ def _validate_pound_sign_count(self, hed_string, column_type): presence of definition tags. """ - # Make a copy without type_defs to check placeholder count. + # Make a copy without definitions to check placeholder count. expected_count, error_type = ColumnMetadata.expected_pound_sign_count(column_type) hed_string_copy = copy.deepcopy(hed_string) hed_string_copy.remove_definitions() diff --git a/hed/validator/spreadsheet_validator.py b/hed/validator/spreadsheet_validator.py index cdec262d1..025aa54d4 100644 --- a/hed/validator/spreadsheet_validator.py +++ b/hed/validator/spreadsheet_validator.py @@ -27,7 +27,7 @@ def validate(self, data, def_dicts=None, name=None, error_handler=None): Parameters: data (BaseInput or pd.DataFrame): Input data to be validated. If a dataframe, it is assumed to be assembled already. - def_dicts(list of DefDict or DefDict): all type_defs to use for validation + def_dicts(list of DefDict or DefDict): all definitions to use for validation name(str): The name to report errors from this file as error_handler (ErrorHandler): Error context to use. Creates a new one if None Returns: diff --git a/hed/validator/tag_validator.py b/hed/validator/tag_validator.py index e81304382..f0d585a70 100644 --- a/hed/validator/tag_validator.py +++ b/hed/validator/tag_validator.py @@ -110,7 +110,7 @@ def run_tag_level_validators(self, original_tag_list, is_top_level, is_group): Notes: - This is for the top-level, all groups, and nested groups. - - This can contain type_defs, Onset, etc tags. + - This can contain definitions, Onset, etc tags. """ validation_issues = [] @@ -424,7 +424,7 @@ def check_tag_level_issue(self, original_tag_list, is_top_level, is_group): list: Validation issues. Each issue is a dictionary. Notes: - - Top-level groups can contain type_defs, Onset, etc tags. + - Top-level groups can contain definitions, Onset, etc tags. """ validation_issues = [] top_level_tags = [tag for tag in original_tag_list if diff --git a/spec_tests/test_errors.py b/spec_tests/test_errors.py index 4a9b60ab5..ac817fa81 100644 --- a/spec_tests/test_errors.py +++ b/spec_tests/test_errors.py @@ -100,7 +100,7 @@ def run_single_test(self, test_file): error_handler = ErrorHandler(check_for_warnings) if schema: schema = load_schema_version(schema) - definitions = info['type_defs'] + definitions = info['definitions'] def_dict = DefinitionDict(definitions, schema) self.assertFalse(def_dict.issues) else: diff --git a/tests/models/test_base_input.py b/tests/models/test_base_input.py index 447aaae95..5f8b2bbab 100644 --- a/tests/models/test_base_input.py +++ b/tests/models/test_base_input.py @@ -51,7 +51,7 @@ def tearDownClass(cls): def test_gathered_defs(self): # todo: probably remove this test? - # todo: add unit tests for type_defs in tsv file + # todo: add unit tests for definitions in tsv file defs = DefinitionDict.get_as_strings(self.tabular_file._sidecar.extract_definitions(hed_schema=self.hed_schema)) expected_defs = { 'jsonfiledef': '(Acceleration/#,Item/JsonDef1)', diff --git a/tests/models/test_spreadsheet_input.py b/tests/models/test_spreadsheet_input.py index bf2e98b98..eeee6bc8d 100644 --- a/tests/models/test_spreadsheet_input.py +++ b/tests/models/test_spreadsheet_input.py @@ -159,7 +159,7 @@ def test_no_column_header_and_convert(self): self.assertTrue(hed_input._dataframe.equals(hed_input_long._dataframe)) def test_convert_short_long_with_definitions(self): - # Verify behavior works as expected even if type_defs are present + # Verify behavior works as expected even if definitions are present events_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../data/model_tests/no_column_header_definition.tsv') hed_input = SpreadsheetInput(events_path, has_column_names=False, tag_columns=[0, 1]) diff --git a/tests/tools/analysis/test_analysis_util_assemble_hed.py b/tests/tools/analysis/test_analysis_util_assemble_hed.py index 4b88f1bbe..018a7ead7 100644 --- a/tests/tools/analysis/test_analysis_util_assemble_hed.py +++ b/tests/tools/analysis/test_analysis_util_assemble_hed.py @@ -39,7 +39,7 @@ def test_assemble_hed_included_no_expand(self): self.assertNotEqual(first_str1.find('Def/'), -1, "assemble_hed with no def expand has Def tags") self.assertEqual(first_str1.find('Def-expand'), -1, "assemble_hed with no def expand does not have Def-expand tags") - self.assertIsInstance(dict1.defs, dict, "hed_assemble returns a dictionary of type_defs") + self.assertIsInstance(dict1.defs, dict, "hed_assemble returns a dictionary of definitions") self.assertEqual(len(dict1.defs), 17, "hed_assemble definition dictionary has the right number of elements.") def test_assemble_hed_included_expand(self): @@ -74,7 +74,7 @@ def test_assemble_hed_no_included_no_expand(self): self.assertNotEqual(first_str1.find('Def/'), -1, "assemble_hed with no def expand has Def tags") self.assertEqual(first_str1.find('Def-expand'), -1, "assemble_hed with no def expand does not have Def-expand tags") - self.assertIsInstance(dict1, DefinitionDict, "hed_assemble returns a dictionary of type_defs") + self.assertIsInstance(dict1, DefinitionDict, "hed_assemble returns a dictionary of definitions") self.assertEqual(len(dict1.defs), 17, "hed_assemble definition dictionary has the right number of elements.") def test_assemble_hed_no_included_expand(self): diff --git a/tests/validator/test_hed_validator.py b/tests/validator/test_hed_validator.py index e5338d6d0..0e3bcdfab 100644 --- a/tests/validator/test_hed_validator.py +++ b/tests/validator/test_hed_validator.py @@ -107,7 +107,7 @@ def test_complex_file_validation_invalid(self): def test_complex_file_validation_invalid_definitions_removed(self): # todo: update this/remove - # This verifies type_defs are being removed from sidecar strings before being added, or it will produce + # This verifies definitions are being removed from sidecar strings before being added, or it will produce # extra errors. schema_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '../data/validator_tests/bids_schema.mediawiki'))