Merge pull request #8 from tcfranks/main

correct Missing Type Annotations #6
This commit is contained in:
Alec Delaney 2022-08-19 17:05:36 -04:00 committed by GitHub
commit 9e9e8b70ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,11 @@ Implementation Notes
import json
try:
from typing import Any
except ImportError:
pass
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests.git"
@ -30,16 +35,16 @@ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests.git"
class Fake_Requests:
"""For faking 'requests' using a local file instead of the network."""
def __init__(self, filename):
def __init__(self, filename: str) -> None:
self._filename = filename
def json(self):
def json(self) -> Any:
"""json parsed version for local requests."""
with open(self._filename, "r") as file:
return json.load(file)
@property
def text(self):
def text(self) -> str:
"""raw text version for local requests."""
with open(self._filename, "r") as file:
return file.read()