Skip to content

Commit

Permalink
Refactor to for-else block (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev committed Apr 25, 2020
1 parent 0d84a4c commit 9865035
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,10 @@ def _setup_logging(self):

# Sync pip's console handler stream with LogContext.stream
logger = logging.getLogger()
console_handlers = [
handler for handler in logger.handlers if handler.name == "console"
]
if console_handlers: # pragma: no branch
console_handlers[0].stream = log.stream
for handler in logger.handlers:
if handler.name == "console": # pragma: no branch
handler.stream = log.stream
break
else: # pragma: no cover
# There is always a console handler. This warning would be a signal that
# this block should be removed/revisited, because of pip possibly
Expand Down

0 comments on commit 9865035

Please sign in to comment.