adafruit-circuitpython-si5351 1.4.6__tar.gz → 1.4.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. adafruit_circuitpython_si5351-1.4.7/.gitattributes +11 -0
  2. adafruit_circuitpython_si5351-1.4.7/.pre-commit-config.yaml +21 -0
  3. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/PKG-INFO +6 -5
  4. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/README.rst +3 -3
  5. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_circuitpython_si5351.egg-info/PKG-INFO +6 -5
  6. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_circuitpython_si5351.egg-info/SOURCES.txt +2 -1
  7. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_si5351.py +13 -33
  8. adafruit_circuitpython_si5351-1.4.7/docs/api.rst +11 -0
  9. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/conf.py +2 -6
  10. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/examples/si5351_simpletest.py +5 -6
  11. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/pyproject.toml +1 -1
  12. adafruit_circuitpython_si5351-1.4.7/ruff.toml +106 -0
  13. adafruit_circuitpython_si5351-1.4.6/.pre-commit-config.yaml +0 -42
  14. adafruit_circuitpython_si5351-1.4.6/.pylintrc +0 -399
  15. adafruit_circuitpython_si5351-1.4.6/docs/api.rst +0 -5
  16. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
  17. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.github/workflows/build.yml +0 -0
  18. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.github/workflows/failure-help-text.yml +0 -0
  19. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.github/workflows/release_gh.yml +0 -0
  20. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.github/workflows/release_pypi.yml +0 -0
  21. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.gitignore +0 -0
  22. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/.readthedocs.yaml +0 -0
  23. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/CODE_OF_CONDUCT.md +0 -0
  24. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/LICENSE +0 -0
  25. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/LICENSES/CC-BY-4.0.txt +0 -0
  26. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/LICENSES/MIT.txt +0 -0
  27. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/LICENSES/Unlicense.txt +0 -0
  28. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/README.rst.license +0 -0
  29. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_circuitpython_si5351.egg-info/dependency_links.txt +0 -0
  30. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_circuitpython_si5351.egg-info/requires.txt +0 -0
  31. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/adafruit_circuitpython_si5351.egg-info/top_level.txt +0 -0
  32. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/_static/favicon.ico +0 -0
  33. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/_static/favicon.ico.license +0 -0
  34. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/api.rst.license +0 -0
  35. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/examples.rst +0 -0
  36. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/examples.rst.license +0 -0
  37. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/index.rst +0 -0
  38. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/index.rst.license +0 -0
  39. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/docs/requirements.txt +0 -0
  40. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/optional_requirements.txt +0 -0
  41. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/requirements.txt +0 -0
  42. {adafruit_circuitpython_si5351-1.4.6 → adafruit_circuitpython_si5351-1.4.7}/setup.cfg +0 -0
@@ -0,0 +1,11 @@
1
+ # SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: Unlicense
4
+
5
+ .py text eol=lf
6
+ .rst text eol=lf
7
+ .txt text eol=lf
8
+ .yaml text eol=lf
9
+ .toml text eol=lf
10
+ .license text eol=lf
11
+ .md text eol=lf
@@ -0,0 +1,21 @@
1
+ # SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: Unlicense
4
+
5
+ repos:
6
+ - repo: https://github.com/pre-commit/pre-commit-hooks
7
+ rev: v4.5.0
8
+ hooks:
9
+ - id: check-yaml
10
+ - id: end-of-file-fixer
11
+ - id: trailing-whitespace
12
+ - repo: https://github.com/astral-sh/ruff-pre-commit
13
+ rev: v0.3.4
14
+ hooks:
15
+ - id: ruff-format
16
+ - id: ruff
17
+ args: ["--fix"]
18
+ - repo: https://github.com/fsfe/reuse-tool
19
+ rev: v3.0.1
20
+ hooks:
21
+ - id: reuse
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: adafruit-circuitpython-si5351
3
- Version: 1.4.6
3
+ Version: 1.4.7
4
4
  Summary: CircuitPython library for SI5351 clock generator module.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT
@@ -17,6 +17,7 @@ License-File: LICENSE
17
17
  Requires-Dist: Adafruit-Blinka
18
18
  Requires-Dist: adafruit-circuitpython-busdevice
19
19
  Provides-Extra: optional
20
+ Dynamic: license-file
20
21
 
21
22
  Introduction
22
23
  ============
@@ -33,9 +34,9 @@ Introduction
33
34
  :target: https://github.com/adafruit/Adafruit_CircuitPython_SI5351/actions/
34
35
  :alt: Build Status
35
36
 
36
- .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
37
- :target: https://github.com/psf/black
38
- :alt: Code Style: Black
37
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
38
+ :target: https://github.com/astral-sh/ruff
39
+ :alt: Code Style: Ruff
39
40
 
40
41
  SI5351 clock generator module.
