fix cache

This commit is contained in:
Sander Land committed 2020-12-21 11:48:06 +01:00
1 parent 801f483da1
commit 999954cc8d
4 files changed
+14 -6

No files matched your search

+5
View File
@@ -707,6 +707,11 @@ def run_app():
print(f"Exception {inst.__class__}: {inst.args}\n{trace}")
return ExceptionManager.PASS
import yappi
yappi.set_clock_type("cpu")
yappi.start()
ExceptionManager.add_handler(CrashHandler())
app = KaTrainApp()
signal.signal(signal.SIGINT, app.signal_handler)
+6 -4
View File
@@ -396,7 +396,7 @@ class Game:
+ f"\ncaptures: {self.prisoner_count}"
)
def generate_filename(self):
def update_root_properties(self):
def player_name(player_info):
if player_info.name and player_info.player_type == PLAYER_HUMAN:
return player_info.name
@@ -413,8 +413,10 @@ class Game:
x_properties[bw + "R"] = rank_label(player_info.calculated_rank)
if "+" in str(self.end_result):
x_properties["RE"] = self.end_result
x_properties["KTV"] = ANALYSIS_FORMAT_VERSION
self.root.properties = {**root_properties, **{k: [v] for k, v in x_properties.items()}}
def generate_filename(self):
self.update_root_properties()
player_names = {
bw: re.sub(r"[\u200b\u3164'<>:\"/\\|?*]", "", self.root.get_property("P" + bw, bw)) for bw in "BW"
}
@@ -422,14 +424,14 @@ class Game:
return f"{base_game_name} {self.game_id}.sgf"
def write_sgf(
self, filename: str = None, trainer_config: Optional[Dict] = None,
self, filename: str, trainer_config: Optional[Dict] = None,
):
if trainer_config is None:
trainer_config = self.katrain.config("trainer", {})
save_feedback = trainer_config.get("save_feedback", False)
eval_thresholds = trainer_config["eval_thresholds"]
save_analysis = trainer_config.get("save_analysis", False)
self.update_root_properties()
show_dots_for = {
bw: trainer_config.get("eval_show_ai", True) or self.katrain.players_info[bw].human for bw in "BW"
}
+1
View File
@@ -141,6 +141,7 @@ class GameNode(SGFNode):
]
properties["CA"] = ["UTF-8"]
properties["AP"] = [f"{PROGRAM_NAME}:{VERSION}"]
properties["KTV"] = [ANALYSIS_FORMAT_VERSION]
if self.shortcut_from:
properties["KTSF"] = [id(self.shortcut_from)]
elif "KTSF" in properties:
+2 -2
View File
@@ -29,7 +29,7 @@ from katrain.core.constants import (
OUTPUT_ERROR,
OUTPUT_INFO,
STATUS_INFO,
DATA_FOLDER,
DATA_FOLDER, SGF_INTERNAL_COMMENTS_MARKER,
)
from katrain.core.engine import KataGoEngine
from katrain.core.lang import i18n, rank_label
@@ -267,7 +267,7 @@ class NewGamePopup(QuickConfigGui):
def update_from_current_game(self, *args):
for bw in "BW":
name = self.katrain.game.root.get_property("P" + bw, None)
if name:
if name and SGF_INTERNAL_COMMENTS_MARKER not in name:
self.player_name[bw].text = name
rules = self.normalized_rules()
self.km.text = str(self.katrain.game.root.komi)