ImportRecord

Auto-generated documentation for mypy_boto3_builder.import_helpers.import_record module.

Helper for Python import strings.

ImportRecord

[find in source code]

class ImportRecord():
    def __init__(
        source: ImportString,
        name: str = '',
        alias: str = '',
        min_version: tuple[int, ...] = (3, 8),
        fallback: _R | None = None,
    ) -> None:

Helper for Python import strings.

Arguments

  • source - Source of import.
  • name - Import name.
  • alias - Import local name.
  • min_version - Minimum Python version, used for fallback.
  • fallback - Fallback ImportRecord.

See also

ImportRecord.empty

[find in source code]

@classmethod
def empty() -> _R:

Whether import record is an empty string.

ImportRecord().get_external

[find in source code]

def get_external(module_name: str) -> 'ImportRecord':

Get itself.

Overriden by InternalImportRecord.

ImportRecord().get_local_name

[find in source code]

def get_local_name() -> str:

Get local import name.

ImportRecord().is_builtins

[find in source code]

def is_builtins() -> bool:

Whether import is from Python builtins module.

ImportRecord().is_local

[find in source code]

def is_local() -> bool:

Whether import is from local module.

ImportRecord().is_standalone

[find in source code]

def is_standalone() -> bool:

Whether import record should not be grouped.

ImportRecord().is_third_party

[find in source code]

def is_third_party() -> bool:

Whether import is from 3rd party module.

ImportRecord().is_type_defs

[find in source code]

def is_type_defs() -> bool:

Whether import is from type_defs module.

ImportRecord().render

[find in source code]

def render() -> str:

Get rendered string.