Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 43d4197

Browse files
committed
Update project
Updated ignore patterns list. Fixed some strict mypy annotation issues.
1 parent ccdebde commit 43d4197

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ dist/
4141
# emacs cache and backup files
4242
\#*\#
4343
*~
44+
45+
# various logs
46+
logs/
47+
*.log

src/conv_store/models.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ class Product:
2121
"""
2222

2323
def __init__(
24-
self, name: str, price: float, unit: Union[int, float]
24+
self,
25+
name: str,
26+
price: float,
27+
unit: Union[int, float]
2528
) -> None:
2629
"""Initialize instance
2730
@@ -60,9 +63,9 @@ def __eq__(self, other: object) -> bool:
6063
return False
6164

6265
return (
63-
self.name == other.name and
64-
self.price == other.price and
65-
self.unit == other.unit
66+
self.name == other.name and
67+
self.price == other.price and
68+
self.unit == other.unit
6669
)
6770

6871
def get_total(self, quantity: Union[int, float]) -> float:
@@ -106,17 +109,19 @@ def __len__(self) -> int:
106109

107110
return len(self.products)
108111

112+
size_of = __len__
113+
109114
def __getitem__(self, idx: int) -> Tuple[Product, Union[int, float]]:
110115
"""Return a product - quantity pair"""
111116

112117
return self.products[idx], self.quantities[idx]
113118

114-
def __contains__(self, item) -> bool:
119+
def __contains__(self, item: object) -> bool:
115120
"""Return True if item is present in the shopping cart"""
116121

117122
return item in self.products
118123

119-
def __iter__(self) -> Iterator:
124+
def __iter__(self) -> Iterator[Tuple[Product, Union[int, float]]]:
120125
"""Return shopping cart iterator"""
121126

122127
return zip(self.products, self.quantities)
@@ -136,8 +141,8 @@ def remove_product(self, product: Product) -> None:
136141
self.quantities.pop(idx)
137142

138143
def add_product(
139-
self, product: Product,
140-
quantity: Optional[Union[int, float]] = None
144+
self, product: Product,
145+
quantity: Optional[Union[int, float]] = None
141146
) -> None:
142147
"""Add product to the shopping cart
143148
@@ -163,7 +168,7 @@ def add_product(
163168
self.remove_product(product)
164169

165170
def sub_product(
166-
self, product: Product, quantity: Union[int, float]
171+
self, product: Product, quantity: Union[int, float]
167172
) -> None:
168173
"""Subtract product from the shopping cart
169174

src/wrw_game/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
logger.addHandler(stream_handler)
1414

1515

16-
def run():
16+
def run() -> None:
1717
"""Run the game"""
1818

1919
try:

0 commit comments

Comments
 (0)