wwvb 4.1.0a0__tar.gz → 5.0.0__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 (94) hide show
  1. wwvb-5.0.0/.coveragerc +15 -0
  2. wwvb-5.0.0/.github/workflows/codeql.yml +48 -0
  3. wwvb-5.0.0/.github/workflows/cron.yml +44 -0
  4. {wwvb-4.1.0a0 → wwvb-5.0.0}/.github/workflows/release.yml +10 -5
  5. {wwvb-4.1.0a0 → wwvb-5.0.0}/.github/workflows/test.yml +31 -13
  6. wwvb-5.0.0/.gitignore +16 -0
  7. {wwvb-4.1.0a0 → wwvb-5.0.0}/.pre-commit-config.yaml +5 -4
  8. wwvb-5.0.0/LICENSES/Apache-2.0.txt +73 -0
  9. wwvb-5.0.0/LICENSES/Unlicense.txt +22 -0
  10. wwvb-5.0.0/Makefile +71 -0
  11. wwvb-5.0.0/PKG-INFO +200 -0
  12. wwvb-5.0.0/README.md +174 -0
  13. wwvb-5.0.0/adafruit_datetime.pyi +416 -0
  14. {wwvb-4.1.0a0/docs → wwvb-5.0.0/doc}/conf.py +31 -18
  15. wwvb-5.0.0/doc/index.rst +31 -0
  16. {wwvb-4.1.0a0 → wwvb-5.0.0}/pyproject.toml +21 -15
  17. wwvb-5.0.0/requirements-dev.txt +25 -0
  18. wwvb-5.0.0/requirements.txt +11 -0
  19. wwvb-5.0.0/src/uwwvb.py +193 -0
  20. wwvb-5.0.0/src/wwvb/__init__.py +937 -0
  21. {wwvb-4.1.0a0/leapseconddata → wwvb-5.0.0/src/wwvb}/__version__.py +2 -2
  22. wwvb-5.0.0/src/wwvb/decode.py +93 -0
  23. wwvb-5.0.0/src/wwvb/dut1table.py +32 -0
  24. wwvb-5.0.0/src/wwvb/gen.py +127 -0
  25. wwvb-5.0.0/src/wwvb/iersdata.json +1 -0
  26. wwvb-5.0.0/src/wwvb/iersdata.json.license +2 -0
  27. wwvb-5.0.0/src/wwvb/iersdata.py +37 -0
  28. wwvb-5.0.0/src/wwvb/tz.py +12 -0
  29. wwvb-5.0.0/src/wwvb/updateiers.py +161 -0
  30. wwvb-5.0.0/src/wwvb/wwvbtk.py +146 -0
  31. wwvb-5.0.0/src/wwvb.egg-info/PKG-INFO +200 -0
  32. wwvb-5.0.0/src/wwvb.egg-info/SOURCES.txt +74 -0
  33. wwvb-5.0.0/src/wwvb.egg-info/entry_points.txt +8 -0
  34. wwvb-5.0.0/src/wwvb.egg-info/requires.txt +8 -0
  35. wwvb-5.0.0/src/wwvb.egg-info/top_level.txt +2 -0
  36. wwvb-5.0.0/test/testcli.py +291 -0
  37. wwvb-5.0.0/test/testdaylight.py +60 -0
  38. wwvb-5.0.0/test/testls.py +62 -0
  39. wwvb-5.0.0/test/testpm.py +33 -0
  40. wwvb-5.0.0/test/testuwwvb.py +221 -0
  41. wwvb-5.0.0/test/testwwvb.py +400 -0
  42. wwvb-5.0.0/test/wwvbgen_testcases/1998leapsecond +12 -0
  43. wwvb-5.0.0/test/wwvbgen_testcases/2012leapsecond +8 -0
  44. wwvb-5.0.0/test/wwvbgen_testcases/all-headers +33 -0
  45. wwvb-5.0.0/test/wwvbgen_testcases/bar +15 -0
  46. wwvb-5.0.0/test/wwvbgen_testcases/both +34 -0
  47. wwvb-5.0.0/test/wwvbgen_testcases/cradek +15 -0
  48. wwvb-5.0.0/test/wwvbgen_testcases/duration +15 -0
  49. wwvb-5.0.0/test/wwvbgen_testcases/enddst-phase +15 -0
  50. wwvb-5.0.0/test/wwvbgen_testcases/enddst-phase-2 +15 -0
  51. wwvb-5.0.0/test/wwvbgen_testcases/endleapyear +9 -0
  52. wwvb-5.0.0/test/wwvbgen_testcases/leapday1 +8 -0
  53. wwvb-5.0.0/test/wwvbgen_testcases/leapday28 +8 -0
  54. wwvb-5.0.0/test/wwvbgen_testcases/leapday29 +8 -0
  55. wwvb-5.0.0/test/wwvbgen_testcases/negleapsecond +12 -0
  56. wwvb-5.0.0/test/wwvbgen_testcases/nextdst +10 -0
  57. wwvb-5.0.0/test/wwvbgen_testcases/nextst +10 -0
  58. wwvb-5.0.0/test/wwvbgen_testcases/nonleapday1 +8 -0
  59. wwvb-5.0.0/test/wwvbgen_testcases/nonleapday28 +8 -0
  60. wwvb-5.0.0/test/wwvbgen_testcases/phase +15 -0
  61. wwvb-5.0.0/test/wwvbgen_testcases/startdst +10 -0
  62. wwvb-5.0.0/test/wwvbgen_testcases/startdst-phase +15 -0
  63. wwvb-5.0.0/test/wwvbgen_testcases/startdst-phase-2 +15 -0
  64. wwvb-5.0.0/test/wwvbgen_testcases/startleapyear +9 -0
  65. wwvb-5.0.0/test/wwvbgen_testcases/startst +10 -0
  66. wwvb-5.0.0/test/wwvbgen_testcases/y2k +15 -0
  67. wwvb-5.0.0/test/wwvbgen_testcases/y2k-1 +15 -0
  68. wwvb-5.0.0/test/wwvbgen_testcases/y2k1 +11 -0
  69. wwvb-5.0.0/test/wwvbgen_testcases/y2k1-1 +11 -0
  70. wwvb-4.1.0a0/.coveragerc +0 -7
  71. wwvb-4.1.0a0/.gitignore +0 -14
  72. wwvb-4.1.0a0/.pylintrc +0 -9
  73. wwvb-4.1.0a0/.readthedocs.yaml +0 -17
  74. wwvb-4.1.0a0/LICENSES/Unlicense.txt +0 -10
  75. wwvb-4.1.0a0/Makefile +0 -47
  76. wwvb-4.1.0a0/PKG-INFO +0 -60
  77. wwvb-4.1.0a0/README.md +0 -41
  78. wwvb-4.1.0a0/docs/index.rst +0 -22
  79. wwvb-4.1.0a0/leapseconddata/__init__.py +0 -342
  80. wwvb-4.1.0a0/leapseconddata/__main__.py +0 -169
  81. wwvb-4.1.0a0/requirements-dev.txt +0 -14
  82. wwvb-4.1.0a0/testleapseconddata.py +0 -124
  83. wwvb-4.1.0a0/wwvb.egg-info/PKG-INFO +0 -60
  84. wwvb-4.1.0a0/wwvb.egg-info/SOURCES.txt +0 -29
  85. wwvb-4.1.0a0/wwvb.egg-info/entry_points.txt +0 -2
  86. wwvb-4.1.0a0/wwvb.egg-info/requires.txt +0 -1
  87. wwvb-4.1.0a0/wwvb.egg-info/top_level.txt +0 -1
  88. {wwvb-4.1.0a0 → wwvb-5.0.0}/LICENSES/CC0-1.0.txt +0 -0
  89. {wwvb-4.1.0a0 → wwvb-5.0.0}/LICENSES/GPL-3.0-only.txt +0 -0
  90. {wwvb-4.1.0a0 → wwvb-5.0.0}/codecov.yml +0 -0
  91. {wwvb-4.1.0a0/docs → wwvb-5.0.0/doc}/_static/.empty +0 -0
  92. {wwvb-4.1.0a0 → wwvb-5.0.0}/setup.cfg +0 -0
  93. {wwvb-4.1.0a0/leapseconddata → wwvb-5.0.0/src/wwvb}/py.typed +0 -0
  94. {wwvb-4.1.0a0 → wwvb-5.0.0/src}/wwvb.egg-info/dependency_links.txt +0 -0
