Compare commits
3 commits
e7abe54821
...
6ef71b2837
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ef71b2837 | ||
| c15b2802ef | |||
| f3b865fafa |
6 changed files with 15 additions and 14 deletions
|
|
@ -21,7 +21,7 @@ repos:
|
|||
- id: reuse
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.7
|
||||
rev: v0.12.1
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# ruff: noqa: C405 PYI024 PLR2004 FBT001 FBT002
|
||||
# ruff: noqa: C405, PYI024, FBT001, FBT002
|
||||
|
||||
"""Implementation of a WWVB state machine & decoder for resource-constrained systems
|
||||
|
||||
|
|
|
|||
|
|
@ -384,6 +384,7 @@ class WWVBMinute(_WWVBMinute):
|
|||
minute: int,
|
||||
dst: DstStatus | int | None = None,
|
||||
ut1: int | None = None,
|
||||
*,
|
||||
ls: bool | None = None,
|
||||
ly: bool | None = None,
|
||||
) -> WWVBMinute:
|
||||
|
|
@ -659,15 +660,15 @@ class WWVBMinute(_WWVBMinute):
|
|||
else:
|
||||
self._fill_pm_timecode_regular(t)
|
||||
|
||||
def next_minute(self, newut1: int | None = None, newls: bool | None = None) -> WWVBMinute:
|
||||
def next_minute(self, *, newut1: int | None = None, newls: bool | None = None) -> WWVBMinute:
|
||||
"""Return an object representing the next minute"""
|
||||
d = self.as_datetime() + datetime.timedelta(minutes=1)
|
||||
return self.from_datetime(d, newut1, newls, self)
|
||||
return self.from_datetime(d, newut1=newut1, newls=newls, old_time=self)
|
||||
|
||||
def previous_minute(self, newut1: int | None = None, newls: bool | None = None) -> WWVBMinute:
|
||||
def previous_minute(self, *, newut1: int | None = None, newls: bool | None = None) -> WWVBMinute:
|
||||
"""Return an object representing the previous minute"""
|
||||
d = self.as_datetime() - datetime.timedelta(minutes=1)
|
||||
return self.from_datetime(d, newut1, newls, self)
|
||||
return self.from_datetime(d, newut1=newut1, newls=newls, old_time=self)
|
||||
|
||||
@classmethod
|
||||
def _get_dut1_info(cls: type, year: int, days: int, old_time: WWVBMinute | None = None) -> tuple[int, bool]: # noqa: ARG003
|
||||
|
|
@ -696,18 +697,19 @@ class WWVBMinute(_WWVBMinute):
|
|||
days = d.pop("days")
|
||||
hour = d.pop("hour")
|
||||
minute = d.pop("minute")
|
||||
dst: int | None = d.pop("dst", None)
|
||||
ut1: int | None = d.pop("ut1", None)
|
||||
dst = d.pop("dst", None)
|
||||
ut1 = d.pop("ut1", None)
|
||||
ls = d.pop("ls", None)
|
||||
d.pop("ly", None)
|
||||
if d:
|
||||
raise ValueError(f"Invalid options: {d}")
|
||||
return cls(year, days, hour, minute, dst, ut1, None if ls is None else bool(ls))
|
||||
return cls(year, days, hour, minute, dst, ut1=ut1, ls=None if ls is None else bool(ls))
|
||||
|
||||
@classmethod
|
||||
def from_datetime(
|
||||
cls,
|
||||
d: datetime.datetime,
|
||||
*,
|
||||
newut1: int | None = None,
|
||||
newls: bool | None = None,
|
||||
old_time: WWVBMinute | None = None,
|
||||
|
|
@ -760,7 +762,7 @@ class WWVBMinute(_WWVBMinute):
|
|||
dst = t._get_am_bcd(57, 58)
|
||||
if dst is None:
|
||||
return None
|
||||
return cls(year, days, hour, minute, dst, ut1, ls, ly)
|
||||
return cls(year, days, hour, minute, dst, ut1, ls=ls, ly=ly)
|
||||
|
||||
|
||||
class WWVBMinuteIERS(WWVBMinute):
|
||||
|
|
@ -858,7 +860,7 @@ class WWVBTimecode:
|
|||
else:
|
||||
self.am[p] = AmplitudeModulation.ZERO
|
||||
|
||||
def _put_pm_bit(self, i: int, v: PhaseModulation | int | bool) -> None:
|
||||
def _put_pm_bit(self, i: int, v: PhaseModulation | int) -> None:
|
||||
"""Update a bit of the Phase Modulation signal"""
|
||||
self.phase[i] = PhaseModulation(v)
|
||||
|
||||
|
|
|
|||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FxpyAooq6lq06UEr+UkLeXOIDPZ6EBrqb5K8Tvu6/B9CdnZqFQL05s2KauWy/IeF/tJGAisjK9MgGyDuUkRq4G1gRE+VjA30uZNPsdantkgMq58QO4fw+sqzj+A2/16mmvnyy9UzDvMktDgKYlnkFeB2rx+wNANG40aA4OgsY03AWoDCVs/XMmkyQ0+0jWaUqPdwA0m/MRuccGjCwirHToWzbcs8P7U1nZZLSYdHapWu5HqVg1YjK2fPEwvPZPzLPUF848tyid2u7dh8B7h+wVQ923Q+kqxZe3JclSSB+YTM3nnHrjgFth/vzgZzw6cbOMYa4bHFPU/DR3mp/ubKM4cgwMnHZW4GFxFprOVcevAKGva6oExn1MOmyGDJQPm0rpU8bjqdOo993O6Xz9ofToZela5vwrWoTn4l4o5CIIaKejCEgSnJv784V6y0/IJeROtycVNAAA="}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# ruff: noqa: N802 D102
|
||||
# ruff: noqa: N802
|
||||
import datetime
|
||||
import random
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
# ruff: noqa: E501
|
||||
|
||||
"""Test most wwvblib functionality"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue