Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
eikowagenknecht committed Oct 4, 2023
1 parent 22f07c3 commit 5ae90d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 5 additions & 1 deletion e3dc/_e3dc_rscp_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ def connect(self):
RscpType.Container,
[
(RscpTag.RSCP_AUTHENTICATION_USER, RscpType.CString, self.username),
(RscpTag.RSCP_AUTHENTICATION_PASSWORD, RscpType.CString, self.password),
(
RscpTag.RSCP_AUTHENTICATION_PASSWORD,
RscpType.CString,
self.password,
),
],
)
)
Expand Down
8 changes: 2 additions & 6 deletions e3dc/_e3dc_rscp_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,11 @@ def respondToINFORequest(self, decoded):
RscpTag.INFO_SUBNET_MASK, RscpType.CString, "0.0.0.0"
)
elif tag == RscpTag.INFO_REQ_GATEWAY:
return rscpLib.rscpEncode(
RscpTag.INFO_GATEWAY, RscpType.CString, "0.0.0.0"
)
return rscpLib.rscpEncode(RscpTag.INFO_GATEWAY, RscpType.CString, "0.0.0.0")
elif tag == RscpTag.INFO_REQ_DNS:
return rscpLib.rscpEncode(RscpTag.INFO_DNS, RscpType.CString, "0.0.0.0")
elif tag == RscpTag.INFO_REQ_DHCP_STATUS:
return rscpLib.rscpEncode(
RscpTag.INFO_DHCP_STATUS, RscpType.Bool, "false"
)
return rscpLib.rscpEncode(RscpTag.INFO_DHCP_STATUS, RscpType.Bool, "false")
elif tag == RscpTag.INFO_REQ_TIME:
return rscpLib.rscpEncode(
RscpTag.INFO_TIME, RscpType.ByteArray, timestampEncode(time.time())
Expand Down
6 changes: 4 additions & 2 deletions e3dc/_rscpLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def rscpEncode(tagStr, typeStr=None, data=None):
tagStr = tagStr[0]
elif typeStr is None:
raise TypeError("Second argument must not be none if first is not a tuple")

tagHex = getHexTag(tagStr)
typeHex = getHexDatatype(typeStr)
type_ = getDatatype(typeStr)
Expand All @@ -139,7 +139,9 @@ def rscpEncode(tagStr, typeStr=None, data=None):

if type_ == RscpType.NoneType: # special case: no content
return struct.pack(packFmt, tagHex, typeHex, 0)
elif type_ == RscpType.Timestamp: # timestamp has a special format, divided into 32 bit integers
elif (
type_ == RscpType.Timestamp
): # timestamp has a special format, divided into 32 bit integers
ts = int(data / 1000) # this is int64
ms = (data - ts * 1000) * 1e6 # ms are multiplied by 10^6

Expand Down

0 comments on commit 5ae90d9

Please sign in to comment.