def _get_properties(self, rule, scope, block):
        """
        Implements properties and variables extraction and assignment
        """
        prop, raw_value = (_prop_split_re.split(block.prop, 1) + [None])[:2]
        if raw_value is not None:
            raw_value = raw_value.strip()

        try:
            is_var = (block.prop[len(prop)] == '=')
        except IndexError:
            is_var = False
        if is_var:
            warn_deprecated(rule, "Assignment with = is deprecated; use : instead.")
        calculator = self._make_calculator(rule.namespace)
        prop = prop.strip()
        prop = calculator.do_glob_math(prop)
        if not prop:
            return

        _prop = (scope or '') + prop
        if is_var or prop.startswith('$') and raw_value is not None:
            # Pop off any flags: !default, !global
            is_default = False
            is_global = True  # eventually sass will default this to false
            while True:
                splits = raw_value.rsplit(None, 1)
                if len(splits) < 2 or not splits[1].startswith('!'):
                    break

                raw_value, flag = splits
                if flag == '!default':
                    is_default = True
                elif flag == '!global':
                    is_global = True
                else:
                    raise ValueError("Unrecognized flag: {0}".format(flag))

            # Variable assignment
            _prop = normalize_var(_prop)
            try:
                existing_value = rule.namespace.variable(_prop)
            except KeyError:
                existing_value = None

            is_defined = existing_value is not None and not existing_value.is_null
            if is_default and is_defined:
                pass
            else:
                if is_defined and prop.startswith('$') and prop[1].isupper():
                    log.warn("Constant %r redefined", prop)

                # Variable assignment is an expression, so it always performs
                # real division
                value = calculator.calculate(raw_value, divide=True)
                rule.namespace.set_variable(
                    _prop, value, local_only=not is_global)
        else:
            # Regular property destined for output
            _prop = calculator.apply_vars(_prop)
            if raw_value is None:
                value = None
            else:
                value = calculator.calculate(raw_value)

            if value is None:
                pass
            elif isinstance(value, six.string_types):
                # TODO kill this branch
                pass
            else:
                if value.is_null:
                    return
                style = rule.legacy_compiler_options.get(
                    'style', self.compiler.output_style)
                compress = style == 'compressed'
                value = value.render(compress=compress)

            rule.properties.append((_prop, value))
def _get_properties ( self , rule , scope , block ) : prop , raw_value = ( _prop_split_re . split ( block . prop , 1 ) + [ None ] ) [ : 2 ] if raw_value is not None : raw_value = raw_value . strip ( ) try : is_var = ( block . prop [ len ( prop ) ] == '=' ) except IndexError : is_var = False if is_var : warn_deprecated ( rule , "Assignment with = is deprecated; use : instead." ) calculator = self . _make_calculator ( rule . namespace ) prop = prop . strip ( ) prop = calculator . do_glob_math ( prop ) if not prop : return _prop = ( scope or '' ) + prop if is_var or prop . startswith ( '$' ) and raw_value is not None : is_default = False is_global = True while True : splits = raw_value . rsplit ( None , 1 ) if len ( splits ) < 2 or not splits [ 1 ] . startswith ( '!' ) : break raw_value , flag = splits if flag == '!default' : is_default = True elif flag == '!global' : is_global = True else : raise ValueError ( "Unrecognized flag: {0}" . format ( flag ) ) _prop = normalize_var ( _prop ) try : existing_value = rule . namespace . variable ( _prop ) except KeyError : existing_value = None is_defined = existing_value is not None and not existing_value . is_null if is_default and is_defined : pass else : if is_defined and prop . startswith ( '$' ) and prop [ 1 ] . isupper ( ) : log . warn ( "Constant %r redefined" , prop ) value = calculator . calculate ( raw_value , divide = True ) rule . namespace . set_variable ( _prop , value , local_only = not is_global ) else : _prop = calculator . apply_vars ( _prop ) if raw_value is None : value = None else : value = calculator . calculate ( raw_value ) if value is None : pass elif isinstance ( value , six . string_types ) : pass else : if value . is_null : return style = rule . legacy_compiler_options . get ( 'style' , self . compiler . output_style ) compress = style == 'compressed' value = value . render ( compress = compress ) rule . properties . append ( ( _prop , value ) )
Implements properties and variables extraction and assignment