ImportString
Wrapper for python import strings.
Handsdown API Index / Handsdown / Utils / ImportString
Auto-generated documentation for handsdown.utils.import_string module.
ImportString
Show source in import_string.py:11
Wrapper for python import strings.
Arguments
value
- Import string.
Signature
ImportString().add
Show source in import_string.py:39
Add new import part.
Examples
ImportString("my_module") + "MyClass"
ImportString("my_module.MyClass")
ImportString("") + "MyClass"
ImportString("MyClass")
Arguments
other
- Import string part.
Returns
A new ImportString instance.
Signature
ImportString().bool
Show source in import_string.py:62
Check if not empty.
Examples
Returns
True if not empty.
Signature
ImportString().eq
Show source in import_string.py:79
Compare to another ImportString or a string.
Examples
ImportString("my_module.MyClass") == ImportString("my_module.MyClass")
True
ImportString("my_module.MyClass") == ImportString("my_module.OtherClass")
False
ImportString("my_module.MyClass") == "my_module.MyClass"
True
ImportString("my_module.MyClass") == "my_module"
False
ImportString("my_module.MyClass") == b"my_module.MyClass"
False
Arguments
other - ImportString instance or a string.
Returns
True if import strings are equal.
Signature
ImportString().str
Show source in import_string.py:22
Get string value.
Examples
Returns
Original import string.
Signature
ImportString().get_parents
Show source in import_string.py:164
Get all parents.
Returns
A list of ImportString instances.
Signature
ImportString().is_top_level
Show source in import_string.py:132
Check if import string has no parents.
Returns
True if it has no parents.
Signature
ImportString().length
Show source in import_string.py:183
Length of import string parts.
Returns
Length of import string.
Signature
ImportString().name
Show source in import_string.py:193
Last part of the import string.
Signature
ImportString().parent
Show source in import_string.py:141
Parent import string.
Returns
A new ImportString instance.
Signature
ImportString().parts
Show source in import_string.py:114
Parts of import string splitted by dots.
Examples
Returns
A list of import string parts.
Signature
ImportString().startswith
Show source in import_string.py:155
Check if it starts with import_string
.
Returns
True if it is a child.