Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def transmissions(self, status="all"):
"""Get all the transmissions of this info.
status can be all/pending/received.
"""
if status not in ["all", "pending", "received"]:
raise ValueError(
"You cannot get transmission of status {}.".format(status)
+ "Status can only be pending, received or all"
)
if status == "all":
return Transmission.query.filter_by(info_id=self.id, failed=False).all()
else:
return Transmission.query.filterby(
info_id=self.id, status=status, failed=False
).all()
and_(
Transmission.failed == false(),
Transmission.status == status,
or_(
Transmission.destination_id == self.id,
Transmission.origin_id == self.id,
),
)
)
.order_by("creation_time")
.all()
)
if direction == "incoming":
if status == "all":
return (
Transmission.query.filter_by(failed=False, destination_id=self.id)
.order_by("creation_time")
.all()
)
else:
return (
Transmission.query.filter(
and_(
Transmission.failed == false(),
Transmission.destination_id == self.id,
Transmission.status == status,
)
)
.order_by("creation_time")
.all()
)
if direction == "outgoing":
status { "all", "received", "pending" }
failed { False, True, "all" }
To get transmissions from a specific vector, see the
transmissions() method in class Vector.
"""
if status not in ["all", "pending", "received"]:
raise ValueError(
"You cannot get transmission of status {}.".format(status)
+ "Status can only be pending, received or all"
)
if failed not in ["all", False, True]:
raise ValueError("{} is not a valid failed".format(failed))
if status == "all":
if failed == "all":
return Transmission.query.filter_by(network_id=self.id).all()
else:
return Transmission.query.filter_by(
network_id=self.id, failed=failed
).all()
else:
if failed == "all":
return Transmission.query.filter_by(
network_id=self.id, status=status
).all()
else:
return Transmission.query.filter_by(
network_id=self.id, status=status, failed=failed
).all()
To get transmissions from a specific vector, see the
transmissions() method in class Vector.
"""
if status not in ["all", "pending", "received"]:
raise ValueError(
"You cannot get transmission of status {}.".format(status)
+ "Status can only be pending, received or all"
)
if failed not in ["all", False, True]:
raise ValueError("{} is not a valid failed".format(failed))
if status == "all":
if failed == "all":
return Transmission.query.filter_by(network_id=self.id).all()
else:
return Transmission.query.filter_by(
network_id=self.id, failed=failed
).all()
else:
if failed == "all":
return Transmission.query.filter_by(
network_id=self.id, status=status
).all()
else:
return Transmission.query.filter_by(
network_id=self.id, status=status, failed=failed
).all()
def transmissions(self, status="all"):
"""Get transmissions sent along this Vector.
Status can be "all" (the default), "pending", or "received".
"""
if status not in ["all", "pending", "received"]:
raise ValueError(
"You cannot get {} transmissions.".format(status)
+ "Status can only be pending, received or all"
)
if status == "all":
return Transmission.query.filter_by(vector_id=self.id, failed=False).all()
else:
return Transmission.query.filter_by(
vector_id=self.id, status=status, failed=False
).all()
else:
return (
Transmission.query.filter(
and_(
Transmission.failed == false(),
Transmission.destination_id == self.id,
Transmission.status == status,
)
)
.order_by("creation_time")
.all()
)
if direction == "outgoing":
if status == "all":
return (
Transmission.query.filter_by(failed=False, origin_id=self.id)
.order_by("creation_time")
.all()
)
else:
return (
Transmission.query.filter(
and_(
Transmission.failed == false(),
Transmission.origin_id == self.id,
Transmission.status == status,
)
)
.order_by("creation_time")
.all()
def transmissions(self, status="all"):
"""Get transmissions sent along this Vector.
Status can be "all" (the default), "pending", or "received".
"""
if status not in ["all", "pending", "received"]:
raise ValueError(
"You cannot get {} transmissions.".format(status)
+ "Status can only be pending, received or all"
)
if status == "all":
return Transmission.query.filter_by(vector_id=self.id, failed=False).all()
else:
return Transmission.query.filter_by(
vector_id=self.id, status=status, failed=False
).all()
raise ValueError("{} is not a valid failed".format(failed))
if status == "all":
if failed == "all":
return Transmission.query.filter_by(network_id=self.id).all()
else:
return Transmission.query.filter_by(
network_id=self.id, failed=failed
).all()
else:
if failed == "all":
return Transmission.query.filter_by(
network_id=self.id, status=status
).all()
else:
return Transmission.query.filter_by(
network_id=self.id, status=status, failed=failed
).all()