Skip to content

Commit

Permalink
fix main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander Land committed Jan 18, 2021
1 parent 60e7c85 commit faa5af5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions katrain/core/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,21 @@ def undo(self, n_times=1, stop_on_mistake=None):
):
self.set_current_node(cn.parent)
return
previous_cn = cn
if cn.shortcut_from:
cn = cn.shortcut_from
elif not cn.is_root:
cn = cn.parent
else:
break # root
if break_on_branch and len(cn.children) > 1:
break
elif break_on_main_branch and len(cn.children) > 1:
elif break_on_main_branch and cn.ordered_children[0] != previous_cn: # implies > 1 child
last_branching_node = cn
if break_on_main_branch:
cn = last_branching_node
self.set_current_node(cn)
if cn is not self.current_node:
self.set_current_node(cn)

def redo(self, n_times=1, stop_on_mistake=None):
if self.insert_mode:
Expand Down
12 changes: 8 additions & 4 deletions katrain/gui/popups.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,10 @@ def update_config(self, save_to_file=True):


class ConfigPopup(QuickConfigGui):
MODEL_ENDPOINTS = {"Latest distributed model": "https://katagotraining.org/api/networks/newest_training/",
"Strongest distributed model": "https://katagotraining.org/api/networks/get_strongest/"}
MODEL_ENDPOINTS = {
"Latest distributed model": "https://katagotraining.org/api/networks/newest_training/",
"Strongest distributed model": "https://katagotraining.org/api/networks/get_strongest/",
}
MODELS = {
"20 block model": "https://github.com/lightvector/KataGo/releases/download/v1.4.5/g170e-b20c256x2-s5303129600-d1228401921.bin.gz",
"30 block model": "https://github.com/lightvector/KataGo/releases/download/v1.4.5/g170-b30c320x2-s4824661760-d1229536699.bin.gz",
Expand Down Expand Up @@ -586,8 +588,10 @@ def download_complete(req, tmp_path, path, model):
try:
http = urllib3.PoolManager()
response = http.request("GET", url)
if response.status!=200:
raise Exception(f"Request to {url} returned code {response.status} != 200: {response.data.decode()}")
if response.status != 200:
raise Exception(
f"Request to {url} returned code {response.status} != 200: {response.data.decode()}"
)
dist_models[name] = json.loads(response.data.decode("utf-8"))["model_file"]
except Exception as e:
self.katrain.log(f"Failed to retrieve info for model: {e}", OUTPUT_INFO)
Expand Down

0 comments on commit faa5af5

Please sign in to comment.