Skip to content

Commit

Permalink
Remove ClassVar type hint from collection_name (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikBelyaev committed Sep 4, 2023
1 parent c7c7c68 commit 67ceda7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ repos:
- fastapi==0.99
- dependency_injector==4.41.0
- langchain==0.0.264
- pymongo~=4.3.3
- cattrs~=23.1.0
args: [--install-types, --non-interactive]

- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
10 changes: 5 additions & 5 deletions ddd_framework/infrastructure/persistance/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ class MongoRepositoryMixin(ABC):
meaning that all the old indexes will be deleted and new added.
"""

collection_name: ClassVar[str]
collection_name: str
indexes: ClassVar[list[Index] | None] = None

@abstractmethod
def get_database(self) -> pymongo.database.Database:
def get_database(self) -> pymongo.database.Database[dict[str, Any]]:
"""Return a database instance."""

@cached_property
def _database(self) -> pymongo.database.Database:
def _database(self) -> pymongo.database.Database[dict[str, Any]]:
return self.get_database()

@cached_property
def _collection(self) -> Collection:
collection: Collection = self._database[self.collection_name]
def _collection(self) -> Collection[dict[str, Any]]:
collection: Collection[dict[str, Any]] = self._database[self.collection_name]
default_indexes = ['_id_']
skip_indexes: list[Index] = []
indexes_to_remove: set[str] = set()
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "docsie-ddd-framework"
version = "0.0.3"
version = "0.0.4"
description = "The package includes helper methods and types for working in DDD"
readme = "README.md"
requires-python = ">=3.8"
Expand Down Expand Up @@ -30,8 +30,6 @@ find = {}

[tool.mypy]
strict = true
explicit_package_bases = true
packages = ["ddd_framework"]
ignore_missing_imports = true
exclude = ['ddd_framework/utils/types.py']

Expand Down

0 comments on commit 67ceda7

Please sign in to comment.