1
0
mirror of synced 2024-11-23 22:10:59 +01:00

Remove unnecessary if statements in some cases.

This commit is contained in:
Jennifer Taylor 2023-03-19 05:40:52 +00:00
parent 64aeeafbc6
commit a2ae886d73
3 changed files with 12 additions and 12 deletions

View File

@ -838,7 +838,7 @@ class MusicData(BaseData):
result["points"],
result["timestamp"],
result["lid"],
True if result["new_record"] == 1 else False,
result["new_record"] == 1,
self.deserialize(result["data"]),
),
)
@ -924,7 +924,7 @@ class MusicData(BaseData):
result["points"],
result["timestamp"],
result["lid"],
True if result["new_record"] == 1 else False,
result["new_record"] == 1,
self.deserialize(result["data"]),
),
)

View File

@ -884,7 +884,7 @@ class Node:
def str_to_val(string: Union[str, bytes]) -> Any:
if translated_type["name"] == "bool":
return True if string == "true" else False
return string == "true"
elif translated_type["name"] == "float":
return float(string)
elif translated_type["name"] == "ip4":

View File

@ -298,15 +298,15 @@ class Sniffer:
by the flag name who's value is True if set and False otherwise.
"""
return {
"ns": True if flags & 0x100 else False,
"cwr": True if flags & 0x080 else False,
"ece": True if flags & 0x040 else False,
"urg": True if flags & 0x020 else False,
"ack": True if flags & 0x010 else False,
"psh": True if flags & 0x008 else False,
"rst": True if flags & 0x004 else False,
"syn": True if flags & 0x002 else False,
"fin": True if flags & 0x001 else False,
"ns": bool(flags & 0x100),
"cwr": bool(flags & 0x080),
"ece": bool(flags & 0x040),
"urg": bool(flags & 0x020),
"ack": bool(flags & 0x010),
"psh": bool(flags & 0x008),
"rst": bool(flags & 0x004),
"syn": bool(flags & 0x002),
"fin": bool(flags & 0x001),
}
def __process_address(