Skip to content

Commit 90b7f82

Browse files
authored
Replace Python 2 type hints with real type annotations (#559)
* Replace Python 2 type hints with real type annotations
1 parent a0cb1ca commit 90b7f82

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,9 @@ In addition, the project follows a convention of:
4040
- Maximum line length: 80 characters
4141
- Indentation: 2 spaces (4 for line continuation)
4242
- PascalCase for function and method names.
43-
- No type hints, as described in [PEP 484], to maintain compatibility with
44-
Python versions < 3.5.
4543
- Single quotes around strings, three double quotes around docstrings.
4644

4745
[Google Python Style Guide]: http://google.github.io/styleguide/pyguide.html
48-
[PEP 484]: https://www.python.org/dev/peps/pep-0484
4946

5047
## Testing
5148

fire/decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
command line arguments to client code.
1919
"""
2020

21+
from typing import Any, Dict
2122
import inspect
2223

2324
FIRE_METADATA = 'FIRE_METADATA'
@@ -80,8 +81,7 @@ def _SetMetadata(fn, attribute, value):
8081
setattr(fn, FIRE_METADATA, metadata)
8182

8283

83-
def GetMetadata(fn):
84-
# type: (...) -> dict
84+
def GetMetadata(fn) -> Dict[str, Any]:
8585
"""Gets metadata attached to the function `fn` as an attribute.
8686
8787
Args:
@@ -104,8 +104,7 @@ def GetMetadata(fn):
104104
return default
105105

106106

107-
def GetParseFns(fn):
108-
# type: (...) -> dict
107+
def GetParseFns(fn) -> Dict[str, Any]:
109108
metadata = GetMetadata(fn)
110109
default = {'default': None, 'positional': [], 'named': {}}
111110
return metadata.get(FIRE_PARSE_FNS, default)

0 commit comments

Comments
 (0)