Skip to content

Commit

Permalink
🔧(linter) fix pydocstyle linter
Browse files Browse the repository at this point in the history
Fix pydocstyle linter now processing all src files and fix linter warnings.
  • Loading branch information
wilbrdt committed Dec 26, 2022
1 parent 0aed3df commit 9671b22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ exclude =

[pydocstyle]
convention = google
match = ^src/ralph.*\.py
match_dir = ^(?!tests).*
match = ^(?!(setup)\.(py)$).*\.(py)$

[isort]
known_ralph=ralph
Expand Down
19 changes: 13 additions & 6 deletions src/ralph/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,28 @@ class UserCredentials(AuthenticatedUser):


class ServerUsersCredentials(BaseModel):
"""Custom root pydantic model describing expected list of all server users
credentials as stored in the credentials file."""
"""Custom root pydantic model.
Describes expected list of all server users credentials as stored in
the credentials file.
Attributes:
__root__ (List): Custom root consisting of the
list of all server users credentials.
"""

__root__: list[UserCredentials]

def __add__(self, other):
def __add__(self, other): # noqa: D105
return ServerUsersCredentials.parse_obj(self.__root__ + other.__root__)

def __getitem__(self, item: int):
def __getitem__(self, item: int): # noqa: D105
return self.__root__[item]

def __len__(self):
def __len__(self): # noqa: D105
return len(self.__root__)

def __iter__(self):
def __iter__(self): # noqa: D105
return iter(self.__root__)

@root_validator
Expand Down
7 changes: 1 addition & 6 deletions src/ralph/backends/storage/s3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""S3 storage backend for Ralph"""
"""S3 storage backend for Ralph."""

import logging

Expand Down Expand Up @@ -34,7 +34,6 @@ def __init__(
bucket_name: str = s3_settings.BUCKET_NAME,
):
"""Instantiates the AWS S3 client."""

self.access_key_id = access_key_id
self.secret_access_key = secret_access_key
self.session_token = session_token
Expand All @@ -60,7 +59,6 @@ def __init__(

def list(self, details=False, new=False):
"""Lists archives in the storage backend."""

archives_to_skip = set()
if new:
archives_to_skip = set(self.get_command_history(self.name, "fetch"))
Expand Down Expand Up @@ -92,12 +90,10 @@ def list(self, details=False, new=False):

def url(self, name):
"""Gets `name` file absolute URL."""

return f"{self.bucket_name}.s3.{self.default_region}.amazonaws.com/{name}"

def read(self, name, chunk_size: int = 4096):
"""Reads `name` file and yields its content by chunks of a given size."""

logger.debug("Getting archive: %s", name)

try:
Expand Down Expand Up @@ -127,7 +123,6 @@ def read(self, name, chunk_size: int = 4096):

def write(self, stream, name, overwrite=False):
"""Writes data from `stream` to the `name` target."""

if not overwrite and name in list(self.list()):
msg = "%s already exists and overwrite is not allowed"
logger.error(msg, name)
Expand Down

0 comments on commit 9671b22

Please sign in to comment.