fixed depreciated escape sequences

This commit is contained in:
Arthur Lu 2021-01-27 04:08:27 +00:00
parent 8f54b8e3fc
commit 106d7a7f47
2 changed files with 22 additions and 22 deletions

View File

@ -25,11 +25,11 @@ __author__ = (
__all__ = [ __all__ = [
] ]
from . import Analysis from . import Analysis as Analysis
from .Array import Array from .Array import Array
from .ClassificationMetric import ClassificationMetric from .ClassificationMetric import ClassificationMetric
from . import CorrelationTest from . import CorrelationTest
from . import Equation from .equation import Expression
from . import Fit from . import Fit
from . import KNN from . import KNN
from . import NaiveBayes from . import NaiveBayes

View File

@ -157,56 +157,56 @@ class Core():
unary_ops = {} unary_ops = {}
ops = {} ops = {}
functions = {} functions = {}
smatch = re.compile("\s*,") smatch = re.compile(r"\s*,")
vmatch = re.compile("\s*" vmatch = re.compile(r"\s*"
"(?:" "(?:"
"(?P<oct>" "(?P<oct>"
"(?P<octsign>[+-]?)" "(?P<octsign>[+-]?)"
"\s*0o" r"\s*0o"
"(?P<octvalue>[0-7]+)" "(?P<octvalue>[0-7]+)"
")|(?P<hex>" ")|(?P<hex>"
"(?P<hexsign>[+-]?)" "(?P<hexsign>[+-]?)"
"\s*0x" r"\s*0x"
"(?P<hexvalue>[0-9a-fA-F]+)" "(?P<hexvalue>[0-9a-fA-F]+)"
")|(?P<bin>" ")|(?P<bin>"
"(?P<binsign>[+-]?)" "(?P<binsign>[+-]?)"
"\s*0b" r"\s*0b"
"(?P<binvalue>[01]+)" "(?P<binvalue>[01]+)"
")|(?P<dec>" ")|(?P<dec>"
"(?P<rsign>[+-]?)" "(?P<rsign>[+-]?)"
"\s*" r"\s*"
"(?P<rvalue>(?:\d+\.\d+|\d+\.|\.\d+|\d+))" r"(?P<rvalue>(?:\d+\.\d+|\d+\.|\.\d+|\d+))"
"(?:" "(?:"
"[Ee]" "[Ee]"
"(?P<rexpoent>[+-]?\d+)" r"(?P<rexpoent>[+-]?\d+)"
")?" ")?"
"(?:" "(?:"
"\s*" r"\s*"
"(?P<sep>(?(rvalue)\+|))?" r"(?P<sep>(?(rvalue)\+|))?"
"\s*" r"\s*"
"(?P<isign>(?(rvalue)(?(sep)[+-]?|[+-])|[+-]?)?)" "(?P<isign>(?(rvalue)(?(sep)[+-]?|[+-])|[+-]?)?)"
"\s*" r"\s*"
"(?P<ivalue>(?:\d+\.\d+|\d+\.|\.\d+|\d+))" r"(?P<ivalue>(?:\d+\.\d+|\d+\.|\.\d+|\d+))"
"(?:" "(?:"
"[Ee]" "[Ee]"
"(?P<iexpoent>[+-]?\d+)" r"(?P<iexpoent>[+-]?\d+)"
")?" ")?"
"[ij]" "[ij]"
")?" ")?"
")" ")"
")") ")")
nmatch = re.compile("\s*([a-zA-Z_][a-zA-Z0-9_]*)") nmatch = re.compile(r"\s*([a-zA-Z_][a-zA-Z0-9_]*)")
gsmatch = re.compile('\s*(\()') gsmatch = re.compile(r'\s*(\()')
gematch = re.compile('\s*(\))') gematch = re.compile(r'\s*(\))')
def recalculateFMatch(self): def recalculateFMatch(self):
fks = sorted(self.functions.keys(), key=len, reverse=True) fks = sorted(self.functions.keys(), key=len, reverse=True)
oks = sorted(self.ops.keys(), key=len, reverse=True) oks = sorted(self.ops.keys(), key=len, reverse=True)
uks = sorted(self.unary_ops.keys(), key=len, reverse=True) uks = sorted(self.unary_ops.keys(), key=len, reverse=True)
self.fmatch = re.compile('\s*(' + '|'.join(map(re.escape,fks)) + ')') self.fmatch = re.compile(r'\s*(' + '|'.join(map(re.escape,fks)) + ')')
self.omatch = re.compile('\s*(' + '|'.join(map(re.escape,oks)) + ')') self.omatch = re.compile(r'\s*(' + '|'.join(map(re.escape,oks)) + ')')
self.umatch = re.compile('\s*(' + '|'.join(map(re.escape,uks)) + ')') self.umatch = re.compile(r'\s*(' + '|'.join(map(re.escape,uks)) + ')')
def addFn(self,id,str,latex,args,func): def addFn(self,id,str,latex,args,func):
self.functions[id] = { self.functions[id] = {