Skip to content

Commit

Permalink
Format with black 2024.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ties committed Mar 9, 2024
1 parent c42d71e commit 046b648
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
16 changes: 10 additions & 6 deletions sagemcom_f3896_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ async def modem_downstreams(
) -> List[ModemQAMDownstreamChannelResult | ModemOFDMDownstreamChannelResult]:
async with self.__request("GET", "/rest/v1/cablemodem/downstream") as resp:
return [
ModemQAMDownstreamChannelResult.build(e)
if e["channelType"] == "sc_qam"
else ModemOFDMDownstreamChannelResult.build(e)
(
ModemQAMDownstreamChannelResult.build(e)
if e["channelType"] == "sc_qam"
else ModemOFDMDownstreamChannelResult.build(e)
)
for e in (await resp.json())["downstream"]["channels"]
]

Expand All @@ -237,9 +239,11 @@ async def modem_upstreams(
) -> List[ModemATDMAUpstreamChannelResult | ModemOFDMAUpstreamChannelResult]:
async with self.__request("GET", "/rest/v1/cablemodem/upstream") as resp:
return [
ModemATDMAUpstreamChannelResult.build(e)
if e["channelType"] == "atdma"
else ModemOFDMAUpstreamChannelResult.build(e)
(
ModemATDMAUpstreamChannelResult.build(e)
if e["channelType"] == "atdma"
else ModemOFDMAUpstreamChannelResult.build(e)
)
for e in (await resp.json())["upstream"]["channels"]
]

Expand Down
8 changes: 5 additions & 3 deletions sagemcom_f3896_client/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ async def __update_downstream_channel_metrics(
).info(
{
"modulation": ch.modulation,
"primary": "true"
if ch.channel_id == primary_downstream.channel_id
else "false",
"primary": (
"true"
if ch.channel_id == primary_downstream.channel_id
else "false"
),
}
)
case "ofdm":
Expand Down
16 changes: 10 additions & 6 deletions sagemcom_f3896_client/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,23 @@ def parse_message(message: str) -> Optional[ParsedMessage]:
if match:
return DownstreamProfileMessage(
channel_id=int(match.group("channel_id")),
previous_profile=tuple(map(int, match.group("previous_profile").split()))
if match.group("previous_profile")
else None,
previous_profile=(
tuple(map(int, match.group("previous_profile").split()))
if match.group("previous_profile")
else None
),
profile=tuple(map(int, match.group("profile").split())),
)

match = US_PROFILE_RE.match(message)
if match:
return UpstreamProfileMessage(
channel_id=int(match.group("channel_id")),
previous_profile=tuple(map(int, match.group("previous_profile").split()))
if match.group("previous_profile")
else None,
previous_profile=(
tuple(map(int, match.group("previous_profile").split()))
if match.group("previous_profile")
else None
),
profile=tuple(map(int, match.group("profile").split())),
)

Expand Down

0 comments on commit 046b648

Please sign in to comment.