Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
d348a826
Commit
d348a826
authored
Feb 28, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: tidy up trixxy importer syntax slightly
parent
7080751f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
mitogen/master.py
mitogen/master.py
+9
-8
No files found.
mitogen/master.py
View file @
d348a826
...
...
@@ -310,11 +310,13 @@ class ModuleFinder(object):
try
:
path
=
self
.
_py_filename
(
loader
.
get_filename
(
fullname
))
source
=
loader
.
get_source
(
fullname
)
if
path
is
not
None
and
source
is
not
None
:
return
path
,
source
,
loader
.
is_package
(
fullname
)
is_pkg
=
loader
.
is_package
(
fullname
)
except
AttributeError
:
return
if
path
is
not
None
and
source
is
not
None
:
return
path
,
source
,
is_pkg
def
_get_module_via_sys_modules
(
self
,
fullname
):
"""Attempt to fetch source code via sys.modules. This is specifically
to support __main__, but it may catch a few more cases."""
...
...
@@ -324,22 +326,21 @@ class ModuleFinder(object):
fullname
)
return
mod
path
=
self
.
_py_filename
(
getattr
(
module
,
'__file__'
,
''
))
if
not
mod
path
:
path
=
self
.
_py_filename
(
getattr
(
module
,
'__file__'
,
''
))
if
not
path
:
return
is_pkg
=
hasattr
(
module
,
'__path__'
)
try
:
source
=
inspect
.
getsource
(
module
)
except
IOError
:
# Work around inspect.getsourcelines() bug.
# Work around inspect.getsourcelines() bug for 0-byte __init__.py
# files.
if
not
is_pkg
:
raise
source
=
'
\
n
'
return
(
module
.
__file__
.
rstrip
(
'co'
),
source
,
hasattr
(
module
,
'__path__'
))
return
path
,
source
,
is_pkg
get_module_methods
=
[
_get_module_via_pkgutil
,
_get_module_via_sys_modules
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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