Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
septs committed Jan 11, 2025
1 parent 27528a4 commit 1d243b1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions handlers/plmn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ def from_tuple(mcc: str, mnc: str) -> "PLMN":
@property
def mcc(self) -> str:
mcc = [(self[0] & 0x0F), (self[0] & 0xF0) >> 4, (self[1] & 0x0F)]
return ''.join(map(str, mcc))
return bytes(_ + 0x30 for _ in mcc if _ != 0xf).decode("ascii")

@property
def mnc(self) -> str:
mnc = [(self[2] & 0x0F), (self[2] & 0xF0) >> 4, (self[1] & 0xF0) >> 4]
if mnc[2] == 0xf:
mnc.pop()
return ''.join(map(str, mnc))
return bytes(_ + 0x30 for _ in mnc if _ != 0xf).decode("ascii")

@property
def mccmnc(self) -> str:
Expand Down

0 comments on commit 1d243b1

Please sign in to comment.