From f007596743ce18647cca782f7765716d4779f3a8 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Tue, 26 Sep 2023 17:22:05 +0000 Subject: [PATCH 1/3] Fix image transforms options --- CHANGELOG.md | 296 ++++++++++++++++++------------------ storage3/_async/file_api.py | 12 +- storage3/_sync/file_api.py | 10 +- storage3/types.py | 4 + 4 files changed, 164 insertions(+), 158 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c7f2c0..8cf2a60a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -287,19 +287,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`c008911`](https://g * chore(deps-dev): bump pytest from 7.3.1 to 7.3.2 (#108) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-patch -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-patch +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`e5df2ff`](https://github.com/supabase-community/storage-py/commit/e5df2ff8a269337d206b7396ebab04039eb1684e)) * chore: test upload_to_signed_url ([`82ccab4`](https://github.com/supabase-community/storage-py/commit/82ccab43c98ae55078ed5fab76d9c12320261235)) @@ -341,19 +341,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`1eef352`](https://g * chore(deps-dev): bump pytest from 7.2.2 to 7.3.1 (#88) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a95a244`](https://github.com/supabase-community/storage-py/commit/a95a24410be08e9276f3e8214b621f6b82fd81ba)) * chore(deps): bump httpx from 0.23.3 to 0.24.0 @@ -374,19 +374,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`84335cd`](https://g * chore(deps-dev): bump pre-commit from 3.1.1 to 3.2.0 (#79) -Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. -- [Release notes](https://github.com/pre-commit/pre-commit/releases) -- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) -- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) - ---- -updated-dependencies: -- dependency-name: pre-commit - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. +- [Release notes](https://github.com/pre-commit/pre-commit/releases) +- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) +- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) + +--- +updated-dependencies: +- dependency-name: pre-commit + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a603a2a`](https://github.com/supabase-community/storage-py/commit/a603a2a684cf6d47eb5b58866c8c8263cc909852)) * chore(deps-dev): bump pytest from 7.2.1 to 7.2.2 @@ -417,25 +417,25 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`e764f25`](https://g * feat: created functions to get multiple signed URLs. (#105) -* feat: created functions to get multiple signed URLs. - -* feat: Fixed optional params. Handling auth token issue #73 in separate PR. - -* feat: remove sync code as it will be generated by unasync. - -* chore: generate sync client - ---------- - -Co-authored-by: Alexander Leonov <alleonov@icloud.com> +* feat: created functions to get multiple signed URLs. + +* feat: Fixed optional params. Handling auth token issue #73 in separate PR. + +* feat: remove sync code as it will be generated by unasync. + +* chore: generate sync client + +--------- + +Co-authored-by: Alexander Leonov <alleonov@icloud.com> Co-authored-by: anand2312 <40204976+anand2312@users.noreply.github.com> ([`2c5e2fc`](https://github.com/supabase-community/storage-py/commit/2c5e2fc309ab0f862a21e52da9b0e7c2c9d24e19)) * feat: bucket level file controls and an update_bucket method (#103) -* feat: bucket level file controls and an update_bucket method - -* fix: import __future__ annotations - +* feat: bucket level file controls and an update_bucket method + +* fix: import __future__ annotations + python 3.8 doesn't allow subscripting types like list ([`80454f9`](https://github.com/supabase-community/storage-py/commit/80454f9f6de5d6d5db9840b848b39937fabf5407)) ### Unknown @@ -478,17 +478,17 @@ chore(deps): bump httpx from 0.23.3 to 0.24.1 ([`fc18260`](https://github.com/su * Make FileOptions type (#100) -* Update lockfile - -* feat: add FileOptions type, make some bucket fields optional - -* feat: use FileOptions in upload and document it - -* docs: add upload example to README - -* fix: don't mark BaseBucket fields as default - -this breaks every other class that inherits from BaseBucket and tries to add +* Update lockfile + +* feat: add FileOptions type, make some bucket fields optional + +* feat: use FileOptions in upload and document it + +* docs: add upload example to README + +* fix: don't mark BaseBucket fields as default + +this breaks every other class that inherits from BaseBucket and tries to add any non-default field. ([`1585e42`](https://github.com/supabase-community/storage-py/commit/1585e4279427934d5e027fc3ea2874085748caa6)) * Merge pull request #87 from supabase-community/dependabot/pip/main/httpx-0.24.0 @@ -497,8 +497,8 @@ chore(deps): bump httpx from 0.23.3 to 0.24.0 ([`b69a8ba`](https://github.com/su * Fix bad typing on upload functions (#89) -* Fix bad typing on upload functions - +* Fix bad typing on upload functions + * Format using black ([`40fc84b`](https://github.com/supabase-community/storage-py/commit/40fc84b7784b37b9da24c09d2eba2d282603c4fb)) * Merge branch 'main' into dependabot/pip/main/httpx-0.24.0 ([`c1b64e1`](https://github.com/supabase-community/storage-py/commit/c1b64e105e06f146499ef7503a958e4f143cd4ed)) @@ -989,40 +989,40 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`68df5c2`](https://g * chore(deps-dev): bump pytest-asyncio from 0.19.0 to 0.20.1 (#26) -Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. -- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) -- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) - ---- -updated-dependencies: -- dependency-name: pytest-asyncio - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. +- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) +- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) + +--- +updated-dependencies: +- dependency-name: pytest-asyncio + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`999e8c9`](https://github.com/supabase-community/storage-py/commit/999e8c993822177d017ab3f7a69aea0209fefea2)) * chore(deps-dev): bump pytest from 6.2.5 to 7.2.0 (#28) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-major -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-major +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`ed35024`](https://github.com/supabase-community/storage-py/commit/ed35024fea5f28fafd6e9b66e73b689e5a9f12f5)) * chore(deps-dev): bump pytest-cov from 3.0.0 to 4.0.0 @@ -1043,21 +1043,21 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`d22118b`](https://g * chore(deps-dev): bump sphinx from 5.2.3 to 5.3.0 (#25) -Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. -- [Release notes](https://github.com/sphinx-doc/sphinx/releases) -- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) -- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) - ---- -updated-dependencies: -- dependency-name: sphinx - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. +- [Release notes](https://github.com/sphinx-doc/sphinx/releases) +- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) +- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) + +--- +updated-dependencies: +- dependency-name: sphinx + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`9f7bc01`](https://github.com/supabase-community/storage-py/commit/9f7bc01b135fbdcb1f7767f426011c0630408712)) ### Feature @@ -1072,18 +1072,18 @@ Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.githu * fix: datetime and upload file type (#12) -* [fix] datetime and upload file type - -fix datetime error and add more acceptable file type - -* [Fix] Add python-dateutil as dependency - -* Fix lock file - -* chore: reformat with black - -* chore: calm isort down - +* [fix] datetime and upload file type + +fix datetime error and add more acceptable file type + +* [Fix] Add python-dateutil as dependency + +* Fix lock file + +* chore: reformat with black + +* chore: calm isort down + Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`a926a06`](https://github.com/supabase-community/storage-py/commit/a926a068234e68afbf8039fc7f71565397dfea86)) ### Unknown @@ -1260,8 +1260,8 @@ chore(deps-dev): bump pytest-asyncio from 0.18.3 to 0.19.0 ([`31d886c`](https:// * Justinbarak patch 1 (#14) -* Removed double "/" in get_public_url - +* Removed double "/" in get_public_url + * Removed double "/" in get_public_url ([`20de85e`](https://github.com/supabase-community/storage-py/commit/20de85e677e29cd17bb210a402be947f0ad98509)) @@ -1321,12 +1321,12 @@ fix: upload fixes ([`844561f`](https://github.com/supabase-community/storage-py/ * Docs (#6) -* docs: setup - -* docs: write basic documentation - -* chore: fix lock file - +* docs: setup + +* docs: write basic documentation + +* chore: fix lock file + * chore: calm pre-commit down ([`0974414`](https://github.com/supabase-community/storage-py/commit/0974414707f3e97fc8e44197d1f59a5699a0b582)) @@ -1502,22 +1502,22 @@ Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`734 * Sync support (#1) -* deps: update black, add unasync - -* feat: make BaseBucket - -* feat: rework bucket, file APIs - -* fix: avoid circular import on StorageException - -* deps: add dotenv - -* feat: pass User-Agent header with requests - -* fix: correct type-hint - -* fix: formatting - +* deps: update black, add unasync + +* feat: make BaseBucket + +* feat: rework bucket, file APIs + +* fix: avoid circular import on StorageException + +* deps: add dotenv + +* feat: pass User-Agent header with requests + +* fix: correct type-hint + +* fix: formatting + * chore: update example in README ([`75c9c43`](https://github.com/supabase-community/storage-py/commit/75c9c43ea373cb58970255b8e7438c2ec67e7f25)) * Merge branch 'main' of github.com:J0/storage-py into main ([`d41b573`](https://github.com/supabase-community/storage-py/commit/d41b57391f04453986f06d564c5c207e4c75b7cc)) diff --git a/storage3/_async/file_api.py b/storage3/_async/file_api.py index b980a573..246a4a77 100644 --- a/storage3/_async/file_api.py +++ b/storage3/_async/file_api.py @@ -15,9 +15,9 @@ CreateSignedURLsOptions, FileOptions, ListBucketFilesOptions, + Options, RequestMethod, SignedUploadURL, - TransformOptions, ) from ..utils import AsyncClient, StorageException @@ -201,7 +201,9 @@ async def create_signed_urls( ] = f"{self._client.base_url}{cast(str, item['signedURL']).lstrip('/')}" return data - async def get_public_url(self, path: str, options: TransformOptions = {}) -> str: + async def get_public_url( + self, path: str, options: Options = {"transform": {}} + ) -> str: """ Parameters ---------- @@ -209,7 +211,7 @@ async def get_public_url(self, path: str, options: TransformOptions = {}) -> str file path, including the path and file name. For example `folder/image.png`. """ render_path = "render/image" if options.get("transform") else "object" - transformation_query = urllib.parse.urlencode(options) + transformation_query = urllib.parse.urlencode(options.get("transform")) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) return f"{self._client.base_url}{render_path}/public/{_path}{query_string}" @@ -304,7 +306,7 @@ async def list( ) return response.json() - async def download(self, path: str, options: TransformOptions = {}) -> bytes: + async def download(self, path: str, options: Options = {"transform": {}}) -> bytes: """ Downloads a file. @@ -316,7 +318,7 @@ async def download(self, path: str, options: TransformOptions = {}) -> bytes: render_path = ( "render/image/authenticated" if options.get("transform") else "object" ) - transformation_query = urllib.parse.urlencode(options) + transformation_query = urllib.parse.urlencode(options.get("transform")) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index eaadbcbc..1a224c62 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -15,9 +15,9 @@ CreateSignedURLsOptions, FileOptions, ListBucketFilesOptions, + Options, RequestMethod, SignedUploadURL, - TransformOptions, ) from ..utils import StorageException, SyncClient @@ -201,7 +201,7 @@ def create_signed_urls( ] = f"{self._client.base_url}{cast(str, item['signedURL']).lstrip('/')}" return data - def get_public_url(self, path: str, options: TransformOptions = {}) -> str: + def get_public_url(self, path: str, options: Options = {"transform": {}}) -> str: """ Parameters ---------- @@ -209,7 +209,7 @@ def get_public_url(self, path: str, options: TransformOptions = {}) -> str: file path, including the path and file name. For example `folder/image.png`. """ render_path = "render/image" if options.get("transform") else "object" - transformation_query = urllib.parse.urlencode(options) + transformation_query = urllib.parse.urlencode(options.get("transform")) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) return f"{self._client.base_url}{render_path}/public/{_path}{query_string}" @@ -304,7 +304,7 @@ def list( ) return response.json() - def download(self, path: str, options: TransformOptions = {}) -> bytes: + def download(self, path: str, options: Options = {"transform": {}}) -> bytes: """ Downloads a file. @@ -316,7 +316,7 @@ def download(self, path: str, options: TransformOptions = {}) -> bytes: render_path = ( "render/image/authenticated" if options.get("transform") else "object" ) - transformation_query = urllib.parse.urlencode(options) + transformation_query = urllib.parse.urlencode(options.get("transform")) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) diff --git a/storage3/types.py b/storage3/types.py index 3c214dbe..6486e6c2 100644 --- a/storage3/types.py +++ b/storage3/types.py @@ -71,6 +71,10 @@ class CreateSignedURLsOptions(TypedDict): download: Union[str, bool] +class Options(TypedDict): + transform: TransformOptions + + FileOptions = TypedDict( "FileOptions", {"cache-control": str, "content-type": str, "x-upsert": str}, From 4fc7d8d9b6dfcfc8068834cfed1fdd5691ae38fc Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Sep 2023 21:35:43 +0000 Subject: [PATCH 2/3] Rename options typehint Add download option to get_public_url --- CHANGELOG.md | 296 ++++++++++++++++++------------------ storage3/_async/file_api.py | 39 +++-- storage3/_sync/file_api.py | 39 +++-- storage3/types.py | 4 +- 4 files changed, 209 insertions(+), 169 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf2a60a..32c7f2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -287,19 +287,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`c008911`](https://g * chore(deps-dev): bump pytest from 7.3.1 to 7.3.2 (#108) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-patch -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-patch +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`e5df2ff`](https://github.com/supabase-community/storage-py/commit/e5df2ff8a269337d206b7396ebab04039eb1684e)) * chore: test upload_to_signed_url ([`82ccab4`](https://github.com/supabase-community/storage-py/commit/82ccab43c98ae55078ed5fab76d9c12320261235)) @@ -341,19 +341,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`1eef352`](https://g * chore(deps-dev): bump pytest from 7.2.2 to 7.3.1 (#88) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a95a244`](https://github.com/supabase-community/storage-py/commit/a95a24410be08e9276f3e8214b621f6b82fd81ba)) * chore(deps): bump httpx from 0.23.3 to 0.24.0 @@ -374,19 +374,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`84335cd`](https://g * chore(deps-dev): bump pre-commit from 3.1.1 to 3.2.0 (#79) -Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. -- [Release notes](https://github.com/pre-commit/pre-commit/releases) -- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) -- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) - ---- -updated-dependencies: -- dependency-name: pre-commit - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. +- [Release notes](https://github.com/pre-commit/pre-commit/releases) +- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) +- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) + +--- +updated-dependencies: +- dependency-name: pre-commit + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a603a2a`](https://github.com/supabase-community/storage-py/commit/a603a2a684cf6d47eb5b58866c8c8263cc909852)) * chore(deps-dev): bump pytest from 7.2.1 to 7.2.2 @@ -417,25 +417,25 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`e764f25`](https://g * feat: created functions to get multiple signed URLs. (#105) -* feat: created functions to get multiple signed URLs. - -* feat: Fixed optional params. Handling auth token issue #73 in separate PR. - -* feat: remove sync code as it will be generated by unasync. - -* chore: generate sync client - ---------- - -Co-authored-by: Alexander Leonov <alleonov@icloud.com> +* feat: created functions to get multiple signed URLs. + +* feat: Fixed optional params. Handling auth token issue #73 in separate PR. + +* feat: remove sync code as it will be generated by unasync. + +* chore: generate sync client + +--------- + +Co-authored-by: Alexander Leonov <alleonov@icloud.com> Co-authored-by: anand2312 <40204976+anand2312@users.noreply.github.com> ([`2c5e2fc`](https://github.com/supabase-community/storage-py/commit/2c5e2fc309ab0f862a21e52da9b0e7c2c9d24e19)) * feat: bucket level file controls and an update_bucket method (#103) -* feat: bucket level file controls and an update_bucket method - -* fix: import __future__ annotations - +* feat: bucket level file controls and an update_bucket method + +* fix: import __future__ annotations + python 3.8 doesn't allow subscripting types like list ([`80454f9`](https://github.com/supabase-community/storage-py/commit/80454f9f6de5d6d5db9840b848b39937fabf5407)) ### Unknown @@ -478,17 +478,17 @@ chore(deps): bump httpx from 0.23.3 to 0.24.1 ([`fc18260`](https://github.com/su * Make FileOptions type (#100) -* Update lockfile - -* feat: add FileOptions type, make some bucket fields optional - -* feat: use FileOptions in upload and document it - -* docs: add upload example to README - -* fix: don't mark BaseBucket fields as default - -this breaks every other class that inherits from BaseBucket and tries to add +* Update lockfile + +* feat: add FileOptions type, make some bucket fields optional + +* feat: use FileOptions in upload and document it + +* docs: add upload example to README + +* fix: don't mark BaseBucket fields as default + +this breaks every other class that inherits from BaseBucket and tries to add any non-default field. ([`1585e42`](https://github.com/supabase-community/storage-py/commit/1585e4279427934d5e027fc3ea2874085748caa6)) * Merge pull request #87 from supabase-community/dependabot/pip/main/httpx-0.24.0 @@ -497,8 +497,8 @@ chore(deps): bump httpx from 0.23.3 to 0.24.0 ([`b69a8ba`](https://github.com/su * Fix bad typing on upload functions (#89) -* Fix bad typing on upload functions - +* Fix bad typing on upload functions + * Format using black ([`40fc84b`](https://github.com/supabase-community/storage-py/commit/40fc84b7784b37b9da24c09d2eba2d282603c4fb)) * Merge branch 'main' into dependabot/pip/main/httpx-0.24.0 ([`c1b64e1`](https://github.com/supabase-community/storage-py/commit/c1b64e105e06f146499ef7503a958e4f143cd4ed)) @@ -989,40 +989,40 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`68df5c2`](https://g * chore(deps-dev): bump pytest-asyncio from 0.19.0 to 0.20.1 (#26) -Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. -- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) -- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) - ---- -updated-dependencies: -- dependency-name: pytest-asyncio - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. +- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) +- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) + +--- +updated-dependencies: +- dependency-name: pytest-asyncio + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`999e8c9`](https://github.com/supabase-community/storage-py/commit/999e8c993822177d017ab3f7a69aea0209fefea2)) * chore(deps-dev): bump pytest from 6.2.5 to 7.2.0 (#28) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-major -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-major +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`ed35024`](https://github.com/supabase-community/storage-py/commit/ed35024fea5f28fafd6e9b66e73b689e5a9f12f5)) * chore(deps-dev): bump pytest-cov from 3.0.0 to 4.0.0 @@ -1043,21 +1043,21 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`d22118b`](https://g * chore(deps-dev): bump sphinx from 5.2.3 to 5.3.0 (#25) -Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. -- [Release notes](https://github.com/sphinx-doc/sphinx/releases) -- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) -- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) - ---- -updated-dependencies: -- dependency-name: sphinx - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. +- [Release notes](https://github.com/sphinx-doc/sphinx/releases) +- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) +- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) + +--- +updated-dependencies: +- dependency-name: sphinx + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`9f7bc01`](https://github.com/supabase-community/storage-py/commit/9f7bc01b135fbdcb1f7767f426011c0630408712)) ### Feature @@ -1072,18 +1072,18 @@ Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.githu * fix: datetime and upload file type (#12) -* [fix] datetime and upload file type - -fix datetime error and add more acceptable file type - -* [Fix] Add python-dateutil as dependency - -* Fix lock file - -* chore: reformat with black - -* chore: calm isort down - +* [fix] datetime and upload file type + +fix datetime error and add more acceptable file type + +* [Fix] Add python-dateutil as dependency + +* Fix lock file + +* chore: reformat with black + +* chore: calm isort down + Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`a926a06`](https://github.com/supabase-community/storage-py/commit/a926a068234e68afbf8039fc7f71565397dfea86)) ### Unknown @@ -1260,8 +1260,8 @@ chore(deps-dev): bump pytest-asyncio from 0.18.3 to 0.19.0 ([`31d886c`](https:// * Justinbarak patch 1 (#14) -* Removed double "/" in get_public_url - +* Removed double "/" in get_public_url + * Removed double "/" in get_public_url ([`20de85e`](https://github.com/supabase-community/storage-py/commit/20de85e677e29cd17bb210a402be947f0ad98509)) @@ -1321,12 +1321,12 @@ fix: upload fixes ([`844561f`](https://github.com/supabase-community/storage-py/ * Docs (#6) -* docs: setup - -* docs: write basic documentation - -* chore: fix lock file - +* docs: setup + +* docs: write basic documentation + +* chore: fix lock file + * chore: calm pre-commit down ([`0974414`](https://github.com/supabase-community/storage-py/commit/0974414707f3e97fc8e44197d1f59a5699a0b582)) @@ -1502,22 +1502,22 @@ Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`734 * Sync support (#1) -* deps: update black, add unasync - -* feat: make BaseBucket - -* feat: rework bucket, file APIs - -* fix: avoid circular import on StorageException - -* deps: add dotenv - -* feat: pass User-Agent header with requests - -* fix: correct type-hint - -* fix: formatting - +* deps: update black, add unasync + +* feat: make BaseBucket + +* feat: rework bucket, file APIs + +* fix: avoid circular import on StorageException + +* deps: add dotenv + +* feat: pass User-Agent header with requests + +* fix: correct type-hint + +* fix: formatting + * chore: update example in README ([`75c9c43`](https://github.com/supabase-community/storage-py/commit/75c9c43ea373cb58970255b8e7438c2ec67e7f25)) * Merge branch 'main' of github.com:J0/storage-py into main ([`d41b573`](https://github.com/supabase-community/storage-py/commit/d41b57391f04453986f06d564c5c207e4c75b7cc)) diff --git a/storage3/_async/file_api.py b/storage3/_async/file_api.py index 246a4a77..de990a6f 100644 --- a/storage3/_async/file_api.py +++ b/storage3/_async/file_api.py @@ -11,13 +11,13 @@ from ..constants import DEFAULT_FILE_OPTIONS, DEFAULT_SEARCH_OPTIONS from ..types import ( BaseBucket, - CreateSignedURLOptions, CreateSignedURLsOptions, + DownloadOptions, FileOptions, ListBucketFilesOptions, - Options, RequestMethod, SignedUploadURL, + URLOptions, ) from ..utils import AsyncClient, StorageException @@ -142,7 +142,7 @@ async def upload_to_signed_url( ) async def create_signed_url( - self, path: str, expires_in: int, options: CreateSignedURLOptions = {} + self, path: str, expires_in: int, options: URLOptions = {} ) -> dict[str, str]: """ Parameters @@ -201,18 +201,37 @@ async def create_signed_urls( ] = f"{self._client.base_url}{cast(str, item['signedURL']).lstrip('/')}" return data - async def get_public_url( - self, path: str, options: Options = {"transform": {}} - ) -> str: + async def get_public_url(self, path: str, options: URLOptions = {}) -> str: """ Parameters ---------- path file path, including the path and file name. For example `folder/image.png`. """ + _query_string = [] + download_query = None + if options.get("download"): + download_query = ( + "download=" + if options.get("download") is True + else f"download={options.get('download')}" + ) + + if download_query: + _query_string.append(download_query) + render_path = "render/image" if options.get("transform") else "object" - transformation_query = urllib.parse.urlencode(options.get("transform")) - query_string = f"?{transformation_query}" if transformation_query else "" + transformation_query = ( + urllib.parse.urlencode(options.get("transform")) + if options.get("transform") + else None + ) + + if transformation_query: + _query_string.append(transformation_query) + + query_string = "&".join(_query_string) + query_string = f"?{query_string}" _path = self._get_final_path(path) return f"{self._client.base_url}{render_path}/public/{_path}{query_string}" @@ -306,7 +325,7 @@ async def list( ) return response.json() - async def download(self, path: str, options: Options = {"transform": {}}) -> bytes: + async def download(self, path: str, options: DownloadOptions = {}) -> bytes: """ Downloads a file. @@ -318,7 +337,7 @@ async def download(self, path: str, options: Options = {"transform": {}}) -> byt render_path = ( "render/image/authenticated" if options.get("transform") else "object" ) - transformation_query = urllib.parse.urlencode(options.get("transform")) + transformation_query = urllib.parse.urlencode(options.get("transform") or {}) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 1a224c62..0bdbd54d 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -11,15 +11,15 @@ from ..constants import DEFAULT_FILE_OPTIONS, DEFAULT_SEARCH_OPTIONS from ..types import ( BaseBucket, - CreateSignedURLOptions, CreateSignedURLsOptions, + DownloadOptions, FileOptions, ListBucketFilesOptions, - Options, RequestMethod, SignedUploadURL, + URLOptions, ) -from ..utils import StorageException, SyncClient +from ..utils import SyncClient, StorageException __all__ = ["SyncBucket"] @@ -142,7 +142,7 @@ def upload_to_signed_url( ) def create_signed_url( - self, path: str, expires_in: int, options: CreateSignedURLOptions = {} + self, path: str, expires_in: int, options: URLOptions = {} ) -> dict[str, str]: """ Parameters @@ -201,16 +201,37 @@ def create_signed_urls( ] = f"{self._client.base_url}{cast(str, item['signedURL']).lstrip('/')}" return data - def get_public_url(self, path: str, options: Options = {"transform": {}}) -> str: + def get_public_url(self, path: str, options: URLOptions = {}) -> str: """ Parameters ---------- path file path, including the path and file name. For example `folder/image.png`. """ + _query_string = [] + download_query = None + if options.get("download"): + download_query = ( + "download=" + if options.get("download") is True + else f"download={options.get('download')}" + ) + + if download_query: + _query_string.append(download_query) + render_path = "render/image" if options.get("transform") else "object" - transformation_query = urllib.parse.urlencode(options.get("transform")) - query_string = f"?{transformation_query}" if transformation_query else "" + transformation_query = ( + urllib.parse.urlencode(options.get("transform")) + if options.get("transform") + else None + ) + + if transformation_query: + _query_string.append(transformation_query) + + query_string = "&".join(_query_string) + query_string = f"?{query_string}" _path = self._get_final_path(path) return f"{self._client.base_url}{render_path}/public/{_path}{query_string}" @@ -304,7 +325,7 @@ def list( ) return response.json() - def download(self, path: str, options: Options = {"transform": {}}) -> bytes: + def download(self, path: str, options: DownloadOptions = {}) -> bytes: """ Downloads a file. @@ -316,7 +337,7 @@ def download(self, path: str, options: Options = {"transform": {}}) -> bytes: render_path = ( "render/image/authenticated" if options.get("transform") else "object" ) - transformation_query = urllib.parse.urlencode(options.get("transform")) + transformation_query = urllib.parse.urlencode(options.get("transform") or {}) query_string = f"?{transformation_query}" if transformation_query else "" _path = self._get_final_path(path) diff --git a/storage3/types.py b/storage3/types.py index 6486e6c2..cd193fdf 100644 --- a/storage3/types.py +++ b/storage3/types.py @@ -62,7 +62,7 @@ class TransformOptions(TypedDict, total=False): quality: int -class CreateSignedURLOptions(TypedDict, total=False): +class URLOptions(TypedDict, total=False): download: Union[str, bool] transform: TransformOptions @@ -71,7 +71,7 @@ class CreateSignedURLsOptions(TypedDict): download: Union[str, bool] -class Options(TypedDict): +class DownloadOptions(TypedDict, total=False): transform: TransformOptions From f8f7482de2088a5539b3c68f53e4c76578c58a70 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 27 Sep 2023 21:43:40 +0000 Subject: [PATCH 3/3] Ran pre-commit hooks --- CHANGELOG.md | 296 ++++++++++++++++++------------------- storage3/_sync/file_api.py | 2 +- 2 files changed, 149 insertions(+), 149 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c7f2c0..8cf2a60a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -287,19 +287,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`c008911`](https://g * chore(deps-dev): bump pytest from 7.3.1 to 7.3.2 (#108) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-patch -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.3.2. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.3.2) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-patch +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`e5df2ff`](https://github.com/supabase-community/storage-py/commit/e5df2ff8a269337d206b7396ebab04039eb1684e)) * chore: test upload_to_signed_url ([`82ccab4`](https://github.com/supabase-community/storage-py/commit/82ccab43c98ae55078ed5fab76d9c12320261235)) @@ -341,19 +341,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`1eef352`](https://g * chore(deps-dev): bump pytest from 7.2.2 to 7.3.1 (#88) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.2 to 7.3.1. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.2...7.3.1) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a95a244`](https://github.com/supabase-community/storage-py/commit/a95a24410be08e9276f3e8214b621f6b82fd81ba)) * chore(deps): bump httpx from 0.23.3 to 0.24.0 @@ -374,19 +374,19 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`84335cd`](https://g * chore(deps-dev): bump pre-commit from 3.1.1 to 3.2.0 (#79) -Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. -- [Release notes](https://github.com/pre-commit/pre-commit/releases) -- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) -- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) - ---- -updated-dependencies: -- dependency-name: pre-commit - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.1.1 to 3.2.0. +- [Release notes](https://github.com/pre-commit/pre-commit/releases) +- [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) +- [Commits](https://github.com/pre-commit/pre-commit/compare/v3.1.1...v3.2.0) + +--- +updated-dependencies: +- dependency-name: pre-commit + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`a603a2a`](https://github.com/supabase-community/storage-py/commit/a603a2a684cf6d47eb5b58866c8c8263cc909852)) * chore(deps-dev): bump pytest from 7.2.1 to 7.2.2 @@ -417,25 +417,25 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`e764f25`](https://g * feat: created functions to get multiple signed URLs. (#105) -* feat: created functions to get multiple signed URLs. - -* feat: Fixed optional params. Handling auth token issue #73 in separate PR. - -* feat: remove sync code as it will be generated by unasync. - -* chore: generate sync client - ---------- - -Co-authored-by: Alexander Leonov <alleonov@icloud.com> +* feat: created functions to get multiple signed URLs. + +* feat: Fixed optional params. Handling auth token issue #73 in separate PR. + +* feat: remove sync code as it will be generated by unasync. + +* chore: generate sync client + +--------- + +Co-authored-by: Alexander Leonov <alleonov@icloud.com> Co-authored-by: anand2312 <40204976+anand2312@users.noreply.github.com> ([`2c5e2fc`](https://github.com/supabase-community/storage-py/commit/2c5e2fc309ab0f862a21e52da9b0e7c2c9d24e19)) * feat: bucket level file controls and an update_bucket method (#103) -* feat: bucket level file controls and an update_bucket method - -* fix: import __future__ annotations - +* feat: bucket level file controls and an update_bucket method + +* fix: import __future__ annotations + python 3.8 doesn't allow subscripting types like list ([`80454f9`](https://github.com/supabase-community/storage-py/commit/80454f9f6de5d6d5db9840b848b39937fabf5407)) ### Unknown @@ -478,17 +478,17 @@ chore(deps): bump httpx from 0.23.3 to 0.24.1 ([`fc18260`](https://github.com/su * Make FileOptions type (#100) -* Update lockfile - -* feat: add FileOptions type, make some bucket fields optional - -* feat: use FileOptions in upload and document it - -* docs: add upload example to README - -* fix: don't mark BaseBucket fields as default - -this breaks every other class that inherits from BaseBucket and tries to add +* Update lockfile + +* feat: add FileOptions type, make some bucket fields optional + +* feat: use FileOptions in upload and document it + +* docs: add upload example to README + +* fix: don't mark BaseBucket fields as default + +this breaks every other class that inherits from BaseBucket and tries to add any non-default field. ([`1585e42`](https://github.com/supabase-community/storage-py/commit/1585e4279427934d5e027fc3ea2874085748caa6)) * Merge pull request #87 from supabase-community/dependabot/pip/main/httpx-0.24.0 @@ -497,8 +497,8 @@ chore(deps): bump httpx from 0.23.3 to 0.24.0 ([`b69a8ba`](https://github.com/su * Fix bad typing on upload functions (#89) -* Fix bad typing on upload functions - +* Fix bad typing on upload functions + * Format using black ([`40fc84b`](https://github.com/supabase-community/storage-py/commit/40fc84b7784b37b9da24c09d2eba2d282603c4fb)) * Merge branch 'main' into dependabot/pip/main/httpx-0.24.0 ([`c1b64e1`](https://github.com/supabase-community/storage-py/commit/c1b64e105e06f146499ef7503a958e4f143cd4ed)) @@ -989,40 +989,40 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`68df5c2`](https://g * chore(deps-dev): bump pytest-asyncio from 0.19.0 to 0.20.1 (#26) -Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. -- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) -- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) - ---- -updated-dependencies: -- dependency-name: pytest-asyncio - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1. +- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) +- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1) + +--- +updated-dependencies: +- dependency-name: pytest-asyncio + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`999e8c9`](https://github.com/supabase-community/storage-py/commit/999e8c993822177d017ab3f7a69aea0209fefea2)) * chore(deps-dev): bump pytest from 6.2.5 to 7.2.0 (#28) -Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. -- [Release notes](https://github.com/pytest-dev/pytest/releases) -- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) -- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) - ---- -updated-dependencies: -- dependency-name: pytest - dependency-type: direct:development - update-type: version-update:semver-major -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.2.0. +- [Release notes](https://github.com/pytest-dev/pytest/releases) +- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) +- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.2.0) + +--- +updated-dependencies: +- dependency-name: pytest + dependency-type: direct:development + update-type: version-update:semver-major +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`ed35024`](https://github.com/supabase-community/storage-py/commit/ed35024fea5f28fafd6e9b66e73b689e5a9f12f5)) * chore(deps-dev): bump pytest-cov from 3.0.0 to 4.0.0 @@ -1043,21 +1043,21 @@ Signed-off-by: dependabot[bot] <support@github.com> ([`d22118b`](https://g * chore(deps-dev): bump sphinx from 5.2.3 to 5.3.0 (#25) -Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. -- [Release notes](https://github.com/sphinx-doc/sphinx/releases) -- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) -- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) - ---- -updated-dependencies: -- dependency-name: sphinx - dependency-type: direct:development - update-type: version-update:semver-minor -... - -Signed-off-by: dependabot[bot] <support@github.com> - -Signed-off-by: dependabot[bot] <support@github.com> +Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.2.3 to 5.3.0. +- [Release notes](https://github.com/sphinx-doc/sphinx/releases) +- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) +- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.2.3...v5.3.0) + +--- +updated-dependencies: +- dependency-name: sphinx + dependency-type: direct:development + update-type: version-update:semver-minor +... + +Signed-off-by: dependabot[bot] <support@github.com> + +Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> ([`9f7bc01`](https://github.com/supabase-community/storage-py/commit/9f7bc01b135fbdcb1f7767f426011c0630408712)) ### Feature @@ -1072,18 +1072,18 @@ Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.githu * fix: datetime and upload file type (#12) -* [fix] datetime and upload file type - -fix datetime error and add more acceptable file type - -* [Fix] Add python-dateutil as dependency - -* Fix lock file - -* chore: reformat with black - -* chore: calm isort down - +* [fix] datetime and upload file type + +fix datetime error and add more acceptable file type + +* [Fix] Add python-dateutil as dependency + +* Fix lock file + +* chore: reformat with black + +* chore: calm isort down + Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`a926a06`](https://github.com/supabase-community/storage-py/commit/a926a068234e68afbf8039fc7f71565397dfea86)) ### Unknown @@ -1260,8 +1260,8 @@ chore(deps-dev): bump pytest-asyncio from 0.18.3 to 0.19.0 ([`31d886c`](https:// * Justinbarak patch 1 (#14) -* Removed double "/" in get_public_url - +* Removed double "/" in get_public_url + * Removed double "/" in get_public_url ([`20de85e`](https://github.com/supabase-community/storage-py/commit/20de85e677e29cd17bb210a402be947f0ad98509)) @@ -1321,12 +1321,12 @@ fix: upload fixes ([`844561f`](https://github.com/supabase-community/storage-py/ * Docs (#6) -* docs: setup - -* docs: write basic documentation - -* chore: fix lock file - +* docs: setup + +* docs: write basic documentation + +* chore: fix lock file + * chore: calm pre-commit down ([`0974414`](https://github.com/supabase-community/storage-py/commit/0974414707f3e97fc8e44197d1f59a5699a0b582)) @@ -1502,22 +1502,22 @@ Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com> ([`734 * Sync support (#1) -* deps: update black, add unasync - -* feat: make BaseBucket - -* feat: rework bucket, file APIs - -* fix: avoid circular import on StorageException - -* deps: add dotenv - -* feat: pass User-Agent header with requests - -* fix: correct type-hint - -* fix: formatting - +* deps: update black, add unasync + +* feat: make BaseBucket + +* feat: rework bucket, file APIs + +* fix: avoid circular import on StorageException + +* deps: add dotenv + +* feat: pass User-Agent header with requests + +* fix: correct type-hint + +* fix: formatting + * chore: update example in README ([`75c9c43`](https://github.com/supabase-community/storage-py/commit/75c9c43ea373cb58970255b8e7438c2ec67e7f25)) * Merge branch 'main' of github.com:J0/storage-py into main ([`d41b573`](https://github.com/supabase-community/storage-py/commit/d41b57391f04453986f06d564c5c207e4c75b7cc)) diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 0bdbd54d..fe6c9d66 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -19,7 +19,7 @@ SignedUploadURL, URLOptions, ) -from ..utils import SyncClient, StorageException +from ..utils import StorageException, SyncClient __all__ = ["SyncBucket"]