Skip to content

ExternalImport#

Mypy_boto3_builder Index / Mypy Boto3 Builder / Type Annotations / ExternalImport

Auto-generated documentation for mypy_boto3_builder.type_annotations.external_import module.

ExternalImport#

Show source in external_import.py:14

Wrapper for type annotations imported from 3rd party libraries, like boto3.service.Service.

Arguments#

  • source - Module import string.
  • name - Import name.
  • alias - Import local name.
  • safe - Whether import is wrapped in try-except.

Signature#

class ExternalImport(FakeAnnotation):
    def __init__(
        self, source: ImportString, name: str = "", alias: str = "", safe: bool = False
    ) -> None: ...

See also#

ExternalImport().copy#

Show source in external_import.py:95

Create a copy of type annotation wrapper.

Signature#

def __copy__(self: Self) -> Self: ...

ExternalImport().hash#

Show source in external_import.py:74

Calcualte hash value based on import record.

Signature#

def __hash__(self) -> int: ...

ExternalImport()._get_import_records#

Show source in external_import.py:89

Get import record required for using type annotation.

Signature#

def _get_import_records(self) -> set[ImportRecord]: ...

See also#

ExternalImport().copy_from#

Show source in external_import.py:101

Copy all fileds from another instance.

Signature#

def copy_from(self: Self, other: Self) -> None: ...

ExternalImport.from_class#

Show source in external_import.py:37

Create an instance from an imported class.

Arguments#

  • value - Any Class.
  • alias - Local name.
  • safe - Whether import is wrapped in try-except.

Signature#

@classmethod
def from_class(
    cls: type[Self], obj: type, alias: str = "", safe: bool = False
) -> Self: ...

ExternalImport().import_record#

Show source in external_import.py:59

Get import record required for using type annotation.

Signature#

@property
def import_record(self) -> ImportRecord: ...

See also#

ExternalImport().render#

Show source in external_import.py:80

Get string with local name to use.

Returns#

Import record local name.

Signature#

def render(self) -> str: ...