Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cigale
CIGALE
Commits
d620d530
Commit
d620d530
authored
Mar 06, 2017
by
Médéric Boquien
Browse files
Slight rewriting of the comments for grammar/PEP8.
parent
0ae585f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
pcigale/warehouse/__init__.py
View file @
d620d530
...
@@ -17,7 +17,7 @@ class SedWarehouse(object):
...
@@ -17,7 +17,7 @@ class SedWarehouse(object):
"""
"""
def
__init__
(
self
,
cache_type
=
"memory"
,
nocache
=
None
):
def
__init__
(
self
,
cache_type
=
"memory"
,
nocache
=
None
):
"""Instantiate a SED warehouse
"""Instantiate a
n
SED warehouse
Parameters
Parameters
----------
----------
...
@@ -85,12 +85,12 @@ class SedWarehouse(object):
...
@@ -85,12 +85,12 @@ class SedWarehouse(object):
def
partial_clear_cache
(
self
,
n_modules_max
):
def
partial_clear_cache
(
self
,
n_modules_max
):
"""Clear the cache of SEDs that are not relevant anymore
"""Clear the cache of SEDs that are not relevant anymore
To do partial clearing of the cache, we go through the entire cache
and
To do partial clearing of the cache, we go through the entire cache
delete the SEDs that have more than a given number of modules.
This is
and
delete the SEDs that have more than a given number of modules.
done by computing the index of the module that has a changed
parameter.
This is
done by computing the index of the module that has a changed
This means that SEDs with this number of modules or more
are not needed
parameter.
This means that SEDs with this number of modules or more
anymore to compute new models and we can discard them.
Passing 0 as an
are not needed
anymore to compute new models and we can discard them.
argument empties the cache completely.
Passing 0 as an
argument empties the cache completely.
Parameters
Parameters
----------
----------
...
@@ -130,8 +130,8 @@ class SedWarehouse(object):
...
@@ -130,8 +130,8 @@ class SedWarehouse(object):
module_list
=
list
(
module_list
)
module_list
=
list
(
module_list
)
parameter_list
=
list
(
parameter_list
)
parameter_list
=
list
(
parameter_list
)
# Marshal a tuple (module_list, parameter_list) to be used as a key
for
# Marshal a tuple (module_list, parameter_list) to be used as a key
# storing the SED in the cache.
#
for
storing the SED in the cache.
sed_key
=
marshal
.
dumps
((
module_list
,
parameter_list
))
sed_key
=
marshal
.
dumps
((
module_list
,
parameter_list
))
sed
=
self
.
storage
.
get
(
sed_key
)
sed
=
self
.
storage
.
get
(
sed_key
)
...
...
Write
Preview
Supports
Markdown
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