]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerVarsha Rao <varao@redhat.com>
Mon, 13 May 2019 12:33:56 +0000 (18:03 +0530)
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>
src/tools/cephfs/cephfs-shell

index 102e61bd74cef7ecaac30a615590ed72105801c1..2c012f8296576a902f419a6933c24d541a768f5d 100755 (executable)
@@ -566,7 +566,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)
@@ -587,7 +587,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(