Skip to content

Commit 22fcea4

Browse files
authored
Merge pull request #118 from adafruit/REUSE
ran pre-commit, added licenses
2 parents 4f2e890 + 39f766e commit 22fcea4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+570
-429
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
__pycache__
26
_build
37
*.pyc

.pylintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2020 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: 2020 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/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_ble/__init__.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2019 Dan Halbert for Adafruit Industries
2+
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
23
#
3-
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
4-
# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
5-
#
6-
# Permission is hereby granted, free of charge, to any person obtaining a copy
7-
# of this software and associated documentation files (the "Software"), to deal
8-
# in the Software without restriction, including without limitation the rights
9-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
# copies of the Software, and to permit persons to whom the Software is
11-
# furnished to do so, subject to the following conditions:
12-
#
13-
# The above copyright notice and this permission notice shall be included in
14-
# all copies or substantial portions of the Software.
15-
#
16-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
# THE SOFTWARE.
4+
# SPDX-License-Identifier: MIT
5+
236
"""
247
258
This module provides higher-level BLE (Bluetooth Low Energy) functionality,
@@ -125,13 +108,13 @@ def paired(self):
125108
@property
126109
def connection_interval(self):
127110
"""Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
128-
increase speed and decrease latency but increase power consumption.
111+
increase speed and decrease latency but increase power consumption.
129112
130-
When setting connection_interval, the peer may reject the new interval and
131-
`connection_interval` will then remain the same.
113+
When setting connection_interval, the peer may reject the new interval and
114+
`connection_interval` will then remain the same.
132115
133-
Apple has additional guidelines that dictate should be a multiple of 15ms except if HID
134-
is available. When HID is available Apple devices may accept 11.25ms intervals."""
116+
Apple has additional guidelines that dictate should be a multiple of 15ms except if HID
117+
is available. When HID is available Apple devices may accept 11.25ms intervals."""
135118
return self._bleio_connection.connection_interval
136119

