calling the module SRE is deprecated [in py25] in favor of RE. so use RE
This commit is contained in:
parent
a2329eaee5
commit
49f1cd3bcf
4 changed files with 13 additions and 13 deletions
|
@ -19,7 +19,7 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
import sre
|
import re
|
||||||
import copy
|
import copy
|
||||||
import defs
|
import defs
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ class Config:
|
||||||
elif type[0] == 'string':
|
elif type[0] == 'string':
|
||||||
return self.is_valid_string(val)
|
return self.is_valid_string(val)
|
||||||
else:
|
else:
|
||||||
if sre.match(type[1], val):
|
if re.match(type[1], val):
|
||||||
return val
|
return val
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
|
|
||||||
import sre
|
import re
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -328,7 +328,7 @@ def from_one_line(msg):
|
||||||
# to match the regexp that follows it
|
# to match the regexp that follows it
|
||||||
|
|
||||||
# So here match '\\n' but not if you have a '\' before that
|
# So here match '\\n' but not if you have a '\' before that
|
||||||
re = sre.compile(r'(?<!\\)\\n')
|
re = re.compile(r'(?<!\\)\\n')
|
||||||
msg = re.sub('\n', msg)
|
msg = re.sub('\n', msg)
|
||||||
msg = msg.replace('\\\\', '\\')
|
msg = msg.replace('\\\\', '\\')
|
||||||
# s12 = 'test\\ntest\\\\ntest'
|
# s12 = 'test\\ntest\\\\ntest'
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import sre
|
import re
|
||||||
|
|
||||||
from xmpp.idlequeue import *
|
from xmpp.idlequeue import *
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ elif os.name == 'posix':
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
# it is good to check validity of arguments, when calling system commands
|
# it is good to check validity of arguments, when calling system commands
|
||||||
ns_type_pattern = sre.compile('^[a-z]+$')
|
ns_type_pattern = re.compile('^[a-z]+$')
|
||||||
|
|
||||||
# match srv host_name
|
# match srv host_name
|
||||||
host_pattern = sre.compile('^[a-z0-9\-._]*[a-z0-9]\.[a-z]{2,}$')
|
host_pattern = re.compile('^[a-z0-9\-._]*[a-z0-9]\.[a-z]{2,}$')
|
||||||
|
|
||||||
class Resolver:
|
class Resolver:
|
||||||
def __init__(self, idlequeue):
|
def __init__(self, idlequeue):
|
||||||
|
|
12
src/gajim.py
12
src/gajim.py
|
@ -96,7 +96,7 @@ del path
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
|
|
||||||
import sre
|
import re
|
||||||
import signal
|
import signal
|
||||||
import getopt
|
import getopt
|
||||||
import time
|
import time
|
||||||
|
@ -1573,7 +1573,7 @@ class Interface:
|
||||||
basic_pattern = links + mail
|
basic_pattern = links + mail
|
||||||
if gajim.config.get('ascii_formatting'):
|
if gajim.config.get('ascii_formatting'):
|
||||||
basic_pattern += formatting
|
basic_pattern += formatting
|
||||||
self.basic_pattern_re = sre.compile(basic_pattern, sre.IGNORECASE)
|
self.basic_pattern_re = re.compile(basic_pattern, re.IGNORECASE)
|
||||||
|
|
||||||
emoticons_pattern = ''
|
emoticons_pattern = ''
|
||||||
if gajim.config.get('emoticons_theme'):
|
if gajim.config.get('emoticons_theme'):
|
||||||
|
@ -1587,7 +1587,7 @@ class Interface:
|
||||||
emoticons_pattern_postmatch = ''
|
emoticons_pattern_postmatch = ''
|
||||||
emoticon_length = 0
|
emoticon_length = 0
|
||||||
for emoticon in keys: # travel thru emoticons list
|
for emoticon in keys: # travel thru emoticons list
|
||||||
emoticon_escaped = sre.escape(emoticon) # espace regexp metachars
|
emoticon_escaped = re.escape(emoticon) # espace regexp metachars
|
||||||
emoticons_pattern += emoticon_escaped + '|'# | means or in regexp
|
emoticons_pattern += emoticon_escaped + '|'# | means or in regexp
|
||||||
if (emoticon_length != len(emoticon)):
|
if (emoticon_length != len(emoticon)):
|
||||||
# Build up expressions to match emoticons next to other emoticons
|
# Build up expressions to match emoticons next to other emoticons
|
||||||
|
@ -1607,12 +1607,12 @@ class Interface:
|
||||||
# because emoticons match later (in the string) they need to be after
|
# because emoticons match later (in the string) they need to be after
|
||||||
# basic matches that may occur earlier
|
# basic matches that may occur earlier
|
||||||
emot_and_basic_pattern = basic_pattern + emoticons_pattern
|
emot_and_basic_pattern = basic_pattern + emoticons_pattern
|
||||||
self.emot_and_basic_re = sre.compile(emot_and_basic_pattern, sre.IGNORECASE)
|
self.emot_and_basic_re = re.compile(emot_and_basic_pattern, re.IGNORECASE)
|
||||||
|
|
||||||
# at least one character in 3 parts (before @, after @, after .)
|
# at least one character in 3 parts (before @, after @, after .)
|
||||||
self.sth_at_sth_dot_sth_re = sre.compile(r'\S+@\S+\.\S*[^\s)?]')
|
self.sth_at_sth_dot_sth_re = re.compile(r'\S+@\S+\.\S*[^\s)?]')
|
||||||
|
|
||||||
sre.purge() # clear the regular expression cache
|
re.purge() # clear the regular expression cache
|
||||||
|
|
||||||
def on_emoticon_sort(self, emot1, emot2):
|
def on_emoticon_sort(self, emot1, emot2):
|
||||||
len1 = len(emot1)
|
len1 = len(emot1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue