coalib.bearlib.spacing package¶
Submodules¶
coalib.bearlib.spacing.SpacingHelper module¶
-
class
coalib.bearlib.spacing.SpacingHelper.
SpacingHelper
(tab_width: int = 4)[source]¶ Bases:
coalib.bearlib.abstractions.SectionCreatable.SectionCreatable
-
DEFAULT_TAB_WIDTH
= 4¶
-
get_indentation
(line: str)[source]¶ Checks the lines indentation.
Parameters: line – A string to check for indentation. Returns: The indentation count in spaces.
-
replace_spaces_with_tabs
(line: str)[source]¶ Replaces spaces with tabs where possible. However in no case only one space will be replaced by a tab.
Example: ” a_text another” will be converted to ” a_text another”, assuming the tab_width is set to 4.
Parameters: line – The string with spaces to replace. Returns: The converted string.
-