Exemple #1
0
def RunTestCase(starttime,devices):
    print("进入",devices,"的RunTestCase")
    # 获取路径
    configPath = "./config.ini"
    package = Config.getValue(configPath, "packName")[0]
    casepath = os.path.join(os.getcwd(), "TestCase")
    if not os.path.exists(casepath):
        print("测试用例需放到‘TestCase’文件目录下")
    reportpath = os.path.join(os.getcwd(), "Report")
    if not os.path.exists(reportpath):
        os.mkdir(reportpath)
        os.mkdir(reportpath+"/Screen")
    #读取ini文件,获得期望测试的用例列表
    TestList=Config.getValue(configPath, "testcase")
    # 通过GetPyList方法,取得目录里可测试的用例列表
    scriptList = File.GetPyList(casepath)
    suite = unittest.TestSuite()
    for i in range(len(TestList)):
        fileName = "TC_" + TestList[i]
        if fileName in scriptList:
            result = globals()[fileName].Main(devices)
            suite.addTests(result)
    unittestReport = BeautifulReport(suite)
    #处理模拟器端口用的冒号
    if ":" in devices:
        devices=devices.split(":")[1]
    print("devices=",devices)
    nowtime=time.strftime("%H%M%S")
    unittestReport.report(filename=devices+"_"+str(nowtime),description=package, report_dir=reportpath)
    stop_app(package)
Exemple #2
0
def main():
    config = Config('mycfg2.cfg')
    # config.remove_peer('third')
    # config.add_peer('third')
    # config.create('192.168.8.1', 'eth0', 125625, 'ASDA5D5A2AS15D1AS61D61A6D')
    # config.add_peer('shitpost', 'SSD5ASD25C25XV4FGGDC6', '192.168.8.9' )
    config.remove_peer('shitpost')
Exemple #3
0
    def __init__(self, hours, wage, cost):
        from tools import Config

        self._cost = cost
        self._data = Config.get_calculator_bot().parse(hours * wage,
                                                       1 if cost == 50 else 0)
        # Check if bot returned some data
        if self._data == None:
            self._calculator = Config.get_fallback_calculator()(hours, wage,
                                                                cost)
Exemple #4
0
    def parse(net, copyright):
        from tools import Config

        # Prepare data for request
        form_data = Config.get('wfirma.pl')
        header_data = {
            'quota_type': form_data['quota_type'],
            'quota': net,
            'company_incidental': form_data['company_incidental'],
        }
        form_data['copyright'] = copyright

        with session() as c:
            # convert data to format viable for url-encoding
            data = {}
            for k, v in form_data.items():
                data['data[StaffContractErrand][%s]' % k] = v
            for k, v in header_data.items():
                data['data[StaffContractHeader][%s]' % k] = v

            # Send the request to the server
            try:
                request = c.post(WfirmaPlBot._url, data=data, timeout=3)
            except:
                print(
                    'Przekroczono maksymalny czas oczekiwania na odpowiedź serwera'
                )
                return None

            # There was some error (most likely server-side), so use offline fallback
            if request.status_code != codes.ok:
                print('Wystąpił błąd podczas pobierania danych do rachunku')
                return None

            return WfirmaPlBot._parse_results(request.text)
Exemple #5
0
    def parse(net, copyright):
        return None

        from tools import Config

        form_data = Config.get('kalkulatory.nf.pl')
        form_data = {
            **form_data,
            **{
                'stawka': 'net',
                'kwota': net,
                '_method': 'POST',
            }
        }

        with session() as c:
            # Fix data format
            data = {}
            for k, v in form_data.items():
                data['data[Calculator][%s]' % k] = v
            # Try to make a request
            try:
                request = c.post(KalkulatoryNfBot._url, data=data, timeout=3)
            except:
                print(
                    'Przekroczono maksymalny czas oczekiwania na odpowiedź serwera'
                )
                return None

            # There was some error (most likely server-side), so use offline fallback
            if request.status_code != codes.ok:
                print('Wystąpił błąd podczas pobierania danych do rachunku')
                return None

            return KalkulatoryNfBot._parse_results(request.text)
Exemple #6
0
def main():
    configPath = "./config.ini"
    devicesList = Config.getValue(
        configPath,
        "deviceslist",
    )
    #devicesList = getdevices()
    print("测试开始")
    try:
        pool = multiprocessing.Pool(processes=len(devicesList))
        print("启动进程池")
        results = []
        for i in range(len(devicesList)):
            pool.apply_async(Main, (
                i,
                devicesList[i],
            ))  #根据设备列表去循环创建进程,对每个进程调用下面的Main方法。
        pool.close()
        pool.join()
        print("进程回收完毕")
        print("测试结束")
    except AirtestError as ae:
        print("Airtest发生错误" + ae)
    except PocoException as pe:
        print("Poco发生错误" + pe)
    except Exception as e:
        print("发生未知错误" + e)
Exemple #7
0
    def __init__(self, mdevice=""):
        # 获取当前文件的上层路径
        self._parentPath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())) + os.path.sep + ".")
        # 获取当前项目的根路径
        self._rootPath = os.path.abspath(os.path.dirname(self._parentPath) + os.path.sep + ".")

        self._devicesList = data['devices_list']
        self._packagePath = data['apkpath']
        self._packageName = data['packname']
        self._activity = data['activity']
        self._mdevice = mdevice
        # 处理模拟器端口用的冒号
        if ":" in self._mdevice:
            self._nickName = self._mdevice.split(":")[1]
        else:
            self._nickName = self._mdevice
        self._allTestcase = data['testcase']
        try:
            app_nick = 'app' + self._nickName
            self._testcaseForSelfDevice = Config.getTestCase(data['TestCaseforDevice'][app_nick])
            if self._testcaseForSelfDevice == "":
                self._testcaseForSelfDevice = self._allTestcase
        except Exception:
            self._testcaseForSelfDevice = self._allTestcase

        self._testCasePath = data['testcasepath']
        if self._testCasePath is None:
            self._testCasePath = os.path.join(self._rootPath, "TestCase")
Exemple #8
0
def sendemail(message):
    # 第三方 SMTP 服务
    configPath = os.path.abspath(
        os.path.dirname(
            os.path.abspath(
                os.path.dirname(inspect.getfile(inspect.currentframe())) +
                os.path.sep + ".")) + os.path.sep + ".") + "\config.ini"
    mail_host = Config.getEmail(configPath, "mail_host")
    mail_user = Config.getEmail(configPath, "mail_user")
    mail_pass = Config.getEmail(configPath, "mail_pass")
    sender = Config.getEmail(configPath, "sender")
    receivers = Config.getEmail(configPath, "receivers")
    print(mail_host, mail_user, mail_pass, sender, receivers)
    smtpObj = smtplib.SMTP()
    smtpObj.connect(mail_host, 25)  # 25 为 SMTP 端口号
    smtpObj.login(mail_user, mail_pass)
    smtpObj.sendmail(sender, receivers, message.as_string())
    print("邮件发送成功")
Exemple #9
0
 def save(self):  # Update daemon config file
     # Make a new Config object
     fileConfig = Config(self.fileName, load=False)
     # Copy values that could be changed to the new Config object and convert representation
     ro = self.get('read-only', False)
     fileConfig['read-only'] = '' if ro else None
     fileConfig['overwrite'] = '' if self.get('overwrite',
                                              False) and ro else None
     fileConfig['startonstartofindicator'] = self.get(
         'startonstartofindicator', True)
     fileConfig['stoponexitfromindicator'] = self.get(
         'stoponexitfromindicator', False)
     exList = self.get('exclude-dirs', None)
     fileConfig['exclude-dirs'] = (None if exList is None else
                                   ', '.join(v for v in CVal(exList)))
     # Store changed values
     fileConfig.save()
     self.changed = False
Exemple #10
0
def main():
    """Main app process. This controls every step of the process"""
    # TODO: Allow users to supply alt configs?
    try:
        config = Config('./Ripmaster.ini')
    # IOError will raise if iniFile is not found. ValueError will raise if
    # iniFile is missing options.
    except (IOError or ValueError), ex:
        print ex
        return
Exemple #11
0
 def __init__(self):
     self.smtp_server = Config.getEmail(configPath, "mail_host")
     self.username = Config.getEmail(configPath, "mail_user")
     self.password = Config.getEmail(configPath, "mail_pass")
     self.sender = Config.getEmail(configPath, "sender")
     # receivers为列表
     self.receivers = Config.getEmail(configPath, "receivers").split(',')
     self.addr_from = Config.getEmail(configPath, "from")
     self.addr_to = Config.getEmail(configPath, "to")
