running lib2to3.fixes.fix_idioms
This commit is contained in:
+7
-7
@@ -2096,7 +2096,7 @@ class IS_URL(Validator):
|
||||
else:
|
||||
raise SyntaxError("invalid mode '%s' in IS_URL" % self.mode)
|
||||
|
||||
if type(value) != unicode:
|
||||
if not isinstance(value, unicode):
|
||||
return subMethod(value)
|
||||
else:
|
||||
try:
|
||||
@@ -3003,13 +3003,13 @@ class IS_STRONG(object):
|
||||
if entropy < self.entropy:
|
||||
failures.append(translate("Entropy (%(have)s) less than required (%(need)s)")
|
||||
% dict(have=entropy, need=self.entropy))
|
||||
if type(self.min) == int and self.min > 0:
|
||||
if isinstance(self.min, int) and self.min > 0:
|
||||
if not len(value) >= self.min:
|
||||
failures.append(translate("Minimum length is %s") % self.min)
|
||||
if type(self.max) == int and self.max > 0:
|
||||
if isinstance(self.max, int) and self.max > 0:
|
||||
if not len(value) <= self.max:
|
||||
failures.append(translate("Maximum length is %s") % self.max)
|
||||
if type(self.special) == int:
|
||||
if isinstance(self.special, int):
|
||||
all_special = [ch in value for ch in self.specials]
|
||||
if self.special > 0:
|
||||
if not all_special.count(True) >= self.special:
|
||||
@@ -3020,7 +3020,7 @@ class IS_STRONG(object):
|
||||
if all_invalid.count(True) > 0:
|
||||
failures.append(translate("May not contain any of the following: %s")
|
||||
% self.invalid)
|
||||
if type(self.upper) == int:
|
||||
if isinstance(self.upper, int):
|
||||
all_upper = re.findall("[A-Z]", value)
|
||||
if self.upper > 0:
|
||||
if not len(all_upper) >= self.upper:
|
||||
@@ -3030,7 +3030,7 @@ class IS_STRONG(object):
|
||||
if len(all_upper) > 0:
|
||||
failures.append(
|
||||
translate("May not include any upper case letters"))
|
||||
if type(self.lower) == int:
|
||||
if isinstance(self.lower, int):
|
||||
all_lower = re.findall("[a-z]", value)
|
||||
if self.lower > 0:
|
||||
if not len(all_lower) >= self.lower:
|
||||
@@ -3040,7 +3040,7 @@ class IS_STRONG(object):
|
||||
if len(all_lower) > 0:
|
||||
failures.append(
|
||||
translate("May not include any lower case letters"))
|
||||
if type(self.number) == int:
|
||||
if isinstance(self.number, int):
|
||||
all_number = re.findall("[0-9]", value)
|
||||
if self.number > 0:
|
||||
numbers = "number"
|
||||
|
||||
Reference in New Issue
Block a user