changeset 7813:f79b864dc192

flake8: fix W605 invalid escape sequence
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 04 Aug 2019 00:13:03 +0200
parents fe4086096758
children f0e8d673f2a2
files kallithea/bin/kallithea_cli_ssh.py kallithea/config/routing.py kallithea/lib/auth_modules/auth_pam.py kallithea/lib/diffs.py kallithea/lib/helpers.py kallithea/lib/markup_renderer.py kallithea/lib/utils.py kallithea/lib/utils2.py
diffstat 8 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_ssh.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/bin/kallithea_cli_ssh.py	Sun Aug 04 00:13:03 2019 +0200
@@ -52,7 +52,7 @@
         os.environ['LANGUAGE'] = ssh_locale # trumps LC_ALL for GNU gettext message handling
 
     ssh_original_command = os.environ.get('SSH_ORIGINAL_COMMAND', '')
-    connection = re.search('^([\d\.]+)', os.environ.get('SSH_CONNECTION', ''))
+    connection = re.search(r'^([0-9.]+)', os.environ.get('SSH_CONNECTION', ''))
     client_ip = connection.group(1) if connection else '0.0.0.0'
     log.debug('ssh-serve was invoked for SSH command %r from %s', ssh_original_command, client_ip)
 
--- a/kallithea/config/routing.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/config/routing.py	Sun Aug 04 00:13:03 2019 +0200
@@ -399,7 +399,7 @@
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/admin') as m:
         m.connect('admin_home', '', action='index')
-        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
+        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9. _-]*}',
                   action='add_repo')
     #==========================================================================
     # API V2
--- a/kallithea/lib/auth_modules/auth_pam.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/auth_modules/auth_pam.py	Sun Aug 04 00:13:03 2019 +0200
@@ -84,7 +84,7 @@
                 "type": "string",
                 "description": "Regex for extracting user name/email etc "
                                "from Unix userinfo",
-                "default": "(?P<last_name>.+),\s*(?P<first_name>\w+)",
+                "default": r"(?P<last_name>.+),\s*(?P<first_name>\w+)",
                 "formname": "Gecos Regex"
             }
         ]
--- a/kallithea/lib/diffs.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/diffs.py	Sun Aug 04 00:13:03 2019 +0200
@@ -42,7 +42,7 @@
 
 
 def _safe_id(idstring):
-    """Make a string safe for including in an id attribute.
+    r"""Make a string safe for including in an id attribute.
 
     The HTML spec says that id attributes 'must begin with
     a letter ([A-Za-z]) and may be followed by any number
--- a/kallithea/lib/helpers.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/helpers.py	Sun Aug 04 00:13:03 2019 +0200
@@ -1073,7 +1073,7 @@
                 return '<div class="label label-meta" data-tag="see">see =&gt; %s</div>' % seen
             license = match_obj.group('license')
             if license:
-                return '<div class="label label-meta" data-tag="license"><a href="http:\/\/www.opensource.org/licenses/%s">%s</a></div>' % (license, license)
+                return '<div class="label label-meta" data-tag="license"><a href="http://www.opensource.org/licenses/%s">%s</a></div>' % (license, license)
             tagtype = match_obj.group('tagtype')
             if tagtype:
                 tagvalue = match_obj.group('tagvalue')
--- a/kallithea/lib/markup_renderer.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/markup_renderer.py	Sun Aug 04 00:13:03 2019 +0200
@@ -90,7 +90,7 @@
         def italic_callback(matchobj):
             s = matchobj.group(0)
             if list(s).count('_') >= 2:
-                return s.replace('_', '\_')
+                return s.replace('_', r'\_')
             return s
         text = re.sub(r'^(?! {4}|\t)\w+_\w+_\w[\w_]*', italic_callback, text)
 
@@ -243,6 +243,6 @@
 
         def wrapp(match_obj):
             uname = match_obj.groups()[0]
-            return '\ **@%(uname)s**\ ' % {'uname': uname}
+            return r'\ **@%(uname)s**\ ' % {'uname': uname}
         mention_hl = MENTIONS_REGEX.sub(wrapp, source).strip()
         return cls.rst(mention_hl)
--- a/kallithea/lib/utils.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/utils.py	Sun Aug 04 00:13:03 2019 +0200
@@ -411,10 +411,10 @@
     from kallithea.config import conf
 
     log.debug('adding extra into INDEX_EXTENSIONS')
-    conf.INDEX_EXTENSIONS.extend(re.split('\s+', config.get('index.extensions', '')))
+    conf.INDEX_EXTENSIONS.extend(re.split(r'\s+', config.get('index.extensions', '')))
 
     log.debug('adding extra into INDEX_FILENAMES')
-    conf.INDEX_FILENAMES.extend(re.split('\s+', config.get('index.filenames', '')))
+    conf.INDEX_FILENAMES.extend(re.split(r'\s+', config.get('index.filenames', '')))
 
 
 def map_groups(path):
@@ -592,7 +592,7 @@
     stdout, stderr = GitRepository._run_git_command(['--version'], _bare=True,
                                                     _safe=True)
 
-    m = re.search("\d+.\d+.\d+", stdout)
+    m = re.search(r"\d+.\d+.\d+", stdout)
     if m:
         ver = StrictVersion(m.group(0))
     else:
--- a/kallithea/lib/utils2.py	Wed Aug 07 23:48:26 2019 +0200
+++ b/kallithea/lib/utils2.py	Sun Aug 04 00:13:03 2019 +0200
@@ -679,7 +679,7 @@
     slug = remove_formatting(value)
     slug = strip_tags(slug)
 
-    for c in """`?=[]\;'"<>,/~!@#$%^&*()+{}|: """:
+    for c in r"""`?=[]\;'"<>,/~!@#$%^&*()+{}|: """:
         slug = slug.replace(c, '-')
     slug = recursive_replace(slug, '-')
     slug = collapse(slug, '-')