Skip to content

Commit

Permalink
Format update
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Apr 25, 2024
1 parent ce5a73a commit f90f3ee
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/source/api/Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion examples/neuroml2/neuroml2_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class neuroml(Base):


if __name__ == "__main__":

nml_doc = neuroml(id="TestNeuroML")

izh = izhikevich2007Cell(
Expand Down
1 change: 0 additions & 1 deletion examples/sbml/sbml32spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class SBase(Base):

@modelspec.define
class SBaseWithId(SBase):

id: str = field(default=None, validator=optional([instance_of(str), valid_sid]))


Expand Down
1 change: 0 additions & 1 deletion examples/sbml/sbml_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ def validate_sbml(doc, units_consistency: bool = False) -> None:


if __name__ == "__main__":

import libsbml

sbml_file = sys.argv[1]
Expand Down
5 changes: 0 additions & 5 deletions src/modelspec/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()),
Expand All @@ -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"

Expand Down Expand Up @@ -636,7 +633,6 @@ def _is_base_type(
can_be_none=False,
can_be_eval_expr=False,
):

import numpy

if verbose:
Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions src/modelspec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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_(
Expand All @@ -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
Expand Down Expand Up @@ -489,7 +483,6 @@ def evaluate(
else:
expr = int(expr)
except:

try:
if array_format == FORMAT_TENSORFLOW:
expr = tf.constant(float(expr))
Expand Down Expand Up @@ -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:
Expand All @@ -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):
Expand Down
1 change: 0 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f90f3ee

Please sign in to comment.