diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-26 18:08:49 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-26 18:08:49 -0700 |
commit | 6a8efa934d9a91c0916ecbc6659f275e25858bc6 (patch) | |
tree | b5d490339631d2ffa144eeb26d81b66ee128883f /scss/types.py | |
parent | 9f0c60e02e76d0fb06538160eb0b36df72abca1a (diff) | |
download | pyscss-6a8efa934d9a91c0916ecbc6659f275e25858bc6.tar.gz |
Partial support for slurpy named arguments.
Diffstat (limited to 'scss/types.py')
-rw-r--r-- | scss/types.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scss/types.py b/scss/types.py index 05973fe..5803b24 100644 --- a/scss/types.py +++ b/scss/types.py @@ -733,6 +733,23 @@ class List(Value): return List([-item for item in self], use_comma=self.use_comma) +class Arglist(List): + """An argument list. Acts mostly like a list, with keyword arguments sort + of tacked on separately, and only accessible via Python (or the Sass + `keywords` function). + """ + sass_type_name = 'arglist' + keywords_retrieved = False + + def __init__(self, args, kwargs): + self._kwargs = Map(kwargs) + super(Arglist, self).__init__(args, use_comma=True) + + def extract_keywords(self): + self.keywords_retrieved = True + return self._kwargs + + def _constrain(value, lb=0, ub=1): """Helper for Color constructors. Constrains a value to a range.""" if value < lb: |