wwvb-5.0.0/.coveragerc ADDED
@@ -0,0 +1,15 @@
1
+ # SPDX-FileCopyrightText: 2021-2024 Jeff Epler
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-only
4
+ [report]
5
+ exclude_also =
6
+ def __repr__
7
+ if self.debug:
8
+ if settings.DEBUG
9
+ raise AssertionError
10
+ raise NotImplementedError
11
+ if 0:
12
+ if __name__ == .__main__.:
13
+ if TYPE_CHECKING:
14
+ class .*\bProtocol\):
15
+ @(abc\.)?abstractmethod
@@ -0,0 +1,48 @@
1
+ # SPDX-FileCopyrightText: 2022-2024 Jeff Epler
2
+ #
3
+ # SPDX-License-Identifier: CC0-1.0
4
+
5
+ name: "CodeQL"
6
+
7
+ on:
8
+ push:
9
+ branches: [ "main" ]
10
+ pull_request:
11
+ branches: [ "main" ]
12
+ schedule:
13
+ - cron: "53 3 * * 5"
14
+
15
+ jobs:
16
+ analyze:
17
+ name: Analyze
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ actions: read
21
+ contents: read
22
+ security-events: write
23
+
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ language: [ python ]
28
+
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Install Dependencies (python)
34
+ run: pip3 install -r requirements-dev.txt
35
+
36
+ - name: Initialize CodeQL
37
+ uses: github/codeql-action/init@v3
38
+ with:
39
+ languages: ${{ matrix.language }}
40
+ queries: +security-and-quality
41
+
42
+ - name: Autobuild
43
+ uses: github/codeql-action/autobuild@v3
44
+
45
+ - name: Perform CodeQL Analysis
46
+ uses: github/codeql-action/analyze@v3
47
+ with:
48
+ category: "/language:${{ matrix.language }}"
@@ -0,0 +1,44 @@
1
+ # SPDX-FileCopyrightText: 2021-2024 Jeff Epler
2
+ #
3
+ # SPDX-License-Identifier: CC0-1.0
4
+
5
+ name: Update DUT1 data
6
+
7
+ on:
8
+ schedule:
9
+ - cron: '0 10 2 * *'
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ update-dut1:
14
+ runs-on: ubuntu-20.04
15
+ if: startswith(github.repository, 'jepler/')
16
+ steps:
17
+
18
+ - name: Dump GitHub context
19
+ env:
20
+ GITHUB_CONTEXT: ${{ toJson(github) }}
21
+ run: echo "$GITHUB_CONTEXT"
22
+
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python 3.10
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.10"
29
+
30
+ - name: Install dependencies
31
+ run: pip install -e .
32
+
33
+ - name: Update DUT1 data
34
+ run: python -m wwvb.updateiers --dist
35
+
36
+ - name: Test
37
+ run: python -munittest
38
+
39
+ - name: Commit updates
40
+ run: |
41
+ git config user.name "${GITHUB_ACTOR} (github actions cron)"
42
+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
43
+ git remote set-url --push origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
44
+ if git commit -m"update iersdata" src/wwvb/iersdata.json; then git push origin HEAD:main; fi
@@ -1,8 +1,8 @@
1
- # SPDX-FileCopyrightText: 2021 Jeff Epler
1
+ # SPDX-FileCopyrightText: 2021-2024 Jeff Epler
2
2
  #
3
3
  # SPDX-License-Identifier: CC0-1.0
4
4
 
5
- name: Release leapseconddata
5
+ name: Release wwvbgen
6
6
 
7
7
  on:
8
8
  release:
@@ -11,7 +11,7 @@ on:
11
11
  jobs:
12
12
  release:
13
13
 
14
- runs-on: ubuntu-latest
14
+ runs-on: ubuntu-20.04
15
15
  steps:
16
16
  - name: Dump GitHub context
17
17
  env:
@@ -23,10 +23,15 @@ jobs:
23
23
  - name: Set up Python
24
24
  uses: actions/setup-python@v5
25
25
  with:
26
- python-version: "3.x"
26
+ python-version: 3.9
27
27
 
28
28
  - name: Install deps
29
- run: python -mpip install -r requirements-dev.txt
29
+ run: |
30
+ python -mpip install wheel
31
+ python -mpip install -r requirements-dev.txt
32
+
33
+ - name: Test
34
+ run: make coverage
30
35
 
31
36
  - name: Build release
32
37
  run: python -mbuild
@@ -1,8 +1,8 @@
1
- # SPDX-FileCopyrightText: 2021 Jeff Epler
1
+ # SPDX-FileCopyrightText: 2021-2024 Jeff Epler
2
2
  #
