From 9c1fe8936ca4ea5a5eb20238bd5091f573ab4dab Mon Sep 17 00:00:00 2001 From: "J.R. Hill" Date: Tue, 2 Jan 2024 10:22:25 -0800 Subject: [PATCH] chore: bump dependencies, update for pycodestyle --- .github/workflows/main.yaml | 2 +- README.md | 2 +- openfga_sdk/api/open_fga_api.py | 60 +++++++++++++------------- openfga_sdk/api_client.py | 76 ++++++++++++++++----------------- openfga_sdk/client/client.py | 8 ++-- openfga_sdk/configuration.py | 5 ++- openfga_sdk/sync/api_client.py | 2 +- test-requirements.txt | 2 +- 8 files changed, 79 insertions(+), 78 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3df9ef2..5badd92 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -66,7 +66,7 @@ jobs: python setup.py sdist bdist_wheel - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/README.md b/README.md index 427e351..2147293 100644 --- a/README.md +++ b/README.md @@ -723,7 +723,7 @@ body = ClientListRelationsRequest( ) var response = await fga_client.list_relations(body, options); -// response.relations = ["can_view", "can_edit"] +# response.relations = ["can_view", "can_edit"] ``` #### Assertions diff --git a/openfga_sdk/api/open_fga_api.py b/openfga_sdk/api/open_fga_api.py index 8238a4f..4c1d42d 100644 --- a/openfga_sdk/api/open_fga_api.py +++ b/openfga_sdk/api/open_fga_api.py @@ -78,7 +78,7 @@ async def check(self, body, **kwargs): # noqa: E501 :rtype: CheckResponse """ kwargs['_return_http_data_only'] = True - return await(self.check_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.check_with_http_info(body, **kwargs)) # noqa: E501 async def check_with_http_info(self, body, **kwargs): # noqa: E501 """Check whether a user is authorized to access an object # noqa: E501 @@ -183,7 +183,7 @@ async def check_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/check'.replace('{store_id}', store_id), 'POST', path_params, query_params, @@ -227,7 +227,7 @@ async def create_store(self, body, **kwargs): # noqa: E501 :rtype: CreateStoreResponse """ kwargs['_return_http_data_only'] = True - return await(self.create_store_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.create_store_with_http_info(body, **kwargs)) # noqa: E501 async def create_store_with_http_info(self, body, **kwargs): # noqa: E501 """Create a store # noqa: E501 @@ -325,7 +325,7 @@ async def create_store_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores', 'POST', path_params, query_params, @@ -367,7 +367,7 @@ async def delete_store(self, **kwargs): # noqa: E501 :rtype: None """ kwargs['_return_http_data_only'] = True - return await(self.delete_store_with_http_info(**kwargs)) # noqa: E501 + return await (self.delete_store_with_http_info(**kwargs)) # noqa: E501 async def delete_store_with_http_info(self, **kwargs): # noqa: E501 """Delete a store # noqa: E501 @@ -453,7 +453,7 @@ async def delete_store_with_http_info(self, **kwargs): # noqa: E501 response_types_map = {} - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}'.replace('{store_id}', store_id), 'DELETE', path_params, query_params, @@ -497,7 +497,7 @@ async def expand(self, body, **kwargs): # noqa: E501 :rtype: ExpandResponse """ kwargs['_return_http_data_only'] = True - return await(self.expand_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.expand_with_http_info(body, **kwargs)) # noqa: E501 async def expand_with_http_info(self, body, **kwargs): # noqa: E501 """Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship # noqa: E501 @@ -602,7 +602,7 @@ async def expand_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/expand'.replace('{store_id}', store_id), 'POST', path_params, query_params, @@ -644,7 +644,7 @@ async def get_store(self, **kwargs): # noqa: E501 :rtype: GetStoreResponse """ kwargs['_return_http_data_only'] = True - return await(self.get_store_with_http_info(**kwargs)) # noqa: E501 + return await (self.get_store_with_http_info(**kwargs)) # noqa: E501 async def get_store_with_http_info(self, **kwargs): # noqa: E501 """Get a store # noqa: E501 @@ -735,7 +735,7 @@ async def get_store_with_http_info(self, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}'.replace('{store_id}', store_id), 'GET', path_params, query_params, @@ -779,7 +779,7 @@ async def list_objects(self, body, **kwargs): # noqa: E501 :rtype: ListObjectsResponse """ kwargs['_return_http_data_only'] = True - return await(self.list_objects_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.list_objects_with_http_info(body, **kwargs)) # noqa: E501 async def list_objects_with_http_info(self, body, **kwargs): # noqa: E501 """List all objects of the given type that the user has a relation with # noqa: E501 @@ -884,7 +884,7 @@ async def list_objects_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/list-objects'.replace('{store_id}', store_id), 'POST', path_params, query_params, @@ -930,7 +930,7 @@ async def list_stores(self, **kwargs): # noqa: E501 :rtype: ListStoresResponse """ kwargs['_return_http_data_only'] = True - return await(self.list_stores_with_http_info(**kwargs)) # noqa: E501 + return await (self.list_stores_with_http_info(**kwargs)) # noqa: E501 async def list_stores_with_http_info(self, **kwargs): # noqa: E501 """List all stores # noqa: E501 @@ -1027,7 +1027,7 @@ async def list_stores_with_http_info(self, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores', 'GET', path_params, query_params, @@ -1071,7 +1071,7 @@ async def read(self, body, **kwargs): # noqa: E501 :rtype: ReadResponse """ kwargs['_return_http_data_only'] = True - return await(self.read_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.read_with_http_info(body, **kwargs)) # noqa: E501 async def read_with_http_info(self, body, **kwargs): # noqa: E501 """Get tuples from the store that matches a query, without following userset rewrite rules # noqa: E501 @@ -1176,7 +1176,7 @@ async def read_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/read'.replace('{store_id}', store_id), 'POST', path_params, query_params, @@ -1220,7 +1220,7 @@ async def read_assertions(self, authorization_model_id, **kwargs): # noqa: E501 :rtype: ReadAssertionsResponse """ kwargs['_return_http_data_only'] = True - return await(self.read_assertions_with_http_info(authorization_model_id, **kwargs)) # noqa: E501 + return await (self.read_assertions_with_http_info(authorization_model_id, **kwargs)) # noqa: E501 async def read_assertions_with_http_info(self, authorization_model_id, **kwargs): # noqa: E501 """Read assertions for an authorization model ID # noqa: E501 @@ -1321,7 +1321,7 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs) 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/assertions/{authorization_model_id}'.replace( '{store_id}', store_id), 'GET', path_params, @@ -1366,7 +1366,7 @@ async def read_authorization_model(self, id, **kwargs): # noqa: E501 :rtype: ReadAuthorizationModelResponse """ kwargs['_return_http_data_only'] = True - return await(self.read_authorization_model_with_http_info(id, **kwargs)) # noqa: E501 + return await (self.read_authorization_model_with_http_info(id, **kwargs)) # noqa: E501 async def read_authorization_model_with_http_info(self, id, **kwargs): # noqa: E501 """Return a particular version of an authorization model # noqa: E501 @@ -1467,7 +1467,7 @@ async def read_authorization_model_with_http_info(self, id, **kwargs): # noqa: 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/authorization-models/{id}'.replace('{store_id}', store_id), 'GET', path_params, query_params, @@ -1513,7 +1513,7 @@ async def read_authorization_models(self, **kwargs): # noqa: E501 :rtype: ReadAuthorizationModelsResponse """ kwargs['_return_http_data_only'] = True - return await(self.read_authorization_models_with_http_info(**kwargs)) # noqa: E501 + return await (self.read_authorization_models_with_http_info(**kwargs)) # noqa: E501 async def read_authorization_models_with_http_info(self, **kwargs): # noqa: E501 """Return all the authorization models for a particular store # noqa: E501 @@ -1614,7 +1614,7 @@ async def read_authorization_models_with_http_info(self, **kwargs): # noqa: E50 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/authorization-models'.replace('{store_id}', store_id), 'GET', path_params, query_params, @@ -1662,7 +1662,7 @@ async def read_changes(self, **kwargs): # noqa: E501 :rtype: ReadChangesResponse """ kwargs['_return_http_data_only'] = True - return await(self.read_changes_with_http_info(**kwargs)) # noqa: E501 + return await (self.read_changes_with_http_info(**kwargs)) # noqa: E501 async def read_changes_with_http_info(self, **kwargs): # noqa: E501 """Return a list of all the tuple changes # noqa: E501 @@ -1768,7 +1768,7 @@ async def read_changes_with_http_info(self, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/changes'.replace('{store_id}', store_id), 'GET', path_params, query_params, @@ -1812,7 +1812,7 @@ async def write(self, body, **kwargs): # noqa: E501 :rtype: object """ kwargs['_return_http_data_only'] = True - return await(self.write_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.write_with_http_info(body, **kwargs)) # noqa: E501 async def write_with_http_info(self, body, **kwargs): # noqa: E501 """Add or delete tuples from the store # noqa: E501 @@ -1917,7 +1917,7 @@ async def write_with_http_info(self, body, **kwargs): # noqa: E501 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/write'.replace('{store_id}', store_id), 'POST', path_params, query_params, @@ -1963,7 +1963,7 @@ async def write_assertions(self, authorization_model_id, body, **kwargs): # noq :rtype: None """ kwargs['_return_http_data_only'] = True - return await(self.write_assertions_with_http_info(authorization_model_id, body, **kwargs)) # noqa: E501 + return await (self.write_assertions_with_http_info(authorization_model_id, body, **kwargs)) # noqa: E501 async def write_assertions_with_http_info(self, authorization_model_id, body, **kwargs): # noqa: E501 """Upsert assertions for an authorization model ID # noqa: E501 @@ -2073,7 +2073,7 @@ async def write_assertions_with_http_info(self, authorization_model_id, body, ** response_types_map = {} - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/assertions/{authorization_model_id}'.replace( '{store_id}', store_id), 'PUT', path_params, @@ -2118,7 +2118,7 @@ async def write_authorization_model(self, body, **kwargs): # noqa: E501 :rtype: WriteAuthorizationModelResponse """ kwargs['_return_http_data_only'] = True - return await(self.write_authorization_model_with_http_info(body, **kwargs)) # noqa: E501 + return await (self.write_authorization_model_with_http_info(body, **kwargs)) # noqa: E501 async def write_authorization_model_with_http_info(self, body, **kwargs): # noqa: E501 """Create a new authorization model # noqa: E501 @@ -2223,7 +2223,7 @@ async def write_authorization_model_with_http_info(self, body, **kwargs): # noq 500: "InternalErrorMessageResponse", } - return await(self.api_client.call_api( + return await (self.api_client.call_api( '/stores/{store_id}/authorization-models'.replace('{store_id}', store_id), 'POST', path_params, query_params, diff --git a/openfga_sdk/api_client.py b/openfga_sdk/api_client.py index 05157e1..b96306f 100644 --- a/openfga_sdk/api_client.py +++ b/openfga_sdk/api_client.py @@ -334,7 +334,7 @@ def __deserialize(self, data, klass): if data is None: return None - if type(klass) == str: + if type(klass) is str: if klass.startswith('list['): sub_kls = re.match(r'list\[(.*)\]', klass).group(1) return [self.__deserialize(sub_data, sub_kls) @@ -411,13 +411,13 @@ async def call_api(self, resource_path, method, then the method will return the response directly. """ if not async_req: - return await(self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, - response_types_map, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host, - _request_auth, _retry_params, _oauth2_client)) + return await (self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, + response_types_map, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host, + _request_auth, _retry_params, _oauth2_client)) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -439,54 +439,54 @@ async def request(self, method, url, query_params=None, headers=None, _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return await(self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers)) - elif method == "HEAD": - return await(self.rest_client.HEAD(url, + return await (self.rest_client.GET(url, query_params=query_params, _preload_content=_preload_content, _request_timeout=_request_timeout, headers=headers)) + elif method == "HEAD": + return await (self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers)) elif method == "OPTIONS": - return await(self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout)) + return await (self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout)) elif method == "POST": - return await(self.rest_client.POST(url, + return await (self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + elif method == "PUT": + return await (self.rest_client.PUT(url, query_params=query_params, headers=headers, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body)) - elif method == "PUT": - return await(self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) elif method == "PATCH": - return await(self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - elif method == "DELETE": - return await(self.rest_client.DELETE(url, + return await (self.rest_client.PATCH(url, query_params=query_params, headers=headers, + post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body)) + elif method == "DELETE": + return await (self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) else: raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," diff --git a/openfga_sdk/client/client.py b/openfga_sdk/client/client.py index 75db4ec..8f6450c 100644 --- a/openfga_sdk/client/client.py +++ b/openfga_sdk/client/client.py @@ -11,6 +11,10 @@ NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. """ +import asyncio +import uuid +from typing import List + from openfga_sdk.api_client import ApiClient from openfga_sdk.api.open_fga_api import OpenFgaApi from openfga_sdk.client.configuration import ClientConfiguration @@ -40,10 +44,6 @@ from openfga_sdk.models.write_request import WriteRequest from openfga_sdk.validation import is_well_formed_ulid_string -import asyncio -import uuid -from typing import List - CLIENT_METHOD_HEADER = "X-OpenFGA-Client-Method" CLIENT_BULK_REQUEST_ID_HEADER = "X-OpenFGA-Client-Bulk-Request-Id" diff --git a/openfga_sdk/configuration.py b/openfga_sdk/configuration.py index b9ffa17..f1f622e 100644 --- a/openfga_sdk/configuration.py +++ b/openfga_sdk/configuration.py @@ -15,11 +15,12 @@ import copy import logging import sys -import urllib3 +from urllib.parse import urlparse +import urllib3 import six from six.moves import http_client as httplib -from urllib.parse import urlparse + from openfga_sdk.exceptions import FgaValidationException, ApiValueError from openfga_sdk.validation import is_well_formed_ulid_string diff --git a/openfga_sdk/sync/api_client.py b/openfga_sdk/sync/api_client.py index d6ca7f6..2d6d595 100644 --- a/openfga_sdk/sync/api_client.py +++ b/openfga_sdk/sync/api_client.py @@ -332,7 +332,7 @@ def __deserialize(self, data, klass): if data is None: return None - if type(klass) == str: + if type(klass) is str: if klass.startswith('list['): sub_kls = re.match(r'list\[(.*)\]', klass).group(1) return [self.__deserialize(sub_data, sub_kls) diff --git a/test-requirements.txt b/test-requirements.txt index 7e44d9a..8fccd5b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ pytest-cov >= 4.1.0 mock >= 5.1.0 aiohttp >= 3.9.1 -pycodestyle == 2.10.0 +pycodestyle == 2.11.1 flake8 >= 6.0.0 python-dateutil >= 2.8.2 urllib3 >= 1.25.11