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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
simso/core/Scheduler.py
+23
-0
simso/schedulers/BF.py
+1
-1
No files found.
simso/core/Scheduler.py
View file @
a80e5063
...
@@ -241,14 +241,37 @@ class Scheduler(object):
...
@@ -241,14 +241,37 @@ class Scheduler(object):
def
get_schedulers
():
def
get_schedulers
():
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'
)
package
=
importlib
.
import_module
(
'simso.schedulers'
)
for
importer
,
modname
,
ispkg
in
pkgutil
.
walk_packages
(
for
importer
,
modname
,
ispkg
in
pkgutil
.
walk_packages
(
path
=
package
.
__path__
,
path
=
package
.
__path__
,
prefix
=
package
.
__name__
+
'.'
,
prefix
=
package
.
__name__
+
'.'
,
onerror
=
lambda
x
:
None
):
onerror
=
lambda
x
:
None
):
modules
.
append
(
modname
)
for
modname
in
sorted
(
modules
):
try
:
m
=
importlib
.
import_module
(
modname
)
m
=
importlib
.
import_module
(
modname
)
for
name
in
dir
(
m
):
for
name
in
dir
(
m
):
c
=
m
.
__getattribute__
(
name
)
c
=
m
.
__getattribute__
(
name
)
if
inspect
.
isclass
(
c
)
and
issubclass
(
c
,
Scheduler
):
if
inspect
.
isclass
(
c
)
and
issubclass
(
c
,
Scheduler
):
yield
modname
yield
modname
break
break
except
(
ImportError
,
SyntaxError
):
print
(
"Import error: "
,
modname
)
simso/schedulers/BF.py
View file @
a80e5063
"""
"""
Implementation of the BF algorithm.
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
simso.core
import
Scheduler
,
Timer
from
fractions
import
Fraction
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