コード例 #1
0
def args_convert_bool(args):
    """
    Purpose: Convert args which are specified as strings (e.g. yesterday, energy) into boolean to work with environment
    """
    if not isinstance(args.two_price_state, (bool)):
        args.two_price_state = utils.string2bool(args.two_price_state)
    if not isinstance(args.energy, (bool)):
        args.energy = utils.string2bool(args.energy)
    if not isinstance(args.test_planning_env, (bool)):
        args.test_planning_env = utils.string2bool(args.test_planning_env)
コード例 #2
0
 def parse_config_cnn(self, arguments, nnet_spec, conv_nnet_spec):
     self.parse_config_dnn(arguments, nnet_spec)
     # parse convolutional layer structure
     self.conv_layer_configs = parse_conv_spec(conv_nnet_spec, self.batch_size)
     # parse convolutional layer activation
     # parse activation function, including maxout
     if arguments.has_key('conv_activation'):
         self.conv_activation_text = arguments['conv_activation']
         self.conv_activation = parse_activation(arguments['conv_activation'])
         # maxout not supported yet
     # whether we use the fast version of convolution
     if arguments.has_key('use_fast'):
         self.use_fast = string2bool(arguments['use_fast'])
コード例 #3
0
ファイル: assembly64.py プロジェクト: freabemania/assembly
    def OnInit(self):
        global client_id

        utils.assert_folders()
        utils.migrate_from_tmp()
        try:
            setup_log()
        except:
            wx.MessageBox('Another instance of Assembly is running', 'Unable to start',wx.OK | wx.ICON_ERROR)
            sys.exit(0)

        platform = utils.get_platform()
        auto_upgrade = utils.string2bool(platform['autoupgrade'])

        if len(sys.argv) > 1:
            utils.add_user_attribute('show_info_popup','True')
            utils.delete_folder_async('%s/upgrade' %os.getcwd())
            wx.MessageBox('Congratulations! Assembly64 was upgraded from version %s to %s.' %(sys.argv[1], version), 'Assembly64 upgraded!',wx.OK | wx.ICON_INFORMATION)

        try:
            utils.update_server_db()
            newer_available,force,available_version = utils.check_version(version)
            if newer_available and force:
                update_dia = UpdateDialog(None,"New version available", "New version available. Upgrade is vital!",auto_upgrade, True)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
            elif newer_available and not force:
                update_dia = UpdateDialog(None,"New version available", "New version available, but you can stay with this one.. For now!", auto_upgrade, False)
                update_dia.ShowModal()
                if update_dia.is_app_upgrade():
                    upgrade = UpgradeSplash()
                    upgrade.Show()
                    utils.do_upgrade(upgrade,version,platform)
                    os._exit(1)
        except FtpOverloadedException:
            wx.MessageBox('Too many users right now, please try later', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except ftplib.all_errors as a:
            wx.MessageBox('Unable to communicate with Assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)
        except:
            wx.MessageBox('Unable to communicate with assembly64 server.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            sys.exit(0)

        if not utils.has_attribute('uid'):
            client_id = str(uuid.uuid1())
            utils.add_user_attribute('uid',client_id)
            post_ga_event('application','startup_new_user')

        else:
            client_id = utils.get_user_attribute('uid')
            post_ga_event('application','startup_existing_user')

        if not utils.has_attribute('show_info_popup'):
            utils.add_user_attribute('show_info_popup','true')

        if utils.has_attribute(delete_files_after_install) is False:
            utils.add_user_attribute(delete_files_after_install,'true')

        thread = Thread(target = update_db,args = (10, ))
        thread.start()

        AssemblySplash().Show()
        return 1