Skip to content

Remove some unnecessary checks for None #1464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions mypy/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ def visit_partial_type(self, template: PartialType) -> List[Constraint]:
# Non-trivial leaf type

def visit_type_var(self, template: TypeVarType) -> List[Constraint]:
if self.actual:
return [Constraint(template.id, self.direction, self.actual)]
else:
return []
return [Constraint(template.id, self.direction, self.actual)]

# Non-leaf types

Expand Down
2 changes: 1 addition & 1 deletion mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ def fullname(self) -> str:

def is_generic(self) -> bool:
"""Is the type generic (i.e. does it have type variables)?"""
return self.type_vars is not None and len(self.type_vars) > 0
return len(self.type_vars) > 0

def get(self, name: str) -> 'SymbolTableNode':
for cls in self.mro:
Expand Down