From b121162d2efb56620d1ebed72a1e36b96bcb4ceb Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Wed, 28 Feb 2024 22:37:54 +0100 Subject: [PATCH] Fix build errors --- .vscode/settings.json | 3 +- .../Nexus.ClientGenerator.csproj | 2 +- src/Nexus.UI/Core/NexusDemoClient.cs | 4 +- src/clients/dotnet-client/NexusClient.g.cs | 8 +-- .../python-client/nexus_api/_nexus_api.py | 50 +++++++++---------- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 092f1e5d..7940f672 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,5 @@ "python.analysis.extraPaths": [ "src/clients/python-client" ], - "dotnet.defaultSolution": "Nexus.sln", - "julia.environmentPath": "/home/vincent/Dokumente/Git/GitHub/malstroem-labs/nexus" + "dotnet.defaultSolution": "Nexus.sln" } \ No newline at end of file diff --git a/src/Nexus.ClientGenerator/Nexus.ClientGenerator.csproj b/src/Nexus.ClientGenerator/Nexus.ClientGenerator.csproj index ae4ea6a1..2ab9ba77 100644 --- a/src/Nexus.ClientGenerator/Nexus.ClientGenerator.csproj +++ b/src/Nexus.ClientGenerator/Nexus.ClientGenerator.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/Nexus.UI/Core/NexusDemoClient.cs b/src/Nexus.UI/Core/NexusDemoClient.cs index f66d6ac1..cb73b96c 100644 --- a/src/Nexus.UI/Core/NexusDemoClient.cs +++ b/src/Nexus.UI/Core/NexusDemoClient.cs @@ -333,12 +333,12 @@ public Task GetHelpLinkAsync(CancellationToken cancellationToken = defau return Task.FromResult("https://github.com/malstroem-labs/nexus"); } - public void SetConfiguration(IReadOnlyDictionary? configuration) + public void SetConfiguration(IReadOnlyDictionary? configuration) { throw new NotImplementedException(); } - public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) + public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } diff --git a/src/clients/dotnet-client/NexusClient.g.cs b/src/clients/dotnet-client/NexusClient.g.cs index 40dbed5a..87165546 100644 --- a/src/clients/dotnet-client/NexusClient.g.cs +++ b/src/clients/dotnet-client/NexusClient.g.cs @@ -2262,14 +2262,14 @@ public interface ISystemClient /// Sets the system configuration. /// /// - void SetConfiguration(IReadOnlyDictionary? configuration); + void SetConfiguration(IReadOnlyDictionary? configuration); /// /// Sets the system configuration. /// /// /// The token to cancel the current operation. - Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); + Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default); } @@ -2344,7 +2344,7 @@ public Task GetHelpLinkAsync(CancellationToken cancellationToken = defau } /// - public void SetConfiguration(IReadOnlyDictionary? configuration) + public void SetConfiguration(IReadOnlyDictionary? configuration) { var __urlBuilder = new StringBuilder(); __urlBuilder.Append("/api/v1/system/configuration"); @@ -2354,7 +2354,7 @@ public void SetConfiguration(IReadOnlyDictionary? configur } /// - public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) + public Task SetConfigurationAsync(IReadOnlyDictionary? configuration, CancellationToken cancellationToken = default) { var __urlBuilder = new StringBuilder(); __urlBuilder.Append("/api/v1/system/configuration"); diff --git a/src/clients/python-client/nexus_api/_nexus_api.py b/src/clients/python-client/nexus_api/_nexus_api.py index 4410d0f6..db69a417 100644 --- a/src/clients/python-client/nexus_api/_nexus_api.py +++ b/src/clients/python-client/nexus_api/_nexus_api.py @@ -85,12 +85,12 @@ def decode(type: Type[T], data: Any, options: Optional[JsonEncoderOptions] = Non def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: if data is None: - return typing.cast(T, None) + return cast(T, None) if typeCls == Any: return data - origin = typing.cast(Type, typing.get_origin(typeCls)) + origin = typing.get_origin(typeCls) args = typing.get_args(typeCls) if origin is not None: @@ -101,7 +101,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: baseType = args[0] instance3 = JsonEncoder._decode(baseType, data, options) - return typing.cast(T, instance3) + return cast(T, instance3) # list elif issubclass(origin, list): @@ -112,7 +112,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: for value in data: instance1.append(JsonEncoder._decode(listType, value, options)) - return typing.cast(T, instance1) + return cast(T, instance1) # dict elif issubclass(origin, dict): @@ -125,7 +125,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: for key, value in data.items(): instance2[key] = JsonEncoder._decode(valueType, value, options) - return typing.cast(T, instance2) + return cast(T, instance2) # default else: @@ -140,7 +140,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: for key, value in data.items(): key = options.property_name_decoder(key) - parameter_type = typing.cast(Type, type_hints.get(key)) + parameter_type = cast(Type, type_hints.get(key)) if (parameter_type is not None): value = JsonEncoder._decode(parameter_type, value, options) @@ -159,7 +159,7 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: else: parameters[key] = None - instance = typing.cast(T, typeCls(**parameters)) + instance = cast(T, typeCls(**parameters)) return instance @@ -952,7 +952,7 @@ def get_license(self, catalog_id: str) -> Awaitable[Optional[str]]: __url = "/api/v1/catalogs/{catalogId}/license" __url = __url.replace("{catalogId}", quote(str(catalog_id), safe="")) - return self.___client._invoke(Optional[str], "GET", __url, "application/json", None, None) + return self.___client._invoke(str, "GET", __url, "application/json", None, None) def get_attachments(self, catalog_id: str) -> Awaitable[list[str]]: """ @@ -1344,9 +1344,9 @@ def get_configuration(self) -> Awaitable[Optional[dict[str, object]]]: __url = "/api/v1/system/configuration" - return self.___client._invoke(Optional[dict[str, object]], "GET", __url, "application/json", None, None) + return self.___client._invoke(dict[str, object], "GET", __url, "application/json", None, None) - def set_configuration(self, configuration: Optional[dict[str, Optional[object]]]) -> Awaitable[None]: + def set_configuration(self, configuration: Optional[dict[str, object]]) -> Awaitable[None]: """ Sets the system configuration. @@ -1733,7 +1733,7 @@ def get_license(self, catalog_id: str) -> Optional[str]: __url = "/api/v1/catalogs/{catalogId}/license" __url = __url.replace("{catalogId}", quote(str(catalog_id), safe="")) - return self.___client._invoke(Optional[str], "GET", __url, "application/json", None, None) + return self.___client._invoke(str, "GET", __url, "application/json", None, None) def get_attachments(self, catalog_id: str) -> list[str]: """ @@ -2125,9 +2125,9 @@ def get_configuration(self) -> Optional[dict[str, object]]: __url = "/api/v1/system/configuration" - return self.___client._invoke(Optional[dict[str, object]], "GET", __url, "application/json", None, None) + return self.___client._invoke(dict[str, object], "GET", __url, "application/json", None, None) - def set_configuration(self, configuration: Optional[dict[str, Optional[object]]]) -> None: + def set_configuration(self, configuration: Optional[dict[str, object]]) -> None: """ Sets the system configuration. @@ -2602,7 +2602,7 @@ def clear_configuration(self) -> None: if self._configuration_header_key in self._http_client.headers: del self._http_client.headers[self._configuration_header_key] - async def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T: + async def _invoke(self, typeOfT: Optional[Type[T]], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T: # prepare request request = self._build_request_message(method, relative_url, content, content_type_value, accept_header_value) @@ -2653,18 +2653,18 @@ async def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept try: if typeOfT is type(None): - return typing.cast(T, type(None)) + return cast(T, type(None)) elif typeOfT is Response: - return typing.cast(T, response) + return cast(T, response) else: jsonObject = json.loads(response.text) - return_value = JsonEncoder.decode(typeOfT, jsonObject, _json_encoder_options) + return_value = JsonEncoder.decode(cast(Type[T], typeOfT), jsonObject, _json_encoder_options) if return_value is None: - raise NexusException(f"N01", "Response data could not be deserialized.") + raise NexusException("N01", "Response data could not be deserialized.") return return_value @@ -3078,7 +3078,7 @@ def clear_configuration(self) -> None: if self._configuration_header_key in self._http_client.headers: del self._http_client.headers[self._configuration_header_key] - def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T: + def _invoke(self, typeOfT: Optional[Type[T]], method: str, relative_url: str, accept_header_value: Optional[str], content_type_value: Optional[str], content: Union[None, str, bytes, Iterable[bytes], AsyncIterable[bytes]]) -> T: # prepare request request = self._build_request_message(method, relative_url, content, content_type_value, accept_header_value) @@ -3129,18 +3129,18 @@ def _invoke(self, typeOfT: Type[T], method: str, relative_url: str, accept_heade try: if typeOfT is type(None): - return typing.cast(T, type(None)) + return cast(T, type(None)) elif typeOfT is Response: - return typing.cast(T, response) + return cast(T, response) else: jsonObject = json.loads(response.text) - return_value = JsonEncoder.decode(typeOfT, jsonObject, _json_encoder_options) + return_value = JsonEncoder.decode(cast(Type[T], typeOfT), jsonObject, _json_encoder_options) if return_value is None: - raise NexusException(f"N01", "Response data could not be deserialized.") + raise NexusException("N01", "Response data could not be deserialized.") return return_value @@ -3179,12 +3179,12 @@ def _refresh_token(self, refresh_token: str): with open(self._token_file_path, "w") as file: file.write(token_pair.refresh_token) - authorization_header_value = f"Bearer {token_pair.access_token}" + authorizationHeaderValue = f"Bearer {token_pair.access_token}" if self._authorization_header_key in self._http_client.headers: del self._http_client.headers[self._authorization_header_key] - self._http_client.headers[self._authorization_header_key] = authorization_header_value + self._http_client.headers[self._authorization_header_key] = authorizationHeaderValue self._token_pair = token_pair finally: