Skip to content

Commit 8b5ac00

Browse files
Merge pull request #869 from tirkarthi/fix-warnings
Fix deprecation warnings due to invalid escape sequences and comparison of literals using is.
2 parents fd408e1 + acd3917 commit 8b5ac00

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

hug/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
-::` ::- VERSION {0}
5656
`::- -::`
5757
-::-` -::-
58-
\########################################################################/
58+
\\########################################################################/
5959
6060
Copyright (C) 2016 Timothy Edmund Crosley
6161
Under the MIT License

hug/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def match_route(self, reqpath):
168168
routes = [route for route, _ in route_dicts.items()]
169169
if reqpath not in routes:
170170
for route in routes: # replace params in route with regex
171-
reqpath = re.sub("^(/v\d*/?)", "/", reqpath)
171+
reqpath = re.sub(r"^(/v\d*/?)", "/", reqpath)
172172
base_url = getattr(self.api.http, "base_url", "")
173173
reqpath = reqpath.replace(base_url, "", 1) if base_url else reqpath
174174
if re.match(re.sub(r"/{[^{}]+}", ".+", route) + "$", reqpath, re.DOTALL):

hug/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def request(
182182
if content_type in input_format:
183183
data = input_format[content_type](data, **content_params)
184184

185-
status_code = int("".join(re.findall("\d+", response.status)))
185+
status_code = int("".join(re.findall(r"\d+", response.status)))
186186
if status_code in self.raise_on:
187187
raise requests.HTTPError("{0} occured for url: {1}".format(response.status, url))
188188

tests/test_output_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def test_json_converter_numpy_types():
368368
ex_np_int_array = numpy.int_([5, 4, 3])
369369
ex_np_float = numpy.float(0.5)
370370

371-
assert 9 is hug.output_format._json_converter(ex_int)
371+
assert 9 == hug.output_format._json_converter(ex_int)
372372
assert [1, 2, 3, 4, 5] == hug.output_format._json_converter(ex_np_array)
373373
assert [5, 4, 3] == hug.output_format._json_converter(ex_np_int_array)
374374
assert 0.5 == hug.output_format._json_converter(ex_np_float)
@@ -411,7 +411,7 @@ def test_json_converter_numpy_types():
411411
for np_type in np_bool_types:
412412
assert True == hug.output_format._json_converter(np_type(True))
413413
for np_type in np_int_types:
414-
assert 1 is hug.output_format._json_converter(np_type(1))
414+
assert 1 == hug.output_format._json_converter(np_type(1))
415415
for np_type in np_float_types:
416416
assert 0.5 == hug.output_format._json_converter(np_type(0.5))
417417
for np_type in np_unicode_types:

0 commit comments

Comments
 (0)