Ejemplo n.º 1
0
Archivo: login.py Proyecto: yxngxr1/KBS
 def select(self):
     if self.list_users.currentItem().text():
         # Запуск главного окна программы для выбранного пользователя
         name = self.list_users.currentItem().text()
         global main
         main = Work(name)
         main.show()
         self.setVisible(False)
Ejemplo n.º 2
0
def deamon_command(command, timer, debug, time_out, is_daemon):
    wk = Work(timer=timer, pid_file=PID_FILE, debug=debug, time_out=time_out, is_daemon=is_daemon)
    if command == DAEMON_START:
        wk.start()
    elif command == DAEMON_STOP:
        wk.stop()
    elif command == DAEMON_RESTART:
        wk.stop()
        time.sleep(3)
        wk.start()
    def login(cls, username, password):
        """
        this method takes two argument and checks if there is a match user with this information
        :param username: unchecked username
        :param password: unchecked password
        :return: True if username and password are match, or False otherwise
        """

        data = file_manager.read_from_file('users_data.json')
        works = file_manager.read_from_file('all_users_works.json')

        user_has_work = True if username in works.keys() else False
        my_works = works[username] if user_has_work else {}

        password = str(password).encode()
        hash_password = md5(password).hexdigest()

        if username in data.keys():
            if hash_password == data[username]['password']:
                current_user = cls(*(data[username].values()))
                if user_has_work:
                    for _ in my_works.values():
                        current_user.works.append(Work(*(_.values())))
                return current_user
            else:
                return False
        else:
            print(f'No user named {username}...')
            return False
Ejemplo n.º 4
0
    def createBtn(self):
        n = self.namee.text
        email = self.email.text
        password = self.password.text
        wk = self.namee.text + ".xlsx"

        l = [email, n, password, wk]

        Work.create_worksheet(wk)

        db.addEntry(l)

        self.namee.text = ""
        self.email.text = ""
        self.password.text = ""
        sm.current = "login"
Ejemplo n.º 5
0
    def featured_works(self):
        _db = Session.object_session(self)
        editions = [e.edition for e in self.entries if e.featured]
        if not editions:
            return None

        identifiers = [ed.primary_identifier for ed in editions]
        return Work.from_identifiers(_db, identifiers)
Ejemplo n.º 6
0
    def featured_works(self):
        _db = Session.object_session(self)
        editions = [e.edition for e in self.entries if e.featured]
        if not editions:
            return None

        identifiers = [ed.primary_identifier for ed in editions]
        return Work.from_identifiers(_db, identifiers)
Ejemplo n.º 7
0
    def c_workers(self):
        self.reset()
        ants = []
        for i in range(0, self.num_ants):
            ant = Work(i, random.randint(0, self.graph.num_nodes - 1), self)
            ants.append(ant)

        return ants
Ejemplo n.º 8
0
    def c_workers_test(self,placeSeed):
        self.reset()
        ants = []
        for i in range(0, self.num_ants):
            self.ant = Work(i, placeSeed , self)
            ants.append(self.ant)

        return ants
 def accept(self):
     # 持续监听端口
     while True:
         # 获得新连接客户机的数据
         client, address = self.server.accept()
         print("检测到新的连接,ip:{},端口:{}".format(address[0], address[1]))
         # 更新用户列表
         self.clients.append({
             "client": client,
             "username": "",
             "status": "connect"
         })
         # 创建子线程处理本次连接
         t = Work(self.update_clients, client, self.db)
         # 将该线程加入线程列表
         self.threads.append(t)
         # 开始子线程
         t.start()
Ejemplo n.º 10
0
def main(tools = [1] * 8, step = 1, is_error = False):
    cnc_arr = [CNC(i+1, tools[i], is_error) for i in range(0,8)]
    rgv = RGV()
    work_num = 1
    for i in range(0, 8*60*60):
        if rgv.state == 0:
            # 检查是否持有物料
            if rgv.target_work == None:
                rgv.target_work = Work(work_num,step)
                work_num = work_num + 1
            # 筛选故障cnc和不同加工工序的cnc
            temp_cnc_arr = []
            for cnc in cnc_arr:
                if cnc.trouble_time != 0:
                    continue
                if rgv.target_work.step + 1 == cnc.tool:
                    temp_cnc_arr.append(cnc)
            # 打擂找出最佳目标cnc
            min_time = float('inf')
            best_cnc = None
            if get_has_minus(temp_cnc_arr,rgv):
                # 有负数情况
                for cnc in temp_cnc_arr:
                    # 去除所有正数
                    if cnc.work_timer - get_move_time(cnc.position, rgv.position) > 0:
                        continue
                    # 求出放置移动时间加上下料时间最小的数
                    place_time = k_even_place_time if cnc.num % 2 == 0 else k_odd_place_time
                    if get_move_time(cnc.position, rgv.position) + place_time < min_time:
                        min_time = get_move_time(cnc.position, rgv.position) + place_time
                        best_cnc = cnc
            else:
                # 全为正数
                # 求出剩余工作时间加上上下料时间最短
                for cnc in temp_cnc_arr:
                    place_time = k_even_place_time if cnc.num % 2 == 0 else k_odd_place_time
                    temp_time = cnc.work_timer + place_time
                    if temp_time < min_time:
                        min_time = temp_time
                        best_cnc = cnc
            # 未找到最佳cnc则退出
            if not best_cnc:return (rgv,cnc_arr)
            # 对rgv下达指令
            rgv.move_to_position(best_cnc.position)
            if best_cnc.work_timer > 0:
                rgv.wait()
            else:
                rgv.place(best_cnc)
        # cnc,rgv 执行指令
        for cnc in cnc_arr:cnc.execute()
        rgv.execute()
    return (rgv,cnc_arr)
Ejemplo n.º 11
0
    def submitWork(self):
        q = 0.0
        listOfWorkAuthors = list()
        if rg.randU() < self._activity:
            listOfWorkAuthors.append(self)
            q = self._quality + rg.randN(m=self._sdQuality)
            for coWorker in self._listOfCoworkers:
                if rg.randU() < coWorker.Prob:
                    q += coWorker.Agent.Quality + \
                         rg.randN(m = coWorker.Agent.SdQuality)
                    listOfWorkAuthors.append(coWorker.Agent)

        return Work(q, listOfWorkAuthors)
Ejemplo n.º 12
0
    def __init__(self,
                work_name ='UNDEFINED',
                work_phone='UNDEFINED',
                work_address = Work()):
            
        if not isinstance(work_address, Work):
            print('[ERROR] work_address is not an Address class')
            return

        #Set class variables
        self.work_name = work_name
        self.work_phone = work_phone
        self.work_address = work_address
Ejemplo n.º 13
0
def main(_):

    #mode = "evalfreeze"
    mode = "pretrain"

    evaldata = "20171213142927.xls"
    model = DomainNameModel(mode='freeze', learning_rate=0.0008)
    worker = Work(model,
                  batch_size=1024,
                  pretrain_iter=20000,
                  train_iter=900000,
                  sample_iter=100,
                  model_save_path='model',
                  sample_path='sample',
                  plk_dir='./plk')

    if mode == 'pretrain':
        pretain()

    else:  #eval
        dosample = preprosample(None, plk_dir='./plk/')
        worker.evalfreeze(evaldata, dosample)
Ejemplo n.º 14
0
class Crawler:
    def __init__(self, origin):
        self._origin = origin
        self._work = Work()
        self._work.put(origin)

    def _scrape(self, url):
        response = requests.get(url)
        page = Page(self._origin, response)
        list(map(self._work.put, page.links))
        print(page.url)
        print(*page.links, sep='\n- ')

    def crawl(self):
        with ThreadPoolExecutor(max_workers=30) as executor:
            while True:
                try:
                    url = self._work.get(timeout=30)
                    executor.submit(self._scrape, url)
                except Empty:
                    return
                except Exception as e:
                    print(e)
                    continue
Ejemplo n.º 15
0
    def get_work(self, wid):
        print('crawling work %d' % wid)
        html = self.P.get(url=self.url + str(wid))

        djson = re.search(r'}\)\((.*?)\);</script>', html.text).group(1)
        #print('djson:',djson)
        data = demjson.decode(djson)
        _type = data['preload']['illust'][wid]['illustType']

        if _type < 2:
            w = Illustration(wid)
        elif _type == 2:
            w = Animation(wid)
        else:
            w = Work(wid)

        w.crawl(data)

        del data
        return w
Ejemplo n.º 16
0
Archivo: main.py Proyecto: lelik9/ttask
                            action="store",
                            help='''File name.
                                                                    For "snmp" mode, file with OID.
                                                                    For "file" mode - data file'''
                            )

        args = parser.parse_args()

        mode = args.mode
        file_name = args.file
        t = args.time
        ip = args.ip_address
        port = args.port

        scheduler = sched.scheduler(time.time, time.sleep)
        work = Work(file_name)
        init_db()

        if mode == 'db':
            print('db')
            periodic_scheduler(scheduler, t, work.get_data_from_db)
        elif mode == 'file':
            print('file', file_name)
            periodic_scheduler(scheduler, t, work.get_data_from_file)
        elif mode == 'snmp':
            print('snmp', file_name)
            periodic_scheduler(scheduler, t, work.get_data_from_snmp,
                               (ip, port))

        scheduler.run()
 def play(self):
     self.wc = self.wc.get().split(' ')
     Work(int(self.now.get()), int(self.ppw.get()), self.wc, self.ip.get(),
          self.op.get())
Ejemplo n.º 18
0
 def __init__(self, origin):
     self._origin = origin
     self._work = Work()
     self._work.put(origin)
Ejemplo n.º 19
0
    def test_early_aeneid(self):
        work = Work(early_aeneid, name='Aeneid 1')
        self.assertCountEqual(
            work.scans_strings(),
            [
"a'r-mă vĭ-/-ru'm-quĕ că'-/-nō trō-/-jā'-ĕ quĭ / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quĕ că'-/-nō trŏ'-jă-/-ē quī / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quē / cā'-nŏ trŏ-/-jā'-ĕ quĭ / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quĕ că'-/-nō trŏ'-ĭ-/-æ quī / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quĕ că'-/-nō trō'-/-jæ quī / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quĕ că'-/-nō trŏ-ĭ-/-ā'-ĕ quĭ / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"a'r-mă vĭ-/-ru'm-quē / cā'-nŏ trŏ'-/-jæ quī / prī'-mŭ-s⁀ă-/-b⁀ō'-ris",
"",
"ī-ta'l-/-jam fā'-/-tō prō-/-fū'-gŭ-s⁀lă-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-ŭ-ĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-ū-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gus lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-ū-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gus lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gus lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gū-s⁀lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gus lau-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gus lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gus lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-vī-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gū-s⁀lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gus lau-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gū-s⁀lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gus lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gū-s⁀lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gū-s⁀lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gus lau-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gū-s⁀lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gus lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gus lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-ŭ-ĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gū-s⁀lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gū-s⁀lau-/-i'n-jă-quĕ / vē'-nit",
"ī-tā-/-lī'-am / fā'-tŏ prŏ-/-fū'-gŭ-s⁀lă-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gū-s⁀lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gū-s⁀lau-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gū-s⁀lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gū-s⁀lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lā-vī-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prō-/-fū'-gŭ-s⁀lă-/-vi'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gus lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lau-ī-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gus lau-/-i'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fā'-/-tō prŏ'-fŭ-/-gus lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō'-fŭ-gŭ-/-s⁀lau-ī-/-nī'-ă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gū-s⁀lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gū-s⁀lā-/-vi'n-jă-quĕ / vē'-nit",
"ī-ta'l-/-jam fă'-tŏ / prō-fū'-/-gū-s⁀lau-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gus lă-ŭ-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fā'-/-tō prŏ'-fŭ-/-gū-s⁀lau-/-i'n-jă-quĕ / vē'-nit",
"ī-tă'-lĭ-/-am fă'-tŏ / prō-fū'-/-gus lă-vĭ-/-nī'-ă-quĕ / vē'-nit",
"",
"lī'-tŏ-ră / mul-t(um)⁀il-/-l(e)⁀et te'r-/-ris jac-/-tā'-tŭ-s⁀ĕ-/-t⁀a'l-to",
"",
"vī sŭ'-pĕ-/-rum să'-ĕ-/-væ mē'-/-mō-r(em)⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum să'-ĕ-/-væ mĕ'-mŏ-/-r(em)⁀ī-ū-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum sæ'-/-væ mĕ'-mŏ-/-rē-m⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum să'-ĕ-/-væ mĕ'-mŏ-/-rem jū-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum să-ĕ-/-vā'-ĕ mĕ'-/-mō-r(em)⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum sæ'-/-væ mĕ'-mŏ-/-rem jū-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum sæ'-/-væ mē'-/-mō-r(em)⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum sæ'-/-væ mĕ'-mŏ-/-r(em)⁀ī-ū-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum să'-ĕ-/-væ mĕ'-mŏ-/-rē-m⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"vī sŭ'-pĕ-/-rum sæ-/-vā'-ĕ mĕ'-/-mō-r(em)⁀ĭ-ŭ-/-nō'-nĭ-s⁀ŏ-/-b⁀ī'-ram",
"",
"mu'l-tă quŏ-/-qu(e)⁀et be'l-/-lō pa's-/-sus dum / co'n-dĕ-rĕ-/-t⁀u'r-bem",
"",
"in-fer-/-re't-quĕ dĕ'-/-ō-s⁀lă'-tĭ-/-ō gĕ'-nŭ-/-s⁀u'n-dĕ lă-/-tī'-num",
"in-fer-/-re't-quĕ dĕ'-/-ō-s⁀la't-/-jō gĕ'-nŭ-/-s⁀u'n-dĕ lă-/-tī'-num",
"in-fer-/-re't-quĕ dĕ'-/-os lă'-tĭ-/-ō gĕ'-nŭ-/-s⁀u'n-dĕ lă-/-tī'-num",
"in-fer-/-re't-quĕ dĕ'-/-os la't-/-jō gĕ'-nŭ-/-s⁀u'n-dĕ lă-/-tī'-num",
"",
"al-bă'-nĭ-/-quē pā'-/-trē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀al-/-tā'-ĕ mŏ-/-e'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀a't-quē / a'l-tă-ĕ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀a'l-/-tæ mō-/-ē'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀a'l-/-tæ mŏ-ĕ-/-nī'-ă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀al-/-tā'-ĕ mŏ-/-ē'-nĭ-ă / rō'-mæ",
"al-bā-/-nī'-quĕ pă'-/-trē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀a'l-/-tæ mō-/-e'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pā'-/-trē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'-nĭ-ă / rō'-mæ",
"al-bā-/-nī'-quĕ pă'-/-trē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pa't-/-rē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pa't-/-rē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀a't-quē / a'l-tă-ĕ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀al-/-tā'-ē / mœ'n-jă rŏ-/-mā'-e",
"al-bā-/-nī'-quĕ pă'-/-trē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pā'-/-trē-s⁀at-/-qu(e)⁀a'l-tă-ĕ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pa't-/-rē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'-nĭ-ă / rō'-mæ",
"al-bă'-nĭ-/-quē pa't-/-rē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀a't-quē / a'l-tæ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pā'-/-trē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀a'l-/-tæ mœ-/-nī'-ă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀at-qu(e)⁀al-/-tā'-ē / mœ'-nĭ-ă / rō'-mæ",
"al-bā-/-nī'-quĕ pă'-/-trē-s⁀at-/-qu(e)⁀a'l-tæ / mœ'n-jă rŏ-/-mā'-e",
"al-bă'-nĭ-/-quē pă'-trĕ-/-s⁀a't-quē / a'l-tæ / mœ'-nĭ-ă / rō'-mæ",
"",
"mū'-să mĭ'-/-hī că'-ŭ-/-sas mĕ'-mŏ-/-rā quō / nū'-mĭ-nĕ / læ'-so",
"mū'-să mĭ'-/-hī cau'-/-sas mĕ'-mŏ-/-rā quō / nū'-mĭ-nĕ / læ'-so",
"mū'-să mĭ'-/-hī că'-ŭ-/-sas mĕ'-mŏ-/-rā quŏ nŭ-/-mī'-nĕ lă-/-ē'-so",
"mū'-să mĭ'-/-hī cau'-/-sas mĕ'-mŏ-/-rā quŏ nŭ-/-mī'-nĕ lă-/-ē'-so",
"mū'-să mĭ'-/-hī cau'-/-sas mē-/-mō'-ră quŏ / nū'-mĭ-nĕ / læ'-so",
"mū'-să mĭ'-/-hī că'-ŭ-/-sas mē-/-mō'-ră quŏ / nū'-mĭ-nĕ / læ'-so",
"",
"qui'd-vĕ dŏ'-/-lens rĕ'-gĭ-/-nā dē'-/-um tot / vo'l-vĕ-rĕ / cā'-sus",
"qui'd-vĕ dŏ'-/-lens rē-/-gī'-nă dĕ'-/-um tot / vo'l-vĕ-rĕ / cā'-sus",
"quī'-dŭ-ĕ / dō'-lens / rē'-gĭ-nă / deum tot / vo'l-vĕ-rĕ / cā'-sus",
"qui'd-vĕ dŏ'-/-lens rē-/-gī'-nā / deum tot / vo'l-vĕ-rĕ / cā'-sus",
"qui'd-vĕ dŏ'-/-lens rĕ'-gĭ-/-nā deum / tot vō-/-lū'-ĕ-rĕ / cā'-sus",
"qui'd-vē / dō'-lens / rē'-gĭ-nă / deum tot / vo'l-vĕ-rĕ / cā'-sus",
"",
"in-si'g-/-nem pjĕ'-tă-/-tē vī'-/-rum tŏ-t⁀ă-/-dī'-rĕ lă-/-bō'-res",
"in-si'g-/-nem pĭ-ĕ-/-tā'-tĕ vĭ'-/-rum tŏ-t⁀ă-/-dī'-rĕ lă-/-bō'-res",
"in-si'g-/-nem pjē-/-tā'-tĕ vĭ'-/-rum tŏ-t⁀ă-/-dī'-rĕ lă-/-bō'-res",
"",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mis că-ĕ-/-le's-tĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mī-s⁀cæ-/-le's-tĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mī-s⁀că-ĕ-/-lē'-stĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mī-s⁀că-ĕ-/-le's-tĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mis cæ-/-lē'-stĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mī-s⁀cæ-/-lē'-stĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mis că-ĕ-/-lē'-stĭ-bŭ-/-s⁀ī'-ræ",
"im-pŭ'-lĕ-/-rit ta'n-/-tæ-n(e)⁀ă'-nĭ-/-mis cæ-/-le's-tĭ-bŭ-/-s⁀ī'-ræ",
"",
"urb-s⁀an-/-tī'-quă fŭ'-/-it ty'-rĭ-/-ī tĕ-nŭ-/-ē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quā / fvit ty'-rĭ-/-ī ten-/-vē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quā / fvit ty'r-/-jī ten-/-vē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quā / fvit ty'r-/-jī tĕ-nŭ-/-ē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quă fŭ'-/-it ty'r-/-jī ten-/-vē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quă fŭ'-/-it ty'r-/-jī tĕ-nŭ-/-ē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quă fŭ'-/-it ty'-rĭ-/-ī ten-/-vē'-rĕ cŏ-/-lō'-ni",
"urb-s⁀an-/-tī'-quā / fvit ty'-rĭ-/-ī tĕ-nŭ-/-ē'-rĕ cŏ-/-lō'-ni",
""
            ]
        )
Ejemplo n.º 20
0
                            zipcode=input('Zipcode: '))))
            while True:
                SUB_COMND = input(
                    'would you like to add your work information yes or no? '
                ).upper()
                if SUB_COMND == 'NO':
                    break
                elif SUB_COMND == 'YES':
                    co_name = input('What is the company name?').lower()

                    co_phone = input('What is the company phone number? ')

                    WORK_ADDRESS.add_contact(
                        WorkContact(
                            work_name=co_name,
                            work_phone=co_phone,
                            work_address=Work(
                                street=input('Street number and street: '),
                                city=input('City: ').upper(),
                                state=input('State: ').upper(),
                                zipcode=input('Zipcode: '))))

                else:
                    print(f'{SUB_COMND} is not valid.')
                    continue
        elif COMMAND == 'list':
            print(ADDRESS_BOOK.get())
            print(WORK_ADDRESS.get())
        else:
            print(f'Man you know {COMMAND} aint what I asked you.')
Ejemplo n.º 21
0

def get_work(work_name):
    for work in all_works:
        if work.name == work_name:
            return work
    return None


def get_all_works():
    return all_works


work1 = Work(id=1,
             name="ホームページ",
             image="homePage.JPG",
             description="このサイト.flaskを使って初めて制作したものです",
             date="2019年4月5日")

work2 = Work(
    id=2,
    name="CANDLE",
    image="candle.jpg",
    description=
    "災害時の被害状況をGoogleMapを使って共有し,避難意識を向上させることを目的としたWebアプリ.開発途中なのでたびたび仕様が変更されています",
    date="2019年3月5日",
    url="https://wsapp.cs.kobe-u.ac.jp/candle")

work3 = Work(id=3,
             name="Todo front",
             image="todo.png",
Ejemplo n.º 22
0
from work import Work

def get_work(work_name):
    for work in all_works:
        if work.name == work_name:
            return work
    return None

def get_all_works():
    return all_works

work01 = Work(id=1,
             name="ホームページ",
             image="homepage1.jpg",
             description="このサイトのことです。flaskを使用しました。",
             date="2019年7月##日")

all_works = [work01]
def check_events(logged_in_user):
    """
    this function checks event file of user just after log in.
    (work_select variable is a dict to assign number to every event
    work_select = {event_num:(sender, received work as Work obj)})
     User should decide what to do with received work.
    :param logged_in_user: current user in reminder
    :return: a massage about user decision
    """
    all_events = {}
    while True:
        try:
            all_events = file_manager.read_from_file('events.json')[logged_in_user.username]
            assert all_events
        except KeyError:
            print(f'{Fore.GREEN}You have no events...{Fore.RESET}')
            reminder_logger.info(f'user checked events and has no event so far')
            back = input(f'{Fore.GREEN}enter "b" to back{Fore.RESET}')
            if back:
                break

        except AssertionError:
            print(f'{Fore.BLUE}no new event...{Fore.RESET}')
            reminder_logger.info(f'"user checked events and has no new event this time')
            back = input(f'{Fore.GREEN}enter "b" to back{Fore.RESET}')
            if back:
                break

        sender_work = {i + 1: event for i, event in enumerate(all_events.items())}
        work_select = {}
        for i, evnt in sender_work.items():
            work_select[i] = (evnt[0], (Work(*(evnt[1].values()))))

        options = len(work_select)

        while work_select:
            for i, evnt in work_select.items():
                print(f'{i}. {evnt[0]}: "{evnt[1].work_name}"')
            print('0. back to main menu')

            select = int(input('choose a work or enter 0 to back:'))

            if 0 < select <= options:
                temp = work_select.pop(select)
                slct_wrk = temp[1]
                all_events.pop(temp[0])
                print(file_manager.write_to_file('events.json', all_events, logged_in_user.username))

                print(f'{Fore.GREEN}information of "{slct_wrk.work_name}": {Fore.RESET}')
                print(f'{slct_wrk}')

                act = int(input(f'{Fore.GREEN}1. accept {Fore.RED}2. reject: {Fore.RESET}'))
                if act == 1:
                    print(logged_in_user.accept_a_work(slct_wrk))
                    wrk_to_file = slct_wrk.__dict__.copy()
                    wrk_to_file.pop("priority")
                    wrk_to_file.pop("time_ntf")
                    print(slct_wrk.__dict__)
                    print(file_manager.write_to_file('all_users_works.json', wrk_to_file,
                                                     logged_in_user.username, slct_wrk.work_name))

                elif act == 2:
                    print(f'\n{Fore.LIGHTYELLOW_EX}{slct_wrk.work_name} has been rejected{Fore.RESET}')
                    continue
            elif select == 0:
                print(f'\n{Fore.CYAN} event check has been aborted {Fore.RESET}')
                break

        if not work_select:
            all_events.clear()
            sender_work.clear()
            print(file_manager.write_to_file('events.json', {}, logged_in_user.username))
            break
Ejemplo n.º 24
0
class WorkerPool(threading.Thread):
    def __init__(self, workq, i, n, workpool_workid_dict, log,
                 queue_task_list):
        # self.logger = logging.getLogger(__name__)
        threading.Thread.__init__(self)
        self.log = log
        ms = Message("tcp", self.log)
        self.message = ms
        self.queue = workq
        self.thread_stop = False
        self.queue_task_list = queue_task_list
        # print "tp to init ", i
        #  self.logger.debug('tp to init: ' + str(i))
        self.work_id = 0
        self.name = str(i)
        self.threadID = i
        self.allcron = n
        self.workpool_workid_dict = workpool_workid_dict
        self.arglist = {}
        self.change_tasktable = True
        if self.workpool_workid_dict.has_key(self.name):
            del self.workpool_workid_dict[self.name]

    def jsonDicts(self, params):
        """
        将json 格式的数据转换为字典
        """
        # dicts = {'ip': None, 'v': None, 'dir': None, 'op': None, 'vf': None, 'pf': None}
        dicts = {}
        if len(params) == 0:
            return dicts
        # dicts['op'] = params['ip']
        for k, v in params.iteritems():
            dicts[k] = v
        # print "jsonDicts is:", dicts
        self.log.logger.debug('jsonDicts is:' + str(dicts))
        return dicts

    def generate_uuid(dashed=True):
        """Creates a random uuid string.
        :param dashed: Generate uuid with dashes or not
        :type dashed: bool
        :returns: string
        """
        if dashed:
            return str(uuid.uuid4())
        return uuid.uuid4().hex

    def get_threadID(self):
        return self.threadID

    def send_ta(self, id, value, bk_id=None):
        """
        Sending messages to modifies the state in the task table
        """
        data = "{'type':'state','data':{'id':'%s','state':'%s','bk_id':'%s'}}" % (
            id, value, bk_id)
        ret = self.message.send(data)
        if ret != 0:
            self.log.logger.error('message send failed %s' % ret)

    def run(self):
        now = datetime.now()
        while not self.thread_stop:  # do forever
            time.sleep(1)
            self.work_id = self.work_id + 1
            if self.queue.empty():
                continue
            task = None
            if not self.queue.empty():
                try:

                    task = self.queue.get(block=True, timeout=20)  # 接收消息
                    self.log.logger.info("task recv:%s ,task No:%d" %
                                         (task[0], task[1]))

                except:
                    # print "get queue timerout!!!!!!!!!!!!"
                    self.log.logger.error("get queue timerout!!!!!!!!!!!!")
                    continue

            if task:
                task_d = eval(task[0])
                self.arglist = self.jsonDicts(task_d)
            if self.arglist is None:
                continue
            ret = 0

            self.log.logger.info('todo work:%s' % (self.threadID))

            #  Remove the task from the waiting task
            #  list and add it to the running task dictionary
            try:
                self.workpool_workid_dict[self.name] = self.arglist['id']
                self.queue_task_list.remove(self.arglist['id'])
            except Exception, e:
                self.log.logger.error(e)
                self.log.logger.error(self.arglist)
                continue

            self.arglist['threadId'] = self.name
            #  Create bk_id for the current task in the backuptask table
            self.arglist['bk_id'] = self.generate_uuid()

            #  Upload information to modify the task in the task table in the state
            if self.arglist['state'] == 'stopped':
                self.send_ta(self.arglist['id'], 'running_s',
                             self.arglist['bk_id'])
            else:
                self.send_ta(self.arglist['id'], 'running_w',
                             self.arglist['bk_id'])
            op = self.arglist.get('op')
            if op == 'delete':
                duration = self.arglist.get('duration')
                vol = self.arglist.get('vol')
                dir = self.arglist.get('dir')
                ip = self.arglist.get('ip')
                name = self.arglist.get('name')
                id = self.arglist.get('id')
                if duration != None and vol != None and dir != None and ip != None and name != None and id != None:
                    try:
                        self.work = Delete(self.log,
                                           duration=duration,
                                           vol=vol,
                                           dir=dir,
                                           ip=ip,
                                           name=name,
                                           id=id,
                                           threadID=self.threadID)
                        self.work.start(True)
                    except Exception, e:
                        self.log.logger.error(e)
                if self.workpool_workid_dict.has_key(self.name):
                    del self.workpool_workid_dict[self.name]
                continue

            self.work = Work(self.arglist, self.log)

            if not self.work:
                self.log.logger.error('work create failed %s' %
                                      (self.threadID))

            self.work.start()
            self.queue.task_done()  # 完成一个任务
            if self.arglist['op'] == 'backup' or self.arglist['op'] == 'dump':
                if self.arglist['state'] == 'stopped' or self.arglist[
                        'state'] == 'running_s':
                    if self.change_tasktable:
                        self.send_ta(self.arglist['id'], 'stopped')
                else:
                    self.log.logger.debug(
                        '=============================change_tasktable %s' %
                        self.change_tasktable)
                    if self.change_tasktable:
                        self.send_ta(self.arglist['id'], 'waiting')
                self.log.logger.debug('change the work %s state' %
                                      self.arglist['name'])
            else:
                self.send_ta(self.arglist['id'], 'end')
            # Remove the task from the task dictionary to the running task
            if self.workpool_workid_dict.has_key(self.name):
                del self.workpool_workid_dict[self.name]
            self.change_tasktable = True
            res = self.queue.qsize()  # 判断消息队列大小
            if res > 0:
                # print("ahua!There are still %d tasks to do" % (res))
                self.log.logger.warning("There are still %d tasks to do" %
                                        (res))
Ejemplo n.º 25
0
def run_bot():
    while 1:
        ircmsg = ircsock.recv(8192)
        ircmsg = ircmsg.strip('\n\r')
        # ping
        if ircmsg.find('PING :') != -1:
            ping()
            continue

        print
        print ircmsg

        if ircmsg[0] != ':':
            continue

        message = IRCMessage(ircmsg)
        print message

        if message.msgType == 'INVITE':
            joinchan(message.channel)
            sendmsg(message.channel, '안녕하세요, 업무 봇입니다')
            sendmsg(message.channel, '업무 추가/제거는 주인만 가능하고 열람은 자유입니다')

        elif message.msgType == 'MODE':
            if message.msg == u'+o 업무봇':
                sendmsg(message.channel, '감사합니다 :)')
            if message.msg == u'-o 업무봇':
                sendmsg(message.channel, '......')

        elif message.msgType == 'PRIVMSG':
            parse = re.match(ur'업무봇\s+조회\s*(?P<limit>전체|[0-9]+)?', message.msg)
            if parse:
                worklist = dao.query(Work).filter(Work.done == False).order_by(
                    Work.due)
                if worklist.count() == 0:
                    sendmsg(message.channel, '남은 할 일이 없습니다')
                else:
                    sendmsg(message.channel, '할 일 목록 :')
                    limit = 5
                    if parse.group('limit') == u'전체':
                        limit = None
                    elif parse.group('limit') != None:
                        limit = int(parse.group('limit').decode('utf-8'))
                    for work in worklist[:limit]:
                        sendmsg(message.channel, '%s' % work)
            if re.match(ur'업무봇\s+(추가|제거|삭제|완료|종료)\s*(.*)', message.msg):
                if message.sender != '[email protected]':
                    sendmsg(message.channel, '봇 주인만 업무 관리를 할 수 있습니다')
                else:
                    work_pattern = re.compile(
                        ur'''
                        (?P<due_day>
                                ((다+음|이번)주\s+[월화수목금토일]요일)
                            |   (오늘|내일|모레|\d+일\s*후)
                            |   ((\d+월\s*)?\d+일)
                        )?\s*
                        (?P<due_time>
                                (\d+시\s*((\d+분)|반)?)
                        )?\s*
                        (?P<title>.*)
                        ''', re.VERBOSE)

                    parse = re.match(ur'업무봇\s+추가\s+(?P<content>.*)',
                                     message.msg)
                    if parse:
                        work_parse = work_pattern.match(parse.group('content'))
                        if work_parse:
                            newWork = Work(work_parse.group('title'),
                                           work_parse.group('due_day'),
                                           work_parse.group('due_time'))
                            dao.add(newWork)
                            try:
                                dao.commit()
                            except exc.SQLAlchemyError:
                                sendmsg(message.channel, '이미 존재하는 업무입니다')
                                dao.rollback()
                            else:
                                sendmsg(message.channel,
                                        '%s 추가되었습니다' % newWork)

                    parse = re.match(ur'업무봇\s+(제거|삭제)\s+(?P<content>.*)',
                                     message.msg)
                    if parse:
                        print parse.group('content')
                        work = dao.query(Work).filter(
                            Work.name == parse.group('content')).first()
                        dao.delete(work)
                        dao.commit()
                        sendmsg(message.channel, '%s 제거되었습니다' % work)

                    parse = re.match(ur'업무봇\s+(완료|종료)\s+(?P<content>.*)',
                                     message.msg)
                    if parse:
                        work = dao.query(Work).filter(
                            Work.name == parse.group('content')).first()
                        work.done = True
                        work.finished = datetime.now()
                        dao.add(work)
                        dao.commit()
Ejemplo n.º 26
0
def main():

    w = Work()
    print(
        "1 로그인 & 게시판 이동 / 2 출석 게시물 작성 / 3 최근 출석 게시물 보기 / 4 크롤링 (출석) / 5 크롤링 (지각) / 6 계산 / 7 결과 게시물 작성/ 8 뒤로 / 9 앞으로"
    )
    print("숫자 이외의 값 입력 시 종료합니다.")

    while True:

        try:
            key = int(input("입력 "))
        except:
            print("잘못된 입력입니다. 프로그램을 종료합니다.")
            break

        if key == 1:
            w.login()
            w.moveMainToBoard()
            w.setTodayMonthDayName()

        elif key == 2:
            # 출석체크 게시물 작성하기
            w.createCheckPost()

        elif key == 3:
            # 가장 최근 출석체크 게시물 접근
            w.moveBoardToNewCheckPost()

        elif key == 4:
            # 정상출석자 크롤링
            comment_list = w.crawlComments()
            attend = w.returnStudentId(comment_list)
            print("출석자 크롤링 완료")

        elif key == 5:
            # 지각자 크롤링
            comment_list = w.crawlComments()
            late = w.returnStudentId(comment_list)
            print("지각자 크롤링 완료")

        elif key == 6:
            # 지각자 결석자 계산
            s_late = late - attend
            s_absent = set(student_dict) - (attend | s_late)

            # 결과 저장
            result_late = w.returnResultString(list(s_late))
            result_absent = w.returnResultString(list(s_absent))
            w.setResultString(result_late, result_absent)
            print("완료")

        elif key == 7:
            # 결과 게시물 작성
            w.createCompletePost()

        elif key == 8:
            w.back()

        elif key == 9:
            w.forward()

        else:
            print("1~9 사이의 숫자 명령어를 입력해주세요")
            continue
Ejemplo n.º 27
0
# 家国梦自动拾取金币、自动完成运货
# Author: LuRenJiasWorld (https://github.com/LuRenJiasWorld) <*****@*****.**>
# Dependency: adb(Shell)

import time
from utils import *
from work import Work

if __name__ == "__main__":
    if check_adb():
        while True:
            if not check_connection():
                sleep_time = 5
                print("未连接设备")
                for each in range(sleep_time):
                    print("\t将于{}秒后重试......".format(str(sleep_time - each)))
                    time.sleep(1)
            else:
                break
        print("连接成功,设备ID为{}".format(check_connection()))
        Work().work()
    else:
        print("没有找到adb命令,请安装adb命令行工具后重试")
        exit(0)
Ejemplo n.º 28
0
from random import randint
from profiles import Profiles
from keyboard import general_keyboard, work_keyboard
from work import Work

cluster = MongoClient(
    f"mongodb+srv://{config.login_mongo}:{config.pass_mongo}@abucontroller.vzuyo.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"
)
db = cluster.chats
vk_session = vk_api.VkApi(token=config.TOKEN)
longpoll = VkBotLongPoll(vk_session, config.group_id)
characteristics = [
    "Имя", "Баланс", "В банке", "Статус", "Судимости", "Состояние"
]
all_profiles = Profiles()
all_jobs = Work()

for event in longpoll.listen():
    '''
    if event.type == VkBotEventType.group_join:
        id_chat = event.chat_id
        if str(id_chat) not in db.getCollectionNames():
            db.createCollevtion(str(id_chat))
    '''
    if event.type == VkBotEventType.MESSAGE_NEW:
        if event.from_chat:
            id_peer = event.object.message["peer_id"]
            id_chat = event.chat_id
            msg = event
            print(msg)
            print(id_chat)
Ejemplo n.º 29
0
        wk.reset(jump[3])

    def backBtn(self):
        self.email.text = ""
        sm.current = "menu"


class WindowManager(ScreenManager):
    pass


global E
kv = Builder.load_file("gui.kv")
sm = WindowManager()
db = Data(" ")
wk = Work(" ")
screens = [
    LoginWindow(name="login"),
    CreateAccountWindow(name="create"),
    Menu(name="menu"),
    Res(name="res"),
    ShowE(name="showE"),
    ShowI(name="showI"),
    ShowI(name="showI"),
    Rem(name="rem"),
    TakeE(name="takeE"),
    TakeI(name="takeI")
]
for screen in screens:
    sm.add_widget(screen)
Ejemplo n.º 30
0
courseId = Common().get_courseId(courseTitle)

# 创建小节、上架小节、返回小节ID
chapter_id, chaptername = Chapter(courseId).chapter_online()

# 编辑上下课时间,生成教室,返回roomID、scheduleId,userphone
RoomId, scheduleId, user = RoomURL(courseId, classname, timefromname,
                                   chapter_id, courseTitle).click_roombtn()

# 输出教室地址

teacherRUL = "https://qa-live-test.igetcool.com/weblivev2/?roomId=" + str(
    RoomId) + "&scheduleId=" + str(scheduleId)

# 创建课后练习,发布练习。worktype:1,常规题;2,填空题;3,卡片题
work_state = Work(scheduleId, courseId, chapter_id).add_work(worktype)

# 发企业微信
Common().oneclck_wechat_message(teacherRUL, chaptername, courseTitle,
                                classname, timefromname, user, work_state)

# 教研系统关联ppt

Teach_research(courseId, scheduleId).add_ppt()

# 输出至工作台

print("小节名称:", chaptername)
print("教室地址:", teacherRUL)
print("可用账号:", user)
def create_work(usr):
    """
    this method gets information from user and makes instance of
    Work by calling creat work of Work class.
    """
    work_names = [w.work_name for w in usr.works]
    time_format = "%Y-%m-%d %H:%M:%S"
    work_name = ''
    work_datetime = 0
    category = ''
    importance = True
    urgency = True

    while True:
        try:
            work_name = input('title of work:')
            assert work_name not in work_names
            break
        except AssertionError:
            print(f'{Fore.LIGHTRED_EX} work_name already exist in work list{Fore.RESET} ')
            continue

    while True:
        try:
            work_datetime = input('Enter date and time as :(year-month-day hour:min:sec): ')
            assert not re.match(time_format, work_datetime)
            break
        except AssertionError:
            print(f'{Fore.LIGHTRED_EX} wrong date or time format...{Fore.RESET}')
            continue
    while True:
        try:
            importance = input('is this work important? 1. Yes  2. No  ')
            urgency = input('is this work urgent? 1. Yes  2. No  ')
            if importance not in ['1', '2'] or urgency not in ['1', '2']:
                ValueError(importance, urgency)
            importance = True if importance == '1' else False
            urgency = True if urgency == '1' else False
            break

        except ValueError:
            print('invalid input... try again')
            reminder_logger.error(f'invalid input of importance or urgency')
            continue

    try:
        category = input('choose a category for your work: ')
        assert category in usr.categories.keys()
    except AssertionError:
        reminder_logger.info('new category adds to works list')
        pass

    location = input('location of work (optional): ')
    link = input('add a link related to your work (optional): ')
    description = input('enter a description for your work (optional): ')
    notification = input('enter a notification for your work(optional)')

    work_dict = {
        'work_name': work_name,
        'work_datetime': work_datetime,
        'category': category,
        'status': 'in progress',
        'importance': importance,
        'urgency': urgency,
        'location': location,
        'link': link,
        'description': description,
        'notification': notification
    }

    new_work = Work.create_work(work_dict)
    usr.works.append(new_work)
    new_thread = threading.Thread(name=new_work.work_name, target=new_work.notify, daemon=True)
    threads.append(new_thread)
    new_thread.start()

    print(file_manager.write_to_file('all_users_works.json', work_dict, usr.username, work_dict['work_name']))
    reminder_logger.info(f"'{usr.username}' created '{new_work.work_name}' work successfully", exc_info=True)
    return f'"{Fore.LIGHTGREEN_EX}new work was added to work list{Fore.RESET}'