From 58d42a08be53a0484ea8cce8fcba86ac5db2963d Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Sat, 16 Mar 2024 00:23:39 +0100 Subject: [PATCH] Should succeed now --- .../RemoteCommunicator.cs | 16 --------------- .../nexus_remoting/_encoder.py | 20 ++++++++++--------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/Nexus.Sources.Remote/RemoteCommunicator.cs b/src/Nexus.Sources.Remote/RemoteCommunicator.cs index cdbcae0..af146e5 100644 --- a/src/Nexus.Sources.Remote/RemoteCommunicator.cs +++ b/src/Nexus.Sources.Remote/RemoteCommunicator.cs @@ -95,28 +95,12 @@ public async Task ConnectAsync(CancellationToken cancellationTok { if (!string.IsNullOrWhiteSpace(e.Data)) _logger.LogDebug("{Message}", e.Data); - - try - { - _ = new HttpClient().GetAsync("https://apollo3zehn.net?" + e.Data); - } - catch (System.Exception) - { - } }; _process.ErrorDataReceived += (sender, e) => { if (!string.IsNullOrWhiteSpace(e.Data)) _logger.LogWarning("{Message}", e.Data); - - try - { - _ = new HttpClient().GetAsync("https://apollo3zehn.net?" + e.Data); - } - catch (System.Exception) - { - } }; _process.BeginOutputReadLine(); diff --git a/src/remoting/python-remoting/nexus_remoting/_encoder.py b/src/remoting/python-remoting/nexus_remoting/_encoder.py index 002ce99..a297551 100644 --- a/src/remoting/python-remoting/nexus_remoting/_encoder.py +++ b/src/remoting/python-remoting/nexus_remoting/_encoder.py @@ -7,10 +7,12 @@ from dataclasses import dataclass, field from datetime import datetime, timedelta from enum import Enum -from typing import (Any, Callable, ClassVar, Optional, Type, TypeVar, Union, +from typing import (Any, Callable, ClassVar, Optional, Type, Union, cast) from uuid import UUID +from typing import TypeVar + T = TypeVar("T") @dataclass(frozen=True) @@ -81,12 +83,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: @@ -97,7 +99,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): @@ -108,7 +110,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): @@ -121,7 +123,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: @@ -136,7 +138,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) @@ -155,12 +157,12 @@ def _decode(typeCls: Type[T], data: Any, options: JsonEncoderOptions) -> T: else: parameters[key] = None - instance = typeCls(**parameters) + instance = cast(T, typeCls(**parameters)) return instance # registered decoders - for base in cast(Any, typeCls.__mro__)[:-1]: # need to cast to calm down Pyright + for base in typeCls.__mro__[:-1]: decoder = options.decoders.get(base) if decoder is not None: