mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
rpc: support dataclasses annotation, fix formatting
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import dataclasses
|
||||
import inspect
|
||||
import random
|
||||
import string
|
||||
@@ -281,7 +282,7 @@ class RpcPeer:
|
||||
return props
|
||||
|
||||
def isTransportSafe(value: any):
|
||||
return not value or (type(value) in jsonSerializable)
|
||||
return not value or (type(value) in jsonSerializable) or dataclasses.is_dataclass(value)
|
||||
|
||||
def serialize(self, value, serializationContext: Dict):
|
||||
if type(value) == dict and value.get(
|
||||
|
||||
@@ -2,16 +2,16 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from typing import List, Any
|
||||
import multiprocessing.connection
|
||||
import rpc
|
||||
import concurrent.futures
|
||||
import json
|
||||
import multiprocessing.connection
|
||||
import os
|
||||
import threading
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import List
|
||||
|
||||
import rpc
|
||||
|
||||
|
||||
class BufferSerializer(rpc.RpcSerializer):
|
||||
|
||||
Reference in New Issue
Block a user