]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-shell: Fix flake8 invalid escape sequence warning
authorVarsha Rao <varao@redhat.com>
Mon, 13 May 2019 12:00:01 +0000 (17:30 +0530)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 20 Jun 2019 22:39:18 +0000 (15:39 -0700)
Backslash-character pair is not a valid escape sequence, since Python 3.6
version. Prefixing character 'r' to the escape sequence, fixes the warning.

Fixes: https://tracker.ceph.com/issues/39717
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit c7d217c2afcb9cdc64356f6a6b1f8f701c7814d9)

src/tools/cephfs/cephfs-shell

index 4e5d4e3a8899e3fd7cae050aae30df1ef1200457..8e8c2384afc8365fdc92086cd84ca7fb425d5606 100644 (file)
@@ -570,7 +570,7 @@ exists.')
         else:
             for src_dir, dirs, files in os.walk(root_src_dir):
                 dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
-                dst_dir = re.sub('\/+', '/', cephfs.getcwd().decode('utf-8') + dst_dir)
+                dst_dir = re.sub(r'\/+', '/', cephfs.getcwd().decode('utf-8') + dst_dir)
                 if args.force and dst_dir != '/' and not is_dir_exists(dst_dir[:-1]) and len(locate_file(dst_dir)) == 0:
                     try:
                         cephfs.mkdirs(to_bytes(dst_dir), 0o777)
@@ -591,7 +591,7 @@ exists.')
 
                 for file_ in files:
                     src_file = os.path.join(src_dir, file_)
-                    dst_file = re.sub('\/+', '/', '/' + dst_dir + '/' + file_)
+                    dst_file = re.sub(r'\/+', '/', '/' + dst_dir + '/' + file_)
                     if (not args.force) and is_file_exists(dst_file):
                         return
                     copy_from_local(src_file, os.path.join(