mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-11 03:50:44 +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):
|
||||
self.assertRegexp(
|
||||
'ddg search wikipedia', 'Wikipedia.*? - .*?https?\:\/\/')
|
||||
r'ddg search wikipedia', 'Wikipedia.*? - .*?https?\:\/\/')
|
||||
self.assertRegexp(
|
||||
'ddg search en.wikipedia.org',
|
||||
'Wikipedia, the free encyclopedia\x02 - '
|
||||
@ -47,6 +47,6 @@ class DDGTestCase(PluginTestCase):
|
||||
with conf.supybot.plugins.DDG.region.context('fr-fr'):
|
||||
self.assertRegexp(
|
||||
'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:
|
||||
|
@ -194,7 +194,7 @@ class Connection:
|
||||
if code != 151 or code is None:
|
||||
break
|
||||
|
||||
resultword, resultdb = re.search('^"(.+)" (\S+)', text).groups()
|
||||
resultword, resultdb = re.search(r'^"(.+)" (\S+)', text).groups()
|
||||
defstr = self.get100block()
|
||||
retval.append(Definition(self, self.getdbobj(resultdb),
|
||||
resultword, defstr))
|
||||
|
@ -33,11 +33,11 @@ import datetime
|
||||
|
||||
# Credits for the regexp and function: https://stackoverflow.com/a/2765366/539465
|
||||
_XSD_DURATION_RE = re.compile(
|
||||
"(?P<sign>-?)P"
|
||||
"(?:(?P<years>\d+)Y)?"
|
||||
"(?:(?P<months>\d+)M)?"
|
||||
"(?:(?P<days>\d+)D)?"
|
||||
"(?:T(?:(?P<hours>\d+)H)?(?:(?P<minutes>\d+)M)?(?:(?P<seconds>\d+)S)?)?"
|
||||
r"(?P<sign>-?)P"
|
||||
r"(?:(?P<years>\d+)Y)?"
|
||||
r"(?:(?P<months>\d+)M)?"
|
||||
r"(?:(?P<days>\d+)D)?"
|
||||
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):
|
||||
"Set current unit number"
|
||||
self.currentNum = len(re.findall('[\*/]', text[:cursorPos]))
|
||||
self.currentNum = len(re.findall(r'[\*/]', text[:cursorPos]))
|
||||
|
||||
def currentUnit(self):
|
||||
"Return current unit if its a full match, o/w None"
|
||||
@ -925,7 +925,7 @@ class UnitGroup:
|
||||
def parseGroup(self, text):
|
||||
"Return list of units from text string"
|
||||
unitList = []
|
||||
parts = [part.strip() for part in re.split('([\*/])', text)]
|
||||
parts = [part.strip() for part in re.split(r'([\*/])', text)]
|
||||
numerator = 1
|
||||
while parts:
|
||||
unit = self.parseUnit(parts.pop(0))
|
||||
@ -1180,7 +1180,7 @@ class Unit:
|
||||
self.equiv = unitList[0].strip()
|
||||
if self.equiv[0] == '[': # used only for non-linear units
|
||||
try:
|
||||
self.equiv, self.fromEqn = re.match('\[(.*?)\](.*)', \
|
||||
self.equiv, self.fromEqn = re.match(r'\[(.*?)\](.*)', \
|
||||
self.equiv).groups()
|
||||
if ';' in self.fromEqn:
|
||||
self.fromEqn, self.toEqn = self.fromEqn.split(';', 1)
|
||||
@ -1190,7 +1190,7 @@ class Unit:
|
||||
raise UnitDataError('Bad equation for "%s"' % self.name)
|
||||
else: # split factor and equiv unit for linear
|
||||
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
|
||||
try:
|
||||
self.factor = float(eval(parts[0]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user