Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 24.10.0
hooks:
- id: black
args: [ "--safe", "--diff", "--color"]
verbose: true
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 24.10.0
hooks:
- id: black
args: [ "--safe", "--quiet"]
Expand All @@ -17,10 +17,10 @@ repos:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/asottile/blacken-docs
rev: v1.10.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [ black==20.8b1 ]
additional_dependencies: [ black==24.10.0 ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
Expand All @@ -41,10 +41,10 @@ repos:
- id: python-use-type-annotations
- id: rst-backticks
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 7.3.0
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-typing-imports==1.9.0
- flake8-docstrings==1.5.0
- flake8-typing-imports==1.15.0
- flake8-docstrings==1.7.0
4 changes: 3 additions & 1 deletion docs/list_labels_by_tracking_number.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def list_labels_by_tracking_number_demo():
{"api_key": api_key, "page_size": 75, "retries": 3, "timeout": 10}
)
try:
result = shipengine.list_labels_by_tracking_number(tracking_number="1ZXXXXXXXXXXXXXXXX")
result = shipengine.list_labels_by_tracking_number(
tracking_number="1ZXXXXXXXXXXXXXXXX"
)
print("::SUCCESS::")
print(result)
except ShipEngineError as err:
Expand Down
113 changes: 55 additions & 58 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fuuid = "^0.1.0"
pytest = "^7.0.0"
pytest-cov = "^2.11.1"
pytest-mock = "^3.6.1"
black = "^22.0.0"
flake8 = "^6.0.0"
black = "^24.0.0"
flake8 = "^7.0.0"
Sphinx = "^3.5.2"
tox = "^3.23.0"
coverage = "^5.5"
Expand All @@ -58,7 +58,6 @@ responses = "^0.13.3"
[tool.black]
line-length = 100
target-version = ["py310"]
safe = true

[tool.isort]
profile = "black"
Expand Down
1 change: 1 addition & 0 deletions shipengine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ShipEngine SDK."""

__version__ = "2.0.5"

import logging
Expand Down
1 change: 1 addition & 0 deletions shipengine/enums/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ShipEngine SDK Enumerations"""

from enum import Enum

from .country import Country
Expand Down
1 change: 1 addition & 0 deletions shipengine/enums/country.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An enumeration of valid/supported countries."""

from enum import Enum


Expand Down
1 change: 1 addition & 0 deletions shipengine/enums/error_code.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enumeration of error sources returned by ShipEngine API."""

from enum import Enum


Expand Down
1 change: 1 addition & 0 deletions shipengine/enums/error_source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enumeration of error sources returned by ShipEngine API."""

from enum import Enum


Expand Down
6 changes: 5 additions & 1 deletion shipengine/enums/error_type.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""Enumeration of error types returned by ShipEngine API."""

from enum import Enum


class ErrorType(Enum):
"""Indicates the type of an error. Think of this as a broad category rather than a specific error."""
"""Indicates the type of an error.

Think of this as a broad category rather than a specific error.
"""

ACCOUNT_STATUS = "account_status"
"""
Expand Down
1 change: 1 addition & 0 deletions shipengine/enums/regex_patterns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enumeration of Regular Expression patterns used in the ShipEngine SDK."""

from enum import Enum


Expand Down
8 changes: 5 additions & 3 deletions shipengine/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Errors that will be raised through-out the ShipEngine SDK."""

import json
from typing import Optional

Expand Down Expand Up @@ -29,7 +30,8 @@ def _are_enums_valid(self):
pass # noqa
elif not does_member_value_exist(self.error_source, ErrorSource):
raise ValueError(
f"Error source must be a member of ErrorSource enum - [{self.error_source}] provided."
"Error source must be a member of ErrorSource enum - "
f"[{self.error_source}] provided."
)

if self.error_type is None:
Expand All @@ -43,7 +45,7 @@ def _are_enums_valid(self):
pass # noqa
elif not does_member_value_exist(self.error_code, ErrorCode):
raise ValueError(
f"Error type must be a member of ErrorCode enum - [{self.error_code}] provided."
"Error type must be a member of ErrorCode enum - " f"[{self.error_code}] provided."
)

def to_dict(self):
Expand Down Expand Up @@ -80,7 +82,7 @@ def __init__(
error_source: Optional[str] = None,
request_id: Optional[str] = None,
) -> None:
"""An exception that indicates the configured timeout has been reached for a given request."""
"""An exception indicating the configured timeout was reached for a given request."""
self.retry_after = retry_after
self.error_source = error_source
self.request_id = request_id
Expand Down
1 change: 1 addition & 0 deletions shipengine/http_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Synchronous HTTP Client for ShipEngine SDK."""

from .client import ShipEngineClient
11 changes: 9 additions & 2 deletions shipengine/http_client/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A synchronous HTTP Client for the ShipEngine SDK."""

import json
import os
import platform
Expand Down Expand Up @@ -133,7 +134,10 @@ def _send_request(
resp: Response = client.send(request=prepared_req, timeout=config.timeout)
except RequestException as err:
raise ShipEngineError(
message=f"An unknown error occurred while calling the ShipEngine {http_method} API:\n {err.response}",
message=(
f"An unknown error occurred while calling the ShipEngine {http_method} "
f"API:\n {err.response}"
),
error_source=ErrorSource.SHIPENGINE.value,
error_type=ErrorType.SYSTEM.value,
error_code=ErrorCode.UNSPECIFIED.value,
Expand Down Expand Up @@ -186,4 +190,7 @@ def _derive_user_agent() -> str:
python_version: str = platform.python_version()
python_implementation: str = platform.python_implementation()

return f"shipengine-python/{sdk_version} {platform_os}/{os_version} {python_implementation}/{python_version}"
return (
f"shipengine-python/{sdk_version} {platform_os}/{os_version} "
f"{python_implementation}/{python_version}"
)
Loading
Loading