mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
move networks commands to [str, Optional[dict]] across the board
and some other updates PrintHTML is an experiment and is unlikely the solution I'll go with
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
import logging
|
||||
|
||||
class PlandoItem(NamedTuple):
|
||||
item: str
|
||||
location: str
|
||||
world: Union[bool, str] = False # False -> own world, True -> not own world
|
||||
from_pool: bool = True # if item should be removed from item pool
|
||||
force: str = 'silent' # false -> warns if item not successfully placed. true -> errors out on failure to place item.
|
||||
|
||||
def warn(self, warning: str):
|
||||
if self.force in ['true', 'fail', 'failure', 'none', 'false', 'warn', 'warning']:
|
||||
logging.warning(f'{warning}')
|
||||
else:
|
||||
logging.debug(f'{warning}')
|
||||
|
||||
def failed(self, warning: str, exception=Exception):
|
||||
if self.force in ['true', 'fail', 'failure']:
|
||||
raise exception(warning)
|
||||
else:
|
||||
self.warn(warning)
|
||||
|
||||
|
||||
class PlandoConnection(NamedTuple):
|
||||
|
||||
Reference in New Issue
Block a user