Skip to main content
Version: 0.3.25

common.typing

StrAny

immutable, covariant entity

StrStr

immutable, covariant entity

StrStrStr

immutable, covariant entity

TFun

any function

TSecretValue

type: ignore

TSecretStrValue

type: ignore

TDataItem

A single data item as extracted from data source

TDataItems

A single data item or a list as extracted from the data source

TAnyDateTime

DateTime represented as pendulum/python object, ISO string or unix timestamp

ConfigValue

value of type None indicating argument that may be injected by config provider

SupportsVariant Objects

@runtime_checkable
class SupportsVariant(Protocol, Generic[TVariantBase])

[view_source]

Defines variant type protocol that should be recognized by normalizers

Variant types behave like TVariantBase type (ie. Decimal) but also implement the protocol below that is used to extract the variant value from it. See Wei type declaration which returns Decimal or str for values greater than supported by destination warehouse.

SupportsHumanize Objects

class SupportsHumanize(Protocol)

[view_source]

asdict

def asdict() -> DictStrAny

[view_source]

Represents object as dict with a schema loadable by dlt

asstr

def asstr(verbosity: int = 0) -> str

[view_source]

Represents object as human readable string

extract_inner_type

def extract_inner_type(hint: Type[Any],
preserve_new_types: bool = False) -> Type[Any]

[view_source]

Gets the inner type from Literal, Optional, Final and NewType

Arguments:

  • hint Type[Any] - Type to extract
  • preserve_new_types bool - Do not extract supertype of a NewType

Returns:

  • Type[Any] - Inner type if hint was Literal, Optional or NewType, otherwise hint

get_generic_type_argument_from_instance

def get_generic_type_argument_from_instance(
instance: Any, sample_value: Optional[Any]) -> Type[Any]

[view_source]

Infers type argument of a Generic class from an instance of that class using optional sample_value of the argument type

Inference depends on the presence of orig_class attribute in instance, if not present - sample_Value will be used

Arguments:

  • instance Any - instance of Generic class
  • sample_value Optional[Any] - instance of type of generic class, optional

Returns:

  • Type[Any] - type argument or Any if not known

copy_sig

def copy_sig(
wrapper: Callable[TInputArgs, Any]
) -> Callable[[Callable[..., TReturnVal]], Callable[TInputArgs, TReturnVal]]

[view_source]

Copies docstring and signature from wrapper to func but keeps the func return value type

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.