diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e90604ad..bbdc85cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,7 +112,7 @@ jobs: python contributors.py cd sphinx make clean - make html + make html - name: Install and test with OMV if: ${{ matrix.runs-on != 'windows-latest' }} diff --git a/docs/sphinx/source/api/Contributors.md b/docs/sphinx/source/api/Contributors.md index 20ab4a5c..ab26a9f3 100644 --- a/docs/sphinx/source/api/Contributors.md +++ b/docs/sphinx/source/api/Contributors.md @@ -3,7 +3,7 @@ # Modelspec contributors This page list names and Github profiles of contributors to Modelspec, listed in no particular order. -This page is generated periodically, most recently on 2024-04-12. +This page is generated periodically, most recently on 2024-04-25. - Padraig Gleeson ([@pgleeson](https://github.com/pgleeson)) - Manifest Chakalov ([@mqnifestkelvin](https://github.com/mqnifestkelvin)) diff --git a/examples/neuroml2/neuroml2_spec.py b/examples/neuroml2/neuroml2_spec.py index 36422ab5..5b9be78c 100644 --- a/examples/neuroml2/neuroml2_spec.py +++ b/examples/neuroml2/neuroml2_spec.py @@ -128,7 +128,6 @@ class neuroml(Base): if __name__ == "__main__": - nml_doc = neuroml(id="TestNeuroML") izh = izhikevich2007Cell( diff --git a/examples/sbml/sbml32spec.py b/examples/sbml/sbml32spec.py index c6372a91..6abebf2c 100644 --- a/examples/sbml/sbml32spec.py +++ b/examples/sbml/sbml32spec.py @@ -82,7 +82,6 @@ class SBase(Base): @modelspec.define class SBaseWithId(SBase): - id: str = field(default=None, validator=optional([instance_of(str), valid_sid])) diff --git a/examples/sbml/sbml_validators.py b/examples/sbml/sbml_validators.py index 5ab66a5b..b1bb44a5 100644 --- a/examples/sbml/sbml_validators.py +++ b/examples/sbml/sbml_validators.py @@ -168,7 +168,6 @@ def validate_sbml(doc, units_consistency: bool = False) -> None: if __name__ == "__main__": - import libsbml sbml_file = sys.argv[1] diff --git a/src/modelspec/base_types.py b/src/modelspec/base_types.py index f9459a37..23f8f2f5 100644 --- a/src/modelspec/base_types.py +++ b/src/modelspec/base_types.py @@ -147,7 +147,6 @@ def from_dict(cls, d: Dict[str, Any]) -> "Base": # If this object has an id attribute, it may have been serialized within a dict with the id as the key, even if # it is a single object. if "id" in [f.name for f in attr.fields(cls)] and "id" not in d.keys(): - keys = list(d.keys()) if len(keys) == 0: raise ValueError( @@ -297,7 +296,6 @@ def to_yaml_file( filename = f"{self.id}.yaml" with open(filename, "w") as outfile: - # We need to setup another yaml.dump( yaml_converter.unstructure(self.to_dict()), @@ -313,7 +311,6 @@ def to_xml_file( filename: Optional[str] = None, include_metadata: bool = True, ) -> str: - if filename is None: filename = f"{self.id}.xml" @@ -636,7 +633,6 @@ def _is_base_type( can_be_none=False, can_be_eval_expr=False, ): - import numpy if verbose: @@ -730,7 +726,6 @@ def _cls_generate_documentation(cls, format: str = MARKDOWN_FORMAT): rst_url_format = "`%s <%s>`__" def insert_links(text, format=MARKDOWN_FORMAT): - code_ref = ":code:`" # print(" > Converting: %s" % text) text2 = text diff --git a/src/modelspec/utils.py b/src/modelspec/utils.py index af2ca292..2d4a65c6 100644 --- a/src/modelspec/utils.py +++ b/src/modelspec/utils.py @@ -192,14 +192,12 @@ def convert_xml_dict_values(value): def save_to_json_file(info_dict, filename, indent=4): - strj = json.dumps(info_dict, indent=indent) with open(filename, "w") as fp: fp.write(strj) def save_to_yaml_file(info_dict, filename, indent=4): - if sys.version_info[0] == 2: stry = yaml.dump(info_dict, indent=indent, default_flow_style=False) else: @@ -251,7 +249,6 @@ def build_xml_element(data, parent=None): attrs = attr.fields(data.__class__) for aattr in attrs: - print_(" == Looking at: {} ({})".format(aattr, type(aattr)), verbose) if isinstance(aattr.default, attr.Factory): children = data.__getattribute__(aattr.name) @@ -280,7 +277,6 @@ def build_xml_element(data, parent=None): ): parent.set(attribute_name, str(attribute_value)) elif type(attribute_value) == dict: - """for k, v in attribute_value.items(): child_element = build_xml_element(v)""" else: @@ -309,7 +305,6 @@ def ascii_encode_dict(data): def _parse_element(dict_format, to_build): - print_("Parse for element: [%s]" % dict_format, verbose) for k in dict_format.keys(): print_( @@ -323,7 +318,6 @@ def _parse_element(dict_format, to_build): def _parse_attributes(dict_format, to_build): - for key in dict_format: value = dict_format[key] new_format = True @@ -489,7 +483,6 @@ def evaluate( else: expr = int(expr) except: - try: if array_format == FORMAT_TENSORFLOW: expr = tf.constant(float(expr)) @@ -557,7 +550,6 @@ def evaluate( ) if (type(v) is float or type(v) is str) and int(v) == v: - print_(" Returning int: %s" % int(v), verbose) if array_format == FORMAT_TENSORFLOW: @@ -576,7 +568,6 @@ def evaluate( def parse_list_like(list_str): - if isinstance(list_str, int): return [list_str] elif isinstance(list_str, float): diff --git a/tests/test_utils.py b/tests/test_utils.py index f3927865..80fc991d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -12,7 +12,6 @@ class TestUtils(unittest.TestCase): def test_evaluate(self): - assert evaluate("33") == 33.0 assert evaluate("33") == 33 assert evaluate(33) == 33