Skip to content

Commit

Permalink
Replace Python 2 type hints with real type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dbieber committed Sep 22, 2024
1 parent a0cb1ca commit b32d1f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 0 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ In addition, the project follows a convention of:
- Maximum line length: 80 characters
- Indentation: 2 spaces (4 for line continuation)
- PascalCase for function and method names.
- No type hints, as described in [PEP 484], to maintain compatibility with
Python versions < 3.5.
- Single quotes around strings, three double quotes around docstrings.

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

## Testing

Expand Down
7 changes: 3 additions & 4 deletions fire/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
command line arguments to client code.
"""

from typing import Any
import inspect

FIRE_METADATA = 'FIRE_METADATA'
Expand Down Expand Up @@ -80,8 +81,7 @@ def _SetMetadata(fn, attribute, value):
setattr(fn, FIRE_METADATA, metadata)


def GetMetadata(fn):
# type: (...) -> dict
def GetMetadata(fn) -> dict[str, Any]:
"""Gets metadata attached to the function `fn` as an attribute.
Args:
Expand All @@ -104,8 +104,7 @@ def GetMetadata(fn):
return default


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

0 comments on commit b32d1f5

Please sign in to comment.