Beispiel #1
0
def message(update: Update, context: CallbackContext):
    """Usage: <IP-address> """
    user_data = context.user_data

    if not update.message.text: return

    text = update.message.text.lower()
    if text == ("ru" or "en"):
        user_data['lang'] = text
        return

    if text != 'default':
        if not validUrl(text):
            logging.info("Invalid URL, too long")
            return

    data(update.effective_user.id, text)

    user_data['url'] = data(update.effective_user.id)

    update.message.reply_chat_action(ChatAction.TYPING)
    update.message.reply_text(
        _('Server addess changed to ') + user_data['url'], ParseMode.MARKDOWN)
Beispiel #2
0
def check_database(update: Update, context: CallbackContext):
    user_data = context.user_data

    try:
        user_data['url']

    except KeyError:
        user_data['url'] = data(update.effective_user.id)

        global lang_code
        lc = update.effective_user.language_code

        user_data['lang'] = (lc if lc and gettext.find(domain, "locale", [lc])
                             else 'en')

    if lang_code != user_data['lang']:
        lang_code = user_data['lang']

        lang = gettext.translation(domain, "locale", [lang_code])
        lang.install(['ngettext'])

    logging.info(
        update_object_type(update).__class__.__name__ + " recieved from " +
        name_and_id(update.effective_user))
Beispiel #3
0
from tkinter import ttk
from PIL import ImageTk, Image
import db
"""
https://stackoverflow.com/questions/57772458/how-to-get-a-treeview-columns-to-fit-the-frame-it-is-within
https://stackoverflow.com/questions/4220295/get-tkinter-window-size
https://stackoverflow.com/questions/43681006/python-tkinter-treeview-get-return-parent-name-of-selected-item
https://www.youtube.com/watch?v=tvXFpMGlHPk
https://stackoverflow.com/questions/61280744/tkinter-how-to-adjust-treeview-indentation-size-and-indicator-arrow-image
https://www.javaer101.com/en/article/46648889.html
https://www.youtube.com/watch?v=TdTks2eSx3c
"""
""" BASE VARIABLES """

userPC = getpass.getuser()
df = db.data()
TeamPPL = list(df["Team"].unique())  # my team list
dfUser = None

root = Tk()
root.title("Tasks View")
app_width, app_height = 700, 500  # width and height of tkinter widget
# below the horizontal and vertical offset of the GUI presence
x = y = 50
""" below trial centers the tkinter widget to screen with above settings.
screen_width, screen_height = root.winfo_screenwidth(), root.winfo_screenwidth()
x = (screen_width / 2) - (app_width / 2)
y = (screen_height / 2) - (app_height / 2) - abs(
    (app_width - app_height) + ((app_width - app_height) / 2))
"""
Beispiel #4
0
    res = s.post(loginUrl, data=userData, headers=httpHeader)
    return res.cookies


def testUserCookies(usercookies):
    r = requests.get(downloadUrl % '123456', cookies=usercookies)
    try:
        a = r.headers['Content-Disposition']
        return True
    except:
        return False


if __name__ == '__main__':
    # 开启用户的数据库
    userDB = data('userData.db')
    # 开启map的数据库
    mapBD = data('map.db')
    # 存放要下载的map id
    mapID = []
    # 从网络获取mpa id
    map = maps()
    # 要下载的地图队列
    mapQueue = Queue.Queue()
    # 从数据库中获取已经登陆的用户session id
    userCookies = userDB.get('userCookies')
    # 从数据库中获取用户session id的过期时间
    # 过期时间1天
    userCookiesExpiryTime = userDB.get('userCookiesExpiryTime')

    # 判断是用户session id是否为空,用户session id是否过期
import db

datas = db.data()

print(datas)
Beispiel #6
0
import db

data = db.data()

num_list_all = []

for i in data:
    num_list_all += i[11:16]

dictionary = {x:num_list_all.count(x) for x in num_list_all}

times_drawn = [num_list_all.count(x) for x in dictionary]

reverse_list = sorted(dictionary, key=dictionary.get)

reverse_list.reverse()

print(reverse_list[0:5])

import matplotlib.pyplot as plt

colors = list("rgbcmyk")

plt.figure(1)
plt.hist(num_list_all, bins=90, color = "r", alpha = 0.5)
plt.title("Lottery Numbers")
plt.xlabel("Balls")
plt.ylabel("Times Drawn")

plt.show()