View on GitHub

mypy_boto3

Type annotations for boto3 compatible with mypy, VSCode and PyCharm

Download this project as a .zip file Download this project as a tar.gz file

ImportString

Auto-generated documentation for builder.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

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