3
3
  # SPDX-License-Identifier: CC0-1.0
4
4
 
5
- name: Test leapseconddata
5
+ name: Test wwvbgen
6
6
 
7
7
  on:
8
8
  push:
@@ -19,7 +19,7 @@ jobs:
19
19
  - name: Set up Python
20
20
  uses: actions/setup-python@v5
21
21
  with:
22
- python-version: '3.10'
22
+ python-version: '3.12'
23
23
 
24
24
  - uses: actions/checkout@v4
25
25
 
@@ -31,6 +31,7 @@ jobs:
31
31
 
32
32
  test:
33
33
  strategy:
34
+ fail-fast: false
34
35
  matrix:
35
36
  python-version:
36
37
  - '3.9'
@@ -38,7 +39,6 @@ jobs:
38
39
  - '3.11'
39
40
  - '3.12'
40
41
  - '3.13.0-alpha.0 - 3.13'
41
- - 'pypy-3.9'
42
42
  os-version:
43
43
  - 'ubuntu-latest'
44
44
  include:
@@ -46,9 +46,8 @@ jobs:
46
46
  python-version: '3.x'
47
47
  - os-version: 'windows-latest'
48
48
  python-version: '3.x'
49
-
50
- env:
51
- PYTHON: ${{ matrix.python-version }}
49
+ - os-version: 'ubuntu-latest'
50
+ python-version: 'pypy-3.10'
52
51
 
53
52
  runs-on: ${{ matrix.os-version }}
54
53
  steps:
@@ -60,17 +59,36 @@ jobs:
60
59
  python-version: ${{ matrix.python-version }}
61
60
 
62
61
  - name: Install deps
63
- run: python -mpip install -r requirements-dev.txt
62
+ run: |
63
+ python -mpip install wheel
64
+ python -mpip install -r requirements-dev.txt
64
65
 
65
66
  - name: Check stubs
66
- if: (startsWith(matrix.python-version, '3.12') && startswith(matrix.os-version, 'ubuntu-'))
67
- run: make mypy
67
+ if: (! startsWith(matrix.python-version, 'pypy-'))
68
+ run: make mypy PYTHON=python
69
+
70
+ - name: Coverage
71
+ run: make coverage PYTHON=python
68
72
 
69
- - name: Test
70
- run: python -mcoverage run --branch -m unittest testleapseconddata.py && python -mcoverage report --fail-under=100 && python -mcoverage xml
73
+ - name: Test installed version
74
+ run: make test_venv PYTHON=python
75
+
76
+ - name: Upload Coverage as artifact
77
+ if: always()
78
+ uses: actions/upload-artifact@v4
79
+ with:
80
+ name: coverage for ${{ matrix.python-version }} on ${{ matrix.os-version }}
81
+ path: coverage.xml
71
82
 
72
83
  pre-commit:
73
84
  runs-on: ubuntu-latest
74
85
  steps:
75
86
  - uses: actions/checkout@v4
