示例#1
0
def __get_item_design_ids_from_name(item_name: str,
                                    items_data: EntitiesData) -> List[str]:
    results = core.get_ids_from_property_value(
        items_data,
        ITEM_DESIGN_DESCRIPTION_PROPERTY_NAME,
        item_name,
        fix_data_delegate=__fix_item_name)
    return results
示例#2
0
def _get_room_design_ids_from_name(room_name: str,
                                   room_designs_data: dict = None):
    if room_designs_data is None:
        room_designs_data = __room_designs_cache.get_data_dict3()

    results = core.get_ids_from_property_value(
        room_designs_data, ROOM_DESIGN_DESCRIPTION_PROPERTY_NAME, room_name)
    return results
示例#3
0
def _get_item_design_ids_from_name(item_name: str,
                                   items_designs_data: dict) -> list:
    results = core.get_ids_from_property_value(
        items_designs_data,
        ITEM_DESIGN_DESCRIPTION_PROPERTY_NAME,
        item_name,
        fix_data_delegate=_fix_item_name)
    return results
示例#4
0
def _get_room_design_ids_from_room_shortname(
        room_short_name: str, rooms_designs_data: entity.EntitiesDesignsData):
    return_best_match = any(char.isdigit() for char in room_short_name)
    results = core.get_ids_from_property_value(
        rooms_designs_data, ROOM_DESIGN_DESCRIPTION_PROPERTY_NAME_2,
        room_short_name)
    if results and return_best_match:
        results = [results[0]]
    return results
示例#5
0
def _get_item_design_ids_from_name(item_name: str,
                                   item_data: dict = None) -> list:
    if item_data is None:
        item_data = __item_designs_cache.get_data_dict3()

    results = core.get_ids_from_property_value(
        item_data,
        ITEM_DESIGN_DESCRIPTION_PROPERTY_NAME,
        item_name,
        fix_data_delegate=_fix_item_name)
    return results
示例#6
0
def _get_collection_design_id_from_name(collection_name, collection_data=None):
    if collection_data is None:
        collection_data = __collection_designs_cache.get_data_dict3()

    results = core.get_ids_from_property_value(
        collection_data, COLLECTION_DESIGN_DESCRIPTION_PROPERTY_NAME,
        collection_name)
    if len(results) > 0:
        return results[0]

    return None
示例#7
0
 async def get_entities_ids_by_name(
         self,
         entity_name: str,
         entities_data: EntitiesData = None) -> List[str]:
     entities_data = entities_data or await self.get_data_dict3()
     results = core.get_ids_from_property_value(
         entities_data,
         self.__description_property_name,
         entity_name,
         fix_data_delegate=self.__fix_data_delegate)
     return results
示例#8
0
def _get_room_design_ids_from_room_shortname(room_short_name: str,
                                             room_designs_data: dict = None):
    if room_designs_data is None:
        room_designs_data = __room_designs_cache.get_data_dict3()

    return_best_match = any(char.isdigit() for char in room_short_name)
    results = core.get_ids_from_property_value(
        room_designs_data, ROOM_DESIGN_DESCRIPTION_PROPERTY_NAME_2,
        room_short_name)
    if results and return_best_match:
        results = [results[0]]
    return results
示例#9
0
 def get_entity_design_ids_by_name(
         self,
         entity_name: str,
         entity_designs_data: Dict[str, Dict[str,
                                             object]] = None) -> List[str]:
     entity_designs_data = entity_designs_data or self.get_data_dict3()
     results = core.get_ids_from_property_value(
         entity_designs_data,
         self.__description_property_name,
         entity_name,
         fix_data_delegate=self.__fix_data_delegate)
     return results
示例#10
0
def _get_char_design_id_from_name(char_name: str, char_data: dict = None):
    if char_data is None:
        char_data = __character_designs_cache.get_data_dict3()

    results = core.get_ids_from_property_value(
        char_data,
        CHARACTER_DESIGN_DESCRIPTION_PROPERTY_NAME,
        char_name,
    )
    if len(results) > 0:
        return results[0]

    return None
示例#11
0
def get_item_details_by_training_id(
        training_id: str, items_data: EntitiesData,
        trainings_data: EntitiesData) -> List[entity.EntityDetails]:
    items_designs_ids = core.get_ids_from_property_value(
        items_data,
        training.TRAINING_DESIGN_KEY_NAME,
        training_id,
        fix_data_delegate=__fix_item_name,
        match_exact=True)
    result = [
        get_item_details_by_id(item_design_id, items_data, trainings_data)
        for item_design_id in items_designs_ids
    ]
    return result
示例#12
0
def _get_room_design_ids_from_room_shortname(room_short_name: str,
                                             room_designs_data: dict = None,
                                             return_on_first: bool = False):
    if room_designs_data is None:
        room_designs_data = __room_designs_cache.get_data_dict3()

    return_on_first = return_on_first or any(char.isdigit()
                                             for char in room_short_name)
    results = core.get_ids_from_property_value(
        room_designs_data,
        ROOM_DESIGN_DESCRIPTION_PROPERTY_NAME_2,
        room_short_name,
        return_on_first=return_on_first)
    return results
示例#13
0
def get_item_details_short_by_training_id(
        training_id: str,
        items_designs_data: entity.EntitiesDesignsData,
        return_best_match: bool = False) -> list:
    item_design_ids = core.get_ids_from_property_value(
        items_designs_data,
        'TrainingDesignId',
        training_id,
        fix_data_delegate=_fix_item_name,
        match_exact=True)
    result = [
        ' '.join(
            get_item_design_details_by_id(
                item_design_id, items_designs_data).get_details_as_text_long())
        for item_design_id in item_design_ids
    ]

    return result
示例#14
0
def get_item_details_short_by_training_id(
        training_id: str,
        item_design_data: dict = None,
        return_best_match: bool = False) -> list:
    if item_design_data is None:
        item_design_data = __item_designs_cache.get_data_dict3()

    item_design_ids = core.get_ids_from_property_value(
        item_design_data,
        'TrainingDesignId',
        training_id,
        fix_data_delegate=_fix_item_name,
        match_exact=True)
    result = [
        ' '.join(get_item_details_short_from_id_as_text(item_design_id))
        for item_design_id in item_design_ids
    ]

    return result
示例#15
0
def _get_room_design_ids_from_name(
        room_name: str,
        rooms_designs_data: entity.EntitiesDesignsData) -> List[str]:
    results = core.get_ids_from_property_value(
        rooms_designs_data, ROOM_DESIGN_DESCRIPTION_PROPERTY_NAME, room_name)
    return results
示例#16
0
def _get_research_design_ids_from_name(research_name: str, research_designs_data: dict = None, return_on_first: bool = False):
    if research_designs_data is None:
        research_designs_data = __research_designs_cache.get_data_dict3()

    results = core.get_ids_from_property_value(research_designs_data, RESEARCH_DESIGN_DESCRIPTION_PROPERTY_NAME, research_name, return_on_first=return_on_first)
    return results