nodes: 0, module; 1, function_definition; 2, function_name:get_all_tags_names_as_list; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:#Cache miss, computes everything; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; 15, expression_statement; 16, expression_statement; 17, if_statement; 18, return_statement; 19, identifier:admin; 20, False; 21, identifier:language; 22, string:"en"; 23, comment:""" Computes and cache two list containing all tags name sorted by natural order on name """; 24, identifier:admin; 25, block; 26, else_clause; 27, assignment; 28, assignment; 29, assignment; 30, identifier:tag; 31, binary_operator:common + org; 32, comment:# Is tag_name_with_translation correct by doing that like that ?; 33, block; 34, assignment; 35, assignment; 36, identifier:admin; 37, block; 38, subscript; 39, if_statement; 40, block; 41, identifier:s_stud; 42, call; 43, identifier:s_admin; 44, call; 45, tuple_pattern; 46, call; 47, identifier:common; 48, identifier:org; 49, expression_statement; 50, expression_statement; 51, if_statement; 52, subscript; 53, call; 54, subscript; 55, call; 56, return_statement; 57, attribute; 58, identifier:language; 59, boolean_operator; 60, block; 61, if_statement; 62, identifier:set; 63, argument_list; 64, identifier:set; 65, argument_list; 66, identifier:common; 67, identifier:_; 68, identifier:org; 69, attribute; 70, argument_list; 71, assignment; 72, call; 73, call; 74, block; 75, attribute; 76, identifier:language; 77, identifier:natsorted; 78, argument_list; 79, attribute; 80, identifier:language; 81, identifier:natsorted; 82, argument_list; 83, subscript; 84, identifier:self; 85, identifier:_all_tags_cache_list; 86, comparison_operator:self._all_tags_cache_list_admin != {}; 87, comparison_operator:language in self._all_tags_cache_list_admin; 88, return_statement; 89, comment:#Cache hit; 90, boolean_operator; 91, block; 92, identifier:self; 93, identifier:get_all_tags; 94, identifier:tag_name_with_translation; 95, conditional_expression:self.gettext(language, tag.get_name()) if tag.get_name() else ""; 96, attribute; 97, argument_list; 98, attribute; 99, argument_list; 100, expression_statement; 101, identifier:self; 102, identifier:_all_tags_cache_list_admin; 103, identifier:s_admin; 104, keyword_argument; 105, identifier:self; 106, identifier:_all_tags_cache_list; 107, identifier:s_stud; 108, keyword_argument; 109, attribute; 110, identifier:language; 111, attribute; 112, dictionary; 113, identifier:language; 114, attribute; 115, subscript; 116, comparison_operator:self._all_tags_cache_list != {}; 117, comparison_operator:language in self._all_tags_cache_list; 118, return_statement; 119, comment:#Cache hit; 120, call; 121, call; 122, string:""; 123, identifier:s_admin; 124, identifier:add; 125, identifier:tag_name_with_translation; 126, identifier:tag; 127, identifier:is_visible_for_student; 128, call; 129, identifier:key; 130, lambda; 131, identifier:key; 132, lambda; 133, identifier:self; 134, identifier:_all_tags_cache_list_admin; 135, identifier:self; 136, identifier:_all_tags_cache_list_admin; 137, identifier:self; 138, identifier:_all_tags_cache_list_admin; 139, attribute; 140, identifier:language; 141, attribute; 142, dictionary; 143, identifier:language; 144, attribute; 145, subscript; 146, attribute; 147, argument_list; 148, attribute; 149, argument_list; 150, attribute; 151, argument_list; 152, lambda_parameters; 153, call; 154, lambda_parameters; 155, call; 156, identifier:self; 157, identifier:_all_tags_cache_list_admin; 158, identifier:self; 159, identifier:_all_tags_cache_list; 160, identifier:self; 161, identifier:_all_tags_cache_list; 162, attribute; 163, identifier:language; 164, identifier:self; 165, identifier:gettext; 166, identifier:language; 167, call; 168, identifier:tag; 169, identifier:get_name; 170, identifier:s_stud; 171, identifier:add; 172, identifier:tag_name_with_translation; 173, identifier:y; 174, attribute; 175, argument_list; 176, identifier:y; 177, attribute; 178, argument_list; 179, identifier:self; 180, identifier:_all_tags_cache_list; 181, attribute; 182, argument_list; 183, identifier:y; 184, identifier:lower; 185, identifier:y; 186, identifier:lower; 187, identifier:tag; 188, identifier:get_name
code: def get_all_tags_names_as_list(self, admin=False, language="en"):
          """ Computes and cache two list containing all tags name sorted by natural order on name """
  
          if admin:
              if self._all_tags_cache_list_admin != {} and language in self._all_tags_cache_list_admin:
                  return self._all_tags_cache_list_admin[language] #Cache hit
          else:
              if self._all_tags_cache_list != {} and language in self._all_tags_cache_list:
                  return self._all_tags_cache_list[language] #Cache hit
                          
          #Cache miss, computes everything
          s_stud = set()
          s_admin = set()
          (common, _, org) = self.get_all_tags()
          for tag in common + org:
              # Is tag_name_with_translation correct by doing that like that ?
              tag_name_with_translation = self.gettext(language, tag.get_name()) if tag.get_name() else ""
              s_admin.add(tag_name_with_translation) 
              if tag.is_visible_for_student():
                  s_stud.add(tag_name_with_translation) 
          self._all_tags_cache_list_admin[language] = natsorted(s_admin, key=lambda y: y.lower())
          self._all_tags_cache_list[language] = natsorted(s_stud, key=lambda y: y.lower())
          
          if admin:
              return self._all_tags_cache_list_admin[language]
          return self._all_tags_cache_list[language]