Commit 8d790784 by Ned Batchelder

Fix a typo, and indent instead of comment for dead code, so I can read it.

parent ff407c4f
......@@ -132,34 +132,35 @@ class Reschedule(Policy):
]
settings = dict(tree.settings)
if 'start_date' in policy:
if 'start_date' in settings:
settings['start_date'] = settings['start_date'] + delta
return tree._replace(settings=settings, children=children)
# class AppendModule(QueryPolicy):
# """
# This module will append a policy after each module matching the query.
# Any keys in policy_to_copy will be copied from the usage node that
# matches the query.
# """
# def __init__(self, query, source, policy_to_copy=None, *args, **kwargs):
# super(AppendModule, self).__init__(query, *args, **kwargs)
# self.policy_to_copy = policy_to_copy if policy_to_copy is not None else []
# self.source = source
# def update(usage):
# """
# Return a list of usages to replace the returned usage with
# """
# to_insert = Usage.create_usage(self.source)
# policy = dict(to_insert.policy)
# for key in self.policy_to_copy:
# if key in usage:
# policy[key] = usage[key]
# return [usage, to_insert._replace(policy=policy)]
if 0:
class AppendModule(QueryPolicy):
"""
This module will append a policy after each module matching the query.
Any keys in policy_to_copy will be copied from the usage node that
matches the query.
"""
def __init__(self, query, source, policy_to_copy=None, *args, **kwargs):
super(AppendModule, self).__init__(query, *args, **kwargs)
self.policy_to_copy = policy_to_copy if policy_to_copy is not None else []
self.source = source
def update(usage):
"""
Return a list of usages to replace the returned usage with
"""
to_insert = Usage.create_usage(self.source)
policy = dict(to_insert.policy)
for key in self.policy_to_copy:
if key in usage:
policy[key] = usage[key]
return [usage, to_insert._replace(policy=policy)]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment