Skip to content

Commit 007e0db

Browse files
authored
Merge pull request #139 from ioet/refactor/change-type-hint-for-functions#135
refactor(type-hints): ♻️ add Callable as type hint of functions
2 parents 65adf5d + f14734c commit 007e0db

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

commons/data_access_layer/cosmos_db.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def find(
210210
self,
211211
id: str,
212212
event_context: EventContext,
213-
peeker: 'function' = None,
213+
peeker: Callable = None,
214214
visible_only=True,
215215
mapper: Callable = None,
216216
):
@@ -275,7 +275,7 @@ def partial_update(
275275
id: str,
276276
changes: dict,
277277
event_context: EventContext,
278-
peeker: 'function' = None,
278+
peeker: Callable = None,
279279
visible_only=True,
280280
mapper: Callable = None,
281281
):
@@ -305,7 +305,7 @@ def delete(
305305
self,
306306
id: str,
307307
event_context: EventContext,
308-
peeker: 'function' = None,
308+
peeker: Callable = None,
309309
mapper: Callable = None,
310310
):
311311
return self.partial_update(
@@ -348,7 +348,9 @@ def __init__(self, repository: CosmosDBRepository):
348348
def get_all(self, conditions: dict = None, **kwargs) -> list:
349349
conditions = conditions if conditions else {}
350350
event_ctx = self.create_event_context("read-many")
351-
return self.repository.find_all(event_ctx, conditions=conditions, **kwargs)
351+
return self.repository.find_all(
352+
event_ctx, conditions=conditions, **kwargs
353+
)
352354

353355
def get(self, id):
354356
event_ctx = self.create_event_context("read")
@@ -406,6 +408,7 @@ def generate_uuid4() -> str:
406408

407409
def get_last_day_of_month(year: int, month: int) -> int:
408410
from calendar import monthrange
411+
409412
return monthrange(year=year, month=month)[1]
410413

411414

@@ -419,7 +422,9 @@ def get_current_month() -> int:
419422

420423
def get_date_range_of_month(year: int, month: int) -> Dict[str, str]:
421424
first_day_of_month = 1
422-
start_date = datetime(year=year, month=month, day=first_day_of_month,tzinfo=timezone.utc)
425+
start_date = datetime(
426+
year=year, month=month, day=first_day_of_month, tzinfo=timezone.utc
427+
)
423428

424429
last_day_of_month = get_last_day_of_month(year=year, month=month)
425430
end_date = datetime(
@@ -430,7 +435,7 @@ def get_date_range_of_month(year: int, month: int) -> Dict[str, str]:
430435
minute=59,
431436
second=59,
432437
microsecond=999999,
433-
tzinfo=timezone.utc
438+
tzinfo=timezone.utc,
434439
)
435440

436441
return {

time_tracker_api/time_entries/time_entries_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def find(
114114
self,
115115
id: str,
116116
event_context: EventContext,
117-
peeker: 'function' = None,
117+
peeker: Callable = None,
118118
visible_only=True,
119119
mapper: Callable = None,
120120
):

0 commit comments

Comments
 (0)