Skip to content

Commit c24f62a

Browse files
committed
Merge branch 'main' of https://github.com/PyCQA/pylint into false_positive_type_checking
2 parents 2fc8fda + 8d13dbe commit c24f62a

File tree

18 files changed

+188
-10
lines changed

18 files changed

+188
-10
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
1+
This error was raised when we encountered an unexpected value type in a toml
2+
configuration between pylint 2.12 and pylint 2.14 (before the argparse refactor).

doc/data/messages/b/bad-configuration-section/good.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/data/messages/p/parse-error/good.py

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
def fifty_percent_off(whole):
2+
return (float(whole)) * 50 / 100
3+
4+
5+
def calculate_sum_and_display_price_of_fruits(*fruits): # [too-complex]
6+
# McCabe rating is 13 here (by default 10)
7+
shopping_list = []
8+
9+
if "apple" in fruits:
10+
v = fifty_percent_off(1.1)
11+
shopping_list.append(v)
12+
if "pear" in fruits:
13+
shopping_list.append(0.8)
14+
if "banana" in fruits:
15+
shopping_list.append(1.2)
16+
if "mango" in fruits:
17+
shopping_list.append(3.5)
18+
if "peach" in fruits:
19+
shopping_list.append(0.5)
20+
if "melon" in fruits:
21+
shopping_list.append(4.9)
22+
if "orange" in fruits:
23+
shopping_list.append(2.0)
24+
if "strawberry" in fruits:
25+
shopping_list.append(2.5)
26+
if "mandarin" in fruits:
27+
shopping_list.append(2.3)
28+
if "plum" in fruits:
29+
shopping_list.append(0.5)
30+
if "watermelon" in fruits:
31+
v = fifty_percent_off(6.4)
32+
shopping_list.append(v)
33+
34+
combine = zip(fruits, shopping_list)
35+
36+
for i in combine:
37+
print(f"{i[0]} ${i[1]:.2f}")
38+
39+
total = sum(shopping_list)
40+
print(f"Total price is ${total:.2f}")
41+
42+
43+
fruits_to_buy = ["apple", "orange", "watermelon"]
44+
calculate_sum_and_display_price_of_fruits(*fruits_to_buy)

doc/data/messages/t/too-complex/details.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
# This is a placeholder for correct code for this message.
1+
FRUIT_PRICES = {
2+
"apple": 1.1,
3+
"pear": 0.8,
4+
"banana": 1.2,
5+
"mango": 3.5,
6+
"peach": 0.5,
7+
"melon": 4.9,
8+
"orange": 2.0,
9+
"strawberry": 2.5,
10+
"mandarin": 2.3,
11+
"plum": 0.5,
12+
"watermelon": 6.4,
13+
}
14+
DISCOUNTED_FRUITS = ["apple", "watermelon"]
15+
16+
17+
def fifty_percent_off(whole):
18+
return (float(whole)) * 50 / 100
19+
20+
21+
def get_price(fruit):
22+
full_price = FRUIT_PRICES.get(fruit)
23+
if fruit in DISCOUNTED_FRUITS:
24+
return fifty_percent_off(full_price)
25+
else:
26+
return full_price
27+
28+
29+
def display_fruit_and_price(fruits):
30+
for fruit in fruits:
31+
print(f"{fruit} ${get_price(fruit) :.2f}")
32+
33+
34+
def get_total(fruits):
35+
return sum(get_price(f) for f in fruits)
36+
37+
38+
fruits_to_buy = ["apple", "orange", "watermelon"]
39+
display_fruit_and_price(fruits_to_buy)
40+
print(f"Total price is ${get_total(fruits_to_buy):.2f}")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[main]
2+
3+
load-plugins=pylint.extensions.mccabe
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f"python {3.5} is past end of life" # [using-f-string-in-unsupported-version]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
1+
f-strings were introduced in Python version 3.6; to use them, please use a more recent version of Python.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# This is a placeholder for correct code for this message.
1+
"python {} is past end of life".format(3.5)

0 commit comments

Comments
 (0)