Skip to content

Ran pre-commit, added licenses #58

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

*.mpy
.idea
__pycache__
Expand Down
4 changes: 4 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

[MASTER]

# A comma-separated list of package or module names from where C extensions may
Expand Down
5 changes: 4 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

python:
version: 3
requirements_file: requirements.txt

14 changes: 10 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
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
Expand Down Expand Up @@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:

The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you don’t just aim to be
"technically unimpeachable", but rather try to be your best self.
"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
Expand Down Expand Up @@ -74,9 +80,9 @@ 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, @Dan Halbert#1614, @cater#2442,
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, @Dan Halbert#1614, @cater#2442,
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.

Email and direct message reports will be kept confidential.
Expand Down
324 changes: 324 additions & 0 deletions LICENSES/CC-BY-4.0.txt

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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 (including the next
paragraph) 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.
20 changes: 20 additions & 0 deletions LICENSES/Unlicense.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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 <https://unlicense.org/>
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Usage Example
Hardware Set-up
----------------

The DHT11 and DHT22 devices both need a pull-resistor on the data signal wire.
This resistor is in the range of 1k to 5k. Please check your device datasheet for the
The DHT11 and DHT22 devices both need a pull-resistor on the data signal wire.
This resistor is in the range of 1k to 5k. Please check your device datasheet for the
appropriate value.

Basics
Expand Down Expand Up @@ -99,7 +99,7 @@ Now get the temperature and humidity values
temperature = dht_device.temperature
humidity = dht_device.humidity

These properties may raise an exception if a problem occurs. You should use try/raise
These properties may raise an exception if a problem occurs. You should use try/raise
logic and catch RuntimeError and then retry getting the values after at least 2 seconds.
If you try again to get a result within 2 seconds, cached values are returned.

Expand Down
3 changes: 3 additions & 0 deletions README.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries

SPDX-License-Identifier: MIT
60 changes: 21 additions & 39 deletions adafruit_dht.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
# The MIT License (MIT)
# SPDX-FileCopyrightText: 2017 Mike McWethy for Adafruit Industries
#
# Copyright (c) 2017 Mike McWethy for Adafruit Industries
#
# 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.
# SPDX-License-Identifier: MIT

"""
:mod:`adafruit_dhtlib`
======================
Expand Down Expand Up @@ -47,8 +30,7 @@


class DHTBase:
""" base support for DHT11 and DHT22 devices
"""
"""base support for DHT11 and DHT22 devices"""

__hiLevel = 51

Expand Down Expand Up @@ -110,7 +92,7 @@ def _pulses_to_binary(self, pulses, start, stop):
return binary

def _get_pulses_pulseio(self):
""" _get_pulses implements the communication protcol for
"""_get_pulses implements the communication protcol for
DHT11 and DHT22 type devices. It sends a start signal
of a specific length and listens and measures the
return signal lengths.
Expand Down Expand Up @@ -138,7 +120,7 @@ def _get_pulses_pulseio(self):
return pulses

def _get_pulses_bitbang(self):
""" _get_pulses implements the communication protcol for
"""_get_pulses implements the communication protcol for
DHT11 and DHT22 type devices. It sends a start signal
of a specific length and listens and measures the
return signal lengths.
Expand Down Expand Up @@ -182,12 +164,12 @@ def _get_pulses_bitbang(self):
return pulses

def measure(self):
""" measure runs the communications to the DHT11/22 type device.
if successful, the class properties temperature and humidity will
return the reading returned from the device.
"""measure runs the communications to the DHT11/22 type device.
if successful, the class properties temperature and humidity will
return the reading returned from the device.

Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
"""
delay_between_readings = 2 # 2 seconds per read according to datasheet
# Initiate new reading if this is the first call or if sufficient delay
Expand Down Expand Up @@ -253,39 +235,39 @@ def measure(self):

@property
def temperature(self):
""" temperature current reading. It makes sure a reading is available
"""temperature current reading. It makes sure a reading is available

Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
"""
self.measure()
return self._temperature

@property
def humidity(self):
""" humidity current reading. It makes sure a reading is available
"""humidity current reading. It makes sure a reading is available

Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
Raises RuntimeError exception for checksum failure and for insuffcient
data returned from the device (try again)
"""
self.measure()
return self._humidity


class DHT11(DHTBase):
""" Support for DHT11 device.
"""Support for DHT11 device.

:param ~board.Pin pin: digital pin used for communication
:param ~board.Pin pin: digital pin used for communication
"""

def __init__(self, pin, use_pulseio=_USE_PULSEIO):
super().__init__(True, pin, 18000, use_pulseio)


class DHT22(DHTBase):
""" Support for DHT22 device.
"""Support for DHT22 device.

:param ~board.Pin pin: digital pin used for communication
:param ~board.Pin pin: digital pin used for communication
"""

def __init__(self, pin, use_pulseio=_USE_PULSEIO):
Expand Down
3 changes: 3 additions & 0 deletions docs/_static/favicon.ico.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries

SPDX-License-Identifier: CC-BY-4.0
3 changes: 3 additions & 0 deletions docs/api.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT

import os
import sys

Expand Down
3 changes: 3 additions & 0 deletions docs/examples.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
3 changes: 3 additions & 0 deletions docs/index.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
3 changes: 3 additions & 0 deletions examples/dht_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import adafruit_dht
Expand Down
3 changes: 3 additions & 0 deletions examples/dht_to_led_display.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
example of reading temperature and humidity from a DHT device
and displaying results to the serial port and a 8 digit 7-segment display
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""A setuptools based setup module.

See:
Expand Down