nodes: 0, module; 1, function_definition; 2, function_name:sorted_filetype_items; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, while_statement; 10, comment:"""Sort the instance's filetypes in using order."""; 11, assignment; 12, assignment; 13, call; 14, block; 15, identifier:processed_types; 16, list; 17, identifier:file_type_items; 18, call; 19, identifier:len; 20, argument_list; 21, expression_statement; 22, expression_statement; 23, if_statement; 24, expression_statement; 25, expression_statement; 26, identifier:deque; 27, argument_list; 28, identifier:file_type_items; 29, assignment; 30, assignment; 31, comparison_operator:requirements is not None; 32, comment:# requirements have not been processed yet -> wait; 33, block; 34, call; 35, yield; 36, call; 37, pattern_list; 38, call; 39, identifier:requirements; 40, call; 41, identifier:requirements; 42, None; 43, expression_statement; 44, if_statement; 45, attribute; 46, argument_list; 47, expression_list; 48, attribute; 49, argument_list; 50, identifier:filetype; 51, identifier:filetype_info; 52, attribute; 53, argument_list; 54, attribute; 55, argument_list; 56, assignment; 57, identifier:missing; 58, block; 59, identifier:processed_types; 60, identifier:append; 61, identifier:filetype; 62, identifier:filetype; 63, identifier:filetype_info; 64, subscript; 65, identifier:items; 66, identifier:file_type_items; 67, identifier:popleft; 68, identifier:filetype_info; 69, identifier:get; 70, string; 71, identifier:missing; 72, list_comprehension; 73, expression_statement; 74, continue_statement; 75, attribute; 76, string; 77, string_content:requires; 78, identifier:req; 79, for_in_clause; 80, if_clause; 81, call; 82, identifier:self; 83, identifier:config; 84, string_content:file_types; 85, identifier:req; 86, identifier:requirements; 87, comparison_operator:req not in processed_types; 88, attribute; 89, argument_list; 90, identifier:req; 91, identifier:processed_types; 92, identifier:file_type_items; 93, identifier:append; 94, tuple; 95, identifier:filetype; 96, identifier:filetype_info
code: def sorted_filetype_items(self):
          """Sort the instance's filetypes in using order."""
          processed_types = []
          file_type_items = deque(self.config['file_types'].items())
          while len(file_type_items):
              filetype, filetype_info = file_type_items.popleft()
  
              requirements = filetype_info.get('requires')
              if requirements is not None:
                  # requirements have not been processed yet -> wait
                  missing = [req for req in requirements
                             if req not in processed_types]
                  if missing:
                      file_type_items.append((filetype, filetype_info))
                      continue
  
              processed_types.append(filetype)
              yield filetype, filetype_info