Skip to content

Commit

Permalink
upgrade black from 23.12.1 to 24.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored and fphammerle committed Jan 26, 2024
1 parent 5c8ce16 commit bbb12a7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 40 deletions.
46 changes: 23 additions & 23 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions cc1101/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,7 @@ def _symbol_rate_real_to_floating_point(cls, real: float) -> typing.Tuple[int, i
math.log2(real / cls._CRYSTAL_OSCILLATOR_FREQUENCY_HERTZ) + 20
)
mantissa = round(
real * 2**28 / cls._CRYSTAL_OSCILLATOR_FREQUENCY_HERTZ / 2**exponent
- 256
real * 2**28 / cls._CRYSTAL_OSCILLATOR_FREQUENCY_HERTZ / 2**exponent - 256
)
if mantissa == 256:
exponent += 1
Expand Down Expand Up @@ -671,16 +670,22 @@ def __str__(self) -> str:
f"symbol_rate={(self.get_symbol_rate_baud() / 1000):.2f}kBaud",
f"modulation_format={self.get_modulation_format().name}",
f"sync_mode={sync_mode.name}",
f"preamble_length={self.get_preamble_length_bytes()}B"
if sync_mode != SyncMode.NO_PREAMBLE_AND_SYNC_WORD
else None,
f"sync_word=0x{self.get_sync_word().hex()}"
if sync_mode != SyncMode.NO_PREAMBLE_AND_SYNC_WORD
else None,
(
f"preamble_length={self.get_preamble_length_bytes()}B"
if sync_mode != SyncMode.NO_PREAMBLE_AND_SYNC_WORD
else None
),
(
f"sync_word=0x{self.get_sync_word().hex()}"
if sync_mode != SyncMode.NO_PREAMBLE_AND_SYNC_WORD
else None
),
"packet_length{}{}B".format( # pylint: disable=consider-using-f-string
"≤"
if self.get_packet_length_mode() == PacketLengthMode.VARIABLE
else "=",
(
"≤"
if self.get_packet_length_mode() == PacketLengthMode.VARIABLE
else "="
),
self.get_packet_length_bytes(),
),
"output_power="
Expand Down
8 changes: 5 additions & 3 deletions cc1101/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ def _add_common_args(argparser: argparse.ArgumentParser) -> None:
def _init_logging(args: argparse.Namespace) -> None:
logging.basicConfig(
level=logging.DEBUG if args.debug else logging.INFO,
format="%(asctime)s:%(levelname)s:%(name)s:%(funcName)s:%(message)s"
if args.debug
else "%(message)s",
format=(
"%(asctime)s:%(levelname)s:%(name)s:%(funcName)s:%(message)s"
if args.debug
else "%(message)s"
),
datefmt="%Y-%m-%dT%H:%M:%S%z",
)

Expand Down
8 changes: 5 additions & 3 deletions tests/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def test___str___(transceiver_str, sync_word):
), unittest.mock.patch.object(
transceiver,
"get_sync_mode",
return_value=cc1101.SyncMode.TRANSMIT_16_MATCH_15_BITS
if sync_word
else cc1101.SyncMode.NO_PREAMBLE_AND_SYNC_WORD,
return_value=(
cc1101.SyncMode.TRANSMIT_16_MATCH_15_BITS
if sync_word
else cc1101.SyncMode.NO_PREAMBLE_AND_SYNC_WORD
),
), unittest.mock.patch.object(
transceiver, "get_preamble_length_bytes", return_value=4
), unittest.mock.patch.object(
Expand Down

0 comments on commit bbb12a7

Please sign in to comment.