diff options
Diffstat (limited to 'doc/data/messages/t')
6 files changed, 26 insertions, 19 deletions
diff --git a/doc/data/messages/t/too-few-public-methods/good.py b/doc/data/messages/t/too-few-public-methods/good.py index ca4b5b6fb..b0de1ef75 100644 --- a/doc/data/messages/t/too-few-public-methods/good.py +++ b/doc/data/messages/t/too-few-public-methods/good.py @@ -12,17 +12,22 @@ class Worm: def wiggle(self): print(f"{self.name} wiggle around wormily.") + # or + @dataclasses.dataclass class Worm: - name:str + name: str fruit_of_residence: Fruit + def bore(worm: Worm): print(f"{worm.name} is boring into {worm.fruit_of_residence}") + # or + def bore(fruit: Fruit, worm_name: str): print(f"{worm_name} is boring into {fruit}") diff --git a/doc/data/messages/t/too-many-boolean-expressions/good.py b/doc/data/messages/t/too-many-boolean-expressions/good.py index 1da025460..8405d4f29 100644 --- a/doc/data/messages/t/too-many-boolean-expressions/good.py +++ b/doc/data/messages/t/too-many-boolean-expressions/good.py @@ -1,3 +1,3 @@ def can_be_divided_by_two_and_are_not_zero(x, y, z): - if all(i and i%2==0 for i in [x, y, z]): + if all(i and i % 2 == 0 for i in [x, y, z]): pass diff --git a/doc/data/messages/t/too-many-locals/bad.py b/doc/data/messages/t/too-many-locals/bad.py index dae054ed8..d2a762b49 100644 --- a/doc/data/messages/t/too-many-locals/bad.py +++ b/doc/data/messages/t/too-many-locals/bad.py @@ -20,7 +20,9 @@ def handle_sweets(infos): # [too-many-locals] # Calculate remaining money remaining_money = money - cost_of_children # Calculate time it took - time_it_took_assuming_parallel_eating = time_to_eat_sweet * number_of_sweet_per_child + time_it_took_assuming_parallel_eating = ( + time_to_eat_sweet * number_of_sweet_per_child + ) print( f"{children} ate {cost_of_children}ยค of sweets in {time_it_took_assuming_parallel_eating}, " f"you still have {remaining_money}" diff --git a/doc/data/messages/t/too-many-return-statements/bad.py b/doc/data/messages/t/too-many-return-statements/bad.py index e421d29a7..827177f1b 100644 --- a/doc/data/messages/t/too-many-return-statements/bad.py +++ b/doc/data/messages/t/too-many-return-statements/bad.py @@ -1,16 +1,16 @@ def to_string(x): # [too-many-return-statements] # max of 6 by default, can be configured if x == 1: - return 'This is one.' + return "This is one." if x == 2: - return 'This is two.' + return "This is two." if x == 3: - return 'This is three.' + return "This is three." if x == 4: - return 'This is four.' + return "This is four." if x == 5: - return 'This is five.' + return "This is five." if x == 6: - return 'This is six.' + return "This is six." if x == 7: - return 'This is seven.' + return "This is seven." diff --git a/doc/data/messages/t/too-many-return-statements/good.py b/doc/data/messages/t/too-many-return-statements/good.py index 0c4032f53..80ae2ac19 100644 --- a/doc/data/messages/t/too-many-return-statements/good.py +++ b/doc/data/messages/t/too-many-return-statements/good.py @@ -1,13 +1,13 @@ NUMBERS_TO_STRINGS = { - 1: 'one', - 2: 'two', - 3: 'three', - 4: 'four', - 5: 'five', - 6: 'six', - 7: 'seven' + 1: "one", + 2: "two", + 3: "three", + 4: "four", + 5: "five", + 6: "six", + 7: "seven", } def to_string(x): - return f'This is {NUMBERS_TO_STRINGS.get(x)}.' + return f"This is {NUMBERS_TO_STRINGS.get(x)}." diff --git a/doc/data/messages/t/truncated-format-string/bad.py b/doc/data/messages/t/truncated-format-string/bad.py index 961582bff..a44bca2f3 100644 --- a/doc/data/messages/t/truncated-format-string/bad.py +++ b/doc/data/messages/t/truncated-format-string/bad.py @@ -1,3 +1,3 @@ PARG_2 = 1 -print("strange format %2" % PARG_2) # [truncated-format-string] +print("strange format %2" % PARG_2) # [truncated-format-string] |