Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
las3_pub
/
simso
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a80e5063
authored
May 24, 2015
by
Maxime Chéramy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import for PyInstaller.
Also remove a Non-ASCII character for Python2...
parent
f3eb8594
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
11 deletions
+34
-11
simso/core/Scheduler.py
+33
-10
simso/schedulers/BF.py
+1
-1
No files found.
simso/core/Scheduler.py
View file @
a80e5063
...
...
@@ -241,14 +241,37 @@ class Scheduler(object):
def
get_schedulers
():
package
=
importlib
.
import_module
(
'simso.schedulers'
)
for
importer
,
modname
,
ispkg
in
pkgutil
.
walk_packages
(
path
=
package
.
__path__
,
prefix
=
package
.
__name__
+
'.'
,
onerror
=
lambda
x
:
None
):
m
=
importlib
.
import_module
(
modname
)
for
name
in
dir
(
m
):
c
=
m
.
__getattribute__
(
name
)
if
inspect
.
isclass
(
c
)
and
issubclass
(
c
,
Scheduler
):
yield
modname
modules
=
[]
# Special case when using PyInstaller:
if
getattr
(
sys
,
'frozen'
,
False
):
import
pyi_importers
importer
=
None
for
obj
in
sys
.
meta_path
:
if
isinstance
(
obj
,
pyi_importers
.
FrozenImporter
):
importer
=
obj
break
for
name
in
importer
.
toc
:
if
name
.
startswith
(
'simso.schedulers.'
):
modules
.
append
(
name
)
# Normal case:
else
:
package
=
importlib
.
import_module
(
'simso.schedulers'
)
for
importer
,
modname
,
ispkg
in
pkgutil
.
walk_packages
(
path
=
package
.
__path__
,
prefix
=
package
.
__name__
+
'.'
,
onerror
=
lambda
x
:
None
):
modules
.
append
(
modname
)
for
modname
in
sorted
(
modules
):
try
:
m
=
importlib
.
import_module
(
modname
)
for
name
in
dir
(
m
):
c
=
m
.
__getattribute__
(
name
)
if
inspect
.
isclass
(
c
)
and
issubclass
(
c
,
Scheduler
):
yield
modname
break
except
(
ImportError
,
SyntaxError
):
print
(
"Import error: "
,
modname
)
simso/schedulers/BF.py
View file @
a80e5063
"""
Implementation of the BF algorithm.
Authors: Maxime Ch
é
ramy and Stefan Junker
Authors: Maxime Ch
e
ramy and Stefan Junker
"""
from
simso.core
import
Scheduler
,
Timer
from
fractions
import
Fraction
...
...
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