Adapt imports to new package structure

This commit is contained in:
Maximilian Keßler 2023-07-04 18:53:18 +02:00
parent 05e1822c3d
commit 6ae72a4b03
Signed by: max
GPG key ID: BCC5A619923C0BA5
14 changed files with 31 additions and 32 deletions

View file

@ -0,0 +1,4 @@
from .logger_setup import LoggerManager
logger_manager = LoggerManager()
logger = logger_manager.get_logger()

View file

@ -8,9 +8,9 @@ COLOR_INITIALS = 'rygbpt'
PLAYER_NAMES = ["Alice", "Bob", "Cathy", "Donald", "Emily", "Frank"] PLAYER_NAMES = ["Alice", "Bob", "Cathy", "Donald", "Emily", "Frank"]
#### hanab.live stuff # hanab.live stuff
# Id of no variant # id of no variant
NO_VARIANT_ID = 0 NO_VARIANT_ID = 0
# a map (num_suits, num_dark_suits) -> variant id of a variant on hanab.live fitting that distribution # a map (num_suits, num_dark_suits) -> variant id of a variant on hanab.live fitting that distribution

View file

@ -1,5 +1,5 @@
from typing import Optional
import psycopg2 import psycopg2
from typing import Optional, Dict
# global connection # global connection
conn = psycopg2.connect("dbname=hanab-live-2 user=postgres") conn = psycopg2.connect("dbname=hanab-live-2 user=postgres")

View file

@ -1,7 +1,7 @@
import json import json
import requests import requests
from pathlib import Path from pathlib import Path
from log_setup import logger from hanabi import logger
from .database import cur, conn from .database import cur, conn

View file

@ -4,10 +4,10 @@ import argparse
import verboselogs import verboselogs
from check_game import check_game from hanabi import logger
from hanabi.live.check_game import check_game
from hanabi.live.download_data import detailed_export_game from hanabi.live.download_data import detailed_export_game
from hanabi.live.compress import link from hanabi.live.compress import link
from hanabi.log_setup import logger, logger_manager
""" """
init db + populate tables init db + populate tables

View file

@ -1,12 +1,12 @@
import copy import copy
from typing import Tuple from typing import Tuple
from database import conn from hanabi.database import conn
from hanabi.live.compress import decompress_deck, decompress_actions, link from hanabi.live.compress import decompress_deck, decompress_actions, link
from hanabi import GameState from hanabi.game import GameState
from hanabi.live.hanab_live import HanabLiveInstance, HanabLiveGameState from hanabi.live.hanab_live import HanabLiveInstance, HanabLiveGameState
from sat import solve_sat from hanabi.solvers.sat import solve_sat
from hanabi.log_setup import logger from hanabi import logger
# returns minimal number T of turns (from game) after which instance was infeasible # returns minimal number T of turns (from game) after which instance was infeasible

8
hanabi/live/compress.py Executable file → Normal file
View file

@ -1,14 +1,10 @@
#! /bin/python3 #! /bin/python3
import json
import sys import sys
import more_itertools import more_itertools
from enum import Enum from typing import List, Union
from termcolor import colored
from typing import List, Optional, Union
from variants import variant_id, variant_name from hanabi.game import DeckCard, ActionType, Action, GameState, HanabiInstance
from hanabi import DeckCard, ActionType, Action, GameState, HanabiInstance
from hanab_live import HanabLiveGameState, HanabLiveInstance from hanab_live import HanabLiveGameState, HanabLiveInstance

View file

@ -9,7 +9,7 @@ from hanabi.live.compress import compress_deck, compress_actions, DeckCard, Acti
from hanabi.live.variants import variant_id, variant_name from hanabi.live.variants import variant_id, variant_name
from hanab_live import HanabLiveInstance, HanabLiveGameState from hanab_live import HanabLiveInstance, HanabLiveGameState
from hanabi.log_setup import logger from hanabi import logger
# #

View file

@ -4,17 +4,17 @@ import concurrent.futures
import traceback import traceback
from sat import solve_sat from hanabi.solvers.sat import solve_sat
from hanabi.database.database import conn, cur from hanabi.database.database import conn, cur
from hanabi.live.download_data import detailed_export_game from hanabi.live.download_data import detailed_export_game
from alive_progress import alive_bar from alive_progress import alive_bar
from hanabi.live.compress import decompress_deck, link from hanabi.live.compress import decompress_deck, link
from hanabi import HanabiInstance from hanabi.game import HanabiInstance
from threading import Lock from threading import Lock
from time import perf_counter from time import perf_counter
from greedy_solver import GameState, GreedyStrategy from hanabi.solvers.greedy_solver import GameState, GreedyStrategy
from hanabi.log_setup import logger from hanabi import logger
from deck_analyzer import analyze, InfeasibilityReason from hanabi.solvers.deck_analyzer import analyze, InfeasibilityReason
from hanabi.live.variants import Variant from hanabi.live.variants import Variant
MAX_PROCESSES = 6 MAX_PROCESSES = 6
@ -98,7 +98,7 @@ def get_decks_for_all_seeds():
res = cur.fetchall() res = cur.fetchall()
with alive_bar(len(res), title="Exporting decks") as bar: with alive_bar(len(res), title="Exporting decks") as bar:
for (game_id,) in res: for (game_id,) in res:
export_game(game_id) detailed_export_game(game_id)
bar() bar()

View file

@ -1,7 +1,6 @@
import json import json
import requests
import requests_cache import requests_cache
from log_setup import logger from hanabi import logger
# Cache all requests to site to reduce traffic and latency # Cache all requests to site to reduce traffic and latency

View file

@ -1,6 +1,6 @@
import enum import enum
from typing import List, Optional from typing import List, Optional
from hanabi import DeckCard, ActionType from hanabi.game import DeckCard, ActionType
from hanabi.database.database import cur from hanabi.database.database import cur

View file

@ -1,8 +1,8 @@
from hanabi.live.compress import DeckCard from hanabi.live.compress import DeckCard
from enum import Enum from enum import Enum
from database import conn from hanabi.database import conn
from hanabi import HanabiInstance, pp_deck from hanabi.game import HanabiInstance, pp_deck
from hanabi.live.compress import decompress_deck from hanabi.live.compress import decompress_deck

View file

@ -2,10 +2,10 @@
import collections import collections
import sys import sys
from enum import Enum from enum import Enum
from hanabi.log_setup import logger from hanabi import logger
from typing import Optional from typing import Optional
from hanabi import DeckCard, GameState, HanabiInstance from hanabi.game import DeckCard, GameState, HanabiInstance
from hanabi.live.compress import link, decompress_deck from hanabi.live.compress import link, decompress_deck
from hanabi.database.database import conn from hanabi.database.database import conn

View file

@ -3,11 +3,11 @@ from pysmt.shortcuts import Symbol, Bool, Not, Implies, Iff, And, Or, AtMostOne,
from pysmt.typing import INT from pysmt.typing import INT
from typing import Optional, Tuple from typing import Optional, Tuple
from hanabi import DeckCard, GameState, HanabiInstance from hanabi.game import DeckCard, GameState, HanabiInstance
from hanabi.live.compress import link, decompress_deck from hanabi.live.compress import link, decompress_deck
from greedy_solver import GreedyStrategy from greedy_solver import GreedyStrategy
from hanabi.constants import COLOR_INITIALS from hanabi.constants import COLOR_INITIALS
from hanabi.log_setup import logger from hanabi import logger
# literals to model game as sat instance to check for feasibility # literals to model game as sat instance to check for feasibility