def PushApk2Devices(devicesname):
    configPath = "./config.ini"
    packagename = Config.getValue(configPath, "packName")[0]
    apkpath = Config.getValue(configPath, "apkpath")[0]
    try:
        installThread = threading.Thread(target=AppInstall,
                                         args=(
                                             devicesname,
                                             apkpath,
                                             packagename,
                                         ))
        inputThread = threading.Thread(target=InputEvent, args=(devicesname, ))
        installThread.start()
        inputThread.start()
        installThread.join()
        inputThread.join()
        return "Success"
    except Exception as e:
        return e
    pass
Exemple #13
0
def start():
    global gConfig
    global gSession 
    parser = ConfigParser.RawConfigParser(allow_no_value=True)
    parser.optionxform = str
    parser.read(Config.absjoin(Config.Path.MODULE, "TimeSlicer.ini" ))
    for key, val in parser.items("config"):
        gConfig[key] = val

    load(parser)
    gSession = Session(int(gConfig["time_quantum"]))
Exemple #14
0
def main():
    if len(sys.argv) < 2:
        print '\nUsage: ' + sys.argv[0] + ' fd.cfg\n'
        sys.exit(-1)
        
    config = Config.Config(sys.argv[1])
    
    global_cfg = {
        'global' : {
            'server.socket_host' : str(config.http_ip),
            'server.socket_port' : int(config.http_port),
            'server.thread_pool' : int(config.thread_pool),
            'server.request_queue_size' : int(config.request_queue_size),
            'server.socket_timeout': int(config.timeout),
            'request.show_tracebacks' : False,
            'response.timeout': int(config.timeout),
            'engine.autoreload_on' : False,
            'log.screen': config.log_output,
            'log.error_file': config.log_error_file,
            'log.access_file': config.log_access_file,
            'environment': config.environment,
            'tools.gzip.on': config.gzip
        }
    }
    
    current_dir = os.path.dirname(os.path.abspath(__file__))
    
    cfg = {
        '/css' : {
            'tools.staticdir.on' : True,
            'tools.staticdir.dir' : "css",
            'tools.staticdir.root' : current_dir
        }
    }
    
    cherrypy.config.update(global_cfg)
    cherrypy.quickstart(FlightDaemon(config), '/', config = cfg)
Exemple #15
0
def StartApp(devices):
    configPath = "../config.ini"
    packagename = Config.getValue(configPath, "packName")[0]
    start_app(packagename)

    # 获取andorid的poco代理对象,准备进行开启应用权限(例如申请文件存储、定位等权限)点击操作
    pocoAndroid = AndroidUiautomationPoco(use_airtest_input=True,
                                          screenshot_each_action=False)
    if devices == "127.0.0.1:62001":
        #这里是针对不同机型进行不同控件的选取,需要用户根据自己的实际机型实际控件进行修改
        count = 0
        while not pocoAndroid("android.view.View").exists():
            print(devices, "开启应用的权限点击,循环第", count, "次")
            if count >= 3:
                break
            if pocoAndroid(
                    "com.android.packageinstaller:id/permission_allow_button"
            ).exists():
                pocoAndroid(
                    "com.android.packageinstaller:id/permission_allow_button"
                ).click()
            else:
                time.sleep(3)
                count += 1
    elif devices == "127.0.0.1:62025":
        count = 0
        while not pocoAndroid("android.view.View").exists():
            print(devices, "开启应用的权限点击,循环第", count, "次")
            if count >= 3:
                break
            if pocoAndroid("android:id/button1").exists():
                pocoAndroid("android:id/button1").click()
            else:
                time.sleep(3)
                count += 1

    return None
Exemple #16
0
import os
import os.path as osp
import torch
from tools import Config, setup_seed, initializeWeights
from BatchData import VD_REGLoader, get_iterator, get_data_file, load_vocab
from Trainer import REGTrainer
from REGer import REGModel

# choose GPU
torch.set_num_threads(3)
os.environ["CUDA_VISIBLE_DEVICES"] = '3'
setup_seed(1234)

# read config
cfg = Config('./configs/BaseModel.yml')

# set datapath
data_root = cfg.DATA_PATH
data_cfg = cfg.DATA
data_path = osp.join(data_root, data_cfg.DATA_SET, data_cfg.SPLIT + '_split')

# load vocab
vocab = load_vocab(data_path)
print('vocab_length:', len(vocab))

# load dataset
train_data = get_iterator(VD_REGLoader(vocab, cfg, split='train'),
                          cfg.TRAIN.T_BS)
eval_data = get_iterator(VD_REGLoader(vocab, cfg, split='val'), cfg.TRAIN.V_BS)
testA_data = get_iterator(VD_REGLoader(vocab, cfg, split='testA'),
                          cfg.TRAIN.V_BS)
Exemple #17
0
            logging.info('dial_id %s:' % (ref_id))
            logging.info('Pred: %s' % (pred_sent))
            logging.info('Dialog Pred: %s' % (dialog_list))
            logging.info('Dialog: %s' % (dialog))
            logging.info('REs: %s' % (sents))
            logging.info('Entities: %s' % (entities))

        return all_refer


eval_path = os.path.join(SAVE_PATH, 'eval')
os.makedirs(eval_path, exist_ok=True)

#'''
config_path = osp.join(SAVE_PATH, 'config', 'trainer_config.yml')
cfg = Config(config_path)
print('load model from ', SAVE_PATH)
check_point = torch.load(os.path.join(
    SAVE_PATH, 'checkpoints', CHECKPOINT))  #,map_location = lambda _1,_2,:_1)

# load dataset
data_root = cfg.DATA_PATH
data_cfg = cfg.DATA
data_path = osp.join(data_root, data_cfg.DATA_SET, data_cfg.SPLIT + '_split')
vocab = load_vocab(data_path)
print('vocab_length:', len(vocab))
test_loader = VD_REGLoader(vocab, cfg, split=SPLIT)

model_cfg = cfg.MODEL
model = REGModel(vocab, cfg).cuda()
model.load_state_dict(check_point['state_dict'])
Exemple #18
0
    def __init__(self, mdevice=""):
        # 获取当前文件的上层路径
        self._parentPath = os.path.abspath(
            os.path.dirname(inspect.getfile(inspect.currentframe())) +
            os.path.sep + ".")
        # 获取当前项目的根路径
        self._rootPath = os.path.abspath(
            os.path.dirname(self._parentPath) + os.path.sep + ".")
        self._configPath = self._rootPath + "\config.ini"
        # 获取项目名称
        self._pro_name = Config.getProName(self._configPath, "pro_name")
        # 获取项目配置
        self._jenkins_url = Config.getProConfig(self._configPath,
                                                'jenkins_url',
                                                self._pro_name)[0]
        self._devicesList = Config.getProConfig(self._configPath,
                                                "deviceslist", self._pro_name)
        self._packagePath = Config.getProConfig(self._configPath, "apkpath",
                                                self._pro_name)[0]
        self._packageName = Config.getProConfig(self._configPath, "packname",
                                                self._pro_name)[0]
        self._activityName = Config.getProConfig(self._configPath,
                                                 "activityname",
                                                 self._pro_name)[0]
        # 获取基本配置
        self._skip_pushapk2devices = Config.getBasicConfig(
            self._configPath, "skip_pushapk2devices")
        self._auto_delete_package = Config.getBasicConfig(
            self._configPath, "auto_delete_package")
        self._auto_install_package = Config.getBasicConfig(
            self._configPath, "auto_install_package")
        self._skip_check_of_install = Config.getBasicConfig(
            self._configPath, "skip_check_of_install")
        self._skip_check_of_startapp = Config.getBasicConfig(
            self._configPath, "skip_check_of_startapp")
        self._skip_generate_report = Config.getBasicConfig(
            self._configPath, "skip_generate_report")
        self._skip_email = Config.getBasicConfig(self._configPath,
                                                 "skip_email")
        self._skip_performance = Config.getBasicConfig(self._configPath,
                                                       "skip_performance")
        self._storage_by_excel = Config.getBasicConfig(self._configPath,
                                                       "storage_by_excel")
        self._startTime = time.time()
        self._timeout_of_per_action = int(
            Config.getBasicConfig(self._configPath, "timeout_of_per_action"))
        self._timeout_of_startapp = int(
            Config.getBasicConfig(self._configPath, "timeout_of_startapp"))
        self._mdevice = mdevice
        # 处理模拟器端口用的冒号
        if ":" in self._mdevice:
            self._nickName = self._mdevice.split(":")[1]
        else:
            self._nickName = self._mdevice
        self._iteration = int(
            Config.getBasicConfig(self._configPath, "iteration"))
        self._allTestcase = Config.getProConfig(self._configPath, "testcase",
                                                self._pro_name)
        try:
            self._testcaseForSelfDevice = Config.getTestCase(
                self._configPath, self._pro_name, self._nickName)
            if self._testcaseForSelfDevice[0] == "":
                self._testcaseForSelfDevice = self._allTestcase
        except Exception:
            self._testcaseForSelfDevice = self._allTestcase
        self._testCasePath = Config.getProConfig(self._configPath,
                                                 "testcasepath",
                                                 self._pro_name)
        if self._testCasePath[0] == "":
            self._testCasePath = os.path.join(self._rootPath, "TestCase")

        if self._activityName == "":
            if self._skip_check_of_install == 0:
                self._activityName = APK(self.get_apkpath()).activities[0]
