Skip to content

Commit e0cdaeb

Browse files
committed
Add suggestions coming from #659
1 parent f3979ee commit e0cdaeb

File tree

6 files changed

+4
-16
lines changed

6 files changed

+4
-16
lines changed

.flake8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ extend-ignore =
148148
WPS420 # FIXME: pointless keyword like `pass`
149149
WPS421 # FIXME: call to `print()`
150150
WPS425 # FIXME: bool non-keyword arg
151-
WPS427 # FIXME: unreachable code
152151
WPS428 # FIXME: pointless statement
153152
WPS430 # FIXME: nested func
154153
WPS431 # FIXME: nested class

.pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ disable=raw-checker-failed,
127127
too-many-return-statements,
128128
too-many-statements,
129129
unnecessary-pass,
130-
unreachable,
131130
unused-argument,
132131
useless-return,
133132
useless-super-delegation,

proxy/common/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
else:
2323
from typing_extensions import Protocol
2424

25+
2526
if TYPE_CHECKING:
2627
DictQueueType = queue.Queue[Dict[str, Any]] # pragma: no cover
2728
else:

proxy/core/event/dispatcher.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ def run(self) -> None:
8383
self.run_once()
8484
except queue.Empty:
8585
pass
86-
except BrokenPipeError:
87-
pass
88-
except EOFError:
89-
pass
90-
except KeyboardInterrupt:
86+
except (BrokenPipeError, EOFError, KeyboardInterrupt):
9187
pass
9288
except Exception as e:
9389
logger.exception('Dispatcher exception', exc_info=e)

proxy/core/event/subscriber.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def unsubscribe(self) -> None:
103103
return
104104
try:
105105
self.event_queue.unsubscribe(self.relay_sub_id)
106-
except BrokenPipeError:
107-
pass
108-
except EOFError:
106+
except (BrokenPipeError, EOFError):
109107
pass
110108
finally:
111109
# self.relay_sub_id = None

proxy/plugin/filter_by_url_regex.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ def handle_client_request(
7272
request.path,
7373
)
7474
# check URL against list
75-
rule_number = 1
76-
for blocked_entry in self.filters:
75+
for rule_number, blocked_entry in enumerate(self.filters, start=1):
7776
# if regex matches on URL
7877
if re.search(text_(blocked_entry['regex']), text_(url)):
7978
# log that the request has been filtered
@@ -90,8 +89,4 @@ def handle_client_request(
9089
status_code=httpStatusCodes.NOT_FOUND,
9190
reason=b'Blocked',
9291
)
93-
# stop looping through filter list
94-
break
95-
# increment rule number
96-
rule_number += 1
9792
return request

0 commit comments

Comments
 (0)