Use == instead of is

`==` should be used when comparing values, `is` should be used to compare identities.
This commit is contained in:
HexPandaa 2021-04-02 17:00:35 +02:00 committed by GitHub
parent 6c51080109
commit c33da69a8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,20 +47,20 @@ SMB1 = "Enabled"
def StructWithLenPython2or3(endian,data):
#Python2...
if PY2OR3 is "PY2":
if PY2OR3 == "PY2":
return struct.pack(endian, data)
#Python3...
else:
return struct.pack(endian, data).decode('latin-1')
def NetworkSendBufferPython2or3(data):
if PY2OR3 is "PY2":
if PY2OR3 == "PY2":
return str(data)
else:
return bytes(str(data), 'latin-1')
def NetworkRecvBufferPython2or3(data):
if PY2OR3 is "PY2":
if PY2OR3 == "PY2":
return str(data)
else:
return str(data.decode('latin-1'))