diff --git a/demo_code.py b/demo_code.py index 68313e68b..6db8b7c00 100644 --- a/demo_code.py +++ b/demo_code.py @@ -5,11 +5,11 @@ import subprocess import ssl - # from django.db.models.expressions import RawSQL AWS_SECRET_KEY = "d6s$f9g!j8mg7hw?n&2" + class BaseNumberGenerator: """Declare a method -- `get_number`.""" @@ -44,6 +44,7 @@ def get_number(self, min_max=[1, 10]): class ImaginaryNumber: """Class to represent an imaginary number.""" + def __init__(self): self.real = 0 self.imaginary = 1 @@ -61,8 +62,7 @@ def main(options: dict = {}) -> str: if type(value) != str: raise Exception() - else: - value = iter(value) + value = iter(value) sorted(value, key=lambda k: len(k)) @@ -91,18 +91,12 @@ def tar_something(): def bad_isinstance(initial_condition, object, other_obj, foo, bar, baz): - if ( - initial_condition - and ( - isinstance(object, int) - or isinstance(object, float) - or isinstance(object, str) - ) - and isinstance(other_obj, float) - and isinstance(foo, str) - or (isinstance(bar, float) or isinstance(bar, str)) - and (isinstance(baz, float) or isinstance(baz, int)) - ): + if (initial_condition and + (isinstance(object, int) or isinstance(object, float) + or isinstance(object, str)) and isinstance(other_obj, float) + and isinstance(foo, str) + or (isinstance(bar, float) or isinstance(bar, str)) and + (isinstance(baz, float) or isinstance(baz, int))): pass @@ -128,11 +122,13 @@ def chained_comparison(): c = 3 return a < b and b < c + def wrong_callable(): number = ImaginaryNumber() - if hasattr(number, '__call__'): + if hasattr(number, "__call__"): return number() + if __name__ == "__main__": args = ["--disable", "all"] for i in range(len(args)):