Skip to content

Commit f14b100

Browse files
cleanup code
1 parent 22ceed2 commit f14b100

File tree

77 files changed

+796
-819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+796
-819
lines changed

oven/multiprocessing/ray_init.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
ray start --head --port=6379
33
"""
44

5-
5+
import ray
66
import time
7+
78
tstart = time.time()
8-
import ray
99

10-
ray.init(address='auto')
10+
11+
ray.init(address="auto")
1112
# ray.init()
1213

1314

1415
tend = time.time()
15-
print(f"ray start time:", tend-tstart)
16+
print("ray start time:", tend - tstart)

src/sbmlsim/combine/datagenerator.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""DataGenerator."""
22

3-
from typing import Dict
4-
53
from sbmlsim.data import DataSet
64
from sbmlsim.result import XResult
75

@@ -10,8 +8,8 @@ class DataGeneratorFunction:
108
"""DataGeneratorFunction."""
119

1210
def __call__(
13-
self, xresults: Dict[str, XResult], dsets: Dict[str, DataSet] = None
14-
) -> Dict[str, XResult]:
11+
self, xresults: dict[str, XResult], dsets: dict[str, DataSet] = None
12+
) -> dict[str, XResult]:
1513
"""Call the function."""
1614
raise NotImplementedError
1715

@@ -24,7 +22,7 @@ def __init__(self, index: int, dimension: str = "_time"):
2422
self.index = index
2523
self.dimension = dimension
2624

27-
def __call__(self, xresults: Dict[str, XResult], dsets=None) -> Dict[str, XResult]:
25+
def __call__(self, xresults: dict[str, XResult], dsets=None) -> dict[str, XResult]:
2826
"""Reduce based on '_time' dimension with given index."""
2927
results = {}
3028
for key, xres in xresults.items():
@@ -50,8 +48,8 @@ class DataGenerator:
5048
def __init__(
5149
self,
5250
f: DataGeneratorFunction,
53-
xresults: Dict[str, XResult],
54-
dsets: Dict[str, DataSet] = None,
51+
xresults: dict[str, XResult],
52+
dsets: dict[str, DataSet] = None,
5553
):
5654
"""Initialize DataGenerator."""
5755
self.xresults = xresults

src/sbmlsim/combine/mathml.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Using sympy to evaluate the expressions.
44
"""
55

6-
from typing import Any, Dict, Set
6+
from typing import Any
77
from pymetadata import log
88
import libsedml
99
from sympy import lambdify, sympify
@@ -92,17 +92,17 @@ def expr_from_formula(formula: str):
9292
return expr
9393

9494

95-
def evaluate(astnode: libsedml.ASTNode, variables: Dict):
95+
def evaluate(astnode: libsedml.ASTNode, variables: dict):
9696
"""Evaluate the astnode with values."""
9797
expr = parse_astnode(astnode)
9898
f = lambdify(args=list(expr.free_symbols), expr=expr)
9999
res = f(**variables)
100100
return res
101101

102102

103-
def _get_variables(astnode: libsedml.ASTNode, variables=None) -> Set[str]:
103+
def _get_variables(astnode: libsedml.ASTNode, variables=None) -> set[str]:
104104
"""Add variable names to the variables."""
105-
variables: Set
105+
variables: set
106106
if variables is None:
107107
variables = set()
108108

src/sbmlsim/combine/sedml/data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""Reading NUML, CSV and TSV data from DataDescriptions."""
2+
23
import http.client as httplib
34
import importlib
45
import os
56
import tempfile
67
from pathlib import Path
7-
from typing import Dict, Optional
8+
from typing import Optional
89

910
import libsbml
1011
import libsedml
@@ -30,7 +31,7 @@ class DataDescriptionParser:
3031
@classmethod
3132
def parse(
3233
cls, dd: libsedml.SedDataDescription, working_dir: Path = None
33-
) -> Dict[str, pd.Series]:
34+
) -> dict[str, pd.Series]:
3435
"""Parse single DataDescription.
3536
3637
Returns dictionary of data sources {DataSource.id, slice_data}
@@ -129,7 +130,6 @@ def parse(
129130
# -------------------------------
130131
data_sources = {}
131132
for ds in dd.getListOfDataSources():
132-
133133
dsid = ds.getId()
134134

135135
# log DataSource

src/sbmlsim/combine/sedml/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""Template functions to run the example cases."""
2+
23
import importlib
34
import os
45
import zipfile
56
from enum import Enum
67
from pathlib import Path
7-
from typing import Dict, Optional, Tuple, Union
8+
from typing import Optional, Tuple, Union
89
from xml.etree import ElementTree
910

1011
import libsedml
@@ -147,7 +148,6 @@ def read_sedml(self) -> Tuple[libsedml.SedDocument, SEDMLInputType]:
147148
omex = pyomex.Omex.from_omex(omex_path=file_path)
148149
sedml_entries = omex.entries_by_format(format_key="sed-ml")
149150
for entry in sedml_entries:
150-
151151
logger.info("SED-ML location: ", entry.location)
152152
if entry.master:
153153
sedml_path = omex.get_path(entry.location)

0 commit comments

Comments
 (0)