]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/rook: fix ivalid escape sequence
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 23 Jul 2024 18:11:23 +0000 (20:11 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 23 Jul 2024 18:11:23 +0000 (20:11 +0200)
Get rid of DepricationWarning which, according to [1],
is going to become a SyntaxError:

  /home/jenkins-build/build/workspace/ceph-pull-requests/src/pybind/mgr/rook/rook_cluster.py:110: DeprecationWarning: invalid escape sequence '\d'
    coeff_and_unit = re.search('(\d+)(\D+)', size_str)

1. https://docs.python.org/3/library/re.html

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@clyso.com>
src/pybind/mgr/rook/rook_cluster.py

index 16d498a70e30da68d6f6c95ab377fa92732e528f..be1b637a30942ab43624d6bf90cbc90346befa4e 100644 (file)
@@ -120,7 +120,7 @@ class DefaultFetcher():
 
     def convert_size(self, size_str: str) -> int:
         units = ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "", "K", "M", "G", "T", "P", "E")
-        coeff_and_unit = re.search('(\d+)(\D+)', size_str)
+        coeff_and_unit = re.search(r'(\d+)(\D+)', size_str)
         assert coeff_and_unit is not None
         coeff = int(coeff_and_unit[1])
         unit = coeff_and_unit[2]