update mypy

This commit is contained in:
Maximilian Hils 2017-03-15 23:10:21 +01:00
parent dadefaecdb
commit 112233891d
4 changed files with 7 additions and 2 deletions

View File

@ -241,7 +241,7 @@ class View(collections.Sequence):
self._refilter() self._refilter()
self.sig_store_refresh.send(self) 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 Adds a flow to the state. If the flow already exists, it is
ignored. ignored.
@ -371,6 +371,7 @@ class Focus:
def index(self) -> typing.Optional[int]: def index(self) -> typing.Optional[int]:
if self.flow: if self.flow:
return self.view.index(self.flow) return self.view.index(self.flow)
return None
@index.setter @index.setter
def index(self, idx): def index(self, idx):

View File

@ -36,12 +36,14 @@ def get(name: str) -> Optional[View]:
for i in views: for i in views:
if i.name.lower() == name.lower(): if i.name.lower() == name.lower():
return i return i
return None
def get_by_shortcut(c: str) -> Optional[View]: def get_by_shortcut(c: str) -> Optional[View]:
for i in views: for i in views:
if i.prompt[1] == c: if i.prompt[1] == c:
return i return i
return None
def add(view: View) -> None: def add(view: View) -> None:

View File

@ -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 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: if a.is_opening and "\n" not in b.data and c.is_closing and a.tag == c.tag:
return True return True
return False
def is_inline(prev2: Token, prev1: Token, t: Token, next1: Token, next2: Token) -> bool: 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 # <div></div> (start tag) return True # <div></div> (start tag)
if isinstance(prev1, Tag) and prev1.is_opening and t.is_closing and prev1.tag == t.tag: if isinstance(prev1, Tag) and prev1.is_opening and t.is_closing and prev1.tag == t.tag:
return True # <div></div> (end tag) return True # <div></div> (end tag)
return False
class ElementStack: class ElementStack:

View File

@ -96,7 +96,7 @@ setup(
'dev': [ 'dev': [
"Flask>=0.10.1, <0.13", "Flask>=0.10.1, <0.13",
"flake8>=3.2.1, <3.4", "flake8>=3.2.1, <3.4",
"mypy>=0.471, <0.480", "mypy>=0.471, <0.502",
"rstcheck>=2.2, <4.0", "rstcheck>=2.2, <4.0",
"tox>=2.3, <3", "tox>=2.3, <3",
"pytest>=3, <3.1", "pytest>=3, <3.1",