Skip to content

Commit 59e8efb

Browse files
committed
fix: Warning about mutable default argument #121
1 parent 979e103 commit 59e8efb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

commons/data_access_layer/cosmos_db.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def delete_container(self, container_id: str):
6060
cosmos_helper: CosmosDBFacade = None
6161

6262

63-
class CosmosDBModel():
63+
class CosmosDBModel:
6464
def __init__(self, data):
6565
names = set([f.name for f in dataclasses.fields(self)])
6666
for k, v in data.items():
@@ -124,7 +124,7 @@ def create_custom_sql_conditions(custom_sql_conditions: List[str]) -> str:
124124
return ''
125125

126126
@staticmethod
127-
def generate_params(conditions: dict) -> dict:
127+
def generate_params(conditions: dict) -> list:
128128
result = []
129129
for k, v in conditions.items():
130130
result.append({
@@ -255,7 +255,8 @@ class CosmosDBDao(CRUDDao):
255255
def __init__(self, repository: CosmosDBRepository):
256256
self.repository = repository
257257

258-
def get_all(self, conditions: dict = {}, **kwargs) -> list:
258+
def get_all(self, conditions: dict = None, **kwargs) -> list:
259+
conditions = conditions if conditions else {}
259260
event_ctx = self.create_event_context("read-many")
260261
return self.repository.find_all(event_ctx, conditions=conditions, **kwargs)
261262

time_tracker_api/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class CRUDDao(abc.ABC):
1818
@abc.abstractmethod
19-
def get_all(self, conditions: dict, **kwargs):
19+
def get_all(self, conditions: dict = None, **kwargs):
2020
raise NotImplementedError # pragma: no cover
2121

2222
@abc.abstractmethod

0 commit comments

Comments
 (0)