mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-14 04:31:04 +01:00
Fix SyntaxWarning on Python 3.12
This commit is contained in:
parent
f65089af86
commit
9bcb21389a
@ -39,7 +39,7 @@ class DDGTestCase(PluginTestCase):
|
|||||||
|
|
||||||
def testSearch(self):
|
def testSearch(self):
|
||||||
self.assertRegexp(
|
self.assertRegexp(
|
||||||
'ddg search wikipedia', 'Wikipedia.*? - .*?https?\:\/\/')
|
r'ddg search wikipedia', 'Wikipedia.*? - .*?https?\:\/\/')
|
||||||
self.assertRegexp(
|
self.assertRegexp(
|
||||||
'ddg search en.wikipedia.org',
|
'ddg search en.wikipedia.org',
|
||||||
'Wikipedia, the free encyclopedia\x02 - '
|
'Wikipedia, the free encyclopedia\x02 - '
|
||||||
@ -47,6 +47,6 @@ class DDGTestCase(PluginTestCase):
|
|||||||
with conf.supybot.plugins.DDG.region.context('fr-fr'):
|
with conf.supybot.plugins.DDG.region.context('fr-fr'):
|
||||||
self.assertRegexp(
|
self.assertRegexp(
|
||||||
'ddg search wikipedia',
|
'ddg search wikipedia',
|
||||||
'Wikipédia, l\'encyclopédie libre - .*?https?\:\/\/')
|
r'Wikipédia, l\'encyclopédie libre - .*?https?\:\/\/')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
@ -194,7 +194,7 @@ class Connection:
|
|||||||
if code != 151 or code is None:
|
if code != 151 or code is None:
|
||||||
break
|
break
|
||||||
|
|
||||||
resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups()
|
resultword, resultdb = re.search(r'^"(.+)" (\S+)', text).groups()
|
||||||
defstr = self.get100block()
|
defstr = self.get100block()
|
||||||
retval.append(Definition(self, self.getdbobj(resultdb),
|
retval.append(Definition(self, self.getdbobj(resultdb),
|
||||||
resultword, defstr))
|
resultword, defstr))
|
||||||
|
@ -33,11 +33,11 @@ import datetime
|
|||||||
|
|
||||||
# Credits for the regexp and function: https://stackoverflow.com/a/2765366/539465
|
# Credits for the regexp and function: https://stackoverflow.com/a/2765366/539465
|
||||||
_XSD_DURATION_RE = re.compile(
|
_XSD_DURATION_RE = re.compile(
|
||||||
"(?P<sign>-?)P"
|
r"(?P<sign>-?)P"
|
||||||
"(?:(?P<years>\d+)Y)?"
|
r"(?:(?P<years>\d+)Y)?"
|
||||||
"(?:(?P<months>\d+)M)?"
|
r"(?:(?P<months>\d+)M)?"
|
||||||
"(?:(?P<days>\d+)D)?"
|
r"(?:(?P<days>\d+)D)?"
|
||||||
"(?:T(?:(?P<hours>\d+)H)?(?:(?P<minutes>\d+)M)?(?:(?P<seconds>\d+)S)?)?"
|
r"(?:T(?:(?P<hours>\d+)H)?(?:(?P<minutes>\d+)M)?(?:(?P<seconds>\d+)S)?)?"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ class UnitGroup:
|
|||||||
|
|
||||||
def updateCurrentUnit(self, text, cursorPos):
|
def updateCurrentUnit(self, text, cursorPos):
|
||||||
"Set current unit number"
|
"Set current unit number"
|
||||||
self.currentNum = len(re.findall('[\*/]', text[:cursorPos]))
|
self.currentNum = len(re.findall(r'[\*/]', text[:cursorPos]))
|
||||||
|
|
||||||
def currentUnit(self):
|
def currentUnit(self):
|
||||||
"Return current unit if its a full match, o/w None"
|
"Return current unit if its a full match, o/w None"
|
||||||
@ -925,7 +925,7 @@ class UnitGroup:
|
|||||||
def parseGroup(self, text):
|
def parseGroup(self, text):
|
||||||
"Return list of units from text string"
|
"Return list of units from text string"
|
||||||
unitList = []
|
unitList = []
|
||||||
parts = [part.strip() for part in re.split('([\*/])', text)]
|
parts = [part.strip() for part in re.split(r'([\*/])', text)]
|
||||||
numerator = 1
|
numerator = 1
|
||||||
while parts:
|
while parts:
|
||||||
unit = self.parseUnit(parts.pop(0))
|
unit = self.parseUnit(parts.pop(0))
|
||||||
@ -1180,7 +1180,7 @@ class Unit:
|
|||||||
self.equiv = unitList[0].strip()
|
self.equiv = unitList[0].strip()
|
||||||
if self.equiv[0] == '[': # used only for non-linear units
|
if self.equiv[0] == '[': # used only for non-linear units
|
||||||
try:
|
try:
|
||||||
self.equiv, self.fromEqn = re.match('\[(.*?)\](.*)', \
|
self.equiv, self.fromEqn = re.match(r'\[(.*?)\](.*)', \
|
||||||
self.equiv).groups()
|
self.equiv).groups()
|
||||||
if ';' in self.fromEqn:
|
if ';' in self.fromEqn:
|
||||||
self.fromEqn, self.toEqn = self.fromEqn.split(';', 1)
|
self.fromEqn, self.toEqn = self.fromEqn.split(';', 1)
|
||||||
@ -1190,7 +1190,7 @@ class Unit:
|
|||||||
raise UnitDataError('Bad equation for "%s"' % self.name)
|
raise UnitDataError('Bad equation for "%s"' % self.name)
|
||||||
else: # split factor and equiv unit for linear
|
else: # split factor and equiv unit for linear
|
||||||
parts = self.equiv.split(None, 1)
|
parts = self.equiv.split(None, 1)
|
||||||
if len(parts) > 1 and re.search('[^\d\.eE\+\-\*/]', parts[0]) \
|
if len(parts) > 1 and re.search(r'[^\d\.eE\+\-\*/]', parts[0]) \
|
||||||
== None: # only allowed digits and operators
|
== None: # only allowed digits and operators
|
||||||
try:
|
try:
|
||||||
self.factor = float(eval(parts[0]))
|
self.factor = float(eval(parts[0]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user