coalib.bearlib.spacing package — coala 0.11.0.rc1 documentation

# coalib.bearlib.spacing package

## Submodules

## coalib.bearlib.spacing.SpacingHelper module

class `coalib.bearlib.spacing.SpacingHelper.` `SpacingHelper`(tab_width: int = 4)

  Bases: `coalib.bearlib.abstractions.SectionCreatable.SectionCreatable`

  `DEFAULT_TAB_WIDTH` = 4
  `get_indentation`(line: str)

    Checks the lines indentation.

    Parameters: | line – A string to check for indentation.
    Returns: | The indentation count in spaces.

  `replace_spaces_with_tabs`(line: str)

    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.

  `replace_tabs_with_spaces`(line: str)

    Replaces tabs in this line with the appropriate number of spaces.

    Example: ” ” will be converted to ” ”, assuming the tab_width is set to 4.

    Parameters: | line – The string with tabs to replace.
    Returns: | A string with no tabs.

  `yield_tab_lengths`(input: str)

    Yields position and size of tabs in a input string.

    Parameters: | input – The string with tabs.

## Module contents