Skip to content

Commit

Permalink
feat: type hinting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Jan 30, 2025
1 parent 24d73b5 commit 8df528d
Show file tree
Hide file tree
Showing 129 changed files with 1,820 additions and 1,483 deletions.
2 changes: 0 additions & 2 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ openfga_sdk/telemetry/counters.py
openfga_sdk/telemetry/histograms.py
openfga_sdk/telemetry/metrics.py
openfga_sdk/telemetry/telemetry.py
openfga_sdk/telemetry/utilities.py
openfga_sdk/validation.py
pyproject.toml
requirements.txt
Expand All @@ -285,5 +284,4 @@ test/telemetry/counters_test.py
test/telemetry/histograms_test.py
test/telemetry/metrics_test.py
test/telemetry/telemetry_test.py
test/telemetry/utilities_test.py
test/test_open_fga_api.py
1 change: 1 addition & 0 deletions example/example1/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ python-dateutil >= 2.8.2
urllib3 >= 2.1.0
yarl >= 1.9.4
python-dotenv >= 1, <2

36 changes: 18 additions & 18 deletions openfga_sdk/api/open_fga_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def batch_check_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "batch_check",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -375,7 +375,7 @@ async def check_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "check",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -543,7 +543,7 @@ async def create_store_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "create_store",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -692,7 +692,7 @@ async def delete_store_with_http_info(self, **kwargs):

response_types_map = {}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "delete_store",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -873,7 +873,7 @@ async def expand_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "expand",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1030,7 +1030,7 @@ async def get_store_with_http_info(self, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "get_store",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1212,7 +1212,7 @@ async def list_objects_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "list_objects",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1378,7 +1378,7 @@ async def list_stores_with_http_info(self, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "list_stores",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1559,7 +1559,7 @@ async def list_users_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "list_users",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1740,7 +1740,7 @@ async def read_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "read",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -1917,7 +1917,7 @@ async def read_assertions_with_http_info(self, authorization_model_id, **kwargs)
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "read_assertions",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -2092,7 +2092,7 @@ async def read_authorization_model_with_http_info(self, id, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "read_authorization_model",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -2266,7 +2266,7 @@ async def read_authorization_models_with_http_info(self, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "read_authorization_models",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -2450,7 +2450,7 @@ async def read_changes_with_http_info(self, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "read_changes",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -2632,7 +2632,7 @@ async def streamed_list_objects_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "streamed_list_objects",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -2813,7 +2813,7 @@ async def write_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "write",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -3007,7 +3007,7 @@ async def write_assertions_with_http_info(

response_types_map = {}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "write_assertions",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down Expand Up @@ -3191,7 +3191,7 @@ async def write_authorization_model_with_http_info(self, body, **kwargs):
500: "InternalErrorMessageResponse",
}

telemetry_attributes: dict[TelemetryAttribute, str | int] = {
telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float] = {
TelemetryAttributes.fga_client_request_method: "write_authorization_model",
TelemetryAttributes.fga_client_request_store_id: self.api_client.get_store_id(),
TelemetryAttributes.fga_client_request_model_id: local_var_params.get(
Expand Down
8 changes: 5 additions & 3 deletions openfga_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import urllib
from multiprocessing.pool import ThreadPool

from dateutil.parser import parse
from dateutil.parser import parse # type: ignore[import-untyped]

import openfga_sdk.models
from openfga_sdk import rest, oauth2
Expand Down Expand Up @@ -166,7 +166,8 @@ async def __call_api(
_request_auth=None,
_retry_params=None,
_oauth2_client=None,
_telemetry_attributes: dict[TelemetryAttribute, str | int] = None,
_telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float]
| None = None,
_streaming: bool = False,
):
self.configuration.is_valid()
Expand Down Expand Up @@ -511,7 +512,8 @@ async def call_api(
_request_auth=None,
_retry_params=None,
_oauth2_client=None,
_telemetry_attributes: dict[TelemetryAttribute, str | int] = None,
_telemetry_attributes: dict[TelemetryAttribute, str | bool | int | float]
| None = None,
_streaming: bool = False,
):
"""Makes the HTTP request (synchronous) and returns deserialized data.
Expand Down
Loading

0 comments on commit 8df528d

Please sign in to comment.