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