parameters: (self, declarations_str, inherited=None)
return_statement: return props
docstring: the given declarations to atomic properties
  
          Parameters
          ----------
          declarations_str : str
              A list of CSS declarations
          inherited : dict, optional
              Atomic properties indicating the inherited style context in which
              declarations_str is to be resolved. ``inherited`` should already
              be resolved, i.e. valid output of this method.
  
          Returns
          -------
          props : dict
              Atomic CSS 2.2 properties
  
          Examples
          --------
          >>> resolve = CSSResolver()
          >>> inherited = {'font-family': 'serif', 'font-weight': 'bold'}
          >>> out = resolve('''
          ...               border-color: BLUE RED;
          ...               font-size: 1em;
          ...               font-size: 2em;
          ...               font-weight: normal;
          ...               font-weight: inherit;
          ...               ''', inherited)
          >>> sorted(out.items())  # doctest: +NORMALIZE_WHITESPACE
          [('border-bottom-color', 'blue'),
           ('border-left-color', 'red'),
           ('border-right-color', 'red'),
           ('border-top-color', 'blue'),
           ('font-family', 'serif'),
           ('font-size', '24pt'),
           ('font-weight', 'bold')]
docstring_summary: the given declarations to atomic properties
docstring_tokens: the given declarations to atomic properties
function: def __call__(self, declarations_str, inherited=None):
          """ the given declarations to atomic properties
  
          Parameters
          ----------
          declarations_str : str
              A list of CSS declarations
          inherited : dict, optional
              Atomic properties indicating the inherited style context in which
              declarations_str is to be resolved. ``inherited`` should already
              be resolved, i.e. valid output of this method.
  
          Returns
          -------
          props : dict
              Atomic CSS 2.2 properties
  
          Examples
          --------
          >>> resolve = CSSResolver()
          >>> inherited = {'font-family': 'serif', 'font-weight': 'bold'}
          >>> out = resolve('''
          ...               border-color: BLUE RED;
          ...               font-size: 1em;
          ...               font-size: 2em;
          ...               font-weight: normal;
          ...               font-weight: inherit;
          ...               ''', inherited)
          >>> sorted(out.items())  # doctest: +NORMALIZE_WHITESPACE
          [('border-bottom-color', 'blue'),
           ('border-left-color', 'red'),
           ('border-right-color', 'red'),
           ('border-top-color', 'blue'),
           ('font-family', 'serif'),
           ('font-size', '24pt'),
           ('font-weight', 'bold')]
          """
  
          props = dict(self.atomize(self.parse(declarations_str)))
          if inherited is None:
              inherited = {}
  
          # 1. resolve inherited, initial
          for prop, val in inherited.items():
              if prop not in props:
                  props[prop] = val
  
          for prop, val in list(props.items()):
              if val == 'inherit':
                  val = inherited.get(prop, 'initial')
              if val == 'initial':
                  val = self.INITIAL_STYLE.get(prop)
  
              if val is None:
                  # we do not define a complete initial stylesheet
                  del props[prop]
              else:
                  props[prop] = val
  
          # 2. resolve relative font size
          if props.get('font-size'):
              if 'font-size' in inherited:
                  em_pt = inherited['font-size']
                  assert em_pt[-2:] == 'pt'
                  em_pt = float(em_pt[:-2])
              else:
                  em_pt = None
              props['font-size'] = self.size_to_pt(
                  props['font-size'], em_pt, conversions=self.FONT_SIZE_RATIOS)
  
              font_size = float(props['font-size'][:-2])
          else:
              font_size = None
  
          # 3. TODO: resolve other font-relative units
          for side in self.SIDES:
              prop = 'border-{side}-width'.format(side=side)
              if prop in props:
                  props[prop] = self.size_to_pt(
                      props[prop], em_pt=font_size,
                      conversions=self.BORDER_WIDTH_RATIOS)
              for prop in ['margin-{side}'.format(side=side),
                           'padding-{side}'.format(side=side)]:
                  if prop in props:
                      # TODO: support %
                      props[prop] = self.size_to_pt(
                          props[prop], em_pt=font_size,
                          conversions=self.MARGIN_RATIOS)
  
          return props
function_tokens: def __call__ ( self , declarations_str , inherited = None ) : props = dict ( self . atomize ( self . parse ( declarations_str ) ) ) if inherited is None : inherited = { } # 1. resolve inherited, initial for prop , val in inherited . items ( ) : if prop not in props : props [ prop ] = val for prop , val in list ( props . items ( ) ) : if val == 'inherit' : val = inherited . get ( prop , 'initial' ) if val == 'initial' : val = self . INITIAL_STYLE . get ( prop ) if val is None : # we do not define a complete initial stylesheet del props [ prop ] else : props [ prop ] = val # 2. resolve relative font size if props . get ( 'font-size' ) : if 'font-size' in inherited : em_pt = inherited [ 'font-size' ] assert em_pt [ - 2 : ] == 'pt' em_pt = float ( em_pt [ : - 2 ] ) else : em_pt = None props [ 'font-size' ] = self . size_to_pt ( props [ 'font-size' ] , em_pt , conversions = self . FONT_SIZE_RATIOS ) font_size = float ( props [ 'font-size' ] [ : - 2 ] ) else : font_size = None # 3. TODO: resolve other font-relative units for side in self . SIDES : prop = 'border-{side}-width' . format ( side = side ) if prop in props : props [ prop ] = self . size_to_pt ( props [ prop ] , em_pt = font_size , conversions = self . BORDER_WIDTH_RATIOS ) for prop in [ 'margin-{side}' . format ( side = side ) , 'padding-{side}' . format ( side = side ) ] : if prop in props : # TODO: support % props [ prop ] = self . size_to_pt ( props [ prop ] , em_pt = font_size , conversions = self . MARGIN_RATIOS ) return props