Skip to content

Commit 3d494b4

Browse files
committed
Small fixes
* Redundant rule in pyproject.toml * "Raises" docstrings
1 parent 95ff337 commit 3d494b4

21 files changed

Lines changed: 43 additions & 103 deletions

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ split-on-trailing-comma = true
174174
"S107", # hardcoded-password-default
175175
]
176176
#
177-
"src/app/domain/value_objects/base.py" = ["B024", ] # abstract-base-class-without-abstract-method
178177
"src/app/infrastructure/adapters/password_hasher_bcrypt.py" = ["E501", ] # line-too-long
179178
"src/app/infrastructure/auth/session/constants.py" = ["S105", ] # hardcoded-password-string
180179
"src/app/presentation/http/auth/constants.py" = ["S105", ] # hardcoded-password-string

src/app/application/common/ports/access_revoker.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
class AccessRevoker(Protocol):
88
@abstractmethod
99
async def remove_all_user_access(self, user_id: UserId) -> None:
10-
"""
11-
:raises DataMapperError:
12-
"""
10+
""":raises DataMapperError:"""

src/app/application/common/ports/flusher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Flusher(Protocol):
1010
@abstractmethod
1111
async def flush(self) -> None:
1212
"""
13-
Flush pending changes to validate constraints or trigger side effects.
14-
1513
:raises DataMapperError:
1614
:raises UsernameAlreadyExists:
15+
16+
Flush pending changes to validate constraints or trigger side effects.
1717
"""

src/app/application/common/ports/identity_provider.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
class IdentityProvider(Protocol):
88
@abstractmethod
99
async def get_current_user_id(self) -> UserId:
10-
"""
11-
:raises AuthenticationError:
12-
"""
10+
""":raises AuthenticationError:"""

src/app/application/common/ports/transaction_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TransactionManager(Protocol):
1212
@abstractmethod
1313
async def commit(self) -> None:
1414
"""
15-
Commit the successful outcome of a business transaction.
16-
1715
:raises DataMapperError:
16+
17+
Commit the successful outcome of a business transaction.
1818
"""

src/app/application/common/ports/user_command_gateway.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,16 @@
99
class UserCommandGateway(Protocol):
1010
@abstractmethod
1111
def add(self, user: User) -> None:
12-
"""
13-
:raises DataMapperError:
14-
"""
12+
""":raises DataMapperError:"""
1513

1614
@abstractmethod
1715
async def read_by_id(self, user_id: UserId) -> User | None:
18-
"""
19-
:raises DataMapperError:
20-
"""
16+
""":raises DataMapperError:"""
2117

2218
@abstractmethod
2319
async def read_by_username(
2420
self,
2521
username: Username,
2622
for_update: bool = False,
2723
) -> User | None:
28-
"""
29-
:raises DataMapperError:
30-
"""
24+
""":raises DataMapperError:"""

src/app/application/common/ports/user_query_gateway.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ async def read_all(
1111
self,
1212
user_read_all_params: UserListParams,
1313
) -> list[UserQueryModel] | None:
14-
"""
15-
:raises ReaderError:
16-
"""
14+
""":raises ReaderError:"""

src/app/application/common/query_params/pagination.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Pagination:
1313
offset: int
1414

1515
def __post_init__(self):
16+
""":raises PaginationError:"""
1617
if self.limit <= 0:
1718
raise PaginationError(f"Limit must be greater than 0, got {self.limit}")
1819
if self.offset < 0:

src/app/application/common/services/authorization/authorize.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def authorize[PC: PermissionContext](
1111
*,
1212
context: PC,
1313
) -> None:
14-
"""
15-
:raises AuthorizationError:
16-
"""
14+
""":raises AuthorizationError:"""
1715
if not permission.is_satisfied_by(context):
1816
raise AuthorizationError(AUTHZ_NOT_AUTHORIZED)

src/app/domain/entities/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
@dataclass(eq=False)
1212
class Entity[T: ValueObject](ABC):
1313
"""
14+
raises DomainError
15+
1416
Base class for domain entities, defined by a unique identity (`id`).
1517
- `id`: Identity that remains constant throughout the entity's lifecycle.
1618
- Entities are mutable, but are compared solely by their `id`.
@@ -22,6 +24,8 @@ class Entity[T: ValueObject](ABC):
2224

2325
def __setattr__(self, name: str, value: Any) -> None:
2426
"""
27+
:raises DomainError:
28+
2529
Prevents modifying the `id` after it's set.
2630
Other attributes can be changed as usual.
2731
"""

0 commit comments

Comments
 (0)