Skip to content

Commit 3a9cd2b

Browse files
committed
style(action_manager): hop(hound oriented programming)
Signed-off-by: TsXor <[email protected]>
1 parent feacb18 commit 3a9cd2b

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

photoshop/api/action_manager/_main_types/action_descriptor.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ def load(cls, adict: dict, namespace: dict): # pass globals() for namespace
2828
"""val = v if (dtype := parsetype(v)) == "others" else namespace[dtype].load(v)"""
2929
)
3030
except SyntaxError:
31-
val = (
32-
v
33-
if parsetype(v) == "others"
34-
else namespace[parsetype(v)].load(v)
35-
)
31+
val = v if parsetype(v) == "others" else namespace[parsetype(v)].load(v)
3632
new.uput(k, val)
3733
return new
3834

photoshop/api/action_manager/_main_types/action_list.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ def load(cls, alist: list, namespace: dict): # pass globals() for namespace
2424
"""val = v if (dtype := parsetype(v)) == "others" else namespace[dtype].load(v)"""
2525
)
2626
except SyntaxError:
27-
val = (
28-
v
29-
if parsetype(v) == "others"
30-
else namespace[parsetype(v)].load(v)
31-
)
27+
val = v if parsetype(v) == "others" else namespace[parsetype(v)].load(v)
3228
new.uput(val)
3329
return new
3430

@@ -52,7 +48,9 @@ def uput(self, val: Any):
5248
# py37 compat
5349
try:
5450
exec(
55-
'''assert True if (dtype := self.dtype) is None else dtype == typestr, "ActionList can only hold things of the same type"'''
51+
'''assert True if (dtype := self.dtype) is None ''' +
52+
'''else dtype == typestr, ''' +
53+
'''"ActionList can only hold things of the same type"'''
5654
)
5755
except SyntaxError:
5856
assert (

photoshop/api/action_manager/js_converter/convert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def unhead(string):
4343

4444
str2getpacker = {
4545
"UnitDouble": lambda x: UnitDouble(unhead(x["unit"]), x["double"]),
46-
"Enumerated": lambda x: Enumerated(
47-
unhead(x["enumtype"]), unhead(x["enumval"])
48-
),
46+
"Enumerated": lambda x: Enumerated(unhead(x["enumtype"]), unhead(x["enumval"])),
4947
"TypeID": lambda x: toid(x["string"]),
5048
"ActionDescriptor": lambda x: parsedict(x),
5149
"ActionReference": lambda x: parseref(x),
@@ -103,7 +101,9 @@ def parseref(tdict):
103101
# py37 compat
104102
try:
105103
exec(
106-
"""ext = [(str2refgetpacker[val["type"]](e) if type(val := e["Value"]) == dict else str2refgetpacker["default"](e)) for e in d2l]"""
104+
"""ext = [(str2refgetpacker[val["type"]](e) """ +
105+
"""if type(val := e["Value"]) == dict """ +
106+
"""else str2refgetpacker["default"](e)) for e in d2l]"""
107107
)
108108
except SyntaxError:
109109
ext = [

0 commit comments

Comments
 (0)