Skip to content

Commit fe848d5

Browse files
committed
style(action_manager): extinguish flake8 error
1 parent 4461d91 commit fe848d5

19 files changed

+64
-40
lines changed

photoshop/api/action_manager/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
from .desc_value_types import *
2-
from .jprint import *
1+
from .desc_value_types import Enumerated
2+
from .desc_value_types import TypeID
3+
from .desc_value_types import UnitDouble
4+
from .jprint import jformat
5+
from .jprint import jprint
36
from .js_converter import dump as dumpjs
4-
from .ref_form_types import *
5-
from .utils import *
7+
from .ref_form_types import Identifier
8+
from .ref_form_types import Index
9+
from .ref_form_types import Offset
10+
from .ref_form_types import ReferenceKey
11+
from .utils import id2str
12+
from .utils import str2id
613

714

815
__all__ = [ # noqa: F405

photoshop/api/action_manager/_main_types/_type_mapper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
Handles almost all type mappings. (Some else are in ReferenceKey.)
33
This module is INTERNAL. You should not import functions from it."""
44

5-
from ..desc_value_types import *
6-
from ..ref_form_types import *
7-
from ..utils import *
5+
from ..desc_value_types import Enumerated
6+
from ..desc_value_types import TypeID
7+
from ..desc_value_types import UnitDouble
8+
from ..utils import id2str
89

910

1011
__all__ = ["unpack", "pack", "parsetype"]
@@ -34,7 +35,7 @@ def unpack(val):
3435
typestr = pytype2str[vtype]
3536
try:
3637
args = val._unpacker()
37-
except:
38+
except BaseException:
3839
args = (val,)
3940
return (typestr, args)
4041

photoshop/api/action_manager/_main_types/action_descriptor.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
from abc import abstractclassmethod
44
from typing import Any
55

6-
from ..utils import *
7-
from ._type_mapper import *
6+
from ..utils import str2id
7+
from ._type_mapper import pack
8+
from ._type_mapper import parsetype
9+
from ._type_mapper import unpack
810
from .action_descriptor_iterator import ActionDescriptor_Iterator
911

1012

11-
class ActionDescriptor:
13+
class ActionDescriptor(ABC):
1214
"""A vessel for my extra utils.
1315
You should not use, and cannot initialize it
1416
because it is an abstract class."""

photoshop/api/action_manager/_main_types/action_descriptor_iterator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
from ..utils import *
1+
from ..utils import id2str
22

33

44
class ActionDescriptor_Iterator:
55
"""An iterator. You don't need to initialize it manually."""
66

7-
def __init__(self, psobj: "ActionDescriptor"):
7+
def __init__(self, psobj):
88
self.curobj = psobj
99
self.n = -1
1010

1111
def __next__(self) -> str:
1212
self.n += 1
1313
try:
1414
keyid = self.curobj.getKey(self.n)
15-
except:
15+
except BaseException:
1616
raise StopIteration
1717
keystr = id2str(keyid)
1818
return keystr

photoshop/api/action_manager/_main_types/action_list.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from abc import abstractclassmethod
44
from typing import Any
55

6-
from ..utils import *
7-
from ._type_mapper import *
6+
from ._type_mapper import pack
7+
from ._type_mapper import parsetype
8+
from ._type_mapper import unpack
89
from .action_list_iterator import ActionList_Iterator
910

1011

photoshop/api/action_manager/_main_types/action_list_iterator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
class ActionList_Iterator:
66
"""An iterator. You don't need to initialize it manually."""
77

8-
def __init__(self, psobj: "ActionList"):
8+
def __init__(self, psobj):
99
self.curobj = psobj
1010
self.n = -1
1111

1212
def __next__(self) -> Any:
1313
self.n += 1
1414
try:
1515
elem = self.curobj.uget(self.n)
16-
except:
16+
except BaseException:
1717
raise StopIteration()
1818
return elem
1919

photoshop/api/action_manager/_main_types/action_reference.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def uget(self, index: int) -> ReferenceKey:
2828
for i in range(index + 1):
2929
try:
3030
target = target.getContainer()
31-
except:
31+
except BaseException:
3232
raise IndexError("index out of range")
3333
return ReferenceKey._packer(target)
3434

@@ -42,7 +42,6 @@ def uput(self, rkey: ReferenceKey):
4242

4343
def dump(self) -> list:
4444
"""Convert an ActionReference to a python object."""
45-
target = self
4645
tlist = ["!ref"]
4746
tlist.extend([elem for elem in self])
4847
return tlist
@@ -54,7 +53,7 @@ def __len__(self):
5453
try:
5554
target = target.getContainer()
5655
rlen += 1
57-
except:
56+
except BaseException:
5857
rlen -= 1
5958
break
6059
return rlen

photoshop/api/action_manager/_main_types/action_reference_iterator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class ActionReference_Iterator:
55
"""An iterator. You don't need to initialize it manually."""
66

7-
def __init__(self, psobj: "ActionReference"):
7+
def __init__(self, psobj):
88
self.curobj = psobj
99
self.init = True
1010
self.n = -1
@@ -17,7 +17,7 @@ def __next__(self) -> ReferenceKey:
1717
self.curobj = self.curobj.getContainer()
1818
try:
1919
self.curobj.getContainer()
20-
except:
20+
except BaseException:
2121
raise StopIteration
2222
return ReferenceKey._packer(self.curobj)
2323

photoshop/api/action_manager/desc_value_types/enumerated.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Import built-in modules
22
from collections import namedtuple
33

4-
from ..utils import *
4+
from ..utils import id2str
5+
from ..utils import str2id
56

67

78
Enumerated_proto = namedtuple("Enumerated_proto", ["type", "value"])

photoshop/api/action_manager/desc_value_types/typeid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Import built-in modules
22
from collections import namedtuple
33

4-
from ..utils import *
4+
from ..utils import id2str
5+
from ..utils import str2id
56

67

78
TypeID_proto = namedtuple("TypeID_proto", ["string"])

0 commit comments

Comments
 (0)