Exemple #19
0
 def set_TestCasePath(self, TestCasepath):
     configPath = self._configPath
     Config.setValue(configPath, "testcasepath", TestCasepath)
Exemple #20
0
from tools import Config

data_config = Config(path_to_train='./autoria/train',
                     path_to_test='./autoria/test',
                     valid_size=0.1,
                     batch_size=64,
                     img_height=224,
                     img_width=224)

train_config = Config(lr_min=1e-5,
                      lr_max=1e-3,
                      n_fozen_layers=[5, 15, 25],
                      path_to_summaries='./summaries',
                      path_to_log='./log.csv',
                      path_to_models='./models',
                      epochs=10,
                      max_queue_size=100,
                      workers=1)

config = Config(
    scope='classifier',
    data=data_config,
    train=train_config,
)
Exemple #21
0
 def __init__(self, mdevice=""):
     #获取当前文件的上层路径
     self._parentPath = os.path.abspath(
         os.path.dirname(inspect.getfile(inspect.currentframe())) +
         os.path.sep + ".")
     #获取当前项目的根路径
     self._rootPath = os.path.abspath(
         os.path.dirname(self._parentPath) + os.path.sep + ".")
     self._configPath = self._rootPath + "\config.ini"
     self._devicesList = Config.getValue(
         self._configPath,
         "deviceslist",
     )
     self._packagePath = Config.getValue(self._configPath, "apkpath")[0]
     self._packageName = Config.getValue(self._configPath, "packname")[0]
     self._activityName = Config.getValue(self._configPath,
                                          "activityname")[0]
     self._needClickInstall = Config.getValue(self._configPath,
                                              "needclickinstall")[0]
     self._needClickStartApp = Config.getValue(self._configPath,
                                               "needclickstartapp")[0]
     self._startTime = time.time()
     self._timeoutAction = int(
         Config.getValue(self._configPath, "timeoutperaction")[0])
     self._timeoutStartApp = int(
         Config.getValue(self._configPath, "timeoutofstartapp")[0])
     self._mdevice = mdevice
     # 处理模拟器端口用的冒号
     if ":" in self._mdevice:
         self._nickName = self._mdevice.split(":")[1]
     else:
         self._nickName = self._mdevice
     self._iteration = int(
         Config.getValue(self._configPath, "iteration")[0])
     self._allTestcase = Config.getValue(self._configPath, "testcase")
     try:
         self._testcaseForSelfDevice = Config.getTestCase(
             self._configPath, self._nickName)
         if self._testcaseForSelfDevice[0] == "":
             self._testcaseForSelfDevice = self._allTestcase
     except Exception:
         self._testcaseForSelfDevice = self._allTestcase
     self._testCasePath = Config.getValue(self._configPath, "testcasepath")
     if self._testCasePath[0] == "":
         self._testCasePath = os.path.join(self._rootPath, "TestCase")
     self._needPerformance = Config.getValue(self._configPath,
                                             "needPerformance")[0]
     if self._activityName == "":
         self._activityName = APK(self.get_apkpath()).activities[0]
