@@ -130,6 +130,8 @@ def compile(**kwargs):
130130 :type image_path: :class:`str`
131131 :param precision: optional precision for numbers. :const:`5` by default.
132132 :type precision: :class:`int`
133+ :param custom_functions: optional mapping of custom functions
134+ :type custom_functions: :class:`collections.Mapping`
133135 :returns: the compiled CSS string
134136 :rtype: :class:`str`
135137 :raises sass.CompileError: when it fails for any reason
@@ -161,6 +163,8 @@ def compile(**kwargs):
161163 :type image_path: :class:`str`
162164 :param precision: optional precision for numbers. :const:`5` by default.
163165 :type precision: :class:`int`
166+ :param custom_functions: optional mapping of custom functions
167+ :type custom_functions: :class:`collections.Mapping`
164168 :returns: the compiled CSS string, or a pair of the compiled CSS string
165169 and the source map string if ``source_comments='map'``
166170 :rtype: :class:`str`, :class:`tuple`
@@ -195,6 +199,8 @@ def compile(**kwargs):
195199 :type image_path: :class:`str`
196200 :param precision: optional precision for numbers. :const:`5` by default.
197201 :type precision: :class:`int`
202+ :param custom_functions: optional mapping of custom functions
203+ :type custom_functions: :class:`collections.Mapping`
198204 :raises sass.CompileError: when it fails for any reason
199205 (for example the given SASS has broken syntax)
200206
@@ -212,6 +218,9 @@ def compile(**kwargs):
212218 .. versionadded:: 0.7.0
213219 Added ``precision`` parameter.
214220
221+ .. versionadded:: 0.7.0
222+ Added ``custom_functions`` parameter.
223+
215224 """
216225 modes = set ()
217226 for mode_name in MODES :
@@ -397,6 +406,7 @@ def and_join(strings):
397406 iterator = enumerate (strings )
398407 return ', ' .join ('and ' + s if i == last else s for i , s in iterator )
399408
409+
400410"""
401411This module provides datatypes to be used in custom sass functions.
402412
@@ -415,6 +425,7 @@ def and_join(strings):
415425
416426
417427class SassNumber (collections .namedtuple ('SassNumber' , ('value' , 'unit' ))):
428+
418429 def __new__ (cls , value , unit ):
419430 value = float (value )
420431 if not isinstance (unit , text_type ):
@@ -423,6 +434,7 @@ def __new__(cls, value, unit):
423434
424435
425436class SassColor (collections .namedtuple ('SassColor' , ('r' , 'g' , 'b' , 'a' ))):
437+
426438 def __new__ (cls , r , g , b , a ):
427439 r = float (r )
428440 g = float (g )
@@ -437,20 +449,23 @@ def __new__(cls, r, g, b, a):
437449
438450
439451class SassList (collections .namedtuple ('SassList' , ('items' , 'separator' ))):
452+
440453 def __new__ (cls , items , separator ):
441454 items = tuple (items )
442455 assert separator in SEPARATORS
443456 return super (SassList , cls ).__new__ (cls , items , separator )
444457
445458
446459class SassError (collections .namedtuple ('SassError' , ('msg' ,))):
460+
447461 def __new__ (cls , msg ):
448462 if not isinstance (msg , text_type ):
449463 msg = msg .decode ('UTF-8' )
450464 return super (SassError , cls ).__new__ (cls , msg )
451465
452466
453- class SassWarning (collections .namedtuple ('SassError' , ('msg' ,))):
467+ class SassWarning (collections .namedtuple ('SassWarning' , ('msg' ,))):
468+
454469 def __new__ (cls , msg ):
455470 if not isinstance (msg , text_type ):
456471 msg = msg .decode ('UTF-8' )
@@ -460,8 +475,12 @@ def __new__(cls, msg):
460475class SassMap (collections .Mapping ):
461476 """Because sass maps can have mapping types as keys, we need an immutable
462477 hashable mapping type.
478+
479+ .. versionadded:: 0.7.0
480+
463481 """
464- __slots__ = ('_dict' , '_hash' ,)
482+
483+ __slots__ = '_dict' , '_hash'
465484
466485 def __init__ (self , * args , ** kwargs ):
467486 self ._dict = dict (* args , ** kwargs )
0 commit comments