Kronuz/pyScss

AttributeError: type object 'type' has no attribute 'sass_type_name'

Azd325 opened this issue · 1 comments

I think there is an issue in the API

>>> from scss.types import Color
>>> from scss.extension.core import darken
>>> color = Color.from_hex('#ccc')
>>> color
<Color #ccc>
>>> darken(color, 10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tim/.local/share/virtualenvs/tim-Q-X-l63L/lib/python2.7/site-packages/scss/extension/core.py", line 333, in darken
    return adjust_color(color, lightness=-amount)
  File "/Users/tim/.local/share/virtualenvs/tim-Q-X-l63L/lib/python2.7/site-packages/scss/extension/core.py", line 435, in adjust_color
    l += _interpret_percentage(lightness or zero, relto=100, clamp=False)
  File "/Users/tim/.local/share/virtualenvs/tim-Q-X-l63L/lib/python2.7/site-packages/scss/extension/core.py", line 91, in _interpret_percentage
    expect_type(n, Number, unit='%')
  File "/Users/tim/.local/share/virtualenvs/tim-Q-X-l63L/lib/python2.7/site-packages/scss/types.py", line 1320, in expect_type
    sass_type_names = list(set(t.sass_type_name for t in types))
  File "/Users/tim/.local/share/virtualenvs/tim-Q-X-l63L/lib/python2.7/site-packages/scss/types.py", line 1320, in <genexpr>
    sass_type_names = list(set(t.sass_type_name for t in types))
AttributeError: type object 'type' has no attribute 'sass_type_name'
>>>

I found a solution what I think is intended. :)

from scss.types import Number
darken(color,  Number(10))