76
- - uses: pre-commit/action@v3.0.1
87
+
88
+ - name: Set up Python
89
+ uses: actions/setup-python@v5
90
+ with:
91
+ python-version: '3.x'
92
+
93
+ - name: pre-commit
94
+ run: pip install pre-commit && pre-commit run --all
wwvb-5.0.0/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ # SPDX-FileCopyrightText: 2021-2024 Jeff Epler
2
+ #
3
+ # SPDX-License-Identifier: CC0-1.0
4
+
5
+ *,cover
6
+ *.egg-info
7
+ /.coverage*
8
+ /.reuse
9
+ /build
10
+ /_build
11
+ /coverage.xml
12
+ /dist
13
+ /finals2000A.all.csv
14
+ /htmlcov
15
+ /src/wwvb/__version__.py
16
+ __pycache__
@@ -1,4 +1,5 @@
1
1
  # SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2
+ # SPDX-FileCopyrightText: 2020-2024 Jeff Epler
2
3
  #
3
4
  # SPDX-License-Identifier: Unlicense
4
5
 
@@ -7,20 +8,20 @@ default_language_version:
7
8
 
8
9
  repos:
9
10
  - repo: https://github.com/pre-commit/pre-commit-hooks
10
- rev: v4.6.0
11
+ rev: v5.0.0
11
12
  hooks:
12
13
  - id: check-yaml
13
14
  - id: end-of-file-fixer
14
15
  exclude: tests
15
16
  - id: trailing-whitespace
16
- exclude: tests
17
+ exclude: test/wwvbgen_testcases
17
18
  - repo: https://github.com/fsfe/reuse-tool
18
- rev: v3.0.2
19
+ rev: v4.0.3
19
20
  hooks:
20
21
  - id: reuse
21
22
  - repo: https://github.com/astral-sh/ruff-pre-commit
22
23
  # Ruff version.
23
- rev: v0.4.3
24
+ rev: v0.6.9
24
25
  hooks:
25
26
  # Run the linter.
26
27
  - id: ruff
