about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm/__init__.py6
-rw-r--r--miasm/arch/x86/arch.py2
-rw-r--r--miasm/core/cpu.py4
-rw-r--r--miasm/core/graph.py2
-rw-r--r--miasm/core/sembuilder.py4
-rw-r--r--miasm/core/utils.py2
-rw-r--r--miasm/ir/ir.py2
-rw-r--r--miasm/os_dep/linux/environment.py4
-rw-r--r--test/analysis/depgraph.py4
-rw-r--r--test/arch/mep/asm/ut_helpers_asm.py2
10 files changed, 16 insertions, 16 deletions
diff --git a/miasm/__init__.py b/miasm/__init__.py
index 417a6268..309a1ae7 100644
--- a/miasm/__init__.py
+++ b/miasm/__init__.py
@@ -40,13 +40,13 @@ def _version_from_git_describe():
 
     if process.returncode == 0:
         tag = out.decode().strip()
-        match = re.match('^v?(.+?)-(\\d+)-g[a-f0-9]+$', tag)
+        match = re.match(r'^v?(.+?)-(\d+)-g[a-f0-9]+$', tag)
         if match:
             # remove the 'v' prefix and add a '.devN' suffix
             return '%s.dev%s' % (match.group(1), match.group(2))
         else:
             # just remove the 'v' prefix
-            return re.sub('^v', '', tag)
+            return re.sub(r'^v', '', tag)
     else:
         raise subprocess.CalledProcessError(process.returncode, err)
 
@@ -71,7 +71,7 @@ def _version():
             # See 'man gitattributes' for more details.
             git_archive_id = '$Format:%h %d$'
             sha1 = git_archive_id.strip().split()[0]
-            match = re.search('tag:(\\S+)', git_archive_id)
+            match = re.search(r'tag:(\S+)', git_archive_id)
             if match:
                 return "git-archive.dev" + match.group(1)
             elif sha1:
diff --git a/miasm/arch/x86/arch.py b/miasm/arch/x86/arch.py
index dabd0c82..c5ff9b63 100644
--- a/miasm/arch/x86/arch.py
+++ b/miasm/arch/x86/arch.py
@@ -428,7 +428,7 @@ def offsize(p):
 
 
 def get_prefix(s):
-    g = re.search('(\S+)(\s+)', s)
+    g = re.search(r'(\S+)(\s+)', s)
     if not g:
         return None, s
     prefix, b = g.groups()
diff --git a/miasm/core/cpu.py b/miasm/core/cpu.py
index 7a1cacff..dae93bf9 100644
--- a/miasm/core/cpu.py
+++ b/miasm/core/cpu.py
@@ -408,7 +408,7 @@ default_prio = 0x1337
 
 
 def isbin(s):
-    return re.match('[0-1]+$', s)
+    return re.match(r'[0-1]+$', s)
 
 
 def int2bin(i, l):
@@ -1301,7 +1301,7 @@ class cls_mn(with_metaclass(metamn, object)):
     @classmethod
     def fromstring(cls, text, loc_db, mode = None):
         global total_scans
-        name = re.search('(\S+)', text).groups()
+        name = re.search(r'(\S+)', text).groups()
         if not name:
             raise ValueError('cannot find name', text)
         name = name[0]
diff --git a/miasm/core/graph.py b/miasm/core/graph.py
index 0dfd7e6a..e680894c 100644
--- a/miasm/core/graph.py
+++ b/miasm/core/graph.py
@@ -20,7 +20,7 @@ class DiGraph(object):
         # N -> Nodes N2 with a edge (N2 -> N)
         self._nodes_pred = {}
 
-        self.escape_chars = re.compile('[' + re.escape('{}') + '&|<>' + ']')
+        self.escape_chars = re.compile(r'[\{\}&|<>]')
 
 
     def __repr__(self):
