_importstmt module
- class pyflyby._importstmt.ImportFormatParams(*args, **kwargs)
-
align_future:
bool
= False Whether ‘from __future__ import …’ statements should be aligned with others. If False, uses a single space after the ‘from’ and ‘import’ keywords.
-
align_imports:
Union
[bool
,set
,list
,tuple
,str
] = True Whether and how to align ‘from modulename import aliases…’. If
True
, then the ‘import’ keywords will be aligned within a block. If an integer, then the ‘import’ keyword will always be at that column. They will be wrapped if necessary.
-
from_spaces:
int
= 1 The number of spaces after the ‘from’ keyword. (Must be at least 1.)
-
separate_from_imports:
bool
= True Whether all ‘from … import …’ in an import block should come after ‘import …’ statements.
separate_from_imports = False
works well withfrom_spaces = 3
. (‘from __future__ import …’ always comes first.)
-
align_future:
- class pyflyby._importstmt.ImportSplit(module_name, member_name, import_as)
Representation of a single import at the token level:
from [...]<module_name> import <member_name> as <import_as>
- If <module_name> is
None
, then there is no “from” clause; instead just:: import <member_name> as <import_as>
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('module_name', 'member_name', 'import_as')
- classmethod _make(iterable)
Make a new ImportSplit object from a sequence or iterable
- _replace(**kwds)
Return a new ImportSplit object replacing specified fields with new values
- import_as
Alias for field number 2
- member_name
Alias for field number 1
- module_name
Alias for field number 0
- If <module_name> is
- pyflyby._importstmt._validate_alias(arg)
Ensure each alias is a tuple (str, None|str), and return it.
- Return type:
Tuple
[str
,Optional
[str
]]
- pyflyby._importstmt.read_black_config()
Read the black configuration from
pyproject.toml
- Return type:
Dict