Exemple #22
0
config = Config(
    # augmentation
    sequence_change = 0.3,
    zoom_range = (1.2, 1.2),
    random_shear = 0.2,
    random_rotation = 20,
    # data config
    rectangle_imgs = True,
    path_to_data='./facs',
    saved_paths='./paths.pkl',
    # path_to_data='/mnt/course/datasets/facs/',
    test_size = 0.1,
    batch_size = 16,
    img_height = 224,
    img_width = 224,
    n_emotions = 7,
    n_action_units = 41, # target action units
    landmark_size = 2*136, # number of features that provide dlib + delta coding
    n_frames = 10, # number of images in sequence
    # train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 100,
    max_queue_size = 100,
    workers = 1,
    au_map = {64.0: 40, 1.0: 0, 2.0: 3, 43.0: 33, 4.0: 4, 5.0: 5, 6.0: 6,
              1.5: 1, 9.0: 8, 10.0: 9, 11.0: 10, 12.0: 11, 13.0: 12, 14.0: 13,
              15.0: 14, 16.0: 15, 17.0: 16, 18.0: 17, 1.7: 2, 21.0: 19, 22.0: 20,
              23.0: 21, 24.0: 22, 25.0: 23, 26.0: 24, 27.0: 25, 28.0: 26,
              29.0: 27, 30.0: 28, 31.0: 29, 34.0: 30, 38.0: 31, 39.0: 32,
              7.0: 7, 44.0: 34, 45.0: 35, 54.0: 36, 20.0: 18, 61.0: 37,
              62.0: 38, 63.0: 39},
    emotion_map = {
        0:'Anger',
        1:'Contempt',
        2:'Disgust',
        3:'Fear',
        4:'Happiness',
        5:'Sadness',
        6:'Surprise'
    }
    )
Exemple #23
0
 def initialize(self):
     print("Initialize master:")
     self.config = Config.Config("Config/pymosy.conf")
     self.load_modules()
Exemple #24
0
from tools import Config

config = Config(
    path_to_train_imgs='/mnt/course/datasets/coco/train2017',
    path_to_train_json='/mnt/course/datasets/coco/annotations/instances_train2017.json',
    path_to_test_imgs='/mnt/course/datasets/coco/val2017',
    path_to_test_json='/mnt/course/datasets/coco/annotations/instances_val2017.json',
    test_size = 0.1,
    batch_size = 2,
    img_height = 240, #after resize
    img_width = 320, # after resize
    n_classes = 80, # 80 classes
    n_obj = 10,

    #train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 100,
    max_queue_size = 100,
    workers = 1
    )

Exemple #25
0
      autostart, notifications, theme, fmextensions and daemons.

    The dictionary 'config' stores the config settings for usage in code. Its values are saved to
    config file on exit from the Menu.Preferences dialogue or when there is no configuration file
    when application starts.

    Note that daemon settings ('dir', 'read-only', 'overwrite' and 'exclude_dir') are stored
    in ~/ .config/yandex-disk/config.cfg file. They are read in YDDaemon.__init__() method
    (in dictionary YDDaemon.config). Their values are saved to daemon config file also
    on exit from Menu.Preferences dialogue.

    Additionally 'startonstartofindicator' and 'stoponexitfromindicator' values are added into daemon
    configuration file to provide the functionality of obsolete 'startonstart' and 'stoponexit'
    values for each daemon individually.
    """
    APPCONF = Config(pathJoin(APPCONFPATH, APPNAME + '.conf'))
    # Read some settings to variables, set default values and update some values
    APPCONF['autostart'] = checkAutoStart(APPAUTOSTARTDST)
    # Setup on-screen notification settings from config value
    APPCONF.setdefault('notifications', True)
    APPCONF.setdefault('theme', False)
    APPCONF.setdefault('fmextensions', True)
    APPCONF.setdefault('daemons', '~/.config/yandex-disk/config.cfg')
    # Is it a first run?
    if not APPCONF.readSuccess:
        LOGGER.info('No config, probably it is a first run.')
        # Create application config folders in ~/.config
        try:
            makeDirs(APPCONFPATH)
            makeDirs(pathJoin(APPCONFPATH, 'icons/light'))
            makeDirs(pathJoin(APPCONFPATH, 'icons/dark'))
Exemple #26
0
    def __init__(self, mdevice=""):
        # 获取当前文件的上层路径
        self._parentPath = os.path.abspath(
            os.path.dirname(inspect.getfile(inspect.currentframe())) +
            os.path.sep + ".")
        # 获取当前项目的根路径
        self._rootPath = os.path.abspath(
            os.path.dirname(self._parentPath) + os.path.sep + ".")
        self._configPath = self._rootPath + "\config.ini"
        self._devicesList = Config.getValue(
            self._configPath,
            "deviceslist",
        )
        self._packagePath = Config.getValue(self._configPath, "apkpath")[0]
        self._packageName = Config.getValue(self._configPath, "packname")[0]
        self._activityName = Config.getValue(self._configPath,
                                             "activityname")[0]
        self._skip_pushapk2devices = Config.getValue(self._configPath,
                                                     "skip_pushapk2devices")[0]
        self._auto_delete_package = Config.getValue(self._configPath,
                                                    "auto_delete_package")[0]
        self._auto_install_package = Config.getValue(self._configPath,
                                                     "auto_install_package")[0]
        self._skip_check_of_install = Config.getValue(
            self._configPath, "skip_check_of_install")[0]
        self._skip_check_of_startapp = Config.getValue(
            self._configPath, "skip_check_of_startapp")[0]
        self._skip_performance = Config.getValue(self._configPath,
                                                 "skip_performance")[0]
        self._storage_by_excel = Config.getValue(self._configPath,
                                                 "storage_by_excel")[0]
        self._screenoff = Config.getValue(self._configPath, "screenoff")[0]
        self._startTime = time.time()
        self._timeout_of_per_action = int(
            Config.getValue(self._configPath, "timeout_of_per_action")[0])
        self._timeout_of_startapp = int(
            Config.getValue(self._configPath, "timeout_of_startapp")[0])
        self._mdevice = mdevice
        # 处理模拟器端口用的冒号
        if ":" in self._mdevice:
            self._nickName = self._mdevice.split(":")[1]
        else:
            self._nickName = self._mdevice
        self._iteration = int(
            Config.getValue(self._configPath, "iteration")[0])
        self._allTestcase = Config.getValue(self._configPath, "testcase")
        try:
            self._testcaseForSelfDevice = Config.getTestCase(
                self._configPath, self._nickName)
            if self._testcaseForSelfDevice[0] == "":
                self._testcaseForSelfDevice = self._allTestcase
        except Exception:
            self._testcaseForSelfDevice = self._allTestcase
        self._testCasePath = Config.getValue(self._configPath, "testcasepath")
        if self._testCasePath[0] == "":
            self._testCasePath = os.path.join(self._rootPath, "TestCase")

        if self._activityName == "":
            self._activityName = APK(self.get_apkpath()).activities[0]
        self._isSurfaceView = Config.getValue(self._configPath,
                                              "isSurfaceView")[0]
Exemple #27
0
from tools import Config

data_config = Config(
    path_to_data='/mnt/course/datasets/portraits/imgs',
    path_to_masks='/mnt/course/datasets/portraits/masks',
    test_size=0.1,
    batch_size=16,
    img_height=480,  #after resize
    img_width=400,  # after resize
    image_shape=(800, 600, 3)  # original
)

train_config = Config(lr_min=1e-5,
                      lr_max=1e-3,
                      n_fozen_layers=[5, 15, 25],
                      path_to_summaries='./summaries',
                      path_to_log='./log.csv',
                      path_to_models='./models',
                      epochs=10,
                      max_queue_size=100,
                      workers=1)

config = Config(
    scope='classifier',
    data=data_config,
    train=train_config,
)
Exemple #28
0
from tools import Config

config = Config(
    # data config
    path_to_train_data='./facs',
    test_size=0.1,
    batch_size=2,  ############################################
    img_height=48,  ############################################
    img_width=48,  ###############################################
    n_emotions=7,
    n_action_units=65,  # target action units
    landmark_size=136,  # number of features that provide dlib
    img_shape=(640, 490, 3),  # original image shape
    n_frames=10,  # number of images in sequence
    # train config
    path_to_summaries='./summaries',
    path_to_log='./log.csv',
    path_to_models='./models',
    epochs=100,
    max_queue_size=100,
    workers=1)
Exemple #29
0
 def set_packagename(self, packagename):
     configPath = self._configPath
     Config.setValue(configPath, "packname", packagename)
Exemple #30
0
from tools import Config

config = Config(
    path_to_texts='./OE',
    test_size = 0.1,
    batch_size = 1024,
    max_len = 100,


    #train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 200,
    max_queue_size = 100,
    workers = 1
    )

Exemple #31
0
 def set_packagepath(self, packagepath):
     configPath = self._configPath
     Config.setValue(configPath, "apkpath", packagepath)