Spaces:
Sleeping
Sleeping
TheYoBots commited on
Commit ·
44c690c
1
Parent(s): b8a9a07
Minor Updates
Browse files- ColorLogger.py +1 -1
- config.yml.default +1 -0
- lishogi.py +3 -2
- logging_pool.py +1 -1
- model.py +1 -2
ColorLogger.py
CHANGED
|
@@ -117,7 +117,7 @@ def add_coloring_to_emit_ansi(fn):
|
|
| 117 |
# #'\x1b[35m' # pink
|
| 118 |
else:
|
| 119 |
color = '\x1b[0m' # normal
|
| 120 |
-
args[1].msg = f'{color}
|
| 121 |
# print "after"
|
| 122 |
return fn(*args)
|
| 123 |
|
|
|
|
| 117 |
# #'\x1b[35m' # pink
|
| 118 |
else:
|
| 119 |
color = '\x1b[0m' # normal
|
| 120 |
+
args[1].msg = f'{color} {args[1].msg}\x1b[0m' # normal
|
| 121 |
# print "after"
|
| 122 |
return fn(*args)
|
| 123 |
|
config.yml.default
CHANGED
|
@@ -45,6 +45,7 @@ challenge: # Incoming challenges.
|
|
| 45 |
variants: # Shogi variants to accept. Currently lishogi only supports 'standard and 'from position' games.
|
| 46 |
- standard
|
| 47 |
# - fromPosition
|
|
|
|
| 48 |
time_controls: # Time controls to accept.
|
| 49 |
- ultraBullet
|
| 50 |
- bullet
|
|
|
|
| 45 |
variants: # Shogi variants to accept. Currently lishogi only supports 'standard and 'from position' games.
|
| 46 |
- standard
|
| 47 |
# - fromPosition
|
| 48 |
+
# - minishogi # Not yet supported. Removing the Hash '#' will only allow the bot to accept challenges, it won't play minishogi.
|
| 49 |
time_controls: # Time controls to accept.
|
| 50 |
- ultraBullet
|
| 51 |
- bullet
|
lishogi.py
CHANGED
|
@@ -43,10 +43,11 @@ class Lishogi:
|
|
| 43 |
max_time=60,
|
| 44 |
interval=0.1,
|
| 45 |
giveup=is_final)
|
| 46 |
-
def api_get(self, path):
|
| 47 |
url = urljoin(self.baseUrl, path)
|
| 48 |
response = self.session.get(url, timeout=2)
|
| 49 |
-
|
|
|
|
| 50 |
return response.json()
|
| 51 |
|
| 52 |
@backoff.on_exception(backoff.constant,
|
|
|
|
| 43 |
max_time=60,
|
| 44 |
interval=0.1,
|
| 45 |
giveup=is_final)
|
| 46 |
+
def api_get(self, path, , raise_for_status=True):
|
| 47 |
url = urljoin(self.baseUrl, path)
|
| 48 |
response = self.session.get(url, timeout=2)
|
| 49 |
+
if raise_for_status:
|
| 50 |
+
response.raise_for_status()
|
| 51 |
return response.json()
|
| 52 |
|
| 53 |
@backoff.on_exception(backoff.constant,
|
logging_pool.py
CHANGED
|
@@ -8,7 +8,7 @@ def error(msg, *args):
|
|
| 8 |
return multiprocessing.get_logger().error(msg, *args)
|
| 9 |
|
| 10 |
|
| 11 |
-
class LogExceptions
|
| 12 |
def __init__(self, callable):
|
| 13 |
self.__callable = callable
|
| 14 |
|
|
|
|
| 8 |
return multiprocessing.get_logger().error(msg, *args)
|
| 9 |
|
| 10 |
|
| 11 |
+
class LogExceptions:
|
| 12 |
def __init__(self, callable):
|
| 13 |
self.__callable = callable
|
| 14 |
|
model.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import time
|
| 2 |
from urllib.parse import urljoin
|
| 3 |
|
| 4 |
-
|
| 5 |
class Challenge:
|
| 6 |
def __init__(self, c_info):
|
| 7 |
self.id = c_info["id"]
|
|
@@ -34,7 +33,7 @@ class Challenge:
|
|
| 34 |
def is_supported(self, config):
|
| 35 |
if not config.get("accept_bot", True) and self.challenger_is_bot:
|
| 36 |
return False
|
| 37 |
-
if config.get("only_bot", False) and
|
| 38 |
return False
|
| 39 |
variants = config["variants"]
|
| 40 |
tc = config["time_controls"]
|
|
|
|
| 1 |
import time
|
| 2 |
from urllib.parse import urljoin
|
| 3 |
|
|
|
|
| 4 |
class Challenge:
|
| 5 |
def __init__(self, c_info):
|
| 6 |
self.id = c_info["id"]
|
|
|
|
| 33 |
def is_supported(self, config):
|
| 34 |
if not config.get("accept_bot", True) and self.challenger_is_bot:
|
| 35 |
return False
|
| 36 |
+
if config.get("only_bot", False) and not self.challenger_is_bot:
|
| 37 |
return False
|
| 38 |
variants = config["variants"]
|
| 39 |
tc = config["time_controls"]
|