diff --git a/miasm/core/sembuilder.py b/miasm/core/sembuilder.py
index 24470656..9843ee6a 100644
--- a/miasm/core/sembuilder.py
+++ b/miasm/core/sembuilder.py
@@ -22,8 +22,8 @@ class MiasmTransformer(ast.NodeTransformer):
     """
 
     # Parsers
-    parse_integer = re.compile("^i([0-9]+)$")
-    parse_mem = re.compile("^mem([0-9]+)$")
+    parse_integer = re.compile(r"^i([0-9]+)$")
+    parse_mem = re.compile(r"^mem([0-9]+)$")
 
     # Visitors
     def visit_Call(self, node):
diff --git a/miasm/core/utils.py b/miasm/core/utils.py
index 41bf78c1..eb170576 100644
--- a/miasm/core/utils.py
+++ b/miasm/core/utils.py
@@ -26,7 +26,7 @@ COLOR_OP = "black"
 
 COLOR_MNEMO = "blue1"
 
-ESCAPE_CHARS = re.compile('[' + re.escape('{}') + '&|<>' + ']')
+ESCAPE_CHARS = re.compile(r'[\{\}&|<>]')
 
 def set_html_text_color(text, color):
     return '<font color="%s">%s</font>' % (color, text)
diff --git a/miasm/ir/ir.py b/miasm/ir/ir.py
index e9b86899..d26c5d1d 100644
--- a/miasm/ir/ir.py
+++ b/miasm/ir/ir.py
@@ -48,7 +48,7 @@ def _expr_loc_to_symb(expr, loc_db):
     return m2_expr.ExprId(name, expr.size)
 
 
-ESCAPE_CHARS = re.compile('[' + re.escape('{}') + '&|<>' + ']')
+ESCAPE_CHARS = re.compile(r'[\{\}&|<>]')
 
 class TranslatorHtml(Translator):
     __LANG__ = "custom_expr_color"
diff --git a/miasm/os_dep/linux/environment.py b/miasm/os_dep/linux/environment.py
index 808fc847..3ba4382f 100644
--- a/miasm/os_dep/linux/environment.py
+++ b/miasm/os_dep/linux/environment.py
@@ -13,7 +13,7 @@ from miasm.core.interval import interval
 from miasm.jitter.csts import PAGE_READ, PAGE_WRITE
 
 
-REGEXP_T = type(re.compile(''))
+REGEXP_T = type(re.compile(r''))
 
 StatInfo = namedtuple("StatInfo", [
     "st_dev", "st_ino", "st_nlink", "st_mode", "st_uid", "st_gid", "st_rdev",
@@ -262,7 +262,7 @@ class FileSystem(object):
                             expr.flags,
                             exc_info=True,
                         )
-                        return re.compile('$X')
+                        return re.compile(r'$X')
                 return expr
 
         # Remove '../', etc.
diff --git a/test/analysis/depgraph.py b/test/analysis/depgraph.py
index 57a73a5f..9760e717 100644
--- a/test/analysis/depgraph.py
+++ b/test/analysis/depgraph.py
@@ -108,7 +108,7 @@ class IRATest(LifterModelCall):
 def bloc2graph(irgraph, label=False, lines=True):
     """Render dot graph of @blocks"""
 
-    escape_chars = re.compile('[' + re.escape('{}') + ']')
+    escape_chars = re.compile(r'[\{\}]')
     label_attr = 'colspan="2" align="center" bgcolor="grey"'
     edge_attr = 'label = "%s" color="%s" style="bold"'
     td_attr = 'align="left"'
@@ -179,7 +179,7 @@ def bloc2graph(irgraph, label=False, lines=True):
 def dg2graph(graph, label=False, lines=True):
     """Render dot graph of @blocks"""
 
-    escape_chars = re.compile('[' + re.escape('{}') + ']')
+    escape_chars = re.compile(r'[\{\}]')
     label_attr = 'colspan="2" align="center" bgcolor="grey"'
     edge_attr = 'label = "%s" color="%s" style="bold"'
     td_attr = 'align="left"'
diff --git a/test/arch/mep/asm/ut_helpers_asm.py b/test/arch/mep/asm/ut_helpers_asm.py
index 9f6dc5c2..2ebd0622 100644
--- a/test/arch/mep/asm/ut_helpers_asm.py
+++ b/test/arch/mep/asm/ut_helpers_asm.py
@@ -27,7 +27,7 @@ def check_instruction(mn_str, mn_hex, multi=None, offset=0):
     """Try to disassemble and assemble this instruction"""
 
     # Rename objdump registers names
-    mn_str = re.sub("\$([0-9]+)", lambda m: "R"+m.group(1), mn_str)
+    mn_str = re.sub(r"\$([0-9]+)", lambda m: "R"+m.group(1), mn_str)
     mn_str = mn_str.replace("$", "")
 
     # Disassemble