Skip to content

Commit 62a3dac

Browse files
committed
updated pyparsing to be 3.10 safe
1 parent 5754728 commit 62a3dac

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

cbmpy/CBWrite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def writeSBML3FBCV2(
159159
add_cbmpy_annot=True,
160160
add_cobra_annot=False,
161161
validate=False,
162-
compress_bounds=True,
162+
compress_bounds=False,
163163
zip_model=False,
164164
return_model_string=False,
165165
):

cbmpy/CBXML.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,20 +1856,21 @@ def addModelHistory(self):
18561856
self.model.setModelHistory(sbmh)
18571857
del sbmh
18581858

1859-
def addBoundsV2(self, compress_bounds=False):
1859+
def addBoundsV2(self, compress_bounds=False, sig_dig=20):
18601860
"""
18611861
Add FBC V2 style fluxbounds to model
18621862
18631863
- *compress_bounds* [default=False] enable parameter compression
1864+
- *sig_dig* [default=20] round off to significant digits
18641865
18651866
"""
18661867
if compress_bounds:
18671868
print('INFO: V2 bounds compression enabled')
18681869
bounds = {}
18691870
shared_values = {}
18701871
for r_ in self.fba.reactions:
1871-
lb = round(r_.getLowerBound(), 12)
1872-
ub = round(r_.getUpperBound(), 12)
1872+
lb = round(r_.getLowerBound(), sig_dig)
1873+
ub = round(r_.getUpperBound(), sig_dig)
18731874
rid = r_.getId()
18741875
bounds[rid] = (lb, ub)
18751876

cbmpy/pyparsing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,10 @@ def __setstate__(self,state):
685685
def __dir__(self):
686686
return dir(super(ParseResults,self)) + list(self) # Python 3 compatible bgoli 20140728
687687

688-
collections.MutableMapping.register(ParseResults)
688+
if PY_3:
689+
collections.abc.MutableMapping
690+
else:
691+
collections.MutableMapping.register(ParseResults)
689692

690693
def col (loc,strg):
691694
"""Returns current column within a string, counting newlines as line separators.
@@ -2228,7 +2231,7 @@ def __init__( self, exprs, savelist = False ):
22282231

22292232
if isinstance( exprs, basestring ):
22302233
self.exprs = [ Literal( exprs ) ]
2231-
elif isinstance( exprs, collections.Sequence ):
2234+
elif isinstance( exprs, collections.abc.Sequence ):
22322235
# if sequence of strings provided, wrap with Literal
22332236
if all(isinstance(expr, basestring) for expr in exprs):
22342237
exprs = map(Literal, exprs)
@@ -3233,7 +3236,7 @@ def oneOf( strs, caseless=False, useRegex=True ):
32333236

32343237
if isinstance(strs,basestring):
32353238
symbols = strs.split()
3236-
elif isinstance(strs, collections.Sequence):
3239+
elif isinstance(strs, collections.abc.Sequence):
32373240
symbols = list(strs[:])
32383241
elif isinstance(strs, _generatorType):
32393242
symbols = list(strs)

0 commit comments

Comments
 (0)