Get rid of a few Python 2 things

This commit is contained in:
Dave Halter
2020-07-02 16:00:26 +02:00
parent ec08506704
commit dac1fb0a06
3 changed files with 6 additions and 8 deletions
+3 -3
View File
@@ -138,8 +138,7 @@ def _infer_param(function_value, param):
"""
annotation = param.annotation
if annotation is None:
# If no Python 3-style annotation, look for a Python 2-style comment
# annotation.
# If no Python 3-style annotation, look for a comment annotation.
# Identify parameters to function in the same sequence as they would
# appear in a type comment.
all_params = [child for child in param.parent.children
@@ -204,7 +203,8 @@ def infer_return_types(function, arguments):
all_annotations = py__annotations__(function.tree_node)
annotation = all_annotations.get("return", None)
if annotation is None:
# If there is no Python 3-type annotation, look for a Python 2-type annotation
# If there is no Python 3-type annotation, look for an annotation
# comment.
node = function.tree_node
comment = parser_utils.get_following_comment_same_line(node)
if comment is None:
+1 -1
View File
@@ -272,7 +272,7 @@ def _load_from_typeshed(inference_state, python_value_set, parent_module_value,
def _try_to_load_stub_from_file(inference_state, python_value_set, file_io, import_names):
try:
stub_module_node = parse_stub_module(inference_state, file_io)
except OSError: # IOError is Python 2 only
except OSError:
# The file that you're looking for doesn't exist (anymore).
return None
else: