ImportString#
Mypy_boto3_builder Index / Mypy Boto3 Builder / Import Helpers / ImportString
Auto-generated documentation for mypy_boto3_builder.import_helpers.import_string module.
ImportString#
Show source in import_string.py:11
Wrapper for Python import strings.
Arguments#
master
- Master module nameparts
- Other import parts
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'
Signature#
ImportString().add#
Show source in import_string.py:99
Create a new import string by adding another import string parts to the end.
Signature#
ImportString().bool#
Show source in import_string.py:67
Whether import string is not empty.
Signature#
ImportString().eq#
Show source in import_string.py:85
Whether import strings produce the same render.
Signature#
ImportString().gt#
Show source in import_string.py:91
Compare import strings for sorting.
Emulates isort
logic.
Signature#
ImportString().hash#
Show source in import_string.py:79
Calculate hash value based on all parts.
Signature#
ImportString().str#
Show source in import_string.py:73
Render as a part of a valid Python import statement.
Signature#
ImportString.empty#
Show source in import_string.py:49
Create an empty ImportString.
Signature#
ImportString.from_str#
Show source in import_string.py:42
Create from string.
Signature#
ImportString().master_name#
Show source in import_string.py:149
Get first import string part or builtins
.
Signature#
ImportString.parent#
Show source in import_string.py:58
Get parent ImportString.
Signature#
ImportString().render#
Show source in import_string.py:140
Render to string.
Returns#
Ready to use import string.
Signature#
ImportString().startswith#
Show source in import_string.py:108
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.