mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 21:16:54 +00:00
Replace comparisons with min/max
This commit is contained in:
parent
9e550df7a0
commit
629398c37f
3 changed files with 3 additions and 7 deletions
|
|
@ -53,9 +53,7 @@ def configure_logging(verbosity, filename=None, logformat=LOG_FORMAT):
|
|||
"""
|
||||
if verbosity <= 0:
|
||||
return
|
||||
if verbosity > 3:
|
||||
verbosity = 3
|
||||
|
||||
verbosity = min(verbosity, 3)
|
||||
log_level = _VERBOSITY_TO_LOG_LEVEL[verbosity]
|
||||
|
||||
if not filename or filename in ("stderr", "stdout"):
|
||||
|
|
|
|||
|
|
@ -464,8 +464,7 @@ class FileChecker:
|
|||
row_offset = len(lines) - 1
|
||||
logical_line = lines[0]
|
||||
logical_line_length = len(logical_line)
|
||||
if column > logical_line_length:
|
||||
column = logical_line_length
|
||||
column = min(column, logical_line_length)
|
||||
row -= row_offset
|
||||
column -= column_offset
|
||||
return row, column
|
||||
|
|
|
|||
|
|
@ -160,8 +160,7 @@ class FileProcessor:
|
|||
(start_row, start_col) = mapping[0][1]
|
||||
start_line = self.lines[start_row - 1]
|
||||
self.indent_level = expand_indent(start_line[:start_col])
|
||||
if self.blank_before < self.blank_lines:
|
||||
self.blank_before = self.blank_lines
|
||||
self.blank_before = max(self.blank_before, self.blank_lines)
|
||||
|
||||
def update_checker_state_for(self, plugin: Dict[str, Any]) -> None:
|
||||
"""Update the checker_state attribute for the plugin."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue