Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
workflow
pypushflow
Commits
88fed3cc
Commit
88fed3cc
authored
May 12, 2020
by
payno
Browse files
[utils] rework '_check_module_for_class'
parent
d69ab181
Changes
1
Hide whitespace changes
Inline
Side-by-side
pypushflow/addon/utils.py
View file @
88fed3cc
...
...
@@ -62,19 +62,19 @@ def _check_module_for_class(module, depth=0):
if
inspect
.
ismodule
(
m
[
1
]):
if
inspect
.
isclass
(
m
[
1
]):
classes
.
append
(
m
[
1
])
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
(
m
[
1
].
__path__
):
module_name
=
module
.
__name__
submod_name
=
'.'
.
join
((
module_name
,
m
[
0
],
modname
))
try
:
mod
=
importlib
.
import_module
(
submod_name
)
except
Exception
:
pass
else
:
classes
.
extend
(
_check_module_for_class
(
module
=
mod
,
depth
=
depth
+
1
))
elif
hasattr
(
m
[
1
],
'__path__'
):
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
(
m
[
1
].
__path__
):
module_name
=
module
.
__name__
submod_name
=
'.'
.
join
((
module_name
,
m
[
0
],
modname
))
try
:
mod
=
importlib
.
import_module
(
submod_name
)
except
Exception
:
pass
else
:
classes
.
extend
(
_check_module_for_class
(
module
=
mod
,
depth
=
depth
+
1
))
return
classes
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment