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

Method delimiter_count_with_priority

src/black/brackets.py:150–159  ·  view source on GitHub ↗

Return the number of delimiters with the given `priority`. If no `priority` is passed, defaults to max priority on the line.

(self, priority: Priority = 0)

Source from the content-addressed store, hash-verified

148 return max(v for k, v in self.delimiters.items() if k not in exclude)
149
150 def delimiter_count_with_priority(self, priority: Priority = 0) -> int:
151 """Return the number of delimiters with the given `priority`.
152
153 If no `priority` is passed, defaults to max priority on the line.
154 """
155 if not self.delimiters:
156 return 0
157
158 priority = priority or self.max_delimiter_priority()
159 return sum(1 for p in self.delimiters.values() if p == priority)
160
161 def maybe_increment_for_loop_variable(self, leaf: Leaf) -> bool:
162 """In a for loop, or comprehension, the variables are often unpacks.

Callers 2

delimiter_splitFunction · 0.80

Calls 1

Tested by

no test coverage detected