d7be73a4eb0f2458752978eb58153202b6bfc2e7,ch18/telegram-bot.py,PlayerBot,_read_leaderboard,#PlayerBot#Any#,100
Before Change
return result
def _read_leaderboard(self, log_file):
return []
def _save_log(self, session, bot_score):
data = {
"ts": time.time(),
After Change
return result
def _read_leaderboard(self, log_file):
with open(log_file, "rt", encoding="utf-8") as fd:
for l in fd:
data = json.loads(l)
bot_name = os.path.basename(data["model_file"])
user_name = data["player_id"].split(":")[0]
bot_score = data["bot_score"]
self._update_leaderboard(bot_score, bot_name, user_name)
def _update_leaderboard(self, bot_score, bot_name, user_name):
if bot_score > 0.5:
game.update_counts(self.leaderboard, bot_name, (1, 0, 0))
game.update_counts(self.leaderboard, user_name, (0, 1, 0))
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: d7be73a4eb0f2458752978eb58153202b6bfc2e7
Time: 2018-03-13
Author: max.lapan@gmail.com
File Name: ch18/telegram-bot.py
Class Name: PlayerBot
Method Name: _read_leaderboard
Project Name: ottogroup/palladium
Commit Name: 60a7dedc11701d99d76e9260979635e7b6474994
Time: 2019-11-05
Author: daniel.nouri@gmail.com
File Name: palladium/persistence.py
Class Name: FileLike
Method Name: read
Project Name: PyThaiNLP/pythainlp
Commit Name: 3edda76da80915d2ecc57b2b4f52a033195822bc
Time: 2018-11-01
Author: arthit@gmail.com
File Name: pythainlp/tag/unigram.py
Class Name:
Method Name: orchid_data
Project Name: Pinafore/qb
Commit Name: a4d0ee7b439752fb09e4c507082eb8aaeae72abb
Time: 2017-04-28
Author: ski.rodriguez@gmail.com
File Name: qanta/guesser/elasticsearch.py
Class Name: ElasticSearchGuesser
Method Name: load