-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/PyCQA/pylint into overridde…
…n-final-method-documentation
- Loading branch information
Showing
64 changed files
with
671 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class Drink: | ||
def mix(self, fluid_one, fluid_two): | ||
return fluid_one + fluid_two | ||
|
||
|
||
class Cocktail(Drink): | ||
def mix(self, fluid_one, fluid_two, alcoholic_fluid_one): # [arguments-differ] | ||
return fluid_one + fluid_two + alcoholic_fluid_one | ||
|
||
|
||
class Car: | ||
tank = 0 | ||
|
||
def fill_tank(self, gas): | ||
self.tank += gas | ||
|
||
|
||
class Airplane(Car): | ||
kerosine_tank = 0 | ||
|
||
def fill_tank(self, gas, kerosine): # [arguments-differ] | ||
self.tank += gas | ||
self.kerosine_tank += kerosine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
``argument-differ`` denotes an issue with the Liskov Substitution Principle. | ||
This means that the code in question violates an important design principle which does not have | ||
one single solution. We recommend to search online for the best solution in your case. | ||
|
||
To give some examples of potential solutions: | ||
- Add the argument to the parent class | ||
- Remove the inheritance completely | ||
- Add default arguments to the child class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class Drink: | ||
def mix(self, fluid_one, fluid_two): | ||
return fluid_one + fluid_two | ||
|
||
|
||
class Cocktail(Drink): | ||
def mix(self, fluid_one, fluid_two, alcoholic_fluid_one="Beer") | ||
return fluid_one + fluid_two + alcoholic_fluid_one | ||
|
||
|
||
class Car: | ||
tank = 0 | ||
|
||
def fill_tank(self, gas): | ||
self.tank += gas | ||
|
||
|
||
class Airplane: | ||
tank = 0 | ||
kerosine_tank = 0 | ||
|
||
def fill_tank(self, gas, kerosine): | ||
self.tank += gas | ||
self.kerosine_tank += kerosine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- `Liskov Substitution Principle <https://en.wikipedia.org/wiki/Liskov_substitution_principle>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def function_3_args(first_argument, second_argument, third_argument): | ||
"""Three arguments function""" | ||
return first_argument, second_argument, third_argument | ||
|
||
|
||
def args_out_of_order(): | ||
first_argument = 1 | ||
second_argument = 2 | ||
third_argument = 3 | ||
|
||
function_3_args( # [arguments-out-of-order] | ||
first_argument, third_argument, second_argument | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def function_3_args(first_argument, second_argument, third_argument): | ||
"""Three arguments function""" | ||
return first_argument, second_argument, third_argument | ||
|
||
|
||
def args_out_of_order(): | ||
first_argument = 1 | ||
second_argument = 2 | ||
third_argument = 3 | ||
|
||
function_3_args(first_argument, second_argument, third_argument) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Fruit: | ||
def brew(self, ingredient_name: str): | ||
print(f"Brewing a {type(self)} with {ingredient_name}") | ||
|
||
class Apple(Fruit): | ||
... | ||
|
||
class Orange(Fruit): | ||
def brew(self, flavor: str): # [arguments-renamed] | ||
print(f"Brewing an orange with {flavor}") | ||
|
||
for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]: | ||
fruit.brew(ingredient_name=ingredient_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Fruit: | ||
def brew(self, ingredient_name: str): | ||
print(f"Brewing a {type(self)} with {ingredient_name}") | ||
|
||
class Apple(Fruit): | ||
... | ||
|
||
class Orange(Fruit): | ||
def brew(self, ingredient_name: str): | ||
print(f"Brewing an orange with {ingredient_name}") | ||
|
||
for fruit, ingredient_name in [[Orange(), "thyme"], [Apple(), "cinnamon"]]: | ||
fruit.brew(ingredient_name=ingredient_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
try: | ||
1 / 0 | ||
except Exception: # [broad-except] | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
try: | ||
1 / 0 | ||
except ZeroDivisionError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class FooError: | ||
pass | ||
|
||
|
||
try: | ||
1 / 0 | ||
except FooError: # [catching-non-exception] | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class FooError(Exception): | ||
pass | ||
|
||
|
||
try: | ||
1 / 0 | ||
except FooError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
incorrect_set = {'value1', 23, 5, 'value1'} # [duplicate-value] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
correct_set = {'value1', 23, 5} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("My name is {first} {last}".format(first="John")) # [missing-format-argument-key] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("My name is {first} {last}".format(first="John", last="Wick")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* `PEP 3101 <https://peps.python.org/pep-3101/>`_ | ||
* `Custom String Formmating <https://docs.python.org/3/library/string.html#custom-string-formatting>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Fruit: | ||
pass | ||
|
||
|
||
class Orange(Fruit): | ||
def __init__(self): | ||
super(Orange, self).__init__() # [super-with-arguments] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Fruit: | ||
pass | ||
|
||
|
||
class Orange(Fruit): | ||
def __init__(self): | ||
super().__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Today is {0}, so tomorrow will be {1}".format("Monday")) # [too-few-format-args] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Today is {0}, so tomorrow will be {1}".format("Monday", "Tuesday")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`String Formmating <https://docs.python.org/3/library/string.html#formatstrings>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def three_d_chess_move( # [too-many-arguments] | ||
x_white, | ||
y_white, | ||
z_white, | ||
piece_white, | ||
x_black, | ||
y_black, | ||
z_black, | ||
piece_black, | ||
x_blue, | ||
y_blue, | ||
z_blue, | ||
piece_blue, | ||
current_player, | ||
): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class ThreeDChessPiece: | ||
x: int | ||
y: int | ||
z: int | ||
type: str | ||
|
||
|
||
def three_d_chess_move( | ||
white: ThreeDChessPiece, | ||
black: ThreeDChessPiece, | ||
blue: ThreeDChessPiece, | ||
current_player, | ||
): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Today is {0}, so tomorrow will be {1}".format("Monday", "Tuesday", "Wednesday")) # [too-many-format-args] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Today is {0}, so tomorrow will be {1}".format("Monday", "Tuesday")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`String Formmating <https://docs.python.org/3/library/string.html#formatstrings>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Sphinx==4.5.0 | ||
python-docs-theme==2022.1 | ||
furo==2022.3.4 | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.