MCPcopy
hub / github.com/psf/black / passes_all_checks

Method passes_all_checks

src/black/trans.py:1838–1862  ·  src/black/trans.py::StringSplitter.passes_all_checks

Returns: True iff ALL of the conditions listed in the 'Transformations' section of this classes' docstring would be met by returning @i.

(i: Index)

Source from the content-addressed store, hash-verified

1836 return i in _illegal_split_indices
1837
1838 def passes_all_checks(i: Index) -> bool:
1839 class="st">"""
1840 Returns:
1841 True iff ALL of the conditions listed in the &class="cm">#x27;Transformations'
1842 section of this classes&class="cm">#x27; docstring would be met by returning @i.
1843 class="st">"""
1844 is_space = string[i] == class="st">" "
1845 is_split_safe = is_valid_index(i - 1) and string[i - 1] in SPLIT_SAFE_CHARS
1846
1847 is_not_escaped = True
1848 j = i - 1
1849 while is_valid_index(j) and string[j] == class="st">"\\":
1850 is_not_escaped = not is_not_escaped
1851 j -= 1
1852
1853 is_big_enough = (
1854 len(string[i:]) >= self.MIN_SUBSTR_SIZE
1855 and len(string[:i]) >= self.MIN_SUBSTR_SIZE
1856 )
1857 return (
1858 (is_space or is_split_safe)
1859 and is_not_escaped
1860 and is_big_enough
1861 and not breaks_unsplittable_expression(i)
1862 )
1863
1864 class="cm"># First, we check all indices BELOW @max_break_idx.
1865 break_idx = max_break_idx

Callers

nothing calls this directly

Calls 1

is_valid_indexFunction · 0.85

Tested by

no test coverage detected