Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Black and isort #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions parchmint/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def to_parchmint_v1_2(self):
dict: dictionary that can be used in json.dumps()
"""
return {
"source": None
if self.__source is None
else self.__source.to_parchmint_v1(),
"source": (
None if self.__source is None else self.__source.to_parchmint_v1()
),
"sink": None if self.__sink is None else self.__sink.to_parchmint_v1(),
"wayPoints": [list(wp) for wp in self.__waypoints],
"features": [feat.ID for feat in self.__features],
Expand Down Expand Up @@ -268,9 +268,9 @@ def to_parchmint_v1(self):
"sinks": [s.to_parchmint_v1() for s in self.sinks],
"name": self.name,
"id": self.ID,
"source": self.source.to_parchmint_v1()
if self.source is not None
else None,
"source": (
self.source.to_parchmint_v1() if self.source is not None else None
),
"params": self.params.to_parchmint_v1(),
"layer": self.layer.ID if self.layer is not None else None,
}
Expand Down Expand Up @@ -359,9 +359,11 @@ def from_parchmint_v1_2(json_data: Dict, device_ref: Device) -> Connection:
entity=json_data["entity"],
params=Params(json_data["params"]),
source=Target(json_data=json_data["source"]),
sinks=[Target(json_data=sink) for sink in json_data["sinks"]]
if "sinks" in json_data.keys()
else [],
sinks=(
[Target(json_data=sink) for sink in json_data["sinks"]]
if "sinks" in json_data.keys()
else []
),
paths=[
ConnectionPath.from_parchmint_v1_2(path, device_ref)
for path in json_data["paths"]
Expand Down
8 changes: 5 additions & 3 deletions parchmint/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,11 @@ def get_valve_type(value: str) -> ValveType:
device_ref.map_valve(
device_ref.get_component(componentid),
device_ref.get_connection(connectionid),
get_valve_type(valve_type)
if valve_type is not None
else ValveType.NORMALLY_OPEN,
(
get_valve_type(valve_type)
if valve_type is not None
else ValveType.NORMALLY_OPEN
),
)

return device_ref
Loading