Skip to content

Commit

Permalink
DH-4724/reformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed Sep 27, 2023
1 parent 14ed35e commit a7b86e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dataherald/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ def find_by_id(self, collection: str, id: str) -> dict:
pass

@abstractmethod
def find(self, collection: str, query: dict, sort: list = None, page: int = 0, limit: int = 0) -> list:
def find(
self,
collection: str,
query: dict,
sort: list = None,
page: int = 0,
limit: int = 0,
) -> list:
pass

@abstractmethod
Expand Down
9 changes: 8 additions & 1 deletion dataherald/db/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ def find_by_id(self, collection: str, id: str) -> dict:
return self._data_store[collection].find_one({"_id": ObjectId(id)})

@override
def find(self, collection: str, query: dict, sort: list = None, page: int = 0, limit: int = 0) -> list:
def find(
self,
collection: str,
query: dict,
sort: list = None,
page: int = 0,
limit: int = 0,
) -> list:
skip_count = (page - 1) * limit
cursor = self._data_store[collection].find(query)
if sort:
Expand Down
9 changes: 8 additions & 1 deletion dataherald/tests/db/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ def find_by_id(self, collection: str, id: str) -> dict:
return None

@override
def find(self, collection: str, query: dict, sort: list = None, page: int = 0, limit: int = 0) -> list:
def find(
self,
collection: str,
query: dict,
sort: list = None,
page: int = 0,
limit: int = 0,
) -> list:
return []

@override
Expand Down

0 comments on commit a7b86e7

Please sign in to comment.