Skip to content

Commit 79f5fad

Browse files
committed
Fix compile warnings
Test for compile warning using: find src/ -iname '*.py' | xargs -P 4 -I{} python -Wall -m py_compile {} find tests/ -iname '*.py' | xargs -P 4 -I{} python -Wall -m py_compile {} Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent ca27122 commit 79f5fad

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/saml2/httpbase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def set_cookie(self, kaka, request):
196196
std_attr["domain"] = _domain
197197
std_attr["domain_specified"] = True
198198

199-
if morsel["max-age"] is 0:
199+
if morsel["max-age"] == 0:
200200
try:
201201
self.cookiejar.clear(domain=std_attr["domain"],
202202
path=std_attr["path"],

src/saml2/s2repoze/plugins/sp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def make_plugin(
670670
discovery="",
671671
idp_query_param="",
672672
):
673-
if saml_conf is "":
673+
if saml_conf == "":
674674
raise ValueError("must include saml_conf in configuration")
675675

676676
if remember_name is None:

src/saml2/saml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _wrong_type_value(xsd, value):
256256

257257
xsd_ns, xsd_type = (
258258
['', type(None)] if xsd_string is None
259-
else ['', ''] if xsd_string is ''
259+
else ['', ''] if xsd_string == ''
260260
else [
261261
XSD if xsd_string in xsd_types_props else '',
262262
xsd_string

src/saml2/soap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def parse_soap_enveloped_saml_thingy(text, expected_tags):
159159

160160
import re
161161

162-
NS_AND_TAG = re.compile("\{([^}]+)\}(.*)")
162+
NS_AND_TAG = re.compile(r"\{([^}]+)\}(.*)")
163163

164164

165165
def instanciate_class(item, modules):

src/saml2/time_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
2020
TIME_FORMAT_WITH_FRAGMENT = re.compile(
21-
"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})(\.\d*)?Z?$")
21+
r"^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})(\.\d*)?Z?$")
2222

2323
# ---------------------------------------------------------------------------
2424
# I'm sure this is implemented somewhere else can't find it now though, so I

src/saml2/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ToEarly(Exception):
4141
# --------------------- validators -------------------------------------
4242
#
4343

44-
NCNAME = re.compile("(?P<NCName>[a-zA-Z_](\w|[_.-])*)")
44+
NCNAME = re.compile(r"(?P<NCName>[a-zA-Z_](\w|[_.-])*)")
4545

4646

4747
def valid_ncname(name):
@@ -436,7 +436,7 @@ def valid_instance(instance):
436436

437437
def valid_domain_name(dns_name):
438438
m = re.match(
439-
"^[a-z0-9]+([-.]{ 1 }[a-z0-9]+).[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$",
439+
r"^[a-z0-9]+([-.]{ 1 }[a-z0-9]+).[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$",
440440
dns_name, re.I)
441441
if not m:
442442
raise ValueError("Not a proper domain name")

tests/test_20_assertion.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_lifetime_1():
151151
"attribute_restrictions": {
152152
"givenName": None,
153153
"surName": None,
154-
"mail": [".*@.*\.umu\.se"],
154+
"mail": [r".*@.*\.umu\.se"],
155155
}
156156
}}
157157

@@ -173,7 +173,7 @@ def test_lifetime_2():
173173
"attribute_restrictions": {
174174
"givenName": None,
175175
"surName": None,
176-
"mail": [".*@.*\.umu\.se"],
176+
"mail": [r".*@.*\.umu\.se"],
177177
}
178178
}}
179179

@@ -195,7 +195,7 @@ def test_ava_filter_1():
195195
"attribute_restrictions": {
196196
"givenName": None,
197197
"surName": None,
198-
"mail": [".*@.*\.umu\.se"],
198+
"mail": [r".*@.*\.umu\.se"],
199199
}
200200
}}
201201

@@ -225,7 +225,7 @@ def test_ava_filter_2():
225225
"attribute_restrictions": {
226226
"givenName": None,
227227
"sn": None,
228-
"mail": [".*@.*\.umu\.se"],
228+
"mail": [r".*@.*\.umu\.se"],
229229
}
230230
}}
231231

@@ -261,7 +261,7 @@ def test_ava_filter_dont_fail():
261261
"attribute_restrictions": {
262262
"givenName": None,
263263
"surName": None,
264-
"mail": [".*@.*\.umu\.se"],
264+
"mail": [r".*@.*\.umu\.se"],
265265
},
266266
"fail_on_missing_requested": False
267267
}}
@@ -688,7 +688,7 @@ def test_filter_ava_3():
688688
"urn:mace:example.com:saml:roland:sp": {
689689
"lifetime": {"minutes": 5},
690690
"attribute_restrictions": {
691-
"mail": [".*@example\.com$"],
691+
"mail": [r".*@example\.com$"],
692692
}
693693
}})
694694

@@ -712,7 +712,7 @@ def test_filter_ava_4():
712712
"urn:mace:example.com:saml:roland:sp": {
713713
"lifetime": {"minutes": 5},
714714
"attribute_restrictions": {
715-
"mail": [".*@example\.com$"],
715+
"mail": [r".*@example\.com$"],
716716
}
717717
}})
718718

0 commit comments

Comments
 (0)