@@ -0,0 +1,73 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
@@ -0,0 +1,22 @@
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
11
+ successors. We intend this dedication to be an overt act of relinquishment
12
+ in perpetuity of all present and future rights to this software under copyright
13
+ law.
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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
18
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
20
+ THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ For more information, please refer to <http://unlicense.org/>
wwvb-5.0.0/Makefile ADDED
@@ -0,0 +1,71 @@
1
+ ifeq ("$(origin V)", "command line")
2
+ BUILD_VERBOSE=$(V)
3
+ endif
4
+ ifndef BUILD_VERBOSE
5
+ $(info Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.)
6
+ BUILD_VERBOSE = 0
7
+ endif
8
+ ifeq ($(BUILD_VERBOSE),0)
9
+ Q = @
10
+ STEPECHO = @:
11
+ else ifeq ($(BUILD_VERBOSE),1)
12
+ Q = @
13
+ STEPECHO = @echo
14
+ else
15
+ Q =
16
+ STEPECHO = @echo
17
+ endif
18
+
19
+ PYTHON ?= python3
20
+ ifeq ($(OS),Windows_NT)
21
+ ENVPYTHON ?= _env/Scripts/python.exe
22
+ else
23
+ ENVPYTHON ?= _env/bin/python3
24
+ endif
25
+
26
+ .PHONY: default
27
+ default: coverage mypy
28
+
29
+ COVERAGE_INCLUDE=--include "src/**/*.py"
30
+ .PHONY: coverage
31
+ coverage:
32
+ $(Q)$(PYTHON) -mcoverage erase
33
+ $(Q)env PYTHONPATH=src $(PYTHON) -mcoverage run --branch -p -m unittest discover -s test
34
+ $(Q)$(PYTHON) -mcoverage combine -q
35
+ $(Q)$(PYTHON) -mcoverage html $(COVERAGE_INCLUDE)
36
+ $(Q)$(PYTHON) -mcoverage xml $(COVERAGE_INCLUDE)
37
+ $(Q)$(PYTHON) -mcoverage report --fail-under=100 $(COVERAGE_INCLUDE)
38
+
39
+ .PHONY: test_venv
40
+ test_venv:
41
+ $(Q)$(PYTHON) -mvenv --clear _env
42
+ $(Q)$(ENVPYTHON) -mpip install .
43
+ $(Q)$(ENVPYTHON) -m unittest discover -s test
44
+
45
+ .PHONY: mypy
46
+ mypy:
47
+ $(Q)mypy --strict --no-warn-unused-ignores src
48
+
49
+ .PHONY: update
50
+ update:
51
+ $(Q)env PYTHONPATH=src $(PYTHON) -mwwvb.updateiers --dist
52
+
53
+ # Minimal makefile for Sphinx documentation
54
+ #
55
+
56
+ # You can set these variables from the command line, and also
57
+ # from the environment for the first two.
58
+ SPHINXOPTS ?= -a -E -j auto
59
+ SPHINXBUILD ?= sphinx-build
60
+ SOURCEDIR = doc
61
+ BUILDDIR = _build
62
+
63
+ # Route particular targets to Sphinx using the new
64
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
65
+ .PHONY: html
66
+ html:
67
+ $(Q)$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
68
+
69
+ # SPDX-FileCopyrightText: 2024 Jeff Epler
70
+ #
71
+ # SPDX-License-Identifier: GPL-3.0-only
wwvb-5.0.0/PKG-INFO ADDED
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.1
2
+ Name: wwvb
3
+ Version: 5.0.0
4
+ Summary: Generate WWVB timecodes for any desired time
5
+ Author-email: Jeff Epler <jepler@gmail.com>
6
+ Project-URL: Source, https://github.com/jepler/wwvbpy
7
+ Project-URL: Documentation, https://github.com/jepler/wwvbpy
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
13
+ Classifier: Programming Language :: Python :: Implementation :: CPython
14
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: adafruit-circuitpython-datetime
19
+ Requires-Dist: beautifulsoup4
20
+ Requires-Dist: click
21
+ Requires-Dist: leapseconddata
22
+ Requires-Dist: platformdirs
23
+ Requires-Dist: python-dateutil
24
+ Requires-Dist: requests
25
+ Requires-Dist: tzdata
26
+
27
+ <!--
28
+ SPDX-FileCopyrightText: 2021-2024 Jeff Epler
29
+
30
+ SPDX-License-Identifier: GPL-3.0-only
31
+ -->
32
+ [![Test wwvbgen](https://github.com/jepler/wwvbpy/actions/workflows/test.yml/badge.svg)](https://github.com/jepler/wwvbpy/actions/workflows/test.yml)
33
+ [![codecov](https://codecov.io/gh/jepler/wwvbpy/branch/main/graph/badge.svg?token=Exx0c3Gp65)](https://codecov.io/gh/jepler/wwvbpy)
34
+ [![Update DUT1 data](https://github.com/jepler/wwvbpy/actions/workflows/cron.yml/badge.svg)](https://github.com/jepler/wwvbpy/actions/workflows/cron.yml)
35
+ [![PyPI](https://img.shields.io/pypi/v/wwvb)](https://pypi.org/project/wwvb)
36
+ [![CodeQL](https://github.com/jepler/wwvbpy/actions/workflows/codeql.yml/badge.svg)](https://github.com/jepler/wwvbpy/actions/workflows/codeql.yml)
37
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/jepler/wwvbpy/main.svg)](https://results.pre-commit.ci/latest/github/jepler/wwvbpy/main)
38
+
39
+ # Purpose
40
+
41
+ wwvbpy generates WWVB timecodes for any desired time. These timecodes
42
+ may be useful in testing WWVB decoder software.
43
+
44
+ Where possible, wwvbpy uses existing facilities for calendar and time
45
+ manipulation (datetime and dateutil).
46
+
47
+ It uses DUT1/leap second data derived from IERS Bulletin "A" and from NIST's
48
+ "Leap second and UT1-UTC information" page. With regular updates to
49
+ the "iersdata", wwvbpy should be able to correctly encode the time anywhere
50
+ within the 100-year WWVB epoch. (yes, WWVB uses a 2-digit year! In order to
51
+ work with historical data, the epoch is arbitrarily assumed to run from 1970 to
52
+ 2069.)
53
+
54
+ Programs include:
55
+ * `wwvbgen`, the main commandline generator program
56
+ * `wwvbdecode`, the main commandline decoder program
57
+ * `wwvbtk`, visualize the simulated WWVB signal in real-time using Tkinter
58
+ * `dut1table`, print the full history of dut1 values, including estimated future values
59
+ * `updateiers`, download the latest dut1 data including prospective data from IERS and NIST
60
+
61
+ The package includes:
62
+ * `wwvb`, for generating WWVB timecodes
63
+ * `wwvb.decode`, a generator-based state machine for decoding WWVB timecodes (amplitude modulation only)
64
+ * `uwwvb`, a version of the decoder intended for use on constrained environments such as [CircuitPython](https://circuitpython.org).
65
+
66
+ # Development status
67
+
68
+ The author (@jepler) occasionally develops and maintains this project, but
69
+ issues are not likely to be acted on. They would be interested in adding
70
+ co-maintainer(s).
71
+
72
+
73
+ # WWVB Timecodes
74
+
75
+ The National Institute of Standards and Technology operates the WWVB time
76
+ signal service near Fort Collins, Colorado. The signal can be received in most
77
+ of the continental US. Each minute, the signal transmits the current time,
78
+ including information about leap years, daylight saving time, and leap seconds.
79
+ The signal is composed of an amplitude channel and a phase modulation channel.
80
+
81
+ The amplitude channel can be visualized as a sequence of (usually) 60 symbols,
82
+ which by default wwvbgen displays as 0, 1, or 2. The 0s and 1s encode
83
+ information like the current day of the year, while the 2s appear in fixed
84
+ locations to allow a receiver to determine the start of a minute.
85
+
86
+ The phase channel (which is displayed with `--channel=phase` or
87
+ `--channel=both`) consists of the same number of symbols per minute. This
88
+ channel is substantially more complicated than the phase channel. It encodes
89
+ the current time as minute-of-the-century, provides extended DST information,
90
+ and includes error-correction information not available in the amplitude
91
+ channel.
92
+
93
+ # Usage
94
+
95
+ ~~~~
96
+ Usage: python -m wwvb.gen [OPTIONS] [TIMESPEC]...
97
+
98
+ Generate WWVB timecodes
99
+
100
+ TIMESPEC: one of "year yday hour minute" or "year month day hour minute", or
101
+ else the current minute
102
+
103
+ Options:
104
+ -i, --iers / -I, --no-iers Whether to use IESR data for DUT1 and LS.
105
+ (Default: --iers)
106
+ -s, --leap-second Force a positive leap second at the end of
107
+ the GMT month (Implies --no-iers)
108
+ -n, --negative-leap-second Force a negative leap second at the end of
109
+ the GMT month (Implies --no-iers)
110
+ -S, --no-leap-second Force no leap second at the end of the month
111
+ (Implies --no-iers)
112
+ -d, --dut1 INTEGER Force the DUT1 value (Implies --no-iers)
113
+ -m, --minutes INTEGER Number of minutes to show (default: 10)
114
+ --style [bar|cradek|default|duration|json|sextant]
115
+ Style of output
116
+ -t, --all-timecodes / -T, --no-all-timecodes
117
+ Show the 'WWVB timecode' line before each
118
+ minute
119
+ --channel [amplitude|phase|both]
120
+ Modulation to show (default: amplitude)
121
+ --help Show this message and exit.
122
+ ~~~~
123
+
124
+ For example, to display the leap second that occurred at the end of 1998,
125
+ ~~~~
126
+ $ python wwvbgen.py -m 7 1998 365 23 56
127
+ WWVB timecode: year=98 days=365 hour=23 min=56 dst=0 ut1=-300 ly=0 ls=1
128
+ '98+365 23:56 210100110200100001120011001102010100010200110100121000001002
129
+ '98+365 23:57 210100111200100001120011001102010100010200110100121000001002
130
+ '98+365 23:58 210101000200100001120011001102010100010200110100121000001002
131
+ '98+365 23:59 2101010012001000011200110011020101000102001101001210000010022
132
+ '99+001 00:00 200000000200000000020000000002000100101201110100121001000002
133
+ '99+001 00:01 200000001200000000020000000002000100101201110100121001000002
134
+ '99+001 00:02 200000010200000000020000000002000100101201110100121001000002
135
+ ~~~~
136
+ (the leap second is the extra digit at the end of the 23:59 line; that minute
137
+ consists of 61 seconds, instead of the normal 60)
138
+
139
+
140
+ # How wwvbpy handles DUT1 data
141
+
142
+ wwvbpy stores a compact representation of DUT1 values in `wwvb/iersdata_dist.py` or `wwvb_iersdata.py`.
143
+ In this representation, one value is used for one day (0000UTC through 2359UTC).
144
+ The letters `a` through `u` represent offsets of -1.0s through +1.0s
145
+ in 0.1s increments; `k` represents 0s. (In practice, only a smaller range
146
+ of values, typically -0.7s to +0.8s, is seen)
147
+
148
+ For 2001 through 2019, NIST has published the actual DUT1 values broadcast,
149
+ and the date of each change, though it in the format of an HTML
150
+ table and not designed for machine readability:
151
+
152
+ https://www.nist.gov/pml/time-and-frequency-division/atomic-standards/leap-second-and-ut1-utc-information
153
+
154
+ NIST does not update the value daily and does not seem to follow any
155
+ specific rounding rule. Rather, in WWVB "the resolution of the DUT1
156
+ correction is 0.1 s, and represents an average value for an extended
157
+ range of dates. Therefore, it will not agree exactly with the weekly
158
+ UT1-UTC(NIST) values shown in the earlier table, which have 1 ms
159
+ resolution and are updated weekly." Like wwvbpy's compact
160
+ representation of DUT1 values, the real WWVB does not appear to ever
161
+ broadcast DUT1=-0.0.
162
+
163
+ For a larger range of dates spanning 1973 through approximately one year from
164
+ now, IERS publishes historical and prospective UT1-UTC values to multiple
165
+ decimal places, in a machine readable fixed length format.
166
+
167
+ wwvbpy merges the WWVB and IERS datasets, favoring the WWVB dataset for dates when it is available. There are some caveats to this, which are mostly commented in the `wwvb/updateiers.py` script.
168
+
169
+ `wwvb/iersdata_dist.py` is updated monthly from github actions or with `iersdata --dist` from within the wwvbpy source tree. However, at this time, releases are not regularly made from the updated information.
170
+
171
+ A site or user version of the file, `wwvb_iersdata.py` can be created or updated with `iersdata --site` or `iersdata --user`. If the distributed iersdata is out of date, the generator will prompt you to run the update command.
172
+
173
+ Leap seconds are inferred from the DUT1 data as follows: If X and Y are the
174
+ 1-digit-rounded DUT1 values for consecutive dates, and `X*Y<0`, then there is a
175
+ leap second at the end of day X. The direction of the leap second can be
176
+ inferred from the sign of X, a 59-second minute if X is positive and a
177
+ 61-second minute if it is negative. As long
178
+ as DUT1 changes slowly enough during other times that there is at least one day
179
+ of DUT1=+0.0, no incorrect (negative) leapsecond will be inferred. (something
180
+ that should remain true for the next few centuries, until the length of the day
181
+ is 100ms different from 86400 seconds)
182
+
183
+
184
+ # The phase modulation channel
185
+
186
+ This should be considered more experimental than the AM channel, as the
187
+ tests only cover a single reference minute. Further tests could be informed
188
+ by the [other implementation I know of](http://www.leapsecond.com/tools/wwvb_pm.c), except that implementation appears incomplete.
189
+
190
+
191
+ # Testing wwvbpy
192
+
193
+ Run the testsuite, check coverage & type annotations with `gmake`.
194
+
195
+ There are several test suites:
196
+ * `testwwvb.py`: Check output against expected values. Uses hard coded leap seconds. Tests amplitude and phase data, though the phase testcases are dubious as they were also generated by wwvbpy.
197
+ * `testuwwvb.py`: Test the reduced-functionality version against the main version
198
+ * `testls.py`: Check the IERS data through 2020-1-1 for expected leap seconds
199
+ * `testpm.py`: Check the phase modulation data against a test case from NIST documentation
200
+ * `testcli.py`: Check the commandline programs work as expected (limited tests to get 100% coverage)