当前位置: 首页>>代码示例>>Python>>正文


Python Parser.get_ship_for_dict方法代码示例

本文整理汇总了Python中parsing.parser.Parser.get_ship_for_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.get_ship_for_dict方法的具体用法?Python Parser.get_ship_for_dict怎么用?Python Parser.get_ship_for_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在parsing.parser.Parser的用法示例。


在下文中一共展示了Parser.get_ship_for_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_ship_descriptor

# 需要导入模块: from parsing.parser import Parser [as 别名]
# 或者: from parsing.parser.Parser import get_ship_for_dict [as 别名]
 def parse_ship_descriptor(ship: Ship, line: dict, lines: list, event: tuple):
     """
     Parse an event_descriptor of the SHIP type. Supports ability,
     component and crew type operations.
     :param ship: Ship instance for the spawn described by lines
     :param line: Trigger line dictionary
     :param lines: List of lines in this spawn
     :param event: Event descriptor tuple (PatternParser docstring)
     :return: The result of results this SHIP event descriptor
     """
     if event[0] != Patterns.SHIP:
         raise InvalidDescriptor(event)
     event_type, args = event[1], event[2:]  # "ability", "component", "crew"
     # Parse Component selected
     if event_type == "component":
         # Component must be selected on the Ship for this spawn
         component, = args
         return PatternParser.get_component_in_ship(lines, ship, component)
     # Parse Crew selected
     elif event_type == "crew":
         crew, = args
         return PatternParser.get_crew_in_ship(ship, crew)
     # Parse Ability Available
     elif event_type == "ability":
         return PatternParser.parse_ability_availability(line, lines, event, ship)
     # Parse ship type selected
     elif event_type == "type":
         # TODO: Optimize usage
         player = Parser.get_player_id_list(lines)
         abs_dict = Parser.get_abilities_dict(lines, player)
         ship_name = ship.name if ship is None else Parser.get_ship_for_dict(abs_dict)
         ship_type, = args
         return get_ship_category(ship_name) == ship_type
     raise InvalidDescriptor(event)
开发者ID:RedFantom,项目名称:GSF-Parser-Public,代码行数:36,代码来源:patterns.py

示例2: check_ships_file

# 需要导入模块: from parsing.parser import Parser [as 别名]
# 或者: from parsing.parser.Parser import get_ship_for_dict [as 别名]
 def check_ships_file(dictionary, abilities):
     for list in abilities:
         for dict in list:
             ships_list = Parser.get_ship_for_dict(dict)
             print(ships_list)
             for ship, intvar in dictionary.items():
                 if intvar.get() == 1:
                     print("Required: ", ship)
                     if variables.settings["gui"]["faction"] == "empire":
                         pass
                     elif variables.settings["gui"]["faction"] == "republic":
                         ships_list = [abls.rep_ships[name] for name in ships_list]
                     else:
                         raise ValueError("faction found not valid")
                     if ship in ships_list:
                         return True
     return False
开发者ID:RedFantom,项目名称:GSF-Parser-Public,代码行数:19,代码来源:filters.py

示例3: _select_date

# 需要导入模块: from parsing.parser import Parser [as 别名]
# 或者: from parsing.parser.Parser import get_ship_for_dict [as 别名]
 def _select_date(self, date: datetime):
     """Callback for Calendar widget selection command"""
     self.clear_data_widgets()
     self._tree.delete(*self._tree.get_children(""))
     if date not in self._dates:
         return
     self._files: List[str] = self._dates[date]
     for f, file in enumerate(sorted(self._files)):
         name = Parser.get_player_name_raw(file)
         cube, matches, spawns = Parser.split_combatlog_file(file)
         for m, match in enumerate(sorted(matches[::2])):
             match = datetime.strftime(match, "%H:%M, {}".format(name))
             match_iid = "{},{}".format(f, m)
             self._tree.insert("", tk.END, text=match, iid=match_iid)
             for s, spawn in enumerate(sorted(spawns[m])):
                 spawn = datetime.strftime(spawn, "%H:%M:%S")
                 player_list: List[str] = Parser.get_player_id_list(cube[m][s])
                 abs_dict: Dict[str: int] = Parser.get_abilities_dict(cube[m][s], player_list)
                 ships: List[str] = Parser.get_ship_for_dict(abs_dict)
                 ship = self.format_ships_list(ships)
                 spawn = "{}{}".format(spawn, ship)
                 spawn_iid = "{},{},{}".format(f, m, s)
                 self._tree.insert(match_iid, tk.END, text=spawn, iid=spawn_iid)
开发者ID:RedFantom,项目名称:GSF-Parser-Public,代码行数:25,代码来源:file.py


注:本文中的parsing.parser.Parser.get_ship_for_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。