Skip to content

Commit 7dd5edd

Browse files
authoredDec 4, 2020
Merge pull request #1 from makermelissa/main
Adding library files
·
1.0.171.0.0
2 parents adf137f + c60c8ad commit 7dd5edd

28 files changed

+1622
-2
lines changed
 

‎.github/workflows/build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Build CI
6+
7+
on: [pull_request, push]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Dump GitHub context
14+
env:
15+
GITHUB_CONTEXT: ${{ toJson(github) }}
16+
run: echo "$GITHUB_CONTEXT"
17+
- name: Translate Repo Name For Build Tools filename_prefix
18+
id: repo-name
19+
run: |
20+
echo ::set-output name=repo-name::$(
21+
echo ${{ github.repository }} |
22+
awk -F '\/' '{ print tolower($2) }' |
23+
tr '_' '-'
24+
)
25+
- name: Set up Python 3.6
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: 3.6
29+
- name: Versions
30+
run: |
31+
python3 --version
32+
- name: Checkout Current Repo
33+
uses: actions/checkout@v1
34+
with:
35+
submodules: true
36+
- name: Checkout tools repo
37+
uses: actions/checkout@v2
38+
with:
39+
repository: adafruit/actions-ci-circuitpython-libs
40+
path: actions-ci
41+
- name: Install dependencies
42+
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
43+
run: |
44+
source actions-ci/install.sh
45+
- name: Pip install pylint, Sphinx, pre-commit
46+
run: |
47+
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
48+
- name: Library version
49+
run: git describe --dirty --always --tags
50+
- name: Pre-commit hooks
51+
run: |
52+
pre-commit run --all-files
53+
- name: PyLint
54+
run: |
55+
pylint $( find . -path './adafruit*.py' )
56+
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
57+
- name: Build assets
58+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
59+
- name: Build docs
60+
working-directory: docs
61+
run: sphinx-build -E -W -b html . _build/html
62+
- name: Check For setup.py
63+
id: need-pypi
64+
run: |
65+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
66+
- name: Build Python package
67+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
68+
run: |
69+
pip install --upgrade setuptools wheel twine readme_renderer testresources
70+
python setup.py sdist
71+
python setup.py bdist_wheel --universal
72+
twine check dist/*

‎.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Release Actions
6+
7+
on:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
upload-release-assets:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Dump GitHub context
16+
env:
17+
GITHUB_CONTEXT: ${{ toJson(github) }}
18+
run: echo "$GITHUB_CONTEXT"
19+
- name: Translate Repo Name For Build Tools filename_prefix
20+
id: repo-name
21+
run: |
22+
echo ::set-output name=repo-name::$(
23+
echo ${{ github.repository }} |
24+
awk -F '\/' '{ print tolower($2) }' |
25+
tr '_' '-'
26+
)
27+
- name: Set up Python 3.6
28+
uses: actions/setup-python@v1
29+
with:
30+
python-version: 3.6
31+
- name: Versions
32+
run: |
33+
python3 --version
34+
- name: Checkout Current Repo
35+
uses: actions/checkout@v1
36+
with:
37+
submodules: true
38+
- name: Checkout tools repo
39+
uses: actions/checkout@v2
40+
with:
41+
repository: adafruit/actions-ci-circuitpython-libs
42+
path: actions-ci
43+
- name: Install deps
44+
run: |
45+
source actions-ci/install.sh
46+
- name: Build assets
47+
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
48+
- name: Upload Release Assets
49+
# the 'official' actions version does not yet support dynamically
50+
# supplying asset names to upload. @csexton's version chosen based on
51+
# discussion in the issue below, as its the simplest to implement and
52+
# allows for selecting files with a pattern.
53+
# https://github.com/actions/upload-release-asset/issues/4
54+
#uses: actions/upload-release-asset@v1.0.1
55+
uses: csexton/release-asset-action@master
56+
with:
57+
pattern: "bundles/*"
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
60+
upload-pypi:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v1
64+
- name: Check For setup.py
65+
id: need-pypi
66+
run: |
67+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
68+
- name: Set up Python
69+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
70+
uses: actions/setup-python@v1
71+
with:
72+
python-version: '3.x'
73+
- name: Install dependencies
74+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install setuptools wheel twine
78+
- name: Build and publish
79+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
80+
env:
81+
TWINE_USERNAME: ${{ secrets.pypi_username }}
82+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
83+
run: |
84+
python setup.py sdist
85+
twine upload dist/*

‎.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
*.mpy
6+
.idea
7+
__pycache__
8+
_build
9+
*.pyc
10+
.env
11+
.python-version
12+
build*/
13+
bundles
14+
*.DS_Store
15+
.eggs
16+
dist
17+
**/*.egg-info
18+
.vscode

‎.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/python/black
7+
rev: stable
8+
hooks:
9+
- id: black
10+
- repo: https://github.com/fsfe/reuse-tool
11+
rev: latest
12+
hooks:
13+
- id: reuse
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v2.3.0
16+
hooks:
17+
- id: check-yaml
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace

‎.pylintrc

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

‎.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
python:
6+
version: 3
7+
requirements_file: requirements.txt

‎CODE_OF_CONDUCT.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
3+
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
4+
5+
SPDX-License-Identifier: CC-BY-4.0
6+
-->
7+
# Adafruit Community Code of Conduct
8+
9+
## Our Pledge
10+
11+
In the interest of fostering an open and welcoming environment, we as
12+
contributors and leaders pledge to making participation in our project and
13+
our community a harassment-free experience for everyone, regardless of age, body
14+
size, disability, ethnicity, gender identity and expression, level or type of
15+
experience, education, socio-economic status, nationality, personal appearance,
16+
race, religion, or sexual identity and orientation.
17+
18+
## Our Standards
19+
20+
We are committed to providing a friendly, safe and welcoming environment for
21+
all.
22+
23+
Examples of behavior that contributes to creating a positive environment
24+
include:
25+
26+
* Be kind and courteous to others
27+
* Using welcoming and inclusive language
28+
* Being respectful of differing viewpoints and experiences
29+
* Collaborating with other community members
30+
* Gracefully accepting constructive criticism
31+
* Focusing on what is best for the community
32+
* Showing empathy towards other community members
33+
34+
Examples of unacceptable behavior by participants include:
35+
36+
* The use of sexualized language or imagery and sexual attention or advances
37+
* The use of inappropriate images, including in a community member's avatar
38+
* The use of inappropriate language, including in a community member's nickname
39+
* Any spamming, flaming, baiting or other attention-stealing behavior
40+
* Excessive or unwelcome helping; answering outside the scope of the question
41+
asked
42+
* Trolling, insulting/derogatory comments, and personal or political attacks
43+
* Promoting or spreading disinformation, lies, or conspiracy theories against
44+
a person, group, organisation, project, or community
45+
* Public or private harassment
46+
* Publishing others' private information, such as a physical or electronic
47+
address, without explicit permission
48+
* Other conduct which could reasonably be considered inappropriate
49+
50+
The goal of the standards and moderation guidelines outlined here is to build
51+
and maintain a respectful community. We ask that you don’t just aim to be
52+
"technically unimpeachable", but rather try to be your best self.
53+
54+
We value many things beyond technical expertise, including collaboration and
55+
supporting others within our community. Providing a positive experience for
56+
other community members can have a much more significant impact than simply
57+
providing the correct answer.
58+
59+
## Our Responsibilities
60+
61+
Project leaders are responsible for clarifying the standards of acceptable
62+
behavior and are expected to take appropriate and fair corrective action in
63+
response to any instances of unacceptable behavior.
64+
65+
Project leaders have the right and responsibility to remove, edit, or
66+
reject messages, comments, commits, code, issues, and other contributions
67+
that are not aligned to this Code of Conduct, or to ban temporarily or
68+
permanently any community member for other behaviors that they deem
69+
inappropriate, threatening, offensive, or harmful.
70+
71+
## Moderation
72+
73+
Instances of behaviors that violate the Adafruit Community Code of Conduct
74+
may be reported by any member of the community. Community members are
75+
encouraged to report these situations, including situations they witness
76+
involving other community members.
77+
78+
You may report in the following ways:
79+
80+
In any situation, you may send an email to <support@adafruit.com>.
81+
82+
On the Adafruit Discord, you may send an open message from any channel
83+
to all Community Moderators by tagging @community moderators. You may
84+
also send an open message from any channel, or a direct message to
85+
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
86+
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
87+
88+
Email and direct message reports will be kept confidential.
89+
90+
In situations on Discord where the issue is particularly egregious, possibly
91+
illegal, requires immediate action, or violates the Discord terms of service,
92+
you should also report the message directly to Discord.
93+
94+
These are the steps for upholding our community’s standards of conduct.
95+
96+
1. Any member of the community may report any situation that violates the
97+
Adafruit Community Code of Conduct. All reports will be reviewed and
98+
investigated.
99+
2. If the behavior is an egregious violation, the community member who
100+
committed the violation may be banned immediately, without warning.
101+
3. Otherwise, moderators will first respond to such behavior with a warning.
102+
4. Moderators follow a soft "three strikes" policy - the community member may
103+
be given another chance, if they are receptive to the warning and change their
104+
behavior.
105+
5. If the community member is unreceptive or unreasonable when warned by a
106+
moderator, or the warning goes unheeded, they may be banned for a first or
107+
second offense. Repeated offenses will result in the community member being
108+
banned.
109+
110+
## Scope
111+
112+
This Code of Conduct and the enforcement policies listed above apply to all
113+
Adafruit Community venues. This includes but is not limited to any community
114+
spaces (both public and private), the entire Adafruit Discord server, and
115+
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
116+
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
117+
interaction at a conference.
118+
119+
This Code of Conduct applies both within project spaces and in public spaces
120+
when an individual is representing the project or its community. As a community
121+
member, you are representing our community, and are expected to behave
122+
accordingly.
123+
124+
## Attribution
125+
126+
This Code of Conduct is adapted from the [Contributor Covenant],
127+
version 1.4, available at
128+
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
129+
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
130+
131+
For other projects adopting the Adafruit Community Code of
132+
Conduct, please contact the maintainers of those projects for enforcement.
133+
If you wish to use this code of conduct for your own project, consider
134+
explicitly mentioning your moderation policy or making a copy with your
135+
own moderation policy so as to avoid confusion.
136+
137+
[Contributor Covenant]: https://www.contributor-covenant.org

‎LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎LICENSES/CC-BY-4.0.txt

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.

‎LICENSES/MIT.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License Copyright (c) <year> <copyright holders>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice (including the next
11+
paragraph) shall be included in all copies or substantial portions of the
12+
Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19+
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎LICENSES/Unlicense.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4+
this software, either in source code form or as a compiled binary, for any
5+
purpose, commercial or non-commercial, and by any means.
6+
7+
In jurisdictions that recognize copyright laws, the author or authors of this
8+
software dedicate any and all copyright interest in the software to the public
9+
domain. We make this dedication for the benefit of the public at large and
10+
to the detriment of our heirs and successors. We intend this dedication to
11+
be an overt act of relinquishment in perpetuity of all present and future
12+
rights to this software under copyright law.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
19+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
20+
please refer to <https://unlicense.org/>

‎README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎README.rst

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Introduction
2+
============
3+
4+
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-fakerequests/badge/?version=latest
5+
:target: https://circuitpython.readthedocs.io/projects/fakerequests/en/latest/
6+
:alt: Documentation Status
7+
8+
.. image:: https://img.shields.io/discord/327254708534116352.svg
9+
:target: https://adafru.it/discord
10+
:alt: Discord
11+
12+
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests/workflows/Build%20CI/badge.svg
13+
:target: https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests/actions
14+
:alt: Build Status
15+
16+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
17+
:target: https://github.com/psf/black
18+
:alt: Code Style: Black
19+
20+
Fake Network Requests helper that retrieves data from a local file.
21+
22+
23+
Dependencies
24+
=============
25+
This driver depends on:
26+
27+
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
28+
29+
Please ensure all dependencies are available on the CircuitPython filesystem.
30+
This is easily achieved by downloading
31+
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
32+
33+
Installing from PyPI
34+
=====================
35+
36+
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
37+
PyPI <https://pypi.org/project/adafruit-circuitpython-fakerequests/>`_. To install for current user:
38+
39+
.. code-block:: shell
40+
41+
pip3 install adafruit-circuitpython-fakerequests
42+
43+
To install system-wide (this may be required in some cases):
44+
45+
.. code-block:: shell
46+
47+
sudo pip3 install adafruit-circuitpython-fakerequests
48+
49+
To install in a virtual environment in your current project:
50+
51+
.. code-block:: shell
52+
53+
mkdir project-name && cd project-name
54+
python3 -m venv .env
55+
source .env/bin/activate
56+
pip3 install adafruit-circuitpython-fakerequests
57+
58+
Usage Example
59+
=============
60+
61+
.. code:: python
62+
63+
from adafruit_fakerequests import Fake_Requests
64+
65+
response = Fake_Requests("local.txt")
66+
print(response.text);
67+
68+
Contributing
69+
============
70+
71+
Contributions are welcome! Please read our `Code of Conduct
72+
<https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests/blob/master/CODE_OF_CONDUCT.md>`_
73+
before contributing to help this project stay welcoming.
74+
75+
Documentation
76+
=============
77+
78+
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

‎README.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

‎adafruit_fakerequests.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
"""
6+
`adafruit_fakerequests`
7+
================================================================================
8+
9+
Fake Network Requests helper that retrieves data from a local file.
10+
11+
12+
* Author(s): Melissa LeBlanc-Williams
13+
14+
Implementation Notes
15+
--------------------
16+
17+
**Software and Dependencies:**
18+
19+
* Adafruit CircuitPython firmware for the supported boards:
20+
https://github.com/adafruit/circuitpython/releases
21+
22+
"""
23+
24+
import json
25+
26+
__version__ = "0.0.0-auto.0"
27+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests.git"
28+
29+
30+
class Fake_Requests:
31+
"""For faking 'requests' using a local file instead of the network."""
32+
33+
def __init__(self, filename):
34+
self._filename = filename
35+
36+
def json(self):
37+
"""json parsed version for local requests."""
38+
with open(self._filename, "r") as file:
39+
return json.load(file)
40+
41+
@property
42+
def text(self):
43+
"""raw text version for local requests."""
44+
with open(self._filename, "r") as file:
45+
return file.read()

‎docs/_static/favicon.ico

4.31 KB
Binary file not shown.

‎docs/_static/favicon.ico.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
2+
3+
SPDX-License-Identifier: CC-BY-4.0

‎docs/api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
.. automodule:: adafruit_fakerequests
4+
:members:

‎docs/api.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

‎docs/conf.py

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
4+
#
5+
# SPDX-License-Identifier: MIT
6+
7+
import os
8+
import sys
9+
10+
sys.path.insert(0, os.path.abspath(".."))
11+
12+
# -- General configuration ------------------------------------------------
13+
14+
# Add any Sphinx extension module names here, as strings. They can be
15+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
16+
# ones.
17+
extensions = [
18+
"sphinx.ext.autodoc",
19+
"sphinx.ext.intersphinx",
20+
"sphinx.ext.napoleon",
21+
"sphinx.ext.todo",
22+
]
23+
24+
# TODO: Please Read!
25+
# Uncomment the below if you use native CircuitPython modules such as
26+
# digitalio, micropython and busio. List the modules you use. Without it, the
27+
# autodoc module docs will fail to generate with a warning.
28+
# autodoc_mock_imports = ["digitalio", "busio"]
29+
30+
31+
intersphinx_mapping = {
32+
"python": ("https://docs.python.org/3.4", None),
33+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
34+
}
35+
36+
# Show the docstring from both the class and its __init__() method.
37+
autoclass_content = "both"
38+
39+
# Add any paths that contain templates here, relative to this directory.
40+
templates_path = ["_templates"]
41+
42+
source_suffix = ".rst"
43+
44+
# The master toctree document.
45+
master_doc = "index"
46+
47+
# General information about the project.
48+
project = "Adafruit FakeRequests Library"
49+
copyright = "2020 Melissa LeBlanc-Williams"
50+
author = "Melissa LeBlanc-Williams"
51+
52+
# The version info for the project you're documenting, acts as replacement for
53+
# |version| and |release|, also used in various other places throughout the
54+
# built documents.
55+
#
56+
# The short X.Y version.
57+
version = "1.0"
58+
# The full version, including alpha/beta/rc tags.
59+
release = "1.0"
60+
61+
# The language for content autogenerated by Sphinx. Refer to documentation
62+
# for a list of supported languages.
63+
#
64+
# This is also used if you do content translation via gettext catalogs.
65+
# Usually you set "language" from the command line for these cases.
66+
language = None
67+
68+
# List of patterns, relative to source directory, that match files and
69+
# directories to ignore when looking for source files.
70+
# This patterns also effect to html_static_path and html_extra_path
71+
exclude_patterns = [
72+
"_build",
73+
"Thumbs.db",
74+
".DS_Store",
75+
".env",
76+
"CODE_OF_CONDUCT.md",
77+
]
78+
79+
# The reST default role (used for this markup: `text`) to use for all
80+
# documents.
81+
#
82+
default_role = "any"
83+
84+
# If true, '()' will be appended to :func: etc. cross-reference text.
85+
#
86+
add_function_parentheses = True
87+
88+
# The name of the Pygments (syntax highlighting) style to use.
89+
pygments_style = "sphinx"
90+
91+
# If true, `todo` and `todoList` produce output, else they produce nothing.
92+
todo_include_todos = False
93+
94+
# If this is True, todo emits a warning for each TODO entries. The default is False.
95+
todo_emit_warnings = True
96+
97+
napoleon_numpy_docstring = False
98+
99+
# -- Options for HTML output ----------------------------------------------
100+
101+
# The theme to use for HTML and HTML Help pages. See the documentation for
102+
# a list of builtin themes.
103+
#
104+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
105+
106+
if not on_rtd: # only import and set the theme if we're building docs locally
107+
try:
108+
import sphinx_rtd_theme
109+
110+
html_theme = "sphinx_rtd_theme"
111+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
112+
except:
113+
html_theme = "default"
114+
html_theme_path = ["."]
115+
else:
116+
html_theme_path = ["."]
117+
118+
# Add any paths that contain custom static files (such as style sheets) here,
119+
# relative to this directory. They are copied after the builtin static files,
120+
# so a file named "default.css" will overwrite the builtin "default.css".
121+
html_static_path = ["_static"]
122+
123+
# The name of an image file (relative to this directory) to use as a favicon of
124+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
125+
# pixels large.
126+
#
127+
html_favicon = "_static/favicon.ico"
128+
129+
# Output file base name for HTML help builder.
130+
htmlhelp_basename = "AdafruitFakerequestsLibrarydoc"
131+
132+
# -- Options for LaTeX output ---------------------------------------------
133+
134+
latex_elements = {
135+
# The paper size ('letterpaper' or 'a4paper').
136+
# 'papersize': 'letterpaper',
137+
# The font size ('10pt', '11pt' or '12pt').
138+
# 'pointsize': '10pt',
139+
# Additional stuff for the LaTeX preamble.
140+
# 'preamble': '',
141+
# Latex figure (float) alignment
142+
# 'figure_align': 'htbp',
143+
}
144+
145+
# Grouping the document tree into LaTeX files. List of tuples
146+
# (source start file, target name, title,
147+
# author, documentclass [howto, manual, or own class]).
148+
latex_documents = [
149+
(
150+
master_doc,
151+
"AdafruitFakeRequestsLibrary.tex",
152+
"AdafruitFakeRequests Library Documentation",
153+
author,
154+
"manual",
155+
),
156+
]
157+
158+
# -- Options for manual page output ---------------------------------------
159+
160+
# One entry per manual page. List of tuples
161+
# (source start file, name, description, authors, manual section).
162+
man_pages = [
163+
(
164+
master_doc,
165+
"AdafruitFakeRequestslibrary",
166+
"Adafruit FakeRequests Library Documentation",
167+
[author],
168+
1,
169+
),
170+
]
171+
172+
# -- Options for Texinfo output -------------------------------------------
173+
174+
# Grouping the document tree into Texinfo files. List of tuples
175+
# (source start file, target name, title, author,
176+
# dir menu entry, description, category)
177+
texinfo_documents = [
178+
(
179+
master_doc,
180+
"AdafruitFakeRequestsLibrary",
181+
"Adafruit FakeRequests Library Documentation",
182+
author,
183+
"AdafruitFakeRequestsLibrary",
184+
"One line description of project.",
185+
"Miscellaneous",
186+
),
187+
]

‎docs/examples.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/fakerequests_simpletest.py
7+
:caption: examples/fakerequests_simpletest.py
8+
:linenos:

‎docs/examples.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

‎docs/index.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. include:: ../README.rst
2+
3+
Table of Contents
4+
=================
5+
6+
.. toctree::
7+
:maxdepth: 4
8+
:hidden:
9+
10+
self
11+
12+
.. toctree::
13+
:caption: Examples
14+
15+
examples
16+
17+
.. toctree::
18+
:caption: API Reference
19+
:maxdepth: 3
20+
21+
api
22+
23+
.. toctree::
24+
:caption: Tutorials
25+
26+
27+
.. toctree::
28+
:caption: Related Products
29+
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests/releases/latest>
35+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
36+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
37+
Discord Chat <https://adafru.it/discord>
38+
Adafruit Learning System <https://learn.adafruit.com>
39+
Adafruit Blog <https://blog.adafruit.com>
40+
Adafruit Store <https://www.adafruit.com>
41+
42+
Indices and tables
43+
==================
44+
45+
* :ref:`genindex`
46+
* :ref:`modindex`
47+
* :ref:`search`

‎docs/index.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

‎examples/fakerequests_simpletest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
from adafruit_fakerequests import Fake_Requests
6+
7+
response = Fake_Requests("local.txt")
8+
print(response.text)

‎pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
[tool.black]
6+
target-version = ['py35']

‎requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
Adafruit-Blinka

‎setup.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
"""A setuptools based setup module.
7+
8+
See:
9+
https://packaging.python.org/en/latest/distributing.html
10+
https://github.com/pypa/sampleproject
11+
"""
12+
13+
from setuptools import setup, find_packages
14+
15+
# To use a consistent encoding
16+
from codecs import open
17+
from os import path
18+
19+
here = path.abspath(path.dirname(__file__))
20+
21+
# Get the long description from the README file
22+
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
23+
long_description = f.read()
24+
25+
setup(
26+
name="adafruit-circuitpython-fakerequests",
27+
use_scm_version=True,
28+
setup_requires=["setuptools_scm"],
29+
description="Fake Network Requests helper that retrieves data from a local file.",
30+
long_description=long_description,
31+
long_description_content_type="text/x-rst",
32+
# The project's main homepage.
33+
url="https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests",
34+
# Author details
35+
author="Adafruit Industries",
36+
author_email="circuitpython@adafruit.com",
37+
install_requires=[
38+
"Adafruit-Blinka",
39+
],
40+
# Choose your license
41+
license="MIT",
42+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
43+
classifiers=[
44+
"Development Status :: 3 - Alpha",
45+
"Intended Audience :: Developers",
46+
"Topic :: Software Development :: Libraries",
47+
"Topic :: System :: Hardware",
48+
"License :: OSI Approved :: MIT License",
49+
"Programming Language :: Python :: 3",
50+
"Programming Language :: Python :: 3.4",
51+
"Programming Language :: Python :: 3.5",
52+
],
53+
# What does your project relate to?
54+
keywords="adafruit blinka circuitpython micropython fakerequests fake requests file "
55+
"network internet http",
56+
# You can just specify the packages manually here if your project is
57+
# simple. Or you can use find_packages().
58+
py_modules=["adafruit_fakerequests"],
59+
)

0 commit comments

Comments
 (0)
Please sign in to comment.