Bump install-pinned/black from 9101a4d68e870eaaaae21c412d1d879b93c9afcb to 13c8a20eb904ba800c87f0b34ccfd932ac2ff81d (#5899)

* Bump install-pinned/black

Bumps [install-pinned/black](https://github.com/install-pinned/black) from 9101a4d68e870eaaaae21c412d1d879b93c9afcb to 13c8a20eb904ba800c87f0b34ccfd932ac2ff81d.
- [Release notes](https://github.com/install-pinned/black/releases)
- [Commits](9101a4d68e...13c8a20eb9)

---
updated-dependencies:
- dependency-name: install-pinned/black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* [autofix.ci] apply automated fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-02-01 23:08:09 +00:00 committed by GitHub
parent 317b7a2be2
commit dfeddcf4ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 13 additions and 32 deletions

View File

@ -38,7 +38,7 @@ jobs:
- uses: install-pinned/autoflake@19ecc14a8688d57cca9dc6cfd705f16f200ff097
- run: autoflake --in-place --remove-all-unused-imports --exclude contrib -r .
- uses: install-pinned/black@9101a4d68e870eaaaae21c412d1d879b93c9afcb
- uses: install-pinned/black@13c8a20eb904ba800c87f0b34ccfd932ac2ff81d
- run: black --extend-exclude mitmproxy/contrib .
- uses: mhils/add-pr-ref-in-changelog@main

View File

@ -60,7 +60,6 @@ class Mapping:
class HttpsDomainFronting:
# configurations for regular ("foo.example.com") mappings:
star_mappings: dict[str, Mapping]

View File

@ -56,7 +56,6 @@ def configure(updated):
def flow_entry(flow: mitmproxy.http.HTTPFlow) -> dict:
# -1 indicates that these values do not apply to current request
ssl_time = -1
connect_time = -1

View File

@ -7,7 +7,6 @@ from urllib.parse import urljoin
def response(flow):
if (
"Content-Type" in flow.response.headers
and flow.response.headers["Content-Type"].find("text/html") != -1

View File

@ -408,7 +408,6 @@ class TestXSSScanner:
assert sqli_info is None
def test_test_query_injection(self, get_request_vuln):
xss_info = xss.test_query_injection(
"<html></html>", "https://example.com/vuln.php?cmd=ls", {}
)[0]

View File

@ -141,7 +141,6 @@ class MappingAddon:
def done(self) -> None:
"""Dumps all new content into the configuration file if self.persistent is set."""
if self.persistent:
# make sure that all items are strings and not soups.
def value_dumper(value):
store = {}

View File

@ -50,7 +50,6 @@ class URLDict(MutableMapping):
return self.store.__len__()
def get_generator(self, flow: HTTPFlow) -> Generator[Any, None, None]:
for fltr, value in self.store.items():
if flowfilter.match(fltr, flow):
yield value

View File

@ -66,7 +66,6 @@ class WatchdogAddon:
and flow.error is not None
and not isinstance(flow.error, HttpSyntaxException)
):
self.last_trigger = time.time()
logger.error(f"Watchdog triggered! Cause: {flow}")
self.error_event.set()

View File

@ -111,7 +111,7 @@ class Dumper:
def _colorful(self, line):
yield " " # we can already indent here
for (style, text) in line:
for style, text in line:
yield self.style(text, **CONTENTVIEW_STYLES.get(style, {}))
def _echo_message(

View File

@ -89,7 +89,7 @@ def safe_to_print(lines, encoding="utf8"):
"""
for line in lines:
clean_line = []
for (style, text) in line:
for style, text in line:
if isinstance(text, bytes):
text = text.decode(encoding, "replace")
text = strutils.escape_control_characters(text)

View File

@ -86,7 +86,6 @@ def format_pairs(items: Iterable[tuple[TTextType, TTextType]]) -> Iterator[TView
for key, value in items:
if isinstance(key, bytes):
key += b":"
else:
key += ":"

View File

@ -1113,7 +1113,6 @@ class ViewGrpcProtobuf(base.View):
http_message: http.Message | None = None,
**unknown_metadata,
) -> float:
if bool(data) and content_type in self.__content_types_grpc:
return 1
if bool(data) and content_type in self.__content_types_pb:

View File

@ -138,7 +138,7 @@ def _rdumpq(q: collections.deque, size: int, value: TSerializable) -> int:
elif isinstance(value, dict):
write(b"}")
init_size = size = size + 1
for (k, v) in value.items():
for k, v in value.items():
size = _rdumpq(q, size, v)
size = _rdumpq(q, size, k)
span = str(size - init_size).encode()

View File

@ -274,7 +274,6 @@ def format_set_cookie_header(set_cookies: list[TSetCookie]) -> str:
rv = []
for name, value, attrs in set_cookies:
pairs = [(name, value)]
pairs.extend(attrs.fields if hasattr(attrs, "fields") else attrs)

View File

@ -56,7 +56,7 @@ def validate_headers(headers: Headers) -> None:
te_found = False
cl_found = False
for (name, value) in headers.fields:
for name, value in headers.fields:
if not _valid_header_name.match(name):
raise ValueError(
f"Received an invalid header name: {name!r}. Invalid header names may introduce "

View File

@ -161,7 +161,7 @@ class OptManager:
def _notify_subscribers(self, updated) -> None:
cleanup = False
for (ref, opts) in self._subscriptions:
for ref, opts in self._subscriptions:
callback = ref()
if callback is not None:
if opts & updated:

View File

@ -132,6 +132,7 @@ IN4_ADDR = ctypes.c_ubyte * 4
# IPv6
#
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366896(v=vs.85).aspx
class MIB_TCP6ROW_OWNER_PID(ctypes.Structure):
_fields_ = [
@ -161,6 +162,7 @@ def MIB_TCP6TABLE_OWNER_PID(size):
# IPv4
#
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa366913(v=vs.85).aspx
class MIB_TCPROW_OWNER_PID(ctypes.Structure):
_fields_ = [

View File

@ -1028,7 +1028,6 @@ class HttpLayer(layer.Layer):
stack = tunnel.LayerStack()
if not can_use_context_connection:
context.server = Server(
address=event.address, transport_protocol=event.transport_protocol
)

View File

@ -610,7 +610,7 @@ def split_pseudo_headers(
) -> tuple[dict[bytes, bytes], http.Headers]:
pseudo_headers: dict[bytes, bytes] = {}
i = 0
for (header, value) in h2_headers:
for header, value in h2_headers:
if header.startswith(b":"):
if header in pseudo_headers:
raise ValueError(f"Duplicate HTTP/2 pseudo header: {header!r}")

View File

@ -93,7 +93,6 @@ class TCPLayer(layer.Layer):
@expect(events.DataReceived, events.ConnectionClosed, TcpMessageInjected)
def relay_messages(self, event: events.Event) -> layer.CommandGenerator[None]:
if isinstance(event, TcpMessageInjected):
# we just spoof that we received data here and then process that regularly.
event = events.DataReceived(

View File

@ -92,7 +92,6 @@ class UDPLayer(layer.Layer):
@expect(events.DataReceived, events.ConnectionClosed, UdpMessageInjected)
def relay_messages(self, event: events.Event) -> layer.CommandGenerator[None]:
if isinstance(event, UdpMessageInjected):
# we just spoof that we received data here and then process that regularly.
event = events.DataReceived(

View File

@ -97,7 +97,6 @@ class WebsocketLayer(layer.Layer):
@expect(events.Start)
def start(self, _) -> layer.CommandGenerator[None]:
client_extensions = []
server_extensions = []

View File

@ -357,7 +357,6 @@ class ConnectionHandler(metaclass=abc.ABCMeta):
try:
layer_commands = self.layer.handle_event(event)
for command in layer_commands:
if isinstance(command, commands.OpenConnection):
assert command.connection not in self.transports
handler = asyncio_utils.create_task(

View File

@ -550,7 +550,6 @@ def format_http_flow_table(
response_style = ""
if response_code:
status = str(response_code)
status_style = response_style or HTTP_RESPONSE_CODE_STYLE.get(
response_code // 100, "code_other"

View File

@ -329,7 +329,7 @@ class FlowDetails(tabs.Tabs):
text_objects = []
for line in lines:
txt = []
for (style, text) in line:
for style, text in line:
if total_chars + len(text) > max_chars:
text = text[: max_chars - total_chars]
txt.append((style, text))

View File

@ -54,7 +54,6 @@ class RequestMultipartEditor(base.FocusEditor):
columns = [col_text.Column("Key"), col_text.Column("Value")]
def get_data(self, flow):
return flow.request.multipart_form.items(multi=True)
def set_data(self, vals, flow):
@ -66,7 +65,6 @@ class RequestUrlEncodedEditor(base.FocusEditor):
columns = [col_text.Column("Key"), col_text.Column("Value")]
def get_data(self, flow):
return flow.request.urlencoded_form.items(multi=True)
def set_data(self, vals, flow):

View File

@ -169,7 +169,7 @@ def _make_row(label: str, items: HelpItems, keymap: Keymap) -> urwid.Columns:
cols = [
(len(label), urwid.Text(label)),
]
for (short, long) in items.items():
for short, long in items.items():
if isinstance(long, BasicKeyHelp):
key_short = long.key
else:

View File

@ -559,7 +559,7 @@ class FlowContentView(RequestHandler):
class Commands(RequestHandler):
def get(self) -> None:
commands = {}
for (name, cmd) in self.master.commands.commands.items():
for name, cmd in self.master.commands.commands.items():
commands[name] = {
"help": cmd.help,
"parameters": [

View File

@ -50,7 +50,6 @@ async def test_playback(mode, concurrency):
with taddons.context(cp, ps) as tctx:
tctx.configure(cp, client_replay_concurrency=concurrency)
async with tcp_server(handler) as addr:
cp.running()
flow = tflow.tflow(live=False)
flow.request.content = b"data"

View File

@ -198,7 +198,6 @@ def test_parse_set_cookie_header():
def test_refresh_cookie():
# Invalid expires format, sent to us by Reddit.
c = "rfoo=bar; Domain=reddit.com; expires=Thu, 31 Dec 2133 23:59:59 GMT; Path=/"
assert cookies.refresh_set_cookie_header(c, 60)

View File

@ -44,7 +44,7 @@ tflow2.marked = "x"
def test_quickhelp(widget, flow, keymap, is_root_widget):
qh = quickhelp.make(widget, flow, is_root_widget)
for row in [qh.top_items, qh.bottom_items]:
for (title, v) in row.items():
for title, v in row.items():
if isinstance(v, quickhelp.BasicKeyHelp):
key_short = v.key
else:

View File

@ -130,7 +130,6 @@ async def test_generate_options_js():
raise RuntimeError(t)
with redirect_stdout(io.StringIO()) as s:
print("/** Auto-generated by test_app.py:test_generate_options_js */")
print("export interface OptionsState {")