def _exec_command(self, string_return=False): result = {IS_INSTANCE: [], HAS_INSTANCES: [], BOTH: [], NO_TAXON: []} target_entities = self._read_target_entities() targeted = 0 for an_entity in target_entities: print an_entity type_relation = self._decide_type_relation(an_entity) if type_relation == IS_INSTANCE: result[IS_INSTANCE].append(self._json_dumper.json_of_entity(an_entity)) elif type_relation == HAS_INSTANCES: result[HAS_INSTANCES].append(self._json_dumper.json_of_entity(an_entity)) elif type_relation == BOTH: result[BOTH].append(self._json_dumper.json_of_entity(an_entity)) else: result[NO_TAXON].append(self._json_dumper.json_of_entity(an_entity)) targeted += 1 if string_return: return json_to_string(result, indent=4) else: write_json_object(result, self._out_file, indent=4)
def _serialize_results(self, string_return): print "\n\nSerializing results...\n\n" write_json_object(json_object=self._candidate_classes, path=self._out_file, indent=4)
def _serialize_results(self, string_return): # TODO: implement string_return mode. Now, we are assuming string_return=False write_json_object(json_object=self._summary_list, path=self._out_file, indent=4)
def _serialize_results(self, target_classes, string_return): # TODO: consider string_return?? write_json_object(json_object=target_classes, path=self._out_file, indent=4)