diff --git a/.flake8 b/.flake8 index 048d04fe..37424edc 100644 --- a/.flake8 +++ b/.flake8 @@ -2,6 +2,7 @@ max-line-length = 100 max-complexity = 5 exclude = .venv,venv,**/migrations/*,snapshots +extend-ignore = E203,E701 per-file-ignores = tests/**: S101 **/tests/**: S101 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5a083d9c..211b2374 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 850abee1..e174bd79 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,9 +9,9 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: "3.9" - name: Install Poetry diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c5bef0c..2c343bf3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,9 +20,9 @@ jobs: python-version: [3.9] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Poetry @@ -46,9 +46,9 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Poetry @@ -79,9 +79,9 @@ jobs: django-version: "3.2" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: install poetry @@ -120,9 +120,9 @@ jobs: django-version: "4.2" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: install poetry @@ -151,9 +151,9 @@ jobs: django-version: ["5.0"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: set up python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: install poetry @@ -180,9 +180,9 @@ jobs: python-version: [3.9] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Poetry diff --git a/HISTORY.md b/HISTORY.md index bdabf07b..f0045dba 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -27,6 +27,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - For `ImageTransformation`: - The `overlay()` and `overlay_self()` methods now treat `overlay_width` and `overlay_height` parameters as optional. - Unified `gif2video()`, `gif2video_format()`, and `gif2video_quality()` methods into a single `gif2video()` method. The `format` and `quality` parameters can now be accepted directly in the `gif2video()` method. +- [Black](https://black.readthedocs.io/) dev dependency has been updated to 24.3.0. ### Fixed diff --git a/pyproject.toml b/pyproject.toml index d701ecf1..87968386 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ django = ["Django"] [tool.poetry.dev-dependencies] pytest = "^7.4" -black = "^23.12.0" +black = "^24.3.0" isort = "^5.13.2" flake8 = "^6.1.0" mypy = "^1.7.1" @@ -63,7 +63,7 @@ build-backend = "poetry.core.masonry.api" [tool.black] line-length = 79 -target-version = ['py39'] +target-version = ['py38'] exclude = ''' ( \.eggs diff --git a/pyuploadcare/api/api.py b/pyuploadcare/api/api.py index 7f8ce473..6a60b9a0 100644 --- a/pyuploadcare/api/api.py +++ b/pyuploadcare/api/api.py @@ -517,9 +517,9 @@ def get_key(self, file_uuid: Union[UUID, str], mkey: str) -> str: class AddonsAPI(API): resource_type = "addons" - request_type: Type[ + request_type: Type[AddonExecutionGeneralRequestData] = ( AddonExecutionGeneralRequestData - ] = AddonExecutionGeneralRequestData + ) response_classes = { "execute": responses.AddonExecuteResponse, "status": responses.AddonResponse, diff --git a/pyuploadcare/api/auth.py b/pyuploadcare/api/auth.py index da36ab67..8067b33e 100644 --- a/pyuploadcare/api/auth.py +++ b/pyuploadcare/api/auth.py @@ -7,8 +7,7 @@ from httpx._utils import to_bytes, to_str -class AuthBase(Auth): - ... +class AuthBase(Auth): ... class UploadcareSimpleAuth(AuthBase): @@ -28,9 +27,9 @@ def auth_flow( if "Content-Type" not in request.headers: request.headers["Content-Type"] = "application/json" - request.headers[ - "Accept" - ] = f"application/vnd.uploadcare-v{self.api_version}+json" + request.headers["Accept"] = ( + f"application/vnd.uploadcare-v{self.api_version}+json" + ) request.headers["Authorization"] = self._build_auth_header( request, self.public_key, self.secret_key ) @@ -56,9 +55,9 @@ def auth_flow( if "Content-Type" not in request.headers: request.headers["Content-Type"] = "application/json" - request.headers[ - "Accept" - ] = f"application/vnd.uploadcare-v{self.api_version}+json" + request.headers["Accept"] = ( + f"application/vnd.uploadcare-v{self.api_version}+json" + ) request.headers["Authorization"] = self._build_auth_header( request, self.public_key, self.secret_key, formated_date_time ) diff --git a/pyuploadcare/api/base.py b/pyuploadcare/api/base.py index 086c87e9..798691b5 100644 --- a/pyuploadcare/api/base.py +++ b/pyuploadcare/api/base.py @@ -118,8 +118,7 @@ def _parse_response( self, raw_resource: Dict[str, Any], response_class: Type[ResponseOrEntity], - ) -> ResponseOrEntity: - ... + ) -> ResponseOrEntity: ... def _build_url( self, @@ -127,40 +126,33 @@ def _build_url( base: Optional[str] = None, suffix: Optional[str] = None, query_parameters: Optional[Dict[str, Any]] = None, - ) -> str: - ... + ) -> str: ... def _get_response_class( self, action: str - ) -> Union[Type[Response], Type[Entity]]: - ... + ) -> Union[Type[Response], Type[Entity]]: ... - def _post(self, data: Optional[Dict] = None) -> Dict[str, Any]: - ... + def _post(self, data: Optional[Dict] = None) -> Dict[str, Any]: ... def _get( self, resource_uuid: Optional[Union[UUID, str, UUIDEntity]] = None, **query_parameters, - ) -> Dict[str, Any]: - ... + ) -> Dict[str, Any]: ... def _put( self, resource_uuid: Optional[Union[UUID, str, UUIDEntity]] = None, data: Optional[Dict] = None, - ) -> Dict[str, Any]: - ... + ) -> Dict[str, Any]: ... def _delete( self, resource_uuid: Optional[Union[UUID, str, UUIDEntity]] = None - ) -> None: - ... + ) -> None: ... def _delete_with_response( self, resource_uuid: Optional[Union[UUID, str, UUIDEntity]] = None - ) -> Dict[str, Any]: - ... + ) -> Dict[str, Any]: ... class RetrieveMixin(APIProtocol): diff --git a/pyuploadcare/api/entities.py b/pyuploadcare/api/entities.py index 476fe97a..a22ffc09 100644 --- a/pyuploadcare/api/entities.py +++ b/pyuploadcare/api/entities.py @@ -10,8 +10,7 @@ from .metadata import META_KEY_MAX_LEN, META_KEY_PATTERN, META_VALUE_MAX_LEN -class Entity(BaseModel): - ... +class Entity(BaseModel): ... class IDEntity(Entity): diff --git a/pyuploadcare/api/responses.py b/pyuploadcare/api/responses.py index a307cd6a..0bc1b540 100644 --- a/pyuploadcare/api/responses.py +++ b/pyuploadcare/api/responses.py @@ -14,8 +14,7 @@ ) -class Response(BaseModel): - ... +class Response(BaseModel): ... class EntityListResponse(Response):