41
42
 
@@ -13,9 +13,9 @@ Introduction
13
13
  :target: https://github.com/adafruit/Adafruit_CircuitPython_SI5351/actions/
14
14
  :alt: Build Status
15
15
 
16
- .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
17
- :target: https://github.com/psf/black
18
- :alt: Code Style: Black
16
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
17
+ :target: https://github.com/astral-sh/ruff
18
+ :alt: Code Style: Ruff
19
19
 
20
20
  SI5351 clock generator module.
21
21
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: adafruit-circuitpython-si5351
3
- Version: 1.4.6
3
+ Version: 1.4.7
4
4
  Summary: CircuitPython library for SI5351 clock generator module.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT
@@ -17,6 +17,7 @@ License-File: LICENSE
17
17
  Requires-Dist: Adafruit-Blinka
18
18
  Requires-Dist: adafruit-circuitpython-busdevice
19
19
  Provides-Extra: optional
20
+ Dynamic: license-file
20
21
 
21
22
  Introduction
22
23
  ============
@@ -33,9 +34,9 @@ Introduction
33
34
  :target: https://github.com/adafruit/Adafruit_CircuitPython_SI5351/actions/
34
35
  :alt: Build Status
35
36
 
36
- .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
37
- :target: https://github.com/psf/black
38
- :alt: Code Style: Black
37
+ .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
38
+ :target: https://github.com/astral-sh/ruff
39
+ :alt: Code Style: Ruff
39
40
 
40
41
  SI5351 clock generator module.
41
42
 
@@ -1,6 +1,6 @@
1
+ .gitattributes
1
2
  .gitignore
2
3
  .pre-commit-config.yaml
3
- .pylintrc
4
4
  .readthedocs.yaml
5
5
  CODE_OF_CONDUCT.md
6
6
  LICENSE
@@ -10,6 +10,7 @@ adafruit_si5351.py
10
10
  optional_requirements.txt
11
11
  pyproject.toml
12
12
  requirements.txt
13
+ ruff.toml
13
14
  .github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
14
15
  .github/workflows/build.yml
15
16
  .github/workflows/failure-help-text.yml
@@ -12,19 +12,20 @@ library at: https://github.com/adafruit/Adafruit_Si5351_Library/
12
12
 
13
13
  * Author(s): Tony DiCola
14
14
  """
15
- import math
16
15
 
17
- from micropython import const
16
+ import math
18
17
 
19
18
  from adafruit_bus_device import i2c_device
19
+ from micropython import const
20
20
 
21
21
  try:
22
- import typing # pylint: disable=unused-import
22
+ import typing
23
+
23
24
  from busio import I2C
24
25
  except ImportError:
25
26
  pass
26
27
 
27
- __version__ = "1.4.6"
28
+ __version__ = "1.4.7"
28
29
  __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SI5351.git"
29
30
 
30
31
 
@@ -122,16 +123,13 @@ R_DIV_128 = 7
122
123
  # Disable invalid name because p1, p2, p3 variables are false positives.
123
124
  # These are legitimate register names and adding more characters obfuscates
124
125
  # the intention of the code.
125
- # pylint: disable=invalid-name
126
126
 
127
127
  # Disable protected access warning because inner classes by design need and use
128
128
  # access to protected members.
129
- # pylint: disable=protected-access
130
129
 
131
130
  # Another silly pylint check to disable, it has no context of the complexity
132
131
  # of R divider values and explicit unrolling of them into multiple if cases
133
132
  # and return statements. Disable.
134
- # pylint: disable=too-many-return-statements
135
133
 
136
134
 
137
135
  class SI5351:
@@ -196,9 +194,7 @@ class SI5351:
196
194
  # https://github.com/adafruit/circuitpython/issues/572
197
195
  self._frequency = fvco
198
196
 
199
- def configure_fractional(
200
- self, multiplier: int, numerator: int, denominator: int
201
- ) -> None:
197
+ def configure_fractional(self, multiplier: int, numerator: int, denominator: int) -> None:
202
198
  """Configure the PLL with a fractional multiplier specified by
203
199
  multiplier and numerator/denominator. This is less accurate and
204
200
  susceptible to jitter but allows a larger range of PLL frequencies.
@@ -206,22 +202,15 @@ class SI5351:
206
202
  if multiplier >= 91 or multiplier <= 14:
207
203
  raise ValueError("Multiplier must be in range 14 to 91.")
208
204
  if denominator > 0xFFFFF or denominator <= 0: # Prevent divide by zero.
209
- raise ValueError(
210
- "Denominator must be greater than 0 and less than 0xFFFFF."
211
- )
205
+ raise ValueError("Denominator must be greater than 0 and less than 0xFFFFF.")
212
206
  if numerator >= 0xFFFFF or numerator < 0:
