Skip to content

Commit ee757c5

Browse files
committed
Remove pytype comments
1 parent 89682cf commit ee757c5

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

fire/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def import_from_file_path(path):
6464
raise OSError('Unable to load module from specified path.')
6565

6666
module = util.module_from_spec(spec) # pylint: disable=no-member
67-
spec.loader.exec_module(module) # pytype: disable=attribute-error
67+
spec.loader.exec_module(module)
6868

6969
return module, module_name
7070

fire/console/encoding.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ def Decode(data, encoding=None):
6767

6868
try:
6969
# Just return the string if its pure ASCII.
70-
return string.decode('ascii') # pytype: disable=attribute-error
70+
return string.decode('ascii')
7171
except UnicodeError:
7272
# The string is not ASCII encoded.
7373
pass
7474

7575
# Try the suggested encoding if specified.
7676
if encoding:
7777
try:
78-
return string.decode(encoding) # pytype: disable=attribute-error
78+
return string.decode(encoding)
7979
except UnicodeError:
8080
# Bad suggestion.
8181
pass
@@ -84,21 +84,21 @@ def Decode(data, encoding=None):
8484
# be exceptional if a valid extended ascii encoding with extended chars
8585
# were also a valid UITF-8 encoding.
8686
try:
87-
return string.decode('utf8') # pytype: disable=attribute-error
87+
return string.decode('utf8')
8888
except UnicodeError:
8989
# Not a UTF-8 encoding.
9090
pass
9191

9292
# Try the filesystem encoding.
9393
try:
94-
return string.decode(sys.getfilesystemencoding()) # pytype: disable=attribute-error
94+
return string.decode(sys.getfilesystemencoding())
9595
except UnicodeError:
9696
# string is not encoded for filesystem paths.
9797
pass
9898

9999
# Try the system default encoding.
100100
try:
101-
return string.decode(sys.getdefaultencoding()) # pytype: disable=attribute-error
101+
return string.decode(sys.getdefaultencoding())
102102
except UnicodeError:
103103
# string is not encoded using the default encoding.
104104
pass
@@ -118,7 +118,7 @@ def Decode(data, encoding=None):
118118
# string = '\xdc'
119119
# string = string.decode('iso-8859-1')
120120
# string = string.encode('ascii', 'backslashreplace')
121-
return string.decode('iso-8859-1') # pytype: disable=attribute-error
121+
return string.decode('iso-8859-1')
122122

123123

124124
def GetEncodedValue(env, name, default=None):

fire/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def _Fire(component, args, parsed_flag_args, context, name=None):
504504

505505
# Treat namedtuples as dicts when handling them as a map.
506506
if inspectutils.IsNamedTuple(component):
507-
component_dict = component._asdict() # pytype: disable=attribute-error
507+
component_dict = component._asdict()
508508
else:
509509
component_dict = component
510510

@@ -519,7 +519,7 @@ def _Fire(component, args, parsed_flag_args, context, name=None):
519519
# a key as another type.
520520
# TODO(dbieber): Consider alternatives for accessing non-string keys.
521521
for key, value in (
522-
component_dict.items()): # pytype: disable=attribute-error
522+
component_dict.items()):
523523
if target == str(key):
524524
component = value
525525
handled = True

fire/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def SetParseFns(*positional, **named):
6868
def _Decorator(fn):
6969
parse_fns = GetParseFns(fn)
7070
parse_fns['positional'] = positional
71-
parse_fns['named'].update(named) # pytype: disable=attribute-error
71+
parse_fns['named'].update(named)
7272
_SetMetadata(fn, FIRE_PARSE_FNS, parse_fns)
7373
return fn
7474

fire/docstrings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def _consume_line(line_info, state):
436436
if state.section.new and state.section.format == Formats.RST:
437437
# The current line starts with an RST directive, e.g. ":param arg:".
438438
directive = _get_directive(line_info)
439-
directive_tokens = directive.split() # pytype: disable=attribute-error
439+
directive_tokens = directive.split()
440440
if state.section.title == Sections.ARGS:
441441
name = directive_tokens[-1]
442442
arg = _get_or_create_arg_by_name(

fire/helptext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def _ArgsAndFlagsSections(info, spec, metadata):
284284
return args_and_flags_sections, notes_sections
285285

286286

287-
def _UsageDetailsSections(component, actions_grouped_by_kind) -> list[tuple[str, str]]:
287+
def _UsageDetailsSections(component, actions_grouped_by_kind):
288288
"""The usage details sections of the help string."""
289289
groups, commands, values, indexes = actions_grouped_by_kind
290290

fire/main_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def testFileNameModuleDuplication(self):
7878
def testFileNameModuleFileFailure(self):
7979
# Confirm that an invalid file that masks a non-existent module fails.
8080
with self.assertRaisesRegex(ValueError,
81-
r'Fire can only be called on \.py files\.'): # pylint: disable=line-too-long, # pytype: disable=attribute-error
81+
r'Fire can only be called on \.py files\.'): # pylint: disable=line-too-long,
8282
dirname = os.path.dirname(self.file.name)
8383
with testutils.ChangeDirectory(dirname):
8484
with open('foobar', 'w'):

fire/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _LiteralEval(value):
9696
SyntaxError: If the value string has a syntax error.
9797
"""
9898
root = ast.parse(value, mode='eval')
99-
if isinstance(root.body, ast.BinOp): # pytype: disable=attribute-error
99+
if isinstance(root.body, ast.BinOp):
100100
raise ValueError(value)
101101

102102
for node in ast.walk(root):

fire/trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(self, initial_component, name=None, separator='-', verbose=False,
6262

6363
def GetResult(self):
6464
"""Returns the component from the last element of the trace."""
65-
# pytype: disable=attribute-error
65+
6666
return self.GetLastHealthyElement().component
6767
# pytype: enable=attribute-error
6868

0 commit comments

Comments
 (0)