Skip to content

Commit 69b1af2

Browse files
authored
Merge pull request #34 from adafruit/REUSE
Ran pre-commit, added licenses
2 parents 1b1d4d9 + eab6103 commit 69b1af2

26 files changed

+634
-149
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
__pycache__
26
_build
37
*.pyc
@@ -8,4 +12,4 @@ bundles
812
*.DS_Store
913
.eggs
1014
dist
11-
**/*.egg-info
15+
**/*.egg-info

.pylintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
[MASTER]
26

37
# A comma-separated list of package or module names from where C extensions may

.readthedocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
python:
26
version: 3
37
requirements_file: requirements.txt

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
3+
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
4+
SPDX-License-Identifier: CC-BY-4.0
5+
-->
6+
17
# Adafruit Community Code of Conduct
28

39
## Our Pledge
@@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:
4349

4450
The goal of the standards and moderation guidelines outlined here is to build
4551
and maintain a respectful community. We ask that you don’t just aim to be
46-
"technically unimpeachable", but rather try to be your best self.
52+
"technically unimpeachable", but rather try to be your best self.
4753

4854
We value many things beyond technical expertise, including collaboration and
4955
supporting others within our community. Providing a positive experience for
@@ -74,9 +80,9 @@ You may report in the following ways:
7480
In any situation, you may send an email to <[email protected]>.
7581

7682
On the Adafruit Discord, you may send an open message from any channel
77-
to all Community Moderators by tagging @community moderators. You may
78-
also send an open message from any channel, or a direct message to
79-
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
83+
to all Community Moderators by tagging @community moderators. You may
84+
also send an open message from any channel, or a direct message to
85+
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
8086
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
8187

8288
Email and direct message reports will be kept confidential.

LICENSES/CC-BY-4.0.txt

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

LICENSES/GPL-3.0-or-later.txt

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

LICENSES/MIT.txt

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

LICENSES/Unlicense.txt

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

README.rst.license

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

adafruit_tinylora/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
"""This file is included to prevent pylint
26
failing with the following error: no-name-in-module.
37
note: revisit/remove this file when this pylint error has been resolved.

adafruit_tinylora/adafruit_tinylora.py

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
# Copyright 2015, 2016 Ideetron B.V.
1+
# SPDX-FileCopyrightText: 2015-2016 Ideetron B.V.
22
#
3-
# This program is free software: you can redistribute it and/or modify
4-
# it under the terms of the GNU Lesser General Public License as published by
5-
# the Free Software Foundation, either version 3 of the License, or
6-
# (at your option) any later version.
7-
#
8-
# This program is distributed in the hope that it will be useful,
9-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11-
# GNU Lesser General Public License for more details.
12-
#
13-
# You should have received a copy of the GNU Lesser General Public License
14-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15-
#
16-
#
17-
# Modified by Brent Rubell for Adafruit Industries.
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
185
"""
196
`Adafruit_TinyLoRa`
207
====================================================
@@ -81,8 +68,7 @@
8168

8269

8370
class TTN:
84-
"""TTN Class
85-
"""
71+
"""TTN Class"""
8672

