Skip to content

correct Missing Type Annotations #6 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions adafruit_fakerequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,28 @@

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"


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()