diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2017-01-22 13:31:46 -0500 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2017-01-22 13:31:46 -0500 |
| commit | 70163703dd6265f9da99421c5d07fafd9a49d994 (patch) | |
| tree | c6a9b78c2cbc5355c47a64fba109a4201742c95f | |
| parent | a0edc29cd71556fd8ba53e96b48972588bfc9b25 (diff) | |
| download | passlib-70163703dd6265f9da99421c5d07fafd9a49d994.tar.gz | |
added r"" prefix to some strings, to fix some python 3.6 deprecation warnings
about invalid escape sequences (e.g. "\s")
| -rw-r--r-- | passlib/crypto/digest.py | 2 | ||||
| -rw-r--r-- | passlib/ifc.py | 2 | ||||
| -rw-r--r-- | passlib/tests/utils.py | 6 | ||||
| -rw-r--r-- | passlib/totp.py | 4 | ||||
| -rw-r--r-- | passlib/utils/handlers.py | 3 |
5 files changed, 9 insertions, 8 deletions
diff --git a/passlib/crypto/digest.py b/passlib/crypto/digest.py index 18dce85..d26f892 100644 --- a/passlib/crypto/digest.py +++ b/passlib/crypto/digest.py @@ -124,7 +124,7 @@ def _get_hash_aliases(name): return result # try to clean name up some more - m = re.match("(?i)^(?P<name>[a-z]+)-?(?P<rev>\d)?-?(?P<size>\d{3,4})?$", name) + m = re.match(r"(?i)^(?P<name>[a-z]+)-?(?P<rev>\d)?-?(?P<size>\d{3,4})?$", name) if m: # roughly follows "SHA2-256" style format, normalize representation, # and checked table. diff --git a/passlib/ifc.py b/passlib/ifc.py index 606fd05..7adf665 100644 --- a/passlib/ifc.py +++ b/passlib/ifc.py @@ -91,7 +91,7 @@ class PasswordHash(object): @abstractmethod def hash(cls, secret, # * **setting_and_context_kwds): # pragma: no cover -- abstract method - """ + r""" Hash secret, returning result. Should handle generating salt, etc, and should return string containing identifier, salt & other configuration, as well as digest. diff --git a/passlib/tests/utils.py b/passlib/tests/utils.py index 62f3ab3..ceda53f 100644 --- a/passlib/tests/utils.py +++ b/passlib/tests/utils.py @@ -246,7 +246,7 @@ def hb(source): usage: ``hb("deadbeef23")`` """ - return unhexlify(re.sub("\s", "", source)) + return unhexlify(re.sub(r"\s", "", source)) def limit(value, lower, upper): if value < lower: @@ -366,8 +366,8 @@ class TestCase(_TestCase): # ignore warnings about PasswordHash features deprecated in 1.7 # TODO: should be cleaned in 2.0, when support will be dropped. # should be kept until then, so we test the legacy paths. - warnings.filterwarnings("ignore", "the method .*\.(encrypt|genconfig|genhash)\(\) is deprecated") - warnings.filterwarnings("ignore", "the 'vary_rounds' option is deprecated") + warnings.filterwarnings("ignore", r"the method .*\.(encrypt|genconfig|genhash)\(\) is deprecated") + warnings.filterwarnings("ignore", r"the 'vary_rounds' option is deprecated") #--------------------------------------------------------------- # tweak message formatting so longMessage mode is only enabled diff --git a/passlib/totp.py b/passlib/totp.py index f0edf36..c2e8891 100644 --- a/passlib/totp.py +++ b/passlib/totp.py @@ -83,7 +83,7 @@ if sys.version_info < (2,7,4): #----------------------------------------------------------------------------- #: regex used to clean whitespace from tokens & keys -_clean_re = re.compile(u("\s|[-=]"), re.U) +_clean_re = re.compile(u(r"\s|[-=]"), re.U) _chunk_sizes = [4,6,5] @@ -1140,7 +1140,7 @@ class TOTP(object): @classmethod def verify(cls, token, source, **kwds): - """ + r""" Convenience wrapper around :meth:`TOTP.from_source` and :meth:`TOTP.match`. This parses a TOTP key & configuration from the specified source, diff --git a/passlib/utils/handlers.py b/passlib/utils/handlers.py index a0c1f51..68b0dbf 100644 --- a/passlib/utils/handlers.py +++ b/passlib/utils/handlers.py @@ -654,7 +654,8 @@ class GenericHandler(MinimalHandler): @classmethod def from_string(cls, hash, **context): # pragma: no cover - """return parsed instance from hash/configuration string + r""" + return parsed instance from hash/configuration string :param \*\*context: context keywords to pass to constructor (if applicable). |
