diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py index 3a0587b05..2218327c9 100644 --- a/mitmproxy/addons/view.py +++ b/mitmproxy/addons/view.py @@ -241,7 +241,7 @@ class View(collections.Sequence): self._refilter() self.sig_store_refresh.send(self) - def add(self, f: mitmproxy.flow.Flow) -> bool: + def add(self, f: mitmproxy.flow.Flow) -> None: """ Adds a flow to the state. If the flow already exists, it is ignored. @@ -371,6 +371,7 @@ class Focus: def index(self) -> typing.Optional[int]: if self.flow: return self.view.index(self.flow) + return None @index.setter def index(self, idx): diff --git a/mitmproxy/contentviews/__init__.py b/mitmproxy/contentviews/__init__.py index c7db66904..f57b27c7f 100644 --- a/mitmproxy/contentviews/__init__.py +++ b/mitmproxy/contentviews/__init__.py @@ -36,12 +36,14 @@ def get(name: str) -> Optional[View]: for i in views: if i.name.lower() == name.lower(): return i + return None def get_by_shortcut(c: str) -> Optional[View]: for i in views: if i.prompt[1] == c: return i + return None def add(view: View) -> None: diff --git a/mitmproxy/contentviews/xml_html.py b/mitmproxy/contentviews/xml_html.py index 0f2ce57df..62fb939fd 100644 --- a/mitmproxy/contentviews/xml_html.py +++ b/mitmproxy/contentviews/xml_html.py @@ -128,6 +128,7 @@ def is_inline_text(a: Token, b: Token, c: Token) -> bool: if isinstance(a, Tag) and isinstance(b, Text) and isinstance(c, Tag): if a.is_opening and "\n" not in b.data and c.is_closing and a.tag == c.tag: return True + return False def is_inline(prev2: Token, prev1: Token, t: Token, next1: Token, next2: Token) -> bool: @@ -140,6 +141,7 @@ def is_inline(prev2: Token, prev1: Token, t: Token, next1: Token, next2: Token) return True #
(start tag) if isinstance(prev1, Tag) and prev1.is_opening and t.is_closing and prev1.tag == t.tag: return True #
(end tag) + return False class ElementStack: diff --git a/setup.py b/setup.py index 6f17a62ee..5bf9fa1b7 100644 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ setup( 'dev': [ "Flask>=0.10.1, <0.13", "flake8>=3.2.1, <3.4", - "mypy>=0.471, <0.480", + "mypy>=0.471, <0.502", "rstcheck>=2.2, <4.0", "tox>=2.3, <3", "pytest>=3, <3.1",