<commit_before>from flask import Flask,session,redirect,url_for,request,render_template,abort,jsonify,flash
from itsdangerous import JSONWebSignatureSerializer
from osuapi import OsuApi, ReqConnector
from flaskext.markdown import Markdown
from datetime import timedelta
import importlib
import platform
import binascii
import requests
import logging
import redis
import utils
import json
import os

#Getting database connected
Redis= os.environ.get('Redis')
db = redis.Redis(host=Redis,decode_responses=True, db = 0)

#Getting Flask
app = Flask(__name__)
app.permanent_session_lifetime = timedelta(hours = 6)
app.db = db
utils.db = db
utils.session = session
md = Markdown(app) #for a markdown work, e.g FAQ

#Setting up log
log = logging.getLogger('Nurevam.site')
log.setLevel(logging.INFO)
format_log = logging.Formatter('%(asctime)s:\t%(levelname)s:\t%(name)s:\tFunction:%(funcName)s ||| MSG: %(message)s')
handler = logging.FileHandler(filename='Nurevam_site.log', encoding='utf-8', mode='w')
handler.setFormatter(format_log)
console = logging.StreamHandler()
console.setFormatter(format_log)
log.addHandler(handler)
log.addHandler(console)

if platform.system() == "Windows": #due to different path for linux and window
    path = "secret.json"
else:
    path = "/home/mave/Nurevam/secret.json"
    from systemd.journal import JournalHandler
    log.addHandler(JournalHandler())

#read files and save it to secret
with open (path,"r") as f:
    secret = json.load(f)

class Data_info(): #dirty way.
    pass
data_info = Data_info()

app.config['SECRET_KEY'] = secret["SECRET_KEY"]
data_info.OAUTH2_CLIENT_ID = secret['OAUTH2_CLIENT_ID']
data_info.OAUTH2_CLIENT_SECRET = secret['OAUTH2_CLIENT_SECRET']
data_info.OAUTH2_REDIRECT_URI = secret.get('OAUTH2_REDIRECT_URI', 'http://localhost:5000/confirm_login')
data_info.API_BASE_URL = 'https://discordapp.com/api'
data_info.AUTHORIZATION_BASE_URL = data_info.API_BASE_URL + '/oauth2/authorize'
data_info.AVATAR_BASE_URL = "https://cdn.discordapp.com/avatars/"
data_info.ICON_BASE_URL = "https://cdn.discordapp.com/icons/"
data_info.DEFAULT_AVATAR = "https://discordapp.com/assets/1cbd08c76f8af6dddce02c5138971129.png"
data_info.DOMAIN = secret.get('VIRTUAL_HOST', 'localhost:5000')
data_info.TOKEN_URL = data_info.API_BASE_URL + '/oauth2/token'
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
data_info.headers = {"Authorization": "Bot " + secret["nurevam_token"]}
utils.data_info = data_info
osu_api = OsuApi(secret["osu"], connector=ReqConnector())

files_cogs = db.smembers("Website:Cogs")<commit_msg>Systemd not found,will check this later<commit_after>from flask import Flask,session,redirect,url_for,request,render_template,abort,jsonify,flash
from itsdangerous import JSONWebSignatureSerializer
from osuapi import OsuApi, ReqConnector
from flaskext.markdown import Markdown
from datetime import timedelta
import importlib
import platform
import binascii
import requests
import logging
import redis
import utils
import json
import os

#Getting database connected
Redis= os.environ.get('Redis')
db = redis.Redis(host=Redis,decode_responses=True, db = 0)

#Getting Flask
app = Flask(__name__)
app.permanent_session_lifetime = timedelta(hours = 6)
app.db = db
utils.db = db
utils.session = session
md = Markdown(app) #for a markdown work, e.g FAQ

#Setting up log
log = logging.getLogger('Nurevam.site')
log.setLevel(logging.INFO)
format_log = logging.Formatter('%(asctime)s:\t%(levelname)s:\t%(name)s:\tFunction:%(funcName)s ||| MSG: %(message)s')
handler = logging.FileHandler(filename='Nurevam_site.log', encoding='utf-8', mode='w')
handler.setFormatter(format_log)
console = logging.StreamHandler()
console.setFormatter(format_log)
log.addHandler(handler)
log.addHandler(console)

if platform.system() == "Windows": #due to different path for linux and window
    path = "secret.json"
else:
    path = "/home/mave/Nurevam/secret.json"
    # from systemd.journal import JournalHandler
    # log.addHandler(JournalHandler())

#read files and save it to secret
with open (path,"r") as f:
    secret = json.load(f)

class Data_info(): #dirty way.
    pass
data_info = Data_info()

app.config['SECRET_KEY'] = secret["SECRET_KEY"]
data_info.OAUTH2_CLIENT_ID = secret['OAUTH2_CLIENT_ID']
data_info.OAUTH2_CLIENT_SECRET = secret['OAUTH2_CLIENT_SECRET']
data_info.OAUTH2_REDIRECT_URI = secret.get('OAUTH2_REDIRECT_URI', 'http://localhost:5000/confirm_login')
data_info.API_BASE_URL = 'https://discordapp.com/api'
data_info.AUTHORIZATION_BASE_URL = data_info.API_BASE_URL + '/oauth2/authorize'
data_info.AVATAR_BASE_URL = "https://cdn.discordapp.com/avatars/"
data_info.ICON_BASE_URL = "https://cdn.discordapp.com/icons/"
data_info.DEFAULT_AVATAR = "https://discordapp.com/assets/1cbd08c76f8af6dddce02c5138971129.png"
data_info.DOMAIN = secret.get('VIRTUAL_HOST', 'localhost:5000')
data_info.TOKEN_URL = data_info.API_BASE_URL + '/oauth2/token'
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
data_info.headers = {"Authorization": "Bot " + secret["nurevam_token"]}
utils.data_info = data_info
osu_api = OsuApi(secret["osu"], connector=ReqConnector())

files_cogs = db.smembers("Website:Cogs")
{'fraction_non_alphanumeric': 0.1262645914396887, 'fraction_numerical': 0.015175097276264591, 'mean_word_length': 6.836890243902439, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1939064', 'n_tokens_mistral': 1877, 'n_tokens_neox': 1832, 'n_words': 344}