Compare commits

..

No commits in common. "main" and "jepler-patch-1" have entirely different histories.

63 changed files with 795 additions and 1563 deletions

View file

View file

@ -1,22 +0,0 @@
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
#
# SPDX-License-Identifier: MIT
name: build-images
on:
pull_request:
push:
jobs:
build-images:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: python3 -mpip install -r requirements.txt
- run: git clone --depth=1 https://github.com/adafruit/Adafruit_Learning_System_Guides learn
- run: env LEARN_GUIDE_REPO=learn/ python3 create_requirement_images.py
- uses: actions/upload-artifact@v2
with:
name: images
path: generated_images

View file

@ -1,17 +0,0 @@
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
#
# SPDX-License-Identifier: MIT
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.2

9
.gitignore vendored
View file

@ -1,8 +1,3 @@
# SPDX-FileCopyrightText: 2021 Jeff Epler
#
# SPDX-License-Identifier: MIT
__pycache__
latest_bundle_data.json
latest_bundle_tag.json
generated_images
.idea/*

View file

@ -1,25 +0,0 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: pylint-2.7.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]

436
.pylintrc
View file

@ -1,436 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the ignore-list. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint.
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=
[REPORTS]
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
[LOGGING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
[SPELLING]
# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
# notes=FIXME,XXX,TODO
notes=FIXME,XXX
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=board
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
# expected-line-ending-format=
expected-line-ending-format=LF
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=12
[BASIC]
# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class names
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
class-name-hint=[A-Z_][a-zA-Z0-9_]+$
# Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[DESIGN]
# Maximum number of arguments for function / method
max-args=5
# Maximum number of attributes for a class (see R0902).
# max-attributes=7
max-attributes=11
# Maximum number of boolean expressions in a if statement
max-bool-expr=5
# Maximum number of branch for function / method body
max-branches=12
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of statements in function / method body
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=1
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception

View file

@ -1,137 +0,0 @@
<!--
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
SPDX-License-Identifier: CC-BY-4.0
-->
# Adafruit Community Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
## Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Promoting or spreading disinformation, lies, or conspiracy theories against
a person, group, organisation, project, or community
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you dont just aim to be
"technically unimpeachable", but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
## Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
## Moderation
Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Moderators by tagging @community moderators. You may
also send an open message from any channel, or a direct message to
@kattni#1507, @tannewt#4653, @danh#1614, @cater#2442,
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
## Scope
This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.
[Contributor Covenant]: https://www.contributor-covenant.org

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 foamyguy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,73 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1,156 +0,0 @@
Creative Commons Attribution 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

View file

@ -1,121 +0,0 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View file

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

View file

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

8
NOTES
View file

@ -1,9 +1,3 @@
<!--
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: MIT
-->
[x] check if fonts/, img/, sounds/ are used and add them in the header if so.
[ ] check if secrets.py is needed and draw it in the header
@ -12,4 +6,4 @@ SPDX-License-Identifier: MIT
[x] add triangles to generated folders
[ ] Download the bundle JSON data instead of using pre-fetched one
[ ] Download the bundle JSON data instead of using pre-fetched one

View file

@ -1,18 +1,5 @@
<!--
SPDX-FileCopyrightText: 2021 foamyguy
This project will contain tools for automating the creation of CircuitPython requirement screenshots.
SPDX-License-Identifier: MIT
-->
[html_app](html_app) is a standalone HTML/JS version of the concept that is more manual.
This folder contains scripts that can be run to create requirement screenshots for all of the learn guide projects
To use the scripts you must set the environment `LEARN_GUIDE_REPO` to point to the location of learn guide repo. It must end with a trailing slash.
The default value is `"../Adafruit_Learning_System_Guides/"`, one directory above the root of this repo.
With that pointed at a learn guide repo you can run:
```
python3 create_requirement_images.py
```
It will create images in the `generated_images` directory.
[python_generator](python_generator) will hold scripts that generate similar images as png files with pillow.

View file

@ -1,4 +0,0 @@
Copyright License. Subject to the terms and conditions of
Copyright [yyyy] [name of copyright owner]
SPDX-License-Identifier: Apache-2.0

View file

@ -1,378 +0,0 @@
#!/usr/bin/env python3
"""
Create requirement screenshots for learn guide projects
"""
# SPDX-FileCopyrightText: 2021 foamyguy
#
# SPDX-License-Identifier: MIT
from multiprocessing import Pool
import json
import os
import click
from PIL import Image, ImageDraw, ImageFont
from get_imports import (
get_libs_for_project,
get_files_for_project,
get_libs_for_example,
get_files_for_example,
get_learn_guide_cp_projects,
)
os.makedirs("generated_images", exist_ok=True)
OUT_WIDTH = 800
PADDING = 20
INDENT_SIZE = 28
LINE_SPACING = 28
HIGHLIGHT_ROW_COLOR = "#404040"
ROW_COLOR = "#383838"
TEXT_COLOR = "#B0B0B0"
HIDDEN_TEXT_COLOR = "#808080"
SHOWN_FILETYPES = ["py", "mpy", "bmp", "pcf", "bdf", "wav", "mp3", "json", "txt"]
f = open("latest_bundle_data.json", "r")
bundle_data = json.load(f)
f.close()
def asset_path(x):
"""Return the location of a file shipped with the screenshot maker"""
return os.path.join(os.path.dirname(__file__), x)
font = ImageFont.truetype(asset_path("Roboto-Regular.ttf"), 24)
right_triangle = Image.open(asset_path("img/right_triangle.png"))
down_triangle = Image.open(asset_path("img/down_triangle.png"))
folder_icon = Image.open(asset_path("img/folder.png"))
folder_hidden_icon = Image.open(asset_path("img/folder_hidden.png"))
file_icon = Image.open(asset_path("img/file.png"))
file_hidden_icon = Image.open(asset_path("img/file_hidden.png"))
file_empty_icon = Image.open(asset_path("img/file_empty.png"))
file_empty_hidden_icon = Image.open(asset_path("img/file_empty_hidden.png"))
file_image_icon = Image.open(asset_path("img/file_image.png"))
file_music_icon = Image.open(asset_path("img/file_music.png"))
file_font_icon = Image.open(asset_path("img/file_font.png"))
FILE_TYPE_ICON_MAP = {
"py": file_icon,
"mpy": file_icon,
"txt": file_empty_icon,
"bmp": file_image_icon,
"wav": file_music_icon,
"mp3": file_music_icon,
"pcf": file_font_icon,
"bdf": file_font_icon,
"json": file_icon,
}
# If this is not done, the images fail to load in the subprocesses.
for file_icon in FILE_TYPE_ICON_MAP.values():
file_icon.load()
def generate_requirement_image(
project_files, libs, image_name
): # pylint: disable=too-many-statements
"""Generate a single requirement image"""
def make_line(
requirement_name, position=(0, 0), icon=None, hidden=False, triangle_icon=None
): # pylint: disable=too-many-branches
if triangle_icon:
img.paste(
triangle_icon,
(position[0] - 24, position[1] + (LINE_SPACING - 24) // 2),
mask=triangle_icon,
)
if icon is None:
if requirement_name.endswith(".mpy") or requirement_name.endswith(".py"):
if hidden:
img.paste(
file_hidden_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=file_hidden_icon,
)
else:
img.paste(
file_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=file_icon,
)
elif "." in requirement_name[-5:]:
if hidden:
img.paste(
file_empty_hidden_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=file_empty_icon,
)
else:
img.paste(
file_empty_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=file_empty_icon,
)
else:
if hidden:
img.paste(
folder_hidden_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=folder_hidden_icon,
)
else:
img.paste(
folder_icon,
(position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=folder_icon,
)
else:
img.paste(
icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=icon
)
if not hidden:
draw.text(
(position[0] + 30, position[1] + LINE_SPACING // 2),
requirement_name,
fill=TEXT_COLOR,
anchor="lm",
font=font,
)
else:
draw.text(
(position[0] + 30, position[1] + LINE_SPACING // 2),
requirement_name,
fill=HIDDEN_TEXT_COLOR,
anchor="lm",
font=font,
)
def make_header(position, project_files):
# Static files
make_line("CIRCUITPY", position)
make_line(
".fseventsd",
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 1)),
hidden=True,
triangle_icon=right_triangle,
)
make_line(
".metadata_never_index",
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 2)),
icon=file_empty_hidden_icon,
hidden=True,
)
make_line(
".Trashes",
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 3)),
icon=file_empty_hidden_icon,
hidden=True,
)
make_line(
"boot_out.txt",
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 4)),
)
make_line(
"code.py",
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 5)),
icon=file_icon,
)
# dynamic files from project dir in learn guide repo
rows_added = 0
project_files_to_draw = []
project_folders_to_draw = []
for cur_file in project_files:
if "." in cur_file[-5:]:
cur_extension = cur_file.split(".")[-1]
if cur_extension in SHOWN_FILETYPES:
project_files_to_draw.append(cur_file)
else:
project_folders_to_draw.append(cur_file)
for i, file in enumerate(sorted(project_files_to_draw)):
cur_file_extension = file.split(".")[-1]
cur_file_icon = FILE_TYPE_ICON_MAP.get(cur_file_extension, file_empty_icon)
make_line(
file,
(position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * (6 + i))),
icon=cur_file_icon,
)
rows_added += 1
for i, file in enumerate(sorted(project_folders_to_draw)):
make_line(
file,
(
position[0] + INDENT_SIZE,
position[1] + (LINE_SPACING * (6 + i + len(project_files_to_draw))),
),
triangle_icon=right_triangle,
)
rows_added += 1
make_line(
"lib",
(
position[0] + INDENT_SIZE,
position[1] + (LINE_SPACING * (5 + rows_added + 1)),
),
triangle_icon=down_triangle,
)
def make_background_highlights(rows, offset=(0, 0)):
for i in range(rows):
if i % 2 == 0:
draw.rectangle(
[
(0 + offset[0], i * LINE_SPACING + offset[1]),
(OUT_WIDTH - offset[0], (i + 1) * LINE_SPACING + offset[1]),
],
fill=HIGHLIGHT_ROW_COLOR,
)
else:
draw.rectangle(
[
(0 + offset[0], i * LINE_SPACING + offset[1]),
(OUT_WIDTH - offset[0], (i + 1) * LINE_SPACING + offset[1]),
],
fill=ROW_COLOR,
)
def get_dependencies(libraries):
package_list = set()
file_list = set()
libraries_to_check = list(libraries)
while len(libraries_to_check) > 0:
lib_name = libraries_to_check[0]
del libraries_to_check[0]
lib_obj = bundle_data[lib_name]
for dep_name in lib_obj["dependencies"]:
libraries_to_check.append(dep_name)
dep_obj = bundle_data[dep_name]
if dep_obj["package"]:
package_list.add(dep_name)
else:
file_list.add(dep_name + ".mpy")
if lib_obj["package"]:
package_list.add(lib_name)
else:
file_list.add(lib_name + ".mpy")
return package_list, file_list
def sort_libraries(libraries):
package_list, file_list = get_dependencies(libraries)
return sorted(package_list) + sorted(file_list)
def make_libraries(libraries, position):
for i, lib_name in enumerate(libraries):
triangle_icon = None
if not lib_name.endswith(".mpy"):
triangle_icon = right_triangle
make_line(
lib_name,
(position[0] + INDENT_SIZE * 2, position[1] + (LINE_SPACING * i)),
triangle_icon=triangle_icon,
)
final_list_to_render = sort_libraries(libs)
if "code.py" in project_files:
project_files.remove("code.py")
if "main.py" in project_files:
project_files.remove("main.py")
project_files_count = len(project_files)
image_height = (
PADDING * 2
+ 7 * LINE_SPACING
+ len(final_list_to_render) * LINE_SPACING
+ (project_files_count) * LINE_SPACING
)
img = Image.new("RGB", (OUT_WIDTH, image_height), "#303030")
draw = ImageDraw.Draw(img)
make_background_highlights(
7 + len(final_list_to_render) + project_files_count,
offset=(PADDING, PADDING),
)
make_header((PADDING, PADDING), project_files)
make_libraries(
final_list_to_render,
(PADDING, PADDING + (LINE_SPACING * (7 + project_files_count))),
)
img.save("generated_images/{}.png".format(image_name))
def generate_learn_requirement_image( # pylint: disable=invalid-name
learn_guide_project,
):
"""Generate an image for a single learn project"""
image_name = learn_guide_project.replace("/", "_")
libs = get_libs_for_project(learn_guide_project)
project_files = get_files_for_project(learn_guide_project)
generate_requirement_image(project_files, libs, image_name)
def generate_example_requirement_image(example_path): # pylint: disable=invalid-name
"""Generate an image for a library example"""
image_name = "_".join(
element
for element in example_path.split("/")
if element not in ("libraries", "drivers", "helpers", "examples")
)
libs = get_libs_for_example(example_path)
project_files = get_files_for_example(example_path)
generate_requirement_image(project_files, libs, image_name)
@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx):
"""Main entry point; invokes the learn subcommand if nothing is specified"""
if ctx.invoked_subcommand is None:
learn()
@cli.command()
def learn():
"""Generate images for a learn-style repo"""
with Pool() as pool:
for _ in pool.imap(
generate_learn_requirement_image, get_learn_guide_cp_projects()
):
pass
@cli.command()
@click.argument("paths", nargs=-1)
def bundle(paths):
"""Generate images for a bundle-style repo"""
with Pool() as pool:
for _ in pool.imap(generate_example_requirement_image, paths):
pass
if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter

11
html_app/README.md Normal file
View file

@ -0,0 +1,11 @@
This is a simple single page HTML / JavaScript application that allows you to create mock file manager screenshots showing required libraries for CirctuitPython devices.
If this is something you do frequently the tool can save you the time and energy of always replacing all of the files on your devices with the ones that you need to screenshot.
Here is an example of a screenshot generated by this tool:
![Example Screenshot](example.png)
Here is an image showing the interface for the utility:
![Utility Interface](interface.png)

76
html_app/css/style.css Normal file
View file

@ -0,0 +1,76 @@
body, html{
background-color: #303030;
color: #B0B0B0;
font-family: "Bitstream Vera Sans Mono", sans-serif;
}
input{
background-color: #404040;
color: #B0B0B0;
}
button{
background-color: #5050AA;
color: #B0B0B0;
padding-left: 30px;
padding-right: 30px;
}
.requirement_row img{
position: relative;
top: 3px;
}
.indent_1 span{
position: relative;
top: -3px;
}
.lib_input{
background-color: rgba(0,0,0,0);
border: 0;
font-family: "Bitstream Vera Sans Mono", sans-serif;
font-size: 19px;
width: 90%;
position: relative;
top: -4px;
}
.requirement_row{
height: 28px;
}
.requirement_row:nth-child(odd){
background-color: #404040;
}
#input_container{
position: relative;
left: 100px;
top: 6px;
}
#requirements_list_container{
padding: 40px;
border: 2px dashed #B0B0B0;
position: relative;
top: 40px;
left: 100px;
width: 600px;
}
.hidden_file{
opacity: 50%;
}
.indent_1{
margin-left: 27px;
}
.indent_2{
margin-left: 54px;
}
.icon_img{
width: 24px;
}

BIN
html_app/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
html_app/img/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
html_app/img/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

64
html_app/index.html Normal file
View file

@ -0,0 +1,64 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<div id="input_container">
<label for="name_input">Name:</label>
<input id="name_input" type="text">
<button id="add_btn">Add</button>
</div>
<div id="requirements_list_container">
<div class="requirement_row">
<img class="icon_img" src="img/folder.png">
<span>CIRCUITPY</span>
</div>
<div class="requirement_row">
<span style="position: relative; top: -4px">&#9654;</span>
<div style="display: inline;" class="hidden_file">
<img class="icon_img" src="img/folder.png">
<span style="position: relative; top: -3px;">.fseventsd</span>
</div>
</div>
<div class="requirement_row">
<div class="indent_1 hidden_file">
<img class="icon_img" src="img/file.png">
<span>.metadata_never_index</span>
</div>
</div>
<div class="requirement_row indent_1">
<img class="icon_img hidden_file" src="img/file.png">
<span class="hidden_file">.Trashes</span>
</div>
<div class="requirement_row">
<div class="indent_1">
<img class="icon_img" src="img/file.png">
<span>boot_out.txt</span>
</div>
</div>
<div class="requirement_row">
<div class="indent_1">
<img class="icon_img" src="img/file.png">
<span>code.py</span>
</div>
</div>
<div class="requirement_row">
<span style="position: relative; top: -4px">&#9660;</span>
<div style="position: relative; left: -4px; display: inline;" class="">
<img class="icon_img" src="img/folder.png">
<span>lib</span>
</div>
</div>
</div>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/script.js"></script>
</body>
</html>

BIN
html_app/interface.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

2
html_app/js/jquery-3.6.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

33
html_app/js/script.js Normal file
View file

@ -0,0 +1,33 @@
let $name_input = $("#name_input");
let $add_btn = $("#add_btn");
let $requirement_container = $("#requirements_list_container");
$name_input.on('keypress',function(e) {
if (e.which == 13) {
$add_btn.click();
}
});
$add_btn.click(function () {
if ($name_input.val() !== "") {
let $new_img, $new_text, $new_div;
if ($name_input.val().endsWith(".mpy") || $name_input.val().endsWith(".py")) {
$new_img = $('<img class="icon_img" src="img/file.png">');
}else{
$new_img = $('<img class="icon_img" src="img/folder.png">');
}
$new_text = $(`<input class="lib_input" type="text" value="${$name_input.val()}">`);
$new_div = $('<div class="requirement_row"></div>');
$new_indent_div = $('<div class="indent_2"></div>');
$new_indent_div.append($new_img);
$new_indent_div.append(" ");
$new_indent_div.append($new_text);
$new_div.append($new_indent_div);
$requirement_container.append($new_div);
}
});

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,9 +0,0 @@
Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,9 +0,0 @@
Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 foamyguy
SPDX-License-Identifier: CC0-1.0

3
python_generator/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
latest_bundle_data.json
latest_bundle_tag.json
generated_images

View file

@ -0,0 +1,20 @@
This folder contains scripts that can be run to create requirement screenshots for all of the learn guide projects
To use the scripts you must set `LEARN_GUIDE_REPO` inside of `get_imports.py` to point to the location of learn guide repo.
default value is `"../../Adafruit_Learning_System_Guides/"`
One directory above the root of this repo.
With that pointed at a learn guide repo you can run:
```
python get_bundle_data.py
```
to download `latest_bundle_data.json`
Once this file is present run
```
python create_requirement_images.py
```
It will create images in the `generated_images` directory.

View file

@ -0,0 +1,202 @@
boto-Medium.ttf",
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,238 @@
#!/usr/bin/env python3
from multiprocessing import Pool
import json
import os
import traceback
from PIL import Image, ImageDraw, ImageFont
from get_imports import get_libs_for_project, get_files_for_project, get_learn_guide_cp_projects
os.makedirs("generated_images", exist_ok=True)
OUT_WIDTH = 800
PADDING = 20
INDENT_SIZE = 28
LINE_SPACING = 28
HIGHLIGHT_ROW_COLOR = "#404040"
ROW_COLOR = "#383838"
TEXT_COLOR = "#B0B0B0"
HIDDEN_TEXT_COLOR = "#808080"
SHOWN_FILETYPES = ["py", "mpy", "bmp", "pcf", "bdf", "wav", "mp3", "json", "txt"]
f = open("latest_bundle_data.json", "r")
bundle_data = json.load(f)
f.close()
font = ImageFont.truetype("Roboto-Regular.ttf", 24)
right_triangle = Image.open('img/right_triangle.png')
down_triangle = Image.open('img/down_triangle.png')
folder_icon = Image.open('img/folder.png')
folder_hidden_icon = Image.open('img/folder_hidden.png')
file_icon = Image.open('img/file.png')
file_hidden_icon = Image.open('img/file_hidden.png')
file_empty_icon = Image.open('img/file_empty.png')
file_empty_hidden_icon = Image.open('img/file_empty_hidden.png')
file_image_icon = Image.open('img/file_image.png')
file_music_icon = Image.open('img/file_music.png')
file_font_icon = Image.open('img/file_font.png')
FILE_TYPE_ICON_MAP = {
"py": file_icon,
"mpy": file_icon,
"txt": file_empty_icon,
"bmp": file_image_icon,
"wav": file_music_icon,
"mp3": file_music_icon,
"pcf": file_font_icon,
"bdf": file_font_icon,
"json": file_icon
}
for img in FILE_TYPE_ICON_MAP.values():
img.load()
def generate_requirement_image(learn_guide_project):
def make_line(requirement_name, position=(0, 0), icon=None, hidden=False, triangle_icon=None):
if triangle_icon:
im.paste(triangle_icon, (position[0] - 24, position[1] + (LINE_SPACING - 24) // 2), mask=triangle_icon)
if icon == None:
if (requirement_name.endswith(".mpy") or requirement_name.endswith(".py")):
if hidden:
im.paste(file_hidden_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=file_hidden_icon)
else:
im.paste(file_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=file_icon)
elif "." in requirement_name[-5:]:
if hidden:
im.paste(file_empty_hidden_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=file_empty_icon)
else:
im.paste(file_empty_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=file_empty_icon)
else:
if hidden:
im.paste(folder_hidden_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2),
mask=folder_hidden_icon)
else:
im.paste(folder_icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=folder_icon)
else:
im.paste(icon, (position[0], position[1] + (LINE_SPACING - 24) // 2), mask=icon)
if not hidden:
draw.text((position[0] + 30, position[1] + LINE_SPACING // 2),
requirement_name, fill=TEXT_COLOR, anchor="lm",
font=font)
else:
draw.text((position[0] + 30, position[1] + LINE_SPACING // 2),
requirement_name, fill=HIDDEN_TEXT_COLOR, anchor="lm",
font=font)
def make_header(position, learn_guide_project):
# Static files
make_line("CIRCUITPY", position)
make_line(".fseventsd", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 1)), hidden=True,
triangle_icon=right_triangle)
make_line(".metadata_never_index", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 2)),
icon=file_empty_hidden_icon,
hidden=True)
make_line(".Trashes", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 3)),
icon=file_empty_hidden_icon,
hidden=True)
make_line("boot_out.txt", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 4)))
make_line("code.py", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * 5)),
icon=file_icon)
# dynamic files from project dir in learn guide repo
project_files = get_files_for_project(learn_guide_project)
rows_added = 0
project_files_to_draw = []
project_folders_to_draw = []
for cur_file in project_files:
if "." in cur_file[-5:]:
cur_extension = cur_file.split(".")[-1]
if cur_extension in SHOWN_FILETYPES:
if cur_file != "main.py":
project_files_to_draw.append(cur_file)
else:
project_folders_to_draw.append(cur_file)
try:
project_files_to_draw.remove("code.py")
except ValueError:
pass
for i, file in enumerate(sorted(project_files_to_draw)):
cur_file_extension = file.split(".")[-1]
if cur_file_extension in FILE_TYPE_ICON_MAP:
cur_file_icon = FILE_TYPE_ICON_MAP[cur_file_extension]
else:
cur_file_icon = file_empty_icon
make_line(file, (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * (6 + i ))), icon=cur_file_icon)
rows_added += 1
for i, file in enumerate(sorted(project_folders_to_draw)):
make_line(file, (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * (6 + i + len(project_files_to_draw)))),
triangle_icon=right_triangle)
rows_added += 1
make_line("lib", (position[0] + INDENT_SIZE, position[1] + (LINE_SPACING * (5 + rows_added + 1))),
triangle_icon=down_triangle)
def make_background_highlights(rows, offset=(0, 0)):
for i in range(rows):
if i % 2 == 0:
draw.rectangle([
(0 + offset[0], i * LINE_SPACING + offset[1]),
(OUT_WIDTH - offset[0], (i + 1) * LINE_SPACING + offset[1])],
fill=HIGHLIGHT_ROW_COLOR)
else:
draw.rectangle([
(0 + offset[0], i * LINE_SPACING + offset[1]),
(OUT_WIDTH - offset[0], (i + 1) * LINE_SPACING + offset[1])],
fill=ROW_COLOR)
def get_dependencies(libraries):
package_list = set()
file_list = set()
libraries_to_check = list(libraries)
while len(libraries_to_check) > 0:
lib_name = libraries_to_check[0]
del libraries_to_check[0]
lib_obj = bundle_data[lib_name]
for dep_name in lib_obj["dependencies"]:
libraries_to_check.append(dep_name)
dep_obj = bundle_data[dep_name]
if dep_obj["package"]:
package_list.add(dep_name)
else:
file_list.add(dep_name + ".mpy")
if lib_obj["package"]:
package_list.add(lib_name)
else:
file_list.add(lib_name + ".mpy")
return package_list, file_list
def sort_libraries(libraries):
package_list, file_list = get_dependencies(libraries)
return sorted(package_list) + sorted(file_list)
def make_libraries(libraries, position):
for i, lib_name in enumerate(libraries):
triangle_icon = None
if not lib_name.endswith(".mpy"):
triangle_icon = right_triangle
make_line(lib_name,
(position[0] + INDENT_SIZE * 2, position[1] + (LINE_SPACING * i)),
triangle_icon=triangle_icon)
try:
libs = get_libs_for_project(learn_guide_project)
final_list_to_render = sort_libraries(libs)
project_file_list = get_files_for_project(learn_guide_project)
project_files_count = len(project_file_list)
if "code.py" in project_file_list:
project_files_count -= 1
if "main.py" in project_file_list:
project_files_count -= 1
image_height = PADDING * 2 + 7 * LINE_SPACING + len(final_list_to_render) * LINE_SPACING + (
project_files_count) * LINE_SPACING
im = Image.new("RGB", (OUT_WIDTH, image_height), "#303030")
draw = ImageDraw.Draw(im)
make_background_highlights(7 + len(final_list_to_render) + project_files_count,
offset=(PADDING, PADDING))
make_header((PADDING, PADDING), learn_guide_project)
make_libraries(final_list_to_render,
(PADDING, PADDING + (LINE_SPACING * (7 + project_files_count))))
im.save("generated_images/{}_files.png".format(learn_guide_project))
except SyntaxError as e:
print(e)
traceback.print_exc()
print("SyntaxError finding imports for {}".format(learn_guide_project))
if __name__ == '__main__':
with Pool() as p:
for _ in p.imap(generate_requirement_image, get_learn_guide_cp_projects()):
pass

View file

@ -0,0 +1,19 @@
import requests
import json
import urllib.request
def find_data_asset(assets):
for i, asset in enumerate(assets):
if asset["name"].endswith(".json"):
return i
return None
resp_obj = requests.get("https://api.github.com/repos/adafruit/Adafruit_CircuitPython_Bundle/releases/latest")
resp_json = json.loads(resp_obj.content)
data_json_index = find_data_asset(resp_json["assets"])
data_json_url = resp_json["assets"][data_json_index]["browser_download_url"]
urllib.request.urlretrieve(data_json_url, 'latest_bundle_data.json')

View file

@ -1,39 +1,35 @@
# SPDX-FileCopyrightText: 2021 foamyguy
# SPDX-FileCopyrightText: 2019 Nicholas Tollervey, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Get the list of required libraries based on a file's imports
"""
import requests
import json
import os
import findimports
import requests
BUNDLE_DATA = "latest_bundle_data.json"
BUNDLE_TAG = "latest_bundle_tag.json"
LEARN_GUIDE_REPO = os.environ.get(
"LEARN_GUIDE_REPO", "../Adafruit_Learning_System_Guides/"
)
LEARN_GUIDE_REPO = os.environ.get('LEARN_GUIDE_REPO', "../../Adafruit_Learning_System_Guides/")
SHOWN_FILETYPES = ["py", "mpy", "bmp", "pcf", "bdf", "wav", "mp3", "json", "txt"]
SHOWN_FILETYPES_EXAMPLE = [s for s in SHOWN_FILETYPES if s != "py"]
def get_bundle(tag):
"""Download the given bundle's data to BUNDLE_DATA"""
url = f"https://adafruit-circuit-python.s3.amazonaws.com/bundles/adafruit/adafruit-circuitpython-bundle-{tag}.json" # pylint: disable=line-too-long
url = f"https://adafruit-circuit-python.s3.amazonaws.com/bundles/adafruit/adafruit-circuitpython-bundle-{tag}.json"
print(f"get bundle metadata from {url}")
r = requests.get(url)
with open(BUNDLE_DATA, "wb") as bundle_file:
bundle_file.write(r.content)
with open(BUNDLE_DATA, "wb") as f:
f.write(r.content)
LATEST_BUNDLE_VERSION = ""
def get_latest_tag():
"""
Find the value of the latest tag for the Adafruit CircuitPython library
bundle.
:return: The most recent tag value for the project.
"""
global LATEST_BUNDLE_VERSION
if not LATEST_BUNDLE_VERSION:
LATEST_BUNDLE_VERSION = get_latest_release_from_url(
"https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest"
)
return LATEST_BUNDLE_VERSION
def get_latest_release_from_url(url):
"""
@ -58,14 +54,13 @@ def get_latest_tag():
bundle.
:return: The most recent tag value for the project.
"""
global LATEST_BUNDLE_VERSION # pylint: disable=global-statement
global LATEST_BUNDLE_VERSION
if LATEST_BUNDLE_VERSION == "":
LATEST_BUNDLE_VERSION = get_latest_release_from_url(
"https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest"
)
return LATEST_BUNDLE_VERSION
def ensure_latest_bundle():
"""
Ensure that there's a copy of the latest library bundle available so circup
@ -78,7 +73,7 @@ def ensure_latest_bundle():
with open(BUNDLE_TAG, encoding="utf-8") as data:
try:
old_tag = json.load(data)["tag"]
except json.decoder.JSONDecodeError as _:
except json.decoder.JSONDecodeError as ex:
# Sometimes (why?) the JSON file becomes corrupt. In which case
# log it and carry on as if setting up for first time.
print(f"Could not parse {BUNDLE_TAG:r}")
@ -88,7 +83,7 @@ def ensure_latest_bundle():
get_bundle(tag)
with open(BUNDLE_TAG, "w", encoding="utf-8") as data:
json.dump({"tag": tag}, data)
except requests.exceptions.HTTPError as _:
except requests.exceptions.HTTPError as ex:
# See #20 for reason this this
print(
(
@ -100,7 +95,6 @@ def ensure_latest_bundle():
else:
print(f"Current library bundle up to date {tag}")
ensure_latest_bundle()
with open("latest_bundle_data.json", "r") as f:
@ -108,23 +102,20 @@ with open("latest_bundle_data.json", "r") as f:
def get_files_for_project(project_name):
"""Get the set of files for a learn project"""
found_files = set()
project_dir = "{}/{}/".format(LEARN_GUIDE_REPO, project_name)
project_dir = "{}{}/".format(LEARN_GUIDE_REPO, project_name)
for file in os.listdir(project_dir):
if "." in file:
cur_extension = file.split(".")[-1]
if cur_extension in SHOWN_FILETYPES:
# print(file)
#print(file)
found_files.add(file)
else:
# add dir
found_files.add(file)
return found_files
def get_libs_for_project(project_name):
"""Get the set of libraries for a learn project"""
found_libs = set()
found_imports = []
project_dir = "{}{}/".format(LEARN_GUIDE_REPO, project_name)
@ -134,68 +125,34 @@ def get_libs_for_project(project_name):
found_imports = findimports.find_imports("{}{}".format(project_dir, file))
for cur_import in found_imports:
cur_lib = cur_import.name.split(".")[0]
cur_lib = cur_import.name.split('.')[0]
if cur_lib in bundle_data:
found_libs.add(cur_lib)
return found_libs
def get_files_for_example(example_path):
"""Get the set of files for a library example"""
found_files = set(("code.py",))
example_dir = os.path.dirname(example_path)
for file in os.listdir(example_dir):
if "." in file:
cur_extension = file.split(".")[-1]
if cur_extension in SHOWN_FILETYPES_EXAMPLE:
# print(file)
found_files.add(file)
else:
# add dir
found_files.add(file)
return found_files
def get_libs_for_example(example_path):
"""Get the set of libraries for a library example"""
found_libs = set()
found_imports = []
found_imports = findimports.find_imports(example_path)
for cur_import in found_imports:
cur_lib = cur_import.name.split(".")[0]
if cur_lib in bundle_data:
found_libs.add(cur_lib)
return found_libs
def get_learn_guide_projects():
return os.listdir(LEARN_GUIDE_REPO)
def get_learn_guide_cp_projects():
"""Get the list of all circuitpython projects, according to some heuristics"""
for dirpath, dirnames, filenames in os.walk(LEARN_GUIDE_REPO):
# Don't consider hidden directories
dirnames[:] = [d for d in dirnames if not d.startswith(".")]
# The top-level needs special treatment
if dirpath == LEARN_GUIDE_REPO:
continue
# Skip this folder and all subfolders
if ".circuitpython.skip" in filenames:
del dirnames[:]
continue
# Skip files in this folder, but handle sub-folders
if ".circuitpython.skip-here" in filenames:
continue
# Do not reurse, but handle files in this folder
if ".circuitpython.skip-sub" in filenames:
del dirnames[:]
if any(f for f in filenames if f.endswith(".py")):
yield os.path.relpath(dirpath, LEARN_GUIDE_REPO)
if __name__ == "__main__":
for p in get_learn_guide_cp_projects():
print("PROJECT", p)
cp_projects = []
def has_py_file(dir):
dir_files = os.listdir(dir)
for file in dir_files:
if file.endswith(".py"):
if ".circuitpython.skip" not in dir_files:
return True
else:
return False
return False
all_projects = get_learn_guide_projects()
for project in all_projects:
project_dir = "{}{}/".format(LEARN_GUIDE_REPO, project)
try:
if has_py_file(project_dir):
cp_projects.append(project)
except NotADirectoryError:
pass
return cp_projects

View file

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 797 B

View file

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View file

@ -0,0 +1,28 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
moral rights retained by the original author(s) and/or performer(s);
publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
rights protecting the extraction, dissemination, use and reuse of data in a Work;
database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -0,0 +1,28 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
moral rights retained by the original author(s) and/or performer(s);
publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
rights protecting the extraction, dissemination, use and reuse of data in a Work;
database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

Before

Width:  |  Height:  |  Size: 763 B

After

Width:  |  Height:  |  Size: 763 B

View file

@ -1,4 +0,0 @@
findimports
pillow
requests
click

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jeff Epler
SPDX-License-Identifier: CC0-1.0