Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Add some attributes to LoadableConfig for the benefit of montague_pas…
Browse files Browse the repository at this point in the history
…tedeploy.
  • Loading branch information
inklesspen committed Mar 1, 2015
1 parent 48d1ef4 commit 832aa12
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/montague/structs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

from itertools import tee
import six
from six.moves import zip as izip
from characteristic import attributes, Attribute

Expand All @@ -21,7 +22,12 @@ class Sigil(object):


@attributes(['name', 'entry_point_groups', 'loadable_type',
'config', 'global_config'], apply_immutable=True)
'config', 'global_config',
Attribute('inner', default_value=None,
exclude_from_immutable=True, exclude_from_repr=True),
Attribute('outer', default_value=None,
exclude_from_immutable=True, exclude_from_repr=True)
], apply_immutable=True)
class LoadableConfig(object):
@classmethod
def app(cls, name, config, global_config):
Expand All @@ -47,6 +53,18 @@ def filter(cls, name, config, global_config):
loadable_type='filter',
entry_point_groups=loadable_type_entry_points['filter'])

def update(self, name=DEFAULT, config=DEFAULT, global_config=DEFAULT,
loadable_type=DEFAULT, entry_point_groups=DEFAULT):
update = {}
for key, val in six.iteritems(locals()):
if key == 'self':
continue
if val is DEFAULT:
update[key] = getattr(self, key)
else:
update[key] = val
return LoadableConfig(**update)


@attributes(['filters'], apply_with_init=False)
class ComposedFilter(object):
Expand Down

0 comments on commit 832aa12

Please sign in to comment.