Skip to content

Commit a273409

Browse files
authored
Merge PR #93 regex: escape patterns w/ raw strings
from fix/regex-escape
2 parents 6f95bc0 + 6ffbddc commit a273409

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dataikuapi/dss/ml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ class DSSMLTask(object):
14471447

14481448
@staticmethod
14491449
def from_full_model_id(client, fmi, project_key=None):
1450-
match = re.match("^A-(\w+)-(\w+)-(\w+)-(s[0-9]+)-(pp[0-9]+(-part-(\w+)|-base)?)-(m[0-9]+)$", fmi)
1450+
match = re.match(r"^A-(\w+)-(\w+)-(\w+)-(s[0-9]+)-(pp[0-9]+(-part-(\w+)|-base)?)-(m[0-9]+)$", fmi)
14511451
if match is None:
14521452
return DataikuException("Invalid model id: {}".format(fmi))
14531453
else:

dataikuapi/dss/tools/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __exit__(self, b, c, d):
1414

1515

1616
def slugify(name):
17-
return re.sub("[^A-Za-z0-9_]", "_", name)
17+
return re.sub("r[^A-Za-z0-9_]", "_", name)
1818

1919
class FlowCodeGenerator(object):
2020
def __init__(self):

dataikuapi/dss/wiki.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def upload_attachement(self, fp, filename):
233233
:param file fp: A file-like object that represents the upload file
234234
:param str filename: The attachement filename
235235
"""
236-
clean_filename = re.sub('[^A-Za-z0-9 \._-]+', '', filename)
236+
clean_filename = re.sub(r'[^A-Za-z0-9 ._-]+', '', filename)
237237

238238
self.client._perform_json("POST", "/projects/%s/wiki/%s/upload" % (self.project_key, dku_quote_fn(self.article_id)), files={"file":(clean_filename, fp)})
239239

0 commit comments

Comments
 (0)