213
207
  raise ValueError("Numerator must be in range 0 to 0xFFFFF.")
214
208
  multiplier = int(multiplier)
215
209
  numerator = int(numerator)
216
210
  denominator = int(denominator)
217
211
  # Compute register values and configure them.
218
- p1 = int(
219
- 128 * multiplier + math.floor(128 * ((numerator / denominator)) - 512)
220
- )
221
- p2 = int(
222
- 128 * numerator
223
- - denominator * math.floor(128 * (numerator / denominator))
224
- )
212
+ p1 = int(128 * multiplier + math.floor(128 * (numerator / denominator) - 512))
213
+ p2 = int(128 * numerator - denominator * math.floor(128 * (numerator / denominator)))
225
214
  p3 = denominator
226
215
  self._configure_registers(p1, p2, p3)
227
216
  # Calculate exact frequency and store it for reference.
@@ -251,7 +240,7 @@ class SI5351:
251
240
  self._divider = None
252
241
 
253
242
  @property
254
- def frequency(self) -> float:
243
+ def frequency(self) -> float: # noqa: PLR0911
255
244
  """Get the frequency of this clock output in hertz. This is
256
245
  computed based on the configured PLL, clock divider, and R divider.
257
246
  """
@@ -263,7 +252,6 @@ class SI5351:
263
252
  base_frequency = self._pll.frequency / self._divider
264
253
  # And add a further division for the R divider if set.
265
254
  r_divider = self.r_divider
266
- # pylint: disable=no-else-return
267
255
  # Disable should be removed when refactor can be tested.
268
256
  if r_divider == R_DIV_1:
269
257
  return base_frequency
@@ -325,9 +313,7 @@ class SI5351:
325
313
  buf[8] = p2 & 0x000000FF
326
314
  i2c.write(buf, end=9)
327
315
 
328
- def configure_integer(
329
- self, pll: "PLL", divider: int, inverted: bool = False
330
- ) -> None:
316
+ def configure_integer(self, pll: "PLL", divider: int, inverted: bool = False) -> None:
331
317
  """Configure the clock output with the specified PLL source
332
318
  (should be a PLL instance on the SI5351 class) and specific integer
333
319
  divider. This is the most accurate way to set the clock output
@@ -371,13 +357,10 @@ class SI5351:
371
357
  fractional divider with numerator/denominator. Again this is less
372
358
  accurate but has a wider range of output frequencies.
373
359
  """
374
- # pylint: disable=too-many-arguments
375
360
  if divider >= 2049 or divider <= 3:
376
361
  raise ValueError("Divider must be in range 3 to 2049.")
377
362
  if denominator > 0xFFFFF or denominator <= 0: # Prevent divide by zero.
378
- raise ValueError(
379
- "Denominator must be greater than 0 and less than 0xFFFFF."
380
- )
363
+ raise ValueError("Denominator must be greater than 0 and less than 0xFFFFF.")
381
364
  if numerator >= 0xFFFFF or numerator < 0:
382
365
  raise ValueError("Numerator must be in range 0 to 0xFFFFF.")
383
366
  divider = int(divider)
@@ -388,10 +371,7 @@ class SI5351:
388
371
  raise RuntimeError("PLL must be configured.")
389
372
  # Compute MSx register values.
390
373
  p1 = int(128 * divider + math.floor(128 * (numerator / denominator)) - 512)
391
- p2 = int(
392
- 128 * numerator
393
- - denominator * math.floor(128 * (numerator / denominator))
394
- )
374
+ p2 = int(128 * numerator - denominator * math.floor(128 * (numerator / denominator)))
395
375
  p3 = denominator
396
376
  self._configure_registers(p1, p2, p3)
397
377
  # Configure the clock control register.
@@ -0,0 +1,11 @@
1
+
2
+ .. If you created a package, create one automodule per module in the package.
3
+
4
+ .. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
5
+ .. use this format as the module name: "adafruit_foo.foo"
6
+
7
+ API Reference
8
+ #############
9
+
10
+ .. automodule:: adafruit_si5351
11
+ :members:
@@ -1,12 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
4
2
  #
5
3
  # SPDX-License-Identifier: MIT
6
4
 
5
+ import datetime
7
6
  import os
8
7
  import sys
9
- import datetime
10
8
 
11
9
  sys.path.insert(0, os.path.abspath(".."))
12
10
 
@@ -49,9 +47,7 @@ project = "Adafruit SI5351 Library"
49
47
  creation_year = "2017"
50
48
  current_year = str(datetime.datetime.now().year)
51
49
  year_duration = (
52
- current_year
53
- if current_year == creation_year
54
- else creation_year + " - " + current_year
50
+ current_year if current_year == creation_year else creation_year + " - " + current_year
55
51
  )
56
52
  copyright = year_duration + " Tony DiCola"