8773
def __init__(self, dev_address, net_key, app_key, country="US"):
8874
"""Interface for TheThingsNetwork
@@ -98,33 +84,28 @@ def __init__(self, dev_address, net_key, app_key, country="US"):
9884

9985
@property
10086
def country(self):
101-
"""Returns the TTN Frequency Country.
102-
"""
87+
"""Returns the TTN Frequency Country."""
10388
return self.region
10489

10590
@property
10691
def device_address(self):
107-
"""Returns the TTN Device Address.
108-
"""
92+
"""Returns the TTN Device Address."""
10993
return self.dev_addr
11094

11195
@property
11296
def application_key(self):
113-
"""Returns the TTN Application Key.
114-
"""
97+
"""Returns the TTN Application Key."""
11598
return self.app_key
11699

117100
@property
118101
def network_key(self):
119-
"""Returns the TTN Network Key.
120-
"""
102+
"""Returns the TTN Network Key."""
121103
return self.net_key
122104

123105

124106
# pylint: disable=too-many-instance-attributes
125107
class TinyLoRa:
126-
"""TinyLoRa Interface
127-
"""
108+
"""TinyLoRa Interface"""
128109

129110
# SPI Write Buffer
130111
_BUFFER = bytearray(2)
@@ -237,10 +218,10 @@ def deinit(self):
237218

238219
def send_data(self, data, data_length, frame_counter, timeout=2):
239220
"""Function to assemble and send data
240-
:param data: data to send
241-
:param data_length: length of data to send
242-
:param frame_counter: frame counter variable, declared in code.py.
243-
:param timeout: TxDone wait time, default is 2.
221+
:param data: data to send
222+
:param data_length: length of data to send
223+
:param frame_counter: frame counter variable, declared in code.py.
224+
:param timeout: TxDone wait time, default is 2.
244225
"""
245226
# data packet
246227
enc_data = bytearray(data_length)
@@ -283,9 +264,9 @@ def send_data(self, data, data_length, frame_counter, timeout=2):
283264

284265
def send_packet(self, lora_packet, packet_length, timeout):
285266
"""Sends a LoRa packet using the RFM Module
286-
:param bytearray lora_packet: assembled LoRa packet from send_data
287-
:param int packet_length: length of LoRa packet to send
288-
:param int timeout: TxDone wait time.
267+
:param bytearray lora_packet: assembled LoRa packet from send_data
268+
:param int packet_length: length of LoRa packet to send
269+
:param int timeout: TxDone wait time.
289270
"""
290271
# Set RFM to standby
291272
self._write_u8(_MODE_STDBY, 0x81)
@@ -342,8 +323,8 @@ def set_datarate(self, datarate):
342323
}
343324
try:
344325
self._sf, self._bw, self._modemcfg = data_rates[datarate]
345-
except KeyError:
346-
raise KeyError("Invalid or Unsupported Datarate.")
326+
except KeyError as err:
327+
raise KeyError("Invalid or Unsupported Datarate.") from err
347328

348329
def set_channel(self, channel):
349330
"""Sets the RFM Channel (if single-channel)

adafruit_tinylora/adafruit_tinylora_encryption.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
# AES-Python, Copyright (C) 2012 Bo Zhu http://about.bozhu.me
1+
# SPDX-FileCopyrightText: 2012 Bo Zhu
2+
# SPDX-FileCopyrightText: Brent Rubell for Adafruit Industries
23
#
3-
# Permission is hereby granted, free of charge, to any person obtaining a
4-
# copy of this software and associated documentation files (the "Software"),
5-
# to deal in the Software without restriction, including without limitation
6-
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7-
# and/or sell copies of the Software, and to permit persons to whom the
8-
# Software is furnished to do so, subject to the following conditions:
9-
#
10-
# The above copyright notice and this permission notice shall be included in
11-
# all copies or substantial portions of the Software.
12-
#
13-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16-
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19-
# DEALINGS IN THE SOFTWARE.
20-
#
21-
# Modified by Brent Rubell for Adafruit Industries
4+
# SPDX-License-Identifier: MIT
5+
226
"""
237
`adafruit_tinylora_encryption.py`
248
======================================================
@@ -28,8 +12,7 @@
2812
"""
2913
# from http://cs.ucsb.edu/~koc/cs178/projects/JT/aes.c
3014
def xtime(col):
31-
"""xtime impl. for _mix_single_column()
32-
"""
15+
"""xtime impl. for _mix_single_column()"""
3316
return (((col << 1) ^ 0x1B) & 0xFF) if (col & 0x80) else (col << 1)
3417

3518

@@ -263,8 +246,7 @@ def _aes_shift_rows(arr):
263246
)
264247

265248
def calculate_mic(self, lora_packet, lora_packet_length, mic):
266-
"""Calculates the validity of data messages, generates a message integrity check bytearray.
267-
"""
249+
"""Calculates the validity of data messages, generates message integrity check bytearray."""
268250
block_b = bytearray(16)
269251
key_k1 = bytearray(16)
270252
key_k2 = bytearray(16)
@@ -363,8 +345,7 @@ def _mic_generate_keys(self, key_1, key_2):
363345

364346
@staticmethod
365347
def _shift_left(data):
366-
""" Shifts data bytearray left by 1
367-
"""
348+
"""Shifts data bytearray left by 1"""
368349
for i in range(16):
369350
if i < 15:
370351
if (data[i + 1] & 0x80) == 0x80:
@@ -378,7 +359,7 @@ def _shift_left(data):
378359

379360
@staticmethod
380361
def _xor_data(new_data, old_data):
381-
""" XOR two data arrays
362+
"""XOR two data arrays
382363
:param bytearray new_data: Calculated data.
383364
:param bytearray old_data: data to be xor'd.
384365
"""

adafruit_tinylora/ttn_as.py

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

adafruit_tinylora/ttn_au.py

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

adafruit_tinylora/ttn_eu.py

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

0 commit comments

Comments
 (0)