Skip to content

Commit

Permalink
one pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliva Kar committed Jan 11, 2024
1 parent 5d343d5 commit f05037e
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 173 deletions.
41 changes: 41 additions & 0 deletions azure-iot-device/azure/iot/device/custom_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typing import Any, Union, Dict, List, Tuple, Callable, Awaitable, TypeVar
from typing_extensions import TypedDict, ParamSpec


_P = ParamSpec("_P")
_R = TypeVar("_R")
FunctionOrCoroutine = Union[Callable[_P, _R], Callable[_P, Awaitable[_R]]]


# typing does not support recursion, so we must use forward references here (PEP484)
JSONSerializable = Union[
Dict[str, "JSONSerializable"],
List["JSONSerializable"],
Tuple["JSONSerializable", ...],
str,
int,
float,
bool,
None,
]
# TODO: verify that the JSON specification requires str as keys in dict. Not sure why that's defined here.


Twin = Dict[str, Dict[str, JSONSerializable]]
TwinPatch = Dict[str, JSONSerializable]


class StorageInfo(TypedDict):
correlationId: str
hostName: str
containerName: str
blobName: str
sasToken: str


ProvisioningPayload = Union[Dict[str, Any], str, int]
Loading

0 comments on commit f05037e

Please sign in to comment.