57
53
  author = "Tony DiCola"
@@ -16,7 +16,6 @@ import busio
16
16
 
17
17
  import adafruit_si5351
18
18
 
19
-
20
19
  # Initialize I2C bus.
21
20
  i2c = busio.I2C(board.SCL, board.SDA)
22
21
 
@@ -32,7 +31,7 @@ si5351 = adafruit_si5351.SI5351(i2c)
32
31
  # but allows less of a range of frequencies compared to a fractional
33
32
  # multiplier shown next.
34
33
  si5351.pll_a.configure_integer(36) # Multiply 25mhz by 36
35
- print("PLL A frequency: {0}mhz".format(si5351.pll_a.frequency / 1000000))
34
+ print(f"PLL A frequency: {si5351.pll_a.frequency / 1000000}mhz")
36
35
 
37
36
  # And next configure PLL B to 616.6667mhz by multiplying 25mhz by 24.667 using
38
37
  # the fractional multiplier configuration. Notice you specify the integer
@@ -41,7 +40,7 @@ print("PLL A frequency: {0}mhz".format(si5351.pll_a.frequency / 1000000))
41
40
  # configuration is susceptible to some jitter over time but can set a larger
42
41
  # range of frequencies.
43
42
  si5351.pll_b.configure_fractional(24, 2, 3) # Multiply 25mhz by 24.667 (24 2/3)
44
- print("PLL B frequency: {0}mhz".format(si5351.pll_b.frequency / 1000000))
43
+ print(f"PLL B frequency: {si5351.pll_b.frequency / 1000000}mhz")
45
44
 
46
45
  # Now configure the clock outputs. Each is driven by a PLL frequency as input
47
46
  # and then further divides that down to a specific frequency.
@@ -49,14 +48,14 @@ print("PLL B frequency: {0}mhz".format(si5351.pll_b.frequency / 1000000))
49
48
  # of 112.5mhz (900mhz / 8). Again this uses the most precise integer division
50
49
  # but can't set as wide a range of values.
51
50
  si5351.clock_0.configure_integer(si5351.pll_a, 8)
52
- print("Clock 0: {0}mhz".format(si5351.clock_0.frequency / 1000000))
51
+ print(f"Clock 0: {si5351.clock_0.frequency / 1000000}mhz")
53
52
 
54
53
  # Next configure clock 1 to be driven by PLL B divided by 45.5 to get
55
54
  # 13.5531mhz (616.6667mhz / 45.5). This uses fractional division and again
56
55
  # notice the numerator and denominator are explicitly specified. This is less
57
56
  # precise but allows a large range of frequencies.
58
57
  si5351.clock_1.configure_fractional(si5351.pll_b, 45, 1, 2) # Divide by 45.5 (45 1/2)
59
- print("Clock 1: {0}mhz".format(si5351.clock_1.frequency / 1000000))
58
+ print(f"Clock 1: {si5351.clock_1.frequency / 1000000}mhz")
60
59
 
61
60
  # Finally configure clock 2 to be driven by PLL B divided once by 900 to get
62
61
  # down to 685.15 khz and then further divided by a special R divider that
@@ -72,7 +71,7 @@ si5351.clock_2.configure_integer(si5351.pll_b, 900)
72
71
  # - R_DIV_64: divider of 64
73
72
  # - R_DIV_128: divider of 128
74
73
  si5351.clock_2.r_divider = adafruit_si5351.R_DIV_64
75
- print("Clock 2: {0}khz".format(si5351.clock_2.frequency / 1000))
74
+ print(f"Clock 2: {si5351.clock_2.frequency / 1000}khz")
76
75
 
77
76
  # After configuring PLLs and clocks, enable the outputs.
78
77
  si5351.outputs_enabled = True
