コード例 #1
0
 def print_item(event):
     a = mylist.curselection()
     with open(r'用户信息\群聊\{}'.format(res[a[0]]), 'r', encoding='utf8') as f:
         res_read = f.readlines()
         ip_list = []
         for i in res_read:
             ip_list.append(i[0:-1])
     demo1.main([1, user_name, res[a[0]][0:-4], ip_list])
コード例 #2
0
ファイル: run_examples.py プロジェクト: mwvgroup/GalSim
def test_demo1():
    """Check that demo1 runs properly.
    """
    import demo1
    print('Running demo1.py')
    demo1.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('demo1.yaml', logger=logger)[0]
    print('Running demo1.yaml')
    galsim.config.Process(config, logger=logger, except_abort=True)
コード例 #3
0
def test_demo1():
    """Check that demo1 runs properly.
    """
    import demo1
    print('Running demo1.py')
    demo1.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('demo1.yaml', logger=logger)[0]
    print('Running demo1.yaml')
    galsim.config.Process(config, logger=logger, except_abort=True)
コード例 #4
0
ファイル: run_examples.py プロジェクト: esheldon/GalSim
def test_demo1():
    """Check that demo1 runs properly.
    """
    import demo1

    print("Running demo1.py")
    demo1.main([])
    logging.basicConfig(format="%(message)s", level=logging.INFO, stream=sys.stdout)
    logger = logging.getLogger("galsim")
    config = galsim.config.ReadConfig("demo1.yaml", logger=logger)[0]
    print("Running demo1.yaml")
    galsim.config.Process(config, logger=logger)
コード例 #5
0
def test_demo1():
    """Check that demo1 runs properly.
    """
    import demo1
    print('Running demo1.py')
    demo1.main([])
    logging.basicConfig(format="%(message)s",
                        level=logging.INFO,
                        stream=sys.stdout)
    logger = logging.getLogger('galsim')
    config = galsim.config.ReadConfig('demo1.yaml', logger=logger)[0]
    print('Running demo1.yaml')
    galsim.config.Process(config, logger=logger)
コード例 #6
0
    with futures.ThreadPoolExecutor(workers) as executor:
        res=executor.map(download_one,sorted(cc_list))  #mao方法返回一个生成器,因此可以迭代 获取各个函数的返回值
        #使用map执行返回结果
    return len(list(res))
'''


def download_many(cc_list):
    with futures.ThreadPoolExecutor(max_workers=3) as executor:
        to_do = []
        for cc in sorted(cc_list):
            future = executor.submit(download_one,
                                     cc)  #排定可调用对象的执行时间 返回期物  表示这个待执行
            to_do.append(future)
            msg = 'Scheduled for {}: {}'
            print(msg.format(cc, future))

        results = []
        for future in futures.as_completed(to_do):  #as_compted函数在期物运行结束后 产出期物
            res = future.result()
            msg = '{} result: {! r}'
            print(msg.format(future, res))
            results.append(res)
    return len(res)
    #目前并行脚本都不能并行下载,使用concurrent.futures库实现的两个实例受GIL 全局解释锁的限制


if __name__ == '__main__':
    print(2)
    main(download_many)
コード例 #7
0
 def print_item(event):
     a = mylist.curselection()
     demo1.main([2, user_name, sheet[a[0] + 1][1].value])