Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
neoppod
Commits
32988e04
Commit
32988e04
authored
May 23, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better use of __import__
parent
48e29a3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
5 deletions
+4
-5
neo/debug.py
neo/debug.py
+1
-1
neo/scripts/runner.py
neo/scripts/runner.py
+1
-1
neo/storage/database/__init__.py
neo/storage/database/__init__.py
+1
-2
neo/tests/functional/__init__.py
neo/tests/functional/__init__.py
+1
-1
No files found.
neo/debug.py
View file @
32988e04
...
@@ -101,7 +101,7 @@ if IF == 'pdb':
...
@@ -101,7 +101,7 @@ if IF == 'pdb':
def
__init__
(
self
,
bp_list
):
def
__init__
(
self
,
bp_list
):
self
.
_lock
=
threading
.
Lock
()
self
.
_lock
=
threading
.
Lock
()
for
o
,
name
in
bp_list
:
for
o
,
name
in
bp_list
:
o
=
__import__
(
o
,
fromlist
=
1
)
o
=
__import__
(
o
,
fromlist
=
(
'*'
,),
level
=
0
)
x
=
name
.
split
(
'.'
)
x
=
name
.
split
(
'.'
)
name
=
x
.
pop
()
name
=
x
.
pop
()
for
x
in
x
:
for
x
in
x
:
...
...
neo/scripts/runner.py
View file @
32988e04
...
@@ -173,7 +173,7 @@ class NeoTestRunner(unittest.TextTestResult):
...
@@ -173,7 +173,7 @@ class NeoTestRunner(unittest.TextTestResult):
exclude != fnmatchcase(test_module, only)):
exclude != fnmatchcase(test_module, only)):
continue
continue
try:
try:
test_module = __import__(test_module,
globals(), locals(), ['
*
']
)
test_module = __import__(test_module,
fromlist=('
*
',), level=0
)
except ImportError, err:
except ImportError, err:
self.failedImports[test_module] = err
self.failedImports[test_module] = err
print "Import of %s failed : %s" % (test_module, err)
print "Import of %s failed : %s" % (test_module, err)
...
...
neo/storage/database/__init__.py
View file @
32988e04
...
@@ -29,8 +29,7 @@ def getAdapterKlass(name):
...
@@ -29,8 +29,7 @@ def getAdapterKlass(name):
module
,
name
=
DATABASE_MANAGER_DICT
[
name
or
'MySQL'
].
split
(
'.'
)
module
,
name
=
DATABASE_MANAGER_DICT
[
name
or
'MySQL'
].
split
(
'.'
)
except
KeyError
:
except
KeyError
:
raise
DatabaseFailure
(
'Cannot find a database adapter <%s>'
%
name
)
raise
DatabaseFailure
(
'Cannot find a database adapter <%s>'
%
name
)
module
=
getattr
(
__import__
(
__name__
,
fromlist
=
[
module
],
level
=
1
),
module
)
return
getattr
(
__import__
(
module
,
globals
(),
level
=
1
),
name
)
return
getattr
(
module
,
name
)
def
buildDatabaseManager
(
name
,
args
=
(),
kw
=
{}):
def
buildDatabaseManager
(
name
,
args
=
(),
kw
=
{}):
return
getAdapterKlass
(
name
)(
*
args
,
**
kw
)
return
getAdapterKlass
(
name
)(
*
args
,
**
kw
)
neo/tests/functional/__init__.py
View file @
32988e04
...
@@ -125,7 +125,7 @@ class NEOProcess(object):
...
@@ -125,7 +125,7 @@ class NEOProcess(object):
def
__init__
(
self
,
command
,
uuid
,
arg_dict
):
def
__init__
(
self
,
command
,
uuid
,
arg_dict
):
try
:
try
:
__import__
(
'neo.scripts.'
+
command
)
__import__
(
'neo.scripts.'
+
command
,
level
=
0
)
except
ImportError
:
except
ImportError
:
raise
NotFound
,
'%s not found'
%
(
command
)
raise
NotFound
,
'%s not found'
%
(
command
)
self
.
command
=
command
self
.
command
=
command
...
...
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