ImportString
Auto-generated documentation for builder.mypy_boto3_builder.import_helpers.import_string module.
Wrapper for Python import strings.
- mypy-boto3 / Modules /
Builder
/ Mypy Boto3 Builder / Import Helpers / ImportString
ImportString
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
@classmethod
def empty() -> 'ImportString':
ImportString.from_str
@classmethod
def from_str(import_string: str) -> 'ImportString':
ImportString().master_name
@property
def master_name() -> str:
Get first import string part or builtins
.
ImportString().render
def render() -> str:
Render to string.
Returns
Ready to use import string.
ImportString().startswith
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.