class_docstr: A callable for parsing and resolving CSS to atomic properties
  
      
docstr: 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')]
docstr_tok: ["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","'",")","]"]
code: 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
  
file_path: catboost/contrib/python/pandas/py2/pandas/io/formats/css.py
imports: import re
  import warnings
label_desc: Use image node_id 1 for calling the CSSResolver obj's underlying member method code with example usage: obj.__call__(declarations_str, inherited) and returns: props