Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/maintainability)](https://codeclimate.com/github/hed-standard/hed-python/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/test_coverage)](https://codeclimate.com/github/hed-standard/hed-python/test_coverage)
![PyPI - Status](https://img.shields.io/pypi/v/hedtools)

[![Documentation Status](https://readthedocs.org/projects/hed-python/badge/?version=latest)](https://hed-python.readthedocs.io/en/latest/?badge=latest)

# HEDTools - Python
HED (Hierarchical Event Descriptors) is a framework for systematically describing
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ openpyxl>=3.1.0
pandas>=1.3.5
portalocker>=2.7.0
semantic_version>=2.10.0
myst-parser>=1.0.0
Sphinx>=5.2.2
sphinx_rtd_theme>=1.0.0
wordcloud==1.9.2
Binary file added docs/source/_static/images/croppedWideLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
author = 'HED Working Group'

# The full version, including alpha/beta/rc tags
version = '0.0.1'
release = '0.0.1'
version = '0.3.1'
release = '0.3.1'

currentdir = os.path.realpath(os.path.dirname(__file__))

Expand Down
4 changes: 4 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Hierarchical Event Descriptor (HED) Python Tools
================================================

.. image:: _static/images/croppedWideLogo.png
:width: 220
:alt: HedLogo

.. sidebar:: **Links**

* `PDF docs <https://hed-python.readthedocs.io/_/downloads/en/latest/pdf/>`_
Expand Down
9 changes: 8 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ you can install directly from the
`GitHub repository <https://github.com/hed-standard/hed-python>`_
using the following command:

```code
>>> pip install git+https://github.com/hed-standard/hed-python.git

```

Finding help
============

:Documentation:

See `HED resources <https://www.hed-resources.org>`_ for user documentation and tutorials.

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
Expand Down
10 changes: 0 additions & 10 deletions hed/errors/error_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
ErrorContext.ROW,
ErrorContext.COLUMN,
ErrorContext.LINE,
# ErrorContext.HED_STRING, # temporarily disable hed string sort(maybe perm, not sure it's needed)
ErrorContext.SCHEMA_SECTION,
ErrorContext.SCHEMA_TAG,
ErrorContext.SCHEMA_ATTRIBUTE,
Expand All @@ -33,10 +32,6 @@
ErrorContext.ROW
]

hed_string_sort_list = [
ErrorContext.HED_STRING
]

def _register_error_function(error_type, wrapper_func):
if error_type in error_functions:
raise KeyError(f"{error_type} defined more than once.")
Expand Down Expand Up @@ -191,11 +186,8 @@ def push_error_context(self, context_type, context):

"""
if context is None:
from hed import HedString
if context_type in int_sort_list:
context = 0
elif context_type in hed_string_sort_list:
context = HedString("")
else:
context = ""
self.error_context.append((context_type, context))
Expand Down Expand Up @@ -430,8 +422,6 @@ def _get_keys(d):
for key in default_sort_list:
if key in int_sort_list:
result.append(d.get(key, -1))
elif key in hed_string_sort_list:
result.append(d.get(key, HedString("")))
else:
result.append(d.get(key, ""))
return tuple(result)
Expand Down
1 change: 0 additions & 1 deletion hed/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .hed_group import HedGroup
from .spreadsheet_input import SpreadsheetInput
from .hed_string import HedString
from .hed_string_group import HedStringGroup
from .hed_tag import HedTag
from .sidecar import Sidecar
from .tabular_input import TabularInput
Expand Down
6 changes: 3 additions & 3 deletions hed/models/base_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def __init__(self, file, file_type=None, worksheet_name=None, has_column_names=T
self._dataframe = None

if isinstance(file, pandas.DataFrame):
self._dataframe = file
self._dataframe = file.astype(str)
self._has_column_names = self._dataframe_has_names(self._dataframe)
elif not file:
raise HedFileError(HedExceptions.FILE_NOT_FOUND, "Empty file passed to BaseInput.", file)
elif input_type in self.TEXT_EXTENSION:
try:
self._dataframe = pandas.read_csv(file, delimiter='\t', header=pandas_header,
dtype=str, keep_default_na=True, na_values=None)
dtype=str, keep_default_na=True, na_values=["", "null"])
except Exception as e:
raise HedFileError(HedExceptions.INVALID_FILE_FORMAT, str(e), self.name) from e
# Convert nan values to a known value
Expand Down Expand Up @@ -493,7 +493,7 @@ def combine_dataframe(dataframe):
)
return dataframe

def get_def_dict(self, hed_schema=None, extra_def_dicts=None):
def get_def_dict(self, hed_schema, extra_def_dicts=None):
""" Returns the definition dict for this file

Note: Baseclass implementation returns just extra_def_dicts.
Expand Down
4 changes: 2 additions & 2 deletions hed/models/column_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,11 @@ def _finalize_mapping(self):
def _remove_from_list(list_to_alter, to_remove):
return [item for item in list_to_alter if item not in to_remove]

def get_def_dict(self, hed_schema=None, extra_def_dicts=None):
def get_def_dict(self, hed_schema, extra_def_dicts=None):
""" Return def dicts from every column description.

Parameters:
hed_schema (Schema or None): A HED schema object to use for extracting definitions.
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:
Expand Down
3 changes: 0 additions & 3 deletions hed/models/def_expand_gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,4 @@ def get_ambiguous_group(ambiguous_def):
Returns:
HedGroup: the ambiguous definition with known placeholders filled in
"""
if not ambiguous_def:
# mostly to not crash, this shouldn't happen.
return HedString("")
return ambiguous_def.get_group()
2 changes: 1 addition & 1 deletion hed/models/definition_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def add_definitions(self, def_dicts, hed_schema=None):
for definition in def_dict:
self.check_for_definitions(HedString(definition, hed_schema))
else:
raise TypeError("Invalid type '{type(def_dict)}' passed to DefinitionDict")
raise TypeError(f"Invalid type '{type(def_dict)}' passed to DefinitionDict")

def _add_definition(self, def_tag, def_value):
if def_tag in self.defs:
Expand Down
3 changes: 2 additions & 1 deletion hed/models/definition_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def __init__(self, name, contents, takes_value, source_context):
"""
self.name = name
if contents:
contents = contents.copy().sort()
contents = contents.copy()
contents.sort()
self.contents = contents
self.takes_value = takes_value
self.source_context = source_context
Expand Down
7 changes: 1 addition & 6 deletions hed/models/hed_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,8 @@ def copy(self):
return return_copy

def sort(self):
""" Sort the tags and groups in this HedString in a consistent order.

Returns:
self
"""
""" Sort the tags and groups in this HedString in a consistent order."""
self.sorted(update_self=True)
return self

def sorted(self, update_self=False):
""" Returns a sorted copy of this hed group as a list of it's children
Expand Down
Loading