text stringlengths 1 93.6k |
|---|
print("# of episode :{}, avg score : {:.1f} alpha:{:.4f}".format(n_epi, score/print_interval, pi.log_alpha.exp()))
|
score = 0.0
|
env.close()
|
if __name__ == '__main__':
|
main()
|
# <FILESEP>
|
#!/usr/bin/env python
|
# s3s (ↄ) 2022-2024 eli fessler (frozenpandaman), clovervidia
|
# Based on splatnet2statink (ↄ) 2017-2024 eli fessler (frozenpandaman), clovervidia
|
# https://github.com/frozenpandaman/s3s
|
# License: GPLv3
|
import argparse, base64, datetime, json, os, shutil, re, sys, time, uuid
|
from concurrent.futures import ThreadPoolExecutor
|
from subprocess import call
|
import requests, msgpack
|
from packaging import version
|
import iksm, utils
|
A_VERSION = "0.6.7"
|
DEBUG = False
|
os.system("") # ANSI escape setup
|
if sys.version_info[1] >= 7: # only works on python 3.7+
|
sys.stdout.reconfigure(encoding='utf-8') # note: please stop using git bash
|
# CONFIG.TXT CREATION
|
if getattr(sys, 'frozen', False): # place config.txt in same directory as script (bundled or not)
|
app_path = os.path.dirname(sys.executable)
|
elif __file__:
|
app_path = os.path.dirname(__file__)
|
config_path = os.path.join(app_path, "config.txt")
|
try:
|
config_file = open(config_path, "r")
|
CONFIG_DATA = json.load(config_file)
|
config_file.close()
|
except (IOError, ValueError):
|
print("Generating new config file.")
|
CONFIG_DATA = {"api_key": "", "acc_loc": "", "gtoken": "", "bullettoken": "", "session_token": "", "f_gen": "https://api.imink.app/f"}
|
config_file = open(config_path, "w")
|
config_file.seek(0)
|
config_file.write(json.dumps(CONFIG_DATA, indent=4, sort_keys=False, separators=(',', ': ')))
|
config_file.close()
|
config_file = open(config_path, "r")
|
CONFIG_DATA = json.load(config_file)
|
config_file.close()
|
# SET GLOBALS
|
API_KEY = CONFIG_DATA["api_key"] # for stat.ink
|
USER_LANG = CONFIG_DATA["acc_loc"][:5] # user input
|
USER_COUNTRY = CONFIG_DATA["acc_loc"][-2:] # nintendo account info
|
GTOKEN = CONFIG_DATA["gtoken"] # for accessing splatnet - base64 json web token
|
BULLETTOKEN = CONFIG_DATA["bullettoken"] # for accessing splatnet - base64
|
SESSION_TOKEN = CONFIG_DATA["session_token"] # for nintendo login
|
F_GEN_URL = CONFIG_DATA["f_gen"] # endpoint for generating f (imink API by default)
|
thread_pool = ThreadPoolExecutor(max_workers=2)
|
# SET HTTP HEADERS
|
DEFAULT_USER_AGENT = 'Mozilla/5.0 (Linux; Android 14; Pixel 7a) ' \
|
'AppleWebKit/537.36 (KHTML, like Gecko) ' \
|
'Chrome/120.0.6099.230 Mobile Safari/537.36'
|
APP_USER_AGENT = str(CONFIG_DATA.get("app_user_agent", DEFAULT_USER_AGENT))
|
def write_config(tokens):
|
'''Writes config file and updates the global variables.'''
|
config_file = open(config_path, "w")
|
config_file.seek(0)
|
config_file.write(json.dumps(tokens, indent=4, sort_keys=False, separators=(',', ': ')))
|
config_file.close()
|
config_file = open(config_path, "r")
|
CONFIG_DATA = json.load(config_file)
|
global API_KEY
|
API_KEY = CONFIG_DATA["api_key"]
|
global USER_LANG
|
USER_LANG = CONFIG_DATA["acc_loc"][:5]
|
global USER_COUNTRY
|
USER_COUNTRY = CONFIG_DATA["acc_loc"][-2:]
|
global GTOKEN
|
GTOKEN = CONFIG_DATA["gtoken"]
|
global BULLETTOKEN
|
BULLETTOKEN = CONFIG_DATA["bullettoken"]
|
global SESSION_TOKEN
|
SESSION_TOKEN = CONFIG_DATA["session_token"]
|
config_file.close()
|
def headbutt(forcelang=None):
|
'''Returns a (dynamic!) header used for GraphQL requests.'''
|
if forcelang:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.