nodes: 0, module; 1, function_definition; 2, function_name:load_css; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, comment:# Remove common prefix; 15, if_statement; 16, expression_statement; 17, return_statement; 18, comment:"""
          Creates a dict of all icons available in CSS file, and finds out
          what's their common prefix.
  
          :returns sorted icons dict, common icon prefix
          """; 19, assignment; 20, assignment; 21, assignment; 22, assignment; 23, assignment; 24, identifier:rule; 25, attribute; 26, block; 27, assignment; 28, boolean_operator; 29, block; 30, assignment; 31, expression_list; 32, identifier:icons; 33, call; 34, identifier:common_prefix; 35, None; 36, identifier:parser; 37, call; 38, identifier:stylesheet; 39, call; 40, identifier:is_icon; 41, call; 42, identifier:stylesheet; 43, identifier:rules; 44, expression_statement; 45, comment:# Skip CSS classes that are not icons; 46, if_statement; 47, comment:# Find out what the common prefix is; 48, if_statement; 49, for_statement; 50, identifier:common_prefix; 51, boolean_operator; 52, not_operator; 53, comparison_operator:len(common_prefix) > 0; 54, expression_statement; 55, for_statement; 56, expression_statement; 57, identifier:sorted_icons; 58, call; 59, identifier:sorted_icons; 60, identifier:common_prefix; 61, identifier:dict; 62, argument_list; 63, attribute; 64, argument_list; 65, attribute; 66, argument_list; 67, attribute; 68, argument_list; 69, assignment; 70, not_operator; 71, block; 72, comparison_operator:common_prefix is None; 73, block; 74, else_clause; 75, identifier:match; 76, call; 77, block; 78, identifier:common_prefix; 79, string; 80, attribute; 81, call; 82, integer:0; 83, assignment; 84, identifier:name; 85, call; 86, block; 87, assignment; 88, identifier:OrderedDict; 89, argument_list; 90, identifier:tinycss; 91, identifier:make_parser; 92, string; 93, identifier:parser; 94, identifier:parse_stylesheet_file; 95, attribute; 96, identifier:re; 97, identifier:compile; 98, string:"\.(.*):before,?"; 99, identifier:selector; 100, call; 101, call; 102, continue_statement; 103, identifier:common_prefix; 104, None; 105, expression_statement; 106, block; 107, attribute; 108, argument_list; 109, expression_statement; 110, for_statement; 111, identifier:self; 112, identifier:keep_prefix; 113, identifier:len; 114, argument_list; 115, identifier:non_prefixed_icons; 116, dictionary; 117, attribute; 118, argument_list; 119, expression_statement; 120, identifier:icons; 121, identifier:non_prefixed_icons; 122, call; 123, string_content:page3; 124, identifier:self; 125, identifier:css_file; 126, attribute; 127, argument_list; 128, attribute; 129, argument_list; 130, assignment; 131, expression_statement; 132, identifier:is_icon; 133, identifier:finditer; 134, identifier:selector; 135, assignment; 136, identifier:declaration; 137, attribute; 138, block; 139, identifier:common_prefix; 140, identifier:icons; 141, identifier:keys; 142, assignment; 143, identifier:sorted; 144, argument_list; 145, attribute; 146, identifier:as_css; 147, identifier:is_icon; 148, identifier:match; 149, identifier:selector; 150, identifier:common_prefix; 151, subscript; 152, assignment; 153, identifier:name; 154, subscript; 155, identifier:rule; 156, identifier:declarations; 157, if_statement; 158, subscript; 159, subscript; 160, call; 161, keyword_argument; 162, identifier:rule; 163, identifier:selector; 164, identifier:selector; 165, slice; 166, identifier:common_prefix; 167, call; 168, call; 169, integer:0; 170, comparison_operator:declaration.name == "content"; 171, block; 172, identifier:non_prefixed_icons; 173, subscript; 174, identifier:icons; 175, identifier:name; 176, attribute; 177, argument_list; 178, identifier:key; 179, lambda; 180, integer:1; 181, attribute; 182, argument_list; 183, attribute; 184, argument_list; 185, attribute; 186, string:"content"; 187, expression_statement; 188, comment:# Strip quotation marks; 189, if_statement; 190, expression_statement; 191, identifier:name; 192, slice; 193, identifier:icons; 194, identifier:items; 195, lambda_parameters; 196, subscript; 197, attribute; 198, identifier:commonprefix; 199, tuple; 200, identifier:match; 201, identifier:groups; 202, identifier:declaration; 203, identifier:name; 204, assignment; 205, call; 206, block; 207, assignment; 208, call; 209, identifier:t; 210, identifier:t; 211, integer:0; 212, identifier:os; 213, identifier:path; 214, identifier:common_prefix; 215, subscript; 216, identifier:val; 217, call; 218, attribute; 219, argument_list; 220, expression_statement; 221, subscript; 222, call; 223, identifier:len; 224, argument_list; 225, identifier:selector; 226, slice; 227, attribute; 228, argument_list; 229, identifier:re; 230, identifier:match; 231, string:"^['\"].*['\"]$"; 232, identifier:val; 233, assignment; 234, identifier:icons; 235, identifier:name; 236, identifier:unichr; 237, argument_list; 238, identifier:common_prefix; 239, integer:1; 240, attribute; 241, identifier:as_css; 242, identifier:val; 243, subscript; 244, call; 245, identifier:declaration; 246, identifier:value; 247, identifier:val; 248, slice; 249, identifier:int; 250, argument_list; 251, integer:1; 252, unary_operator; 253, subscript; 254, integer:16; 255, integer:1; 256, identifier:val; 257, slice; 258, integer:1
code: def load_css(self):
          """
          Creates a dict of all icons available in CSS file, and finds out
          what's their common prefix.
  
          :returns sorted icons dict, common icon prefix
          """
          icons = dict()
          common_prefix = None
          parser = tinycss.make_parser('page3')
          stylesheet = parser.parse_stylesheet_file(self.css_file)
  
          is_icon = re.compile("\.(.*):before,?")
  
          for rule in stylesheet.rules:
              selector = rule.selector.as_css()
  
              # Skip CSS classes that are not icons
              if not is_icon.match(selector):
                  continue
  
              # Find out what the common prefix is
              if common_prefix is None:
                  common_prefix = selector[1:]
              else:
                  common_prefix = os.path.commonprefix((common_prefix,
                                                        selector[1:]))
  
              for match in is_icon.finditer(selector):
                  name = match.groups()[0]
                  for declaration in rule.declarations:
                      if declaration.name == "content":
                          val = declaration.value.as_css()
                          # Strip quotation marks
                          if re.match("^['\"].*['\"]$", val):
                              val = val[1:-1]
                          icons[name] = unichr(int(val[1:], 16))
  
          common_prefix = common_prefix or ''
  
          # Remove common prefix
          if not self.keep_prefix and len(common_prefix) > 0:
              non_prefixed_icons = {}
              for name in icons.keys():
                  non_prefixed_icons[name[len(common_prefix):]] = icons[name]
              icons = non_prefixed_icons
  
          sorted_icons = OrderedDict(sorted(icons.items(), key=lambda t: t[0]))
  
          return sorted_icons, common_prefix