ImportString

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

Wrapper for Python import strings.

ImportString

[find in source code]

class ImportString():
    def __init__(master_name: str, *parts: str) -> None:

Wrapper for Python import strings.

Arguments

  • import_string - Wrapped import string.

Examples

import_string = ImportString('my.name')

str(import_string)
'my.name'

import_string.render()
'my.name'

import_string.parts.append('test')
import_string.render()
'my.name.test'

ImportString.empty

[find in source code]

@classmethod
def empty() -> 'ImportString':

ImportString.from_str

[find in source code]

@classmethod
def from_str(import_string: str) -> 'ImportString':

ImportString().master_name

[find in source code]

@property
def master_name() -> str:

Get first import string part or builtins.

ImportString().render

[find in source code]

def render() -> str:

Render to string.

Returns

Ready to use import string.

ImportString().startswith

[find in source code]

def startswith(other: 'ImportString') -> bool:

Check if import string starts with other.

Examples

ImportString('my', 'name').startswith(ImportString('my'))
True

ImportString('my_module', 'name').startswith(ImportString('my'))
False

ImportString('my', 'name').startswith(ImportString('my, 'name'))
True

ImportString('my', 'name').startswith(ImportString.empty())
True

Arguments

  • other - Other import string.