Skip to content

Commit 1dbbc4a

Browse files
authored
Fix and add missing docstrings (#22)
1 parent 121fecd commit 1dbbc4a

31 files changed

+128
-87
lines changed

src/abstract_api/avatars/avatars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def create(
4848
The characters will first be chosen from distinct words, then
4949
from the second letter of distinct words.
5050
background_color: The hex color for the background.
51-
It defaults to #335eea. TODO: Remove # from prefix.
51+
It defaults to #335eea.
5252
font_color: The hex color for the font.
53-
It defaults to white, i.e.,ffffff. TODO: Remove # from prefix.
53+
It defaults to white, i.e.,ffffff.
5454
is_rounded: Create a rounded avatar picture instead of squared one.
5555
It defaults to false.
5656
is_uppercase: Set the initials in the avatar to all capitals.

src/abstract_api/avatars/avatars_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class AvatarsResponse(FileResponse):
5-
"""TODO."""
5+
"""Avatars service response."""

src/abstract_api/company_enrichment/company_enrichment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class CompanyEnrichment(
1616
1717
Attributes:
1818
_subdomain: Company enrichment service subdomain.
19+
_response_fields: API response fields.
1920
"""
2021
_subdomain = "companyenrichment"
2122
_response_fields = RESPONSE_FIELDS
@@ -28,7 +29,7 @@ def check(
2829
"""Finds a company's details using its domain.
2930
3031
Args:
31-
domain: The domain of the company you want to get data from.
32+
domain: The domain of the company you want to get data for.
3233
fields: Selected response fields (optional).
3334
3435
Returns:

src/abstract_api/company_enrichment/company_enrichment_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def employees_count(self) -> str | None:
3131

3232
@property
3333
def locality(self) -> str | None:
34-
"""The city or region he company headquarter is based in."""
34+
"""The city or region the company headquarter is based in."""
3535
return self._get_response_field("locality")
3636

3737
@property

src/abstract_api/core/bases/_base_response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class BaseResponseMeta(ABC):
8-
"""Base response meta data for Abstract API service response."""
8+
"""Base response metadata for Abstract API service response."""
99

1010
def __init__(self, response: requests.models.Response) -> None:
1111
"""Initialize a new ResponseMeta."""
@@ -27,7 +27,7 @@ class BaseResponse(ABC):
2727
"""Base Abstract API service response.
2828
2929
Attributes:
30-
_meta_class: Class (type) of meta.
30+
_meta_class: Class (type) of response metadata instance.
3131
"""
3232
_meta_class: ClassVar[Type[BaseResponseMeta]]
3333

@@ -37,5 +37,5 @@ def __init__(self, response: requests.models.Response) -> None:
3737

3838
@property
3939
def meta(self) -> BaseResponseMeta:
40-
"""Meta data about response."""
40+
"""Metadata about response."""
4141
return self._meta

src/abstract_api/core/bases/base_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _service_request(
7070
endpoints.
7171
7272
Returns:
73-
AbstractAPI's response.
73+
Parsed AbstractAPI's response.
7474
"""
7575
if _method.lower() not in ["get", "post"]:
7676
raise ClientRequestError(

src/abstract_api/core/bases/file_response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77

88
class FileResponseMeta(BaseResponseMeta):
9-
"""TODO."""
9+
"""Meta data about a file-based API response."""
1010

1111

1212
class FileResponse(BaseResponse):
13-
"""TODO."""
13+
"""File-based API response."""
1414
_meta_class: ClassVar[Type[FileResponseMeta]] = FileResponseMeta
1515
meta: FileResponseMeta
1616

1717
def __init__(self, response: requests.models.Response) -> None:
18-
"""Initialize a new ResponseMeta."""
18+
"""Initialize a new FileResponse."""
1919
super().__init__(response)
2020
self._content: bytes = response.content
2121

src/abstract_api/core/bases/json_response.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class JSONResponseMeta(BaseResponseMeta):
9-
"""TODO."""
9+
"""Metadata about a JSON-based API response."""
1010

1111
def __init__(self, response: requests.models.Response) -> None:
1212
"""Initialize a new JSONResponseMeta."""
@@ -23,13 +23,21 @@ def body_json(self) -> dict[str, Any] | list[dict[str, Any]]:
2323

2424

2525
class JSONResponse(BaseResponse):
26-
"""TODO."""
26+
"""JSON-based API response."""
2727
_response_fields: frozenset[str]
2828
_meta_class: ClassVar[Type[JSONResponseMeta]] = JSONResponseMeta
2929
meta: JSONResponseMeta
3030

3131
def _init_response_field(self, field: str, value: Any) -> None:
32-
"""TODO."""
32+
"""Sets a response field's value during instance initialization.
33+
34+
This should be used in/as a part of __init__ method.
35+
36+
Args:
37+
field: Field name.
38+
value: Value to be set. The value is parsed to a nested entity
39+
if the field is a nested entity.
40+
"""
3341
setattr(self, f"_{field}", value)
3442

3543
def __init__(
@@ -38,7 +46,7 @@ def __init__(
3846
response_fields: frozenset[str],
3947
list_response: bool = False
4048
) -> None:
41-
"""TODO."""
49+
"""Initialize a new JSONResponse."""
4250
super().__init__(response)
4351
self._response_fields = response_fields
4452

src/abstract_api/core/exceptions/api_request_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class APIRequestError(AbstractAPIException):
9-
"""Raised when there's after making an API request."""
9+
"""Raised when there's a problem with returned in API response."""
1010
def __init__(
1111
self,
1212
http_status: int,

src/abstract_api/core/exceptions/client_request_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class ClientRequestError(AbstractAPIException):
5-
"""Raised when there's a problem on our side before making API request."""
5+
"""Raised when there's a problem before making API request."""

0 commit comments

Comments
 (0)