Skip to content

Commit 4ae38f1

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

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cbmpy/pyparsing.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,11 +2231,16 @@ def __init__( self, exprs, savelist = False ):
22312231

22322232
if isinstance( exprs, basestring ):
22332233
self.exprs = [ Literal( exprs ) ]
2234-
elif isinstance( exprs, collections.abc.Sequence ):
2234+
elif PY_3 and isinstance( exprs, collections.abc.Sequence ):
22352235
# if sequence of strings provided, wrap with Literal
22362236
if all(isinstance(expr, basestring) for expr in exprs):
22372237
exprs = map(Literal, exprs)
22382238
self.exprs = list(exprs)
2239+
elif isinstance( exprs, collections.Sequence ):
2240+
# if sequence of strings provided, wrap with Literal
2241+
if all(isinstance(expr, basestring) for expr in exprs):
2242+
exprs = map(Literal, exprs)
2243+
self.exprs = list(exprs)
22392244
else:
22402245
try:
22412246
self.exprs = list( exprs )
@@ -3236,7 +3241,9 @@ def oneOf( strs, caseless=False, useRegex=True ):
32363241

32373242
if isinstance(strs,basestring):
32383243
symbols = strs.split()
3239-
elif isinstance(strs, collections.abc.Sequence):
3244+
elif PY_3 and isinstance(strs, collections.abc.Sequence):
3245+
symbols = list(strs[:])
3246+
elif isinstance(strs, collections.Sequence):
32403247
symbols = list(strs[:])
32413248
elif isinstance(strs, _generatorType):
32423249
symbols = list(strs)

0 commit comments

Comments
 (0)