137120
@connection_interval.setter
@@ -289,8 +272,8 @@ def start_scan(
289272
def stop_scan(self):
290273
"""Stops any active scan.
291274
292-
The scan results iterator will return any buffered results and then raise StopIteration
293-
once empty."""
275+
The scan results iterator will return any buffered results and then raise StopIteration
276+
once empty."""
294277
self._adapter.stop_scan()
295278

296279
def connect(self, advertisement, *, timeout=4.0):

adafruit_ble/advertising/__init__.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2018 Dan Halbert for Adafruit Industries
22
#
3-
# Copyright (c) 2018 Dan Halbert for Adafruit Industries
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
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
Advertising is the first phase of BLE where devices can broadcast
247
"""
@@ -38,7 +21,7 @@ def to_bytes_literal(seq):
3821

3922
def decode_data(data, *, key_encoding="B"):
4023
"""Helper which decodes length encoded structures into a dictionary with the given key
41-
encoding."""
24+
encoding."""
4225
i = 0
4326
data_dict = {}
4427
key_size = struct.calcsize(key_encoding)
@@ -73,7 +56,7 @@ def compute_length(data_dict, *, key_encoding="B"):
7356

7457
def encode_data(data_dict, *, key_encoding="B"):
7558
"""Helper which encodes dictionaries into length encoded structures with the given key
76-
encoding."""
59+
encoding."""
7760
length = compute_length(data_dict, key_encoding=key_encoding)
7861
data = bytearray(length)
7962
key_size = struct.calcsize(key_encoding)
@@ -151,7 +134,7 @@ def __str__(self):
151134
class String(AdvertisingDataField):
152135
"""UTF-8 encoded string in an Advertisement.
153136
154-
Not null terminated once encoded because length is always transmitted."""
137+
Not null terminated once encoded because length is always transmitted."""
155138

156139
def __init__(self, *, advertising_data_type):
157140
self._adt = advertising_data_type
@@ -265,7 +248,7 @@ def __init__(self):
265248
@classmethod
266249
def from_entry(cls, entry):
267250
"""Create an Advertisement based on the given ScanEntry. This is done automatically by
268-
`BLERadio` for all scan results."""
251+
`BLERadio` for all scan results."""
269252
self = cls()
270253
# If data_dict is available, use it directly. Otherwise decode the bytestring.
271254
if hasattr(entry, "data_dict"):
@@ -282,7 +265,7 @@ def from_entry(cls, entry):
282265
@property
283266
def rssi(self):
284267
"""Signal strength of the scanned advertisement. Only available on Advertisements returned
285-
from `BLERadio.start_scan()`. (read-only)"""
268+
from `BLERadio.start_scan()`. (read-only)"""
286269
return self._rssi
287270

288271
@classmethod

adafruit_ble/advertising/adafruit.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: 2019 Scott Shawcroft for Adafruit Industries
22
#
3-
# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
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
`adafruit`
247
====================================================

adafruit_ble/advertising/apple.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
# class iBeacon(Advertisement):
26
# # Apple manufacturer data with subtype 2
37
# match_prefixes = (b"\xff\x00\x4c\x02",)

adafruit_ble/advertising/standard.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
22
#
3-
# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
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
:py:mod:`~adafruit_ble.advertising.standard`
247
====================================================
@@ -211,10 +194,10 @@ def __init__(self, *services):
211194

212195
class ManufacturerData(AdvertisingDataField):
213196
"""Encapsulates manufacturer specific keyed data bytes. The manufacturer is identified by the
214-
company_id and the data is structured like an advertisement with a configurable key
215-
format. The order of the serialized data is determined by the order that the
216-
`ManufacturerDataField` attributes are set in - this can be useful for
217-
`match_prefixes` in an `Advertisement` sub-class."""
197+
company_id and the data is structured like an advertisement with a configurable key
198+
format. The order of the serialized data is determined by the order that the
199+
`ManufacturerDataField` attributes are set in - this can be useful for
200+
`match_prefixes` in an `Advertisement` sub-class."""
218201

219202
def __init__(
220203
self, obj, *, advertising_data_type=0xFF, company_id, key_encoding="B"
@@ -313,7 +296,7 @@ def __set__(self, obj, value):
313296

314297
class ServiceData(AdvertisingDataField):
315298
"""Encapsulates service data. It is read as a memoryview which can be manipulated or set as a
316-
bytearray to change the size."""
299+
bytearray to change the size."""
317300

318301
def __init__(self, service):
319302
if isinstance(service.uuid, StandardUUID):

adafruit_ble/attributes/__init__.py

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2019 Dan Halbert for Adafruit Industries
22
#
3-
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
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
:py:mod:`~adafruit_ble.attributes`
247
====================================================
@@ -36,34 +19,33 @@
3619
class Attribute:
3720
"""Constants describing security levels.
3821
39-
.. data:: NO_ACCESS
22+
.. data:: NO_ACCESS
4023
41-
security mode: access not allowed
24+
security mode: access not allowed
4225
43-
.. data:: OPEN
26+
.. data:: OPEN
4427
45-
security_mode: no security (link is not encrypted)
28+
security_mode: no security (link is not encrypted)
4629
47-
.. data:: ENCRYPT_NO_MITM
30+
.. data:: ENCRYPT_NO_MITM
4831
49-
security_mode: unauthenticated encryption, without man-in-the-middle protection
32+
security_mode: unauthenticated encryption, without man-in-the-middle protection
5033
51-
.. data:: ENCRYPT_WITH_MITM
34+
.. data:: ENCRYPT_WITH_MITM
5235
53-
security_mode: authenticated encryption, with man-in-the-middle protection
36+
security_mode: authenticated encryption, with man-in-the-middle protection
5437
55-
.. data:: LESC_ENCRYPT_WITH_MITM
38+
.. data:: LESC_ENCRYPT_WITH_MITM
5639
57-
security_mode: LESC encryption, with man-in-the-middle protection
40+
security_mode: LESC encryption, with man-in-the-middle protection
5841
59-
.. data:: SIGNED_NO_MITM
42+
.. data:: SIGNED_NO_MITM
6043
61-
security_mode: unauthenticated data signing, without man-in-the-middle protection
44+
security_mode: unauthenticated data signing, without man-in-the-middle protection
6245
63-
.. data:: SIGNED_WITH_MITM
46+
.. data:: SIGNED_WITH_MITM
6447
65-
security_mode: authenticated data signing, without man-in-the-middle protection
66-
"""
48+
security_mode: authenticated data signing, without man-in-the-middle protection"""
6749

6850
# pylint: disable=too-few-public-methods
6951
NO_ACCESS = _bleio.Attribute.NO_ACCESS

0 commit comments

Comments
 (0)