@@ -12,7 +12,7 @@ requires = [
12
12
  [project]
13
13
  name = "adafruit-circuitpython-si5351"
14
14
  description = "CircuitPython library for SI5351 clock generator module."
15
- version = "1.4.6"
15
+ version = "1.4.7"
16
16
  readme = "README.rst"
17
17
  authors = [
18
18
  {name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
@@ -0,0 +1,106 @@
1
+ # SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ target-version = "py38"
6
+ line-length = 100
7
+
8
+ [lint]
9
+ preview = true
10
+ select = ["I", "PL", "UP"]
11
+
12
+ extend-select = [
13
+ "D419", # empty-docstring
14
+ "E501", # line-too-long
15
+ "W291", # trailing-whitespace
16
+ "PLC0414", # useless-import-alias
17
+ "PLC2401", # non-ascii-name
18
+ "PLC2801", # unnecessary-dunder-call
19
+ "PLC3002", # unnecessary-direct-lambda-call
20
+ "E999", # syntax-error
21
+ "PLE0101", # return-in-init
22
+ "F706", # return-outside-function
23
+ "F704", # yield-outside-function
24
+ "PLE0116", # continue-in-finally
25
+ "PLE0117", # nonlocal-without-binding
26
+ "PLE0241", # duplicate-bases
27
+ "PLE0302", # unexpected-special-method-signature
28
+ "PLE0604", # invalid-all-object
29
+ "PLE0605", # invalid-all-format
30
+ "PLE0643", # potential-index-error
31
+ "PLE0704", # misplaced-bare-raise
32
+ "PLE1141", # dict-iter-missing-items
33
+ "PLE1142", # await-outside-async
34
+ "PLE1205", # logging-too-many-args
35
+ "PLE1206", # logging-too-few-args
36
+ "PLE1307", # bad-string-format-type
37
+ "PLE1310", # bad-str-strip-call
38
+ "PLE1507", # invalid-envvar-value
39
+ "PLE2502", # bidirectional-unicode
40
+ "PLE2510", # invalid-character-backspace
41
+ "PLE2512", # invalid-character-sub
42
+ "PLE2513", # invalid-character-esc
43
+ "PLE2514", # invalid-character-nul
44
+ "PLE2515", # invalid-character-zero-width-space
45
+ "PLR0124", # comparison-with-itself
46
+ "PLR0202", # no-classmethod-decorator
47
+ "PLR0203", # no-staticmethod-decorator
48
+ "UP004", # useless-object-inheritance
49
+ "PLR0206", # property-with-parameters
50
+ "PLR0904", # too-many-public-methods
51
+ "PLR0911", # too-many-return-statements
52
+ "PLR0912", # too-many-branches
53
+ "PLR0913", # too-many-arguments
54
+ "PLR0914", # too-many-locals
55
+ "PLR0915", # too-many-statements
56
+ "PLR0916", # too-many-boolean-expressions
57
+ "PLR1702", # too-many-nested-blocks
58
+ "PLR1704", # redefined-argument-from-local
59
+ "PLR1711", # useless-return
60
+ "C416", # unnecessary-comprehension
61
+ "PLR1733", # unnecessary-dict-index-lookup
62
+ "PLR1736", # unnecessary-list-index-lookup
63
+
64
+ # ruff reports this rule is unstable
65
+ #"PLR6301", # no-self-use
66
+
67
+ "PLW0108", # unnecessary-lambda
68
+ "PLW0120", # useless-else-on-loop
69
+ "PLW0127", # self-assigning-variable
70
+ "PLW0129", # assert-on-string-literal
71
+ "B033", # duplicate-value
72
+ "PLW0131", # named-expr-without-context
73
+ "PLW0245", # super-without-brackets
74
+ "PLW0406", # import-self
75
+ "PLW0602", # global-variable-not-assigned
76
+ "PLW0603", # global-statement
77
+ "PLW0604", # global-at-module-level
78
+
79
+ # fails on the try: import typing used by libraries
80
+ #"F401", # unused-import
81
+
82
+ "F841", # unused-variable
83
+ "E722", # bare-except
84
+ "PLW0711", # binary-op-exception
85
+ "PLW1501", # bad-open-mode
86
+ "PLW1508", # invalid-envvar-default
87
+ "PLW1509", # subprocess-popen-preexec-fn
88
+ "PLW2101", # useless-with-lock
89
+ "PLW3301", # nested-min-max
90
+ ]
91
+
92
+ ignore = [
93
+ "PLR2004", # magic-value-comparison
94
+ "UP030", # format literals
95
+ "PLW1514", # unspecified-encoding
96
+ "PLR0913", # too-many-arguments
97
+ "PLR0915", # too-many-statements
98
+ "PLR0917", # too-many-positional-arguments
99
+ "PLR0904", # too-many-public-methods
100
+ "PLR0912", # too-many-branches
101
+ "PLR0916", # too-many-boolean-expressions
102
+ "PLR6301", # could-be-static no-self-use
103
+ ]
104
+
105
+ [format]
106
+ line-ending = "lf"
@@ -1,42 +0,0 @@
1
- # SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2
- #
3
- # SPDX-License-Identifier: Unlicense
4
-
5
- repos:
6
- - repo: https://github.com/python/black
7
- rev: 23.3.0
8
- hooks:
9
- - id: black
10
- - repo: https://github.com/fsfe/reuse-tool
11
- rev: v1.1.2
12
- hooks:
13
- - id: reuse
14
- - repo: https://github.com/pre-commit/pre-commit-hooks
15
- rev: v4.4.0
16
- hooks:
17
- - id: check-yaml
18
- - id: end-of-file-fixer
19
- - id: trailing-whitespace
20
- - repo: https://github.com/pycqa/pylint
21
- rev: v2.17.4
22
- hooks:
23
- - id: pylint
24
- name: pylint (library code)
25
- types: [python]
26
- args:
27
- - --disable=consider-using-f-string
28
- exclude: "^(docs/|examples/|tests/|setup.py$)"
29
- - id: pylint
30
- name: pylint (example code)
31
- description: Run pylint rules on "examples/*.py" files
32
- types: [python]
33
- files: "^examples/"
34
- args:
35
- - --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
36
- - id: pylint
37
- name: pylint (test code)
38
- description: Run pylint rules on "tests/*.py" files
39
- types: [python]
40
- files: "^tests/"
41
- args:
42
- - --disable=missing-docstring,consider-using-f-string,duplicate-code
@@ -1,399 +0,0 @@
1
- # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2
- #
3
- # SPDX-License-Identifier: Unlicense
4
-
5
- [MASTER]
6
-
7
- # A comma-separated list of package or module names from where C extensions may
8
- # be loaded. Extensions are loading into the active Python interpreter and may
9
- # run arbitrary code
10
- extension-pkg-whitelist=
11
-
12
- # Add files or directories to the ignore-list. They should be base names, not
13
- # paths.
14
- ignore=CVS
15
-
16
- # Add files or directories matching the regex patterns to the ignore-list. The
17
- # regex matches against base names, not paths.
18
- ignore-patterns=
19
-
20
- # Python code to execute, usually for sys.path manipulation such as
21
- # pygtk.require().
22
- #init-hook=
23
-
24
- # Use multiple processes to speed up Pylint.
25
- jobs=1
26
-
27
- # List of plugins (as comma separated values of python modules names) to load,
28
- # usually to register additional checkers.
29
- load-plugins=pylint.extensions.no_self_use
30
-
31
- # Pickle collected data for later comparisons.
32
- persistent=yes
33
-
34
- # Specify a configuration file.
35
- #rcfile=
36
-
37
- # Allow loading of arbitrary C extensions. Extensions are imported into the
38
- # active Python interpreter and may run arbitrary code.
39
- unsafe-load-any-extension=no
40
-
41
-
42
- [MESSAGES CONTROL]
43
-
44
- # Only show warnings with the listed confidence levels. Leave empty to show
45
- # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
46
- confidence=
47
-
48
- # Disable the message, report, category or checker with the given id(s). You
49
- # can either give multiple identifiers separated by comma (,) or put this
50
- # option multiple times (only on the command line, not in the configuration
51
- # file where it should appear only once).You can also use "--disable=all" to
52
- # disable everything first and then reenable specific checks. For example, if
53
- # you want to run only the similarities checker, you can use "--disable=all
54
- # --enable=similarities". If you want to run only the classes checker, but have
55
- # no Warning level messages displayed, use"--disable=all --enable=classes
56
- # --disable=W"
57
- # disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
58
- disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding
59
-
60
- # Enable the message, report, category or checker with the given id(s). You can
61
- # either give multiple identifier separated by comma (,) or put this option
62
- # multiple time (only on the command line, not in the configuration file where
63
- # it should appear only once). See also the "--disable" option for examples.
64
- enable=
65
-
66
-
67
- [REPORTS]
68
-
69
- # Python expression which should return a note less than 10 (10 is the highest
70
- # note). You have access to the variables errors warning, statement which
71
- # respectively contain the number of errors / warnings messages and the total
72
- # number of statements analyzed. This is used by the global evaluation report
73
- # (RP0004).
74
- evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
75
-
76
- # Template used to display messages. This is a python new-style format string
77
- # used to format the message information. See doc for all details
78
- #msg-template=
79
-
80
- # Set the output format. Available formats are text, parseable, colorized, json
81
- # and msvs (visual studio).You can also give a reporter class, eg
82
- # mypackage.mymodule.MyReporterClass.
83
- output-format=text
84
-
85
- # Tells whether to display a full report or only the messages
86
- reports=no
87
-
88
- # Activate the evaluation score.
89
- score=yes
90
-
91
-
92
- [REFACTORING]
93
-
94
- # Maximum number of nested blocks for function / method body
95
- max-nested-blocks=5
96
-
97
-
98
- [LOGGING]
99
-
100
- # Logging modules to check that the string format arguments are in logging
101
- # function parameter format
102
- logging-modules=logging
103
-
104
-
105
- [SPELLING]
106
-
107
- # Spelling dictionary name. Available dictionaries: none. To make it working
108
- # install python-enchant package.
109
- spelling-dict=
110
-
111
- # List of comma separated words that should not be checked.
112
- spelling-ignore-words=
113
-
114
- # A path to a file that contains private dictionary; one word per line.
115
- spelling-private-dict-file=
116
-
117
- # Tells whether to store unknown words to indicated private dictionary in
118
- # --spelling-private-dict-file option instead of raising a message.
119
- spelling-store-unknown-words=no
120
-
121
-
122
- [MISCELLANEOUS]
123
-
124
- # List of note tags to take in consideration, separated by a comma.
125
- # notes=FIXME,XXX,TODO
126
- notes=FIXME,XXX
127
-
128
-
129
- [TYPECHECK]
130
-
131
- # List of decorators that produce context managers, such as
132
- # contextlib.contextmanager. Add to this list to register other decorators that
133
- # produce valid context managers.
134
- contextmanager-decorators=contextlib.contextmanager
135
-
136
- # List of members which are set dynamically and missed by pylint inference
137
- # system, and so shouldn't trigger E1101 when accessed. Python regular
138
- # expressions are accepted.
139
- generated-members=
140
-
141
- # Tells whether missing members accessed in mixin class should be ignored. A
142
- # mixin class is detected if its name ends with "mixin" (case insensitive).
143
- ignore-mixin-members=yes
144
-
145
- # This flag controls whether pylint should warn about no-member and similar
146
- # checks whenever an opaque object is returned when inferring. The inference
147
- # can return multiple potential results while evaluating a Python object, but
148
- # some branches might not be evaluated, which results in partial inference. In
149
- # that case, it might be useful to still emit no-member and other checks for
150
- # the rest of the inferred objects.
151
- ignore-on-opaque-inference=yes
152
-
153
- # List of class names for which member attributes should not be checked (useful
154
- # for classes with dynamically set attributes). This supports the use of
155
- # qualified names.
156
- ignored-classes=optparse.Values,thread._local,_thread._local
157
-
158
- # List of module names for which member attributes should not be checked
159
- # (useful for modules/projects where namespaces are manipulated during runtime
160
- # and thus existing member attributes cannot be deduced by static analysis. It
161
- # supports qualified module names, as well as Unix pattern matching.
162
- ignored-modules=board
163
-
164
- # Show a hint with possible names when a member name was not found. The aspect
165
- # of finding the hint is based on edit distance.
166
- missing-member-hint=yes
167
-
168
- # The minimum edit distance a name should have in order to be considered a
169
- # similar match for a missing member name.
170
- missing-member-hint-distance=1
171
-
172
- # The total number of similar names that should be taken in consideration when
173
- # showing a hint for a missing member.
174
- missing-member-max-choices=1
175
-
176
-
177
- [VARIABLES]
178
-
179
- # List of additional names supposed to be defined in builtins. Remember that
180
- # you should avoid to define new builtins when possible.
181
- additional-builtins=
182
-
183
- # Tells whether unused global variables should be treated as a violation.
184
- allow-global-unused-variables=yes
185
-
186
- # List of strings which can identify a callback function by name. A callback
187
- # name must start or end with one of those strings.
188
- callbacks=cb_,_cb
189
-
190
- # A regular expression matching the name of dummy variables (i.e. expectedly
191
- # not used).
192
- dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
193
-
194
- # Argument names that match this expression will be ignored. Default to name
195
- # with leading underscore
196
- ignored-argument-names=_.*|^ignored_|^unused_
197
-
198
- # Tells whether we should check for unused import in __init__ files.
199
- init-import=no
200
-
201
- # List of qualified module names which can have objects that can redefine
202
- # builtins.
203
- redefining-builtins-modules=six.moves,future.builtins
204
-
205
-
206
- [FORMAT]
207
-
208
- # Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
209
- # expected-line-ending-format=
210
- expected-line-ending-format=LF
211
-
212
- # Regexp for a line that is allowed to be longer than the limit.
213
- ignore-long-lines=^\s*(# )?<?https?://\S+>?$
214
-
215
- # Number of spaces of indent required inside a hanging or continued line.
216
- indent-after-paren=4
217
-
218
- # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
219
- # tab).
220
- indent-string=' '
221
-
222
- # Maximum number of characters on a single line.
223
- max-line-length=100
224
-
225
- # Maximum number of lines in a module
226
- max-module-lines=1000
227
-
228
- # Allow the body of a class to be on the same line as the declaration if body
229
- # contains single statement.
230
- single-line-class-stmt=no
231
-
232
- # Allow the body of an if to be on the same line as the test if there is no
233
- # else.
234
- single-line-if-stmt=no
235
-
236
-
237
- [SIMILARITIES]
238
-
239
- # Ignore comments when computing similarities.
240
- ignore-comments=yes
241
-
242
- # Ignore docstrings when computing similarities.
243
- ignore-docstrings=yes
244
-
245
- # Ignore imports when computing similarities.
246
- ignore-imports=yes
247
-
248
- # Minimum lines number of a similarity.
249
- min-similarity-lines=12
250
-
251
-
252
- [BASIC]
253
-
254
- # Regular expression matching correct argument names
255
- argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
256
-
257
- # Regular expression matching correct attribute names
258
- attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
259
-
260
- # Bad variable names which should always be refused, separated by a comma
261
- bad-names=foo,bar,baz,toto,tutu,tata
262
-
263
- # Regular expression matching correct class attribute names
264
- class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
265
-
266
- # Regular expression matching correct class names
267
- # class-rgx=[A-Z_][a-zA-Z0-9]+$
268
- class-rgx=[A-Z_][a-zA-Z0-9_]+$
269
-
270
- # Regular expression matching correct constant names
271
- const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
272
-
273
- # Minimum line length for functions/classes that require docstrings, shorter
274
- # ones are exempt.
275
- docstring-min-length=-1
276
-
277
- # Regular expression matching correct function names
278
- function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
279
-
280
- # Good variable names which should always be accepted, separated by a comma
281
- # good-names=i,j,k,ex,Run,_
282
- good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
283
-
284
- # Include a hint for the correct naming format with invalid-name
285
- include-naming-hint=no
286
-
287
- # Regular expression matching correct inline iteration names
288
- inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
289
-
290
- # Regular expression matching correct method names
291
- method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
292
-
293
- # Regular expression matching correct module names
294
- module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
295
-
296
- # Colon-delimited sets of names that determine each other's naming style when
297
- # the name regexes allow several styles.
298
- name-group=
299
-
300
- # Regular expression which should only match function or class names that do
301
- # not require a docstring.
302
- no-docstring-rgx=^_
303
-
304
- # List of decorators that produce properties, such as abc.abstractproperty. Add
305
- # to this list to register other decorators that produce valid properties.
306
- property-classes=abc.abstractproperty
307
-
308
- # Regular expression matching correct variable names
309
- variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
310
-
311
-
312
- [IMPORTS]
313
-
314
- # Allow wildcard imports from modules that define __all__.
315
- allow-wildcard-with-all=no
316
-
317
- # Analyse import fallback blocks. This can be used to support both Python 2 and
318
- # 3 compatible code, which means that the block might have code that exists
319
- # only in one or another interpreter, leading to false positives when analysed.
320
- analyse-fallback-blocks=no
321
-
322
- # Deprecated modules which should not be used, separated by a comma
323
- deprecated-modules=optparse,tkinter.tix
324
-
325
- # Create a graph of external dependencies in the given file (report RP0402 must
326
- # not be disabled)
327
- ext-import-graph=
328
-
329
- # Create a graph of every (i.e. internal and external) dependencies in the
330
- # given file (report RP0402 must not be disabled)
331
- import-graph=
332
-
333
- # Create a graph of internal dependencies in the given file (report RP0402 must
334
- # not be disabled)
335
- int-import-graph=
336
-
337
- # Force import order to recognize a module as part of the standard
338
- # compatibility libraries.
339
- known-standard-library=
340
-
341
- # Force import order to recognize a module as part of a third party library.
342
- known-third-party=enchant
343
-
344
-
345
- [CLASSES]
346
-
347
- # List of method names used to declare (i.e. assign) instance attributes.
348
- defining-attr-methods=__init__,__new__,setUp
349
-
350
- # List of member names, which should be excluded from the protected access
351
- # warning.
352
- exclude-protected=_asdict,_fields,_replace,_source,_make
353
-
354
- # List of valid names for the first argument in a class method.
355
- valid-classmethod-first-arg=cls
356
-
357
- # List of valid names for the first argument in a metaclass class method.
358
- valid-metaclass-classmethod-first-arg=mcs
359
-
360
-
361
- [DESIGN]
362
-
363
- # Maximum number of arguments for function / method
364
- max-args=5
365
-
366
- # Maximum number of attributes for a class (see R0902).
367
- # max-attributes=7
368
- max-attributes=11
369
-
370
- # Maximum number of boolean expressions in a if statement
371
- max-bool-expr=5
372
-
373
- # Maximum number of branch for function / method body
374
- max-branches=12
375
-
376
- # Maximum number of locals for function / method body
377
- max-locals=15
378
-
379
- # Maximum number of parents for a class (see R0901).
380
- max-parents=7
381
-
382
- # Maximum number of public methods for a class (see R0904).
383
- max-public-methods=20
384
-
385
- # Maximum number of return / yield for function / method body
386
- max-returns=6
387
-
388
- # Maximum number of statements in function / method body
389
- max-statements=50
390
-
391
- # Minimum number of public methods for a class (see R0903).
392
- min-public-methods=1
393
-
394
-
395
- [EXCEPTIONS]
396
-
397
- # Exceptions that will emit a warning when being caught. Defaults to
398
- # "Exception"
399
- overgeneral-exceptions=builtins.Exception
@@ -1,5 +0,0 @@
1
-
2
- .. If you created a package, create one automodule per module in the package.
3
-
4
- .. automodule:: adafruit_si5351
5
- :members: