Ejemplo n.º 1
0
 def __init__(self, word_no, phn, phn_no, pel, start, end):
     """ """
     self.no = int(word_no)
     self.start = int(start)
     self.end = int(end)
     self.phones = [ph.Phone(phn, phn_no, pel, start, end)]
     self.curr_phn = self.phones[0]  # consider renaming
Ejemplo n.º 2
0
    def editkeep(self):
        # 获取按钮名称
        indexName = self.pushButton_2.objectName()
        # 获取表
        pi_table = pd.read_excel(path + '名片信息表.xlsx', sheet_name='data')
        # 获取控件信息 # 'name', 'comp', 'tel', 'mobile', 'email', 'addr', 'city', 'type'
        name = self.lineEdit.text()
        comp = self.lineEdit_2.text()
        tel = self.lineEdit_3.text()
        mobile = self.lineEdit_4.text()
        email = self.lineEdit_5.text()
        addr = self.lineEdit_6.text()
        # 判断手机号是否为空
        if mobile.strip():
            # 根据手机号判断区域
            try:
                info = phone.Phone().find(int(mobile))
            except Exception as e:
                print("根据手机号判断区域时出错", e)
                QMessageBox.critical(self, "错误:", "手机号码不正确!",
                                     QMessageBox.Ok)  # 弹出提示对话框
                self.lineEdit_4.setFocus()  # 让手机文本框获得焦点
                return
            # 判断手机号是否正确返回信息
            if info == None:
                city = '其他'
            else:
                # 正确返回信息获取省
                city = info['province']
        else:
            city = '其他'
        # 判断姓名是否为空
        if name.strip():
            # 获取首字母拼音
            type = pinyintool.getPinyin(name[0])
            # 根据行号删除数据
            datas = pi_table.drop(index=[int(indexName)], axis=0)
            data = datas.append(
                {
                    'name': name,
                    'comp': comp,
                    'tel': tel,
                    'mobile': mobile,
                    'email': email,
                    'addr': addr,
                    'city': city,
                    'type': type
                },
                ignore_index=True)

            # 更新xlsx文件
            DataFrame(data).to_excel(path + '名片信息表.xlsx',
                                     sheet_name='data',
                                     index=False)
            self.close()
            window.dataall()
        else:
            QMessageBox.information(self, '提示信息', '姓名不能为空')
        pass
Ejemplo n.º 3
0
    def test_part_one(self):
        "Test part one example of Phone object"

        # 1. Create Phone object from text
        myobj = phone.Phone(text=aoc_05.from_text(PART_ONE_TEXT))

        # 2. Check the part one result
        self.assertEqual(myobj.part_one(verbose=False), PART_ONE_RESULT)
Ejemplo n.º 4
0
    def test_part_two(self):
        "Test part two example of Phone object"

        # 1. Create Phone object from text
        myobj = phone.Phone(part2=True, text=aoc_05.from_text(PART_TWO_TEXT))

        # 2. Check the part two result
        self.assertEqual(myobj.part_two(verbose=False), PART_TWO_RESULT)
Ejemplo n.º 5
0
def getInfo(phoneNum):
    info = phone.Phone().find(phoneNum)
    data = []
    data.append(info['phone'])
    data.append(info['province'])
    data.append(info['city'])
    data.append(info['phone_type'])
    data.append(info['area_code'])
    data.append(info['zip_code'])
    return data
Ejemplo n.º 6
0
    def test_empty_init(self):
        "Test the default Phone creation"

        # 1. Create default Phone object
        myobj = phone.Phone()

        # 2. Make sure it has the default values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(myobj.text, None)
        self.assertEqual(len(myobj.passes), 0)
Ejemplo n.º 7
0
    def test_text_init(self):
        "Test the Phone object creation from text"

        # 1. Create Phone object from text
        myobj = phone.Phone(text=aoc_05.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 4)
        self.assertEqual(len(myobj.passes), 4)
Ejemplo n.º 8
0
 def __init__(self):
     self.phone = phone.Phone()
     #self.phone.unlock()
     while (True):
         x = self.phone.read(mode='new')
         if x != None and x != []:
             for i in x:
                 print(i)
                 self.handle_message(i)
         time.sleep(1)
Ejemplo n.º 9
0
def get_phone_region(phone_num):
    """
    获取电话号码的归属地信息
    :param phone_num: 电话号码
    :return: 归属信息
    """
    info = phone.Phone().find(phone_num)
    if info is not None:
        region = info['province'] + ' ' + info['city'] + ' ' + info['phone_type']
    else:
        region = '该号码暂未查询到归属地,请检查号码正确性或手动查询!'
    return region
Ejemplo n.º 10
0
def part_one(args, input_lines):
    "Process part one of the puzzle"

    # 1. Create the puzzle solver
    solver = phone.Phone(part2=False, text=input_lines)

    # 2. Determine the solution for part one
    solution = solver.part_one(verbose=args.verbose, limit=args.limit)
    if solution is None:
        print("There is no solution")
    else:
        print("The solution for part one is %s" % (solution))

    # 3. Return result
    return solution is not None
Ejemplo n.º 11
0
    def assign_room(self, conn, origin):
        if origin == "pc":  # If a pc connected to us
            cd = (self.generate_code())
            conn.sendall(
                f"code_{cd}".encode())  # We notify the PC of their room number

            # We create a new PC object
            obj = pc.PC(cd, conn, self)
            self.PCs.append(obj)

            listeningThread = t.Thread(target=obj.receive, args=())
            listeningThread.start()

        if "phone" == origin:
            phone_obj = phone.Phone(conn, self)
            self.phones.append(phone_obj)

            phoneListeningThread = t.Thread(target=phone_obj.receive, args=())
            phoneListeningThread.start()
Ejemplo n.º 12
0
    'conditions': ebay_constants.kAllConditions,
    'carriers': ['AT&T', 'Sprint', 'Unlocked', 'Verizon'],
    'storage_capacities': ['16 GB', '32 GB', '64 GB'],
    'colors': ['White', 'Black'],
  }
]
"""
for template in kPhoneTemplates_:
    for color in template['colors']:
        for storage_capacity in template['storage_capacities']:
            for carrier in template['carriers']:
                for cond in template['conditions']:
                    kPhones.append(
                        phone.Phone(template['model'],
                                    template['brand'],
                                    cond,
                                    carrier,
                                    storage_capacity=storage_capacity,
                                    color=color))

# The percentage of sales to trim from either end, before calculating average
# sale.
kTrimPercentage = .25

kDatabaseInfo = {
    'host': 'localhost',
    'user': '******',
    'passwd': 'password',
    'db': 'ebay_scraper_data',
}

kEbayPhoneUrlInfo = {
Ejemplo n.º 13
0
 def add_phone(self, phn, phn_no, pel, start, end):
     """ """
     new_phn = ph.Phone(phn, phn_no, pel, start, end)
     self.phones.append(new_phn)
     self.curr_phn = new_phn
     self.end = int(end)
Ejemplo n.º 14
0
import phone
import pandas as pd

phone_list = []
for i in range(1300000, 1300010):
    try:
        info = phone.Phone().find(str(i))
        phone_list.append(info.values())
        #如果出错,推出本次循环
        continue
    except (RuntimeError, TypeError, NameError, AttributeError):
        #出错后,直接跳过,不做任何处理
        pass

df = pd.DataFrame(phone_list, columns=['手机号段', '省份', '运营商', '邮编', '区号', '地市'])
print(df)

df.to_csv('phone_list.csv', encoding='gbk')
Ejemplo n.º 15
0
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--user",
    help="SIP user name",
    action="store",
    default=None,
    type=str)
parser.add_argument("-p", "--password",
    help="SIP password",
    action="store",
    default=None,
    type=str)
parser.add_argument("host",
    help="SIP host",
    action="store",
    type=str)

args = parser.parse_args()

p = phone.Phone( user=args.user, host=args.host,  passwd=args.password )

signal.signal(signal.SIGINT, signal.default_int_handler)

try:
    while True:
        #time.sleep(.005)
        time.sleep(.5)
        p.run()
except KeyboardInterrupt:
    p.shutdown()

Ejemplo n.º 16
0
def fun():
    print('fun()函数被调用!')
    ph1 = phone.Phone('华为手机', 4500, '麒麟', 5.4)
Ejemplo n.º 17
0
# -*- coding: utf-8 -*-

import phone

def fun():
    print('fun()函数被调用!')
    ph1 = phone.Phone('华为手机', 4500, '麒麟', 5.4)


if __name__ == '__main__':
    ph = phone.Phone('华为手机', 4500, '麒麟', 5.4)
    ph.startup()
    ph.send_msg()
    ph.call(13917163546)
    ph.shutdown()
    ph.info()
    # del ph # 会执行对象的析构函数
    fun()
    print('\n程序退出!')

print
Ejemplo n.º 18
0
import time
import problem, store, phone, handler, paras

store = store.Store("./store")
phone = phone.Phone()
entryHandler = handler.Handler("entry", "pics/entrySign.jpg", phone)
endHandler = handler.Handler("end", "pics/endSign.jpg", phone)
retryHandler = handler.Handler("retry", "pics/retrySign.jpg", phone)
exitHandler = handler.Handler("exit", "pics/exitSign.jpg", phone)
backHandler = handler.Handler("back", "pics/backSign.jpg", phone)
wrongHandler = handler.Handler("wrong", "pics/wrongSign.jpg", phone)
problemHandler = problem.ProblemHandler("pics/problemSign.jpg", phone, store)

inputFile = "inputs/a.png"

if __name__ == '__main__':
    while True:
        phone.screencast(inputFile, paras.SCALE)
        if entryHandler.check(inputFile):
            entryHandler.handle()
        elif endHandler.check(inputFile):
            endHandler.handle()
        elif exitHandler.check(inputFile):
            exitHandler.handle()
        elif retryHandler.check(inputFile):
            retryHandler.handle()
        elif problemHandler.check(inputFile):
            problemHandler.handle()
        elif wrongHandler.check(inputFile):
            break
            backHandler.check(inputFile)
Ejemplo n.º 19
0
 def city(phoneNum):
     inphone=phone.Phone().find(phoneNum)
     aa='南京市'
     if inphone != None:
         aa=inphone['city']+'市'
     return aa
Ejemplo n.º 20
0
def find_phone_info(mobile):
    result = phone.Phone().find(mobile)
    # del result["zip_code"]
    # del result["area_code"]
    return result