当前位置: 首页>>代码示例>>Python>>正文


Python helpers.Helpers类代码示例

本文整理汇总了Python中helpers.Helpers的典型用法代码示例。如果您正苦于以下问题:Python Helpers类的具体用法?Python Helpers怎么用?Python Helpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Helpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connect

 def connect(cls, host='0.0.0.0', port=12100):
     try:
         cls.sock.connect((host, port))
         return True
     except Exception as e:
         Helpers.print_error(str(e))
     return False
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:7,代码来源:socket_client.py

示例2: _populate_grid_at_position

    def _populate_grid_at_position(self,
                                   grid_position,
                                   mapper,
                                   layout,
                                   coordinate_pair):
        # creates a button and positions it on the grid

        x, y = coordinate_pair[0], coordinate_pair[1]
        textual_coordinates = "{0}-{1}".format(x, y)
        button = QCustomPushButton(
            self,
            grid_position,
            Coordinates.parse_coordinates(textual_coordinates,
                                          self._grid_size)
        )

        Helpers.paint_grid_button(button, style.FIELD_BLUE)
        button.setObjectName("GridButton")
        button.setFixedSize(style.FIELD_ICON_SIZE + 10,
                            style.FIELD_ICON_SIZE + 10)
        button.setIconSize(QSize(style.FIELD_ICON_SIZE, style.FIELD_ICON_SIZE))

        # set the QSignalMapper's mapping to work with strings
        mapper.setMapping(button, textual_coordinates)
        # connecting the button's clicked signal to the QSignalMappers
        # mapped slot
        button.clicked.connect(mapper.map)
        # finally, add the button to the QGridLayout
        layout.addWidget(button, x, y)
开发者ID:Venom1991,项目名称:RagingSeas,代码行数:29,代码来源:raging_seas_window.py

示例3: recv

 def recv(cls):
     recv_header = cls.sock.recv(1024)
     headers = json.loads(recv_header.decode('utf-8'))
     content_length = headers['content-length']
     recv_data = cls.sock.recv(content_length)
     data = recv_data.decode('utf-8')
     data_dict = json.loads(data)
     Helpers.check_data(data_dict)
     return data_dict
开发者ID:1635594911,项目名称:FeelUOwn,代码行数:9,代码来源:socket_client.py

示例4: main

def main(args):
    commander = Commander()
    helpers = Helpers()
    extractor = Extractor()

    commandandarguments = superCreatePushCommand(args, commander, helpers, extractor)

    dumpfilepath = helpers.getDumpFilePath(args)
    executeCommandAndArguments(commandandarguments, dumpfilepath);
开发者ID:Enome,项目名称:SuperFetcher,代码行数:9,代码来源:usqlpusher.py

示例5: __init__

 def __init__(self, filename, spec=None):
     Helpers.__init__(self)
     self.filename = filename
     self.spec = spec
     self.is_build = False
     self.build_failed = False
     self._rpm_files = None
     self.rpmlint_output = []
     self.unpack()
开发者ID:hadrons123,项目名称:FedoraReview,代码行数:9,代码来源:srpm_file.py

示例6: assertCanResizeCluster

 def assertCanResizeCluster(self, resource_group, target):
     self.client.clusters.update(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name,
                                 scale_settings=models.ScaleSettings(
                                     manual=models.ManualScaleSettings(target_node_count=target)))
     self.assertEqual(
         Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, target,
                                Helpers.NODE_STARTUP_TIMEOUT_SEC),
         target)
     Helpers.assert_remote_login_info_reported_for_nodes(self, self.client, resource_group.name,
                                                         self.cluster_name, target)
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:10,代码来源:test_mgmt_batchai_clusters.py

示例7: test_setup_task_execution

    def test_setup_task_execution(self, resource_group, location, storage_account, storage_account_key):
        """Tests setup task execution.
        """
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 1,
            storage_account.name, storage_account_key,
            setup_task_cmd='echo $GREETING $SECRET_GREETING',
            setup_task_env={'GREETING': 'setup task'},
            setup_task_secrets={'SECRET_GREETING': 'has a secret'})  # type: models.Cluster

        # Verify that the cluster is reported in the list of clusters
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [self.cluster_name])

        # Verify that one node is allocated and become available
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 1,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 1)

        # Check that server doesn't return values for secrets
        self.assertEqual(len(cluster.node_setup.setup_task.secrets), 1)
        self.assertEqual(cluster.node_setup.setup_task.secrets[0].name, 'SECRET_GREETING')
        self.assertIsNone(cluster.node_setup.setup_task.secrets[0].value)
        # Verify that the setup task is completed by checking generated output. BatchAI reports a path which was auto-
        # generated for storing setup output logs.
        setup_task_output_path = cluster.node_setup.setup_task.std_out_err_path_suffix
        nodes = Helpers.get_node_ids(self.client, resource_group.name, self.cluster_name)
        self.assertEqual(len(nodes), 1)
        node_id = nodes[0]
        Helpers.assert_file_in_file_share(self, storage_account.name, storage_account_key,
                                          setup_task_output_path,
                                          'stdout-{0}.txt'.format(node_id),
                                          u'setup task has a secret\n')
        Helpers.assert_file_in_file_share(self, storage_account.name, storage_account_key,
                                          setup_task_output_path, 'stderr-{0}.txt'.format(node_id), u'')
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:35,代码来源:test_mgmt_batchai_clusters.py

示例8: getWeather

 def getWeather(self):
     if(Helpers.isAligned(self.p1,self.p2,self.p3)):
         if(Helpers.isAligned(self.p1,self.p2,self.sun)):
            # print 'sequia ' + str(self.p1) + str(self.p2) + str(self.p3)+ ' - ' + str(self.p1.day)
             return -2
         print 'buen clima ' + str(self.p1) + str(self.p2) + str(self.p3)
         return -1
     if(Helpers.inTriangle(self.sun,self.p1,self.p2,self.p3)):
         #print 'lluvia ' + str(self.p1) + str(self.p2) + str(self.p3)
         return Helpers.perimeter(self.p1,self.p2,self.p3)
    # print 'invalido ' + str(self.p1) + str(self.p2) + str(self.p3) + ' - ' + str(self.p1.day)
     return -3
开发者ID:aranajuan,项目名称:ml_examen,代码行数:12,代码来源:system.py

示例9: _declare_winner

    def _declare_winner(self, winner):
        self.session.session_phase = SessionPhase.game_over
        self._is_new_game = False
        self._update_status_bar()

        player_type_textual = EnumConverters.\
            player_type_to_string_converter(winner.player_type)

        Helpers.raise_info(
            self,
            self.tr("Game over - {0} wins!".format(
                    player_type_textual))
        )
开发者ID:Venom1991,项目名称:RagingSeas,代码行数:13,代码来源:raging_seas_window.py

示例10: __init__

 def __init__(self, base, plugin_path):
     Helpers.__init__(self)
     self.plugin_path = plugin_path
     self.version = None
     self.spec = base.spec
     self.srpm = base.srpm
     self.sources = base.sources
     self.encoder = ReviewJSONEncoder()
     self.decoder = JSONDecoder()
     self.results = []
     self.plug_in = None
     self.plug_out = None
     self.plug_err = None
开发者ID:hadrons123,项目名称:FedoraReview,代码行数:13,代码来源:jsonapi.py

示例11: build

def build():

  sed = Sed()
  help.replacer(sed)

  sh('compass compile src')

  app = FileList('src/app', filter="*root.js")
  app.merge(FileList('src/app', filter="*.js", exclude="*root.js"))
  combine(app, FileSystem.join(Yak.paths['build'], 'js/app.js'))

  knownHelpers = [
    'action',
    'bind',
    'bindAttr',
    'collection',
    'each',
    'if',
    'log',
    'outlet',
    'unless',
    'view',
    'with'
  ]

  helperCmd = ''
  for helper in knownHelpers:
    helperCmd += '-k %s ' % helper

  stf = Std()
  sh('handlebars src/app/templates -r src/app/templates -f .build/js/templates.js %s' % helperCmd, header="build templates", std = stf)
  if stf.err:
    console.fail("PROUT")

  deepcopy('src/index.html', Yak.paths['build'])

  deepcopy('src/assets/images', FileSystem.join(Yak.paths['build'], 'images'))

  fontcss = FileList('src/assets/fonts/', filter="*.css")
  combine(fontcss, FileSystem.join(Yak.paths['build'], 'fonts/pictos.css'))

  # pictos = FileList('src/assets/fonts/generated', exclude="*.css")
  # deepcopy(pictos, FileSystem.join(Yak.paths['build'], 'fonts'))

  fonts = FileList('src/assets/fonts/signika')
  deepcopy(fonts, FileSystem.join(Yak.paths['build'], 'fonts'))

  # Phonegap is still needed on desktop
  libs = FileList('src/lib/phonegap/ios', filter="*.js")
  libs.merge(FileList('src/lib/phonegap/plugins', filter="*.js"))
  combine(libs, FileSystem.join(Yak.paths['build'], 'js', 'phonegap.js'))
开发者ID:BensonXiong,项目名称:mobile-app,代码行数:51,代码来源:pukefile.py

示例12: test_creation_and_deletion

    def test_creation_and_deletion(self, resource_group, location, storage_account, storage_account_key):
        """Tests basic use-case scenario.

        1. Create cluster
        2. Execute a task on the host
        3. Execute a task in a docker container
        4. Delete cluster
        """
        cluster = Helpers.create_cluster(
            self.client, location, resource_group.name, self.cluster_name, 'STANDARD_D1', 1,
            storage_account.name, storage_account_key)

        self.assertEqual(cluster.name, self.cluster_name)
        self.assertIsNone(cluster.errors)
        self.assertEqual(cluster.vm_size, 'STANDARD_D1')

        # Verify that the cluster is reported in the list of clusters
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [self.cluster_name])

        # Verify that one node is allocated and become available
        self.assertEqual(
            Helpers.wait_for_nodes(self.is_live, self.client, resource_group.name, self.cluster_name, 1,
                                   Helpers.NODE_STARTUP_TIMEOUT_SEC), 1)
        Helpers.assert_remote_login_info_reported_for_nodes(self, self.client, resource_group.name,
                                                            self.cluster_name, 1)

        # Verify that the cluster able to run tasks.
        self.assertCanRunJobOnHost(resource_group, location, cluster.id)
        self.assertCanRunJobInContainer(resource_group, location, cluster.id)

        # Test cluster deletion
        self.client.clusters.delete(resource_group.name, Helpers.DEFAULT_WORKSPACE_NAME, self.cluster_name).result()
        Helpers.assert_existing_clusters_are(self, self.client, resource_group.name, [])
开发者ID:Azure,项目名称:azure-sdk-for-python,代码行数:33,代码来源:test_mgmt_batchai_clusters.py

示例13: __init__

 def __init__(self, base):
     Helpers.__init__(self)
     self.base = base
     self.spec = base.spec
     self.srpm = base.srpm
     self.sources = base.sources
     self.url = None
     self.text = None
     self.description = None
     self.state = 'pending'
     self.type = 'MUST'
     self.result = None
     self.output_extra = None
     self.attachments = []
开发者ID:hadrons123,项目名称:FedoraReview,代码行数:14,代码来源:check_base.py

示例14: delete_record

    def delete_record(self, o):

        if hasattr(o, 'service'):
            # this is a ServiceAttribute model
            if 'ONOSService' in o.service.leaf_model.class_names:
                print "sync ONOSService Attribute", o.service.leaf_model

                log.info("Deleting config %s" % o.name)
                # getting onos url and auth
                onos_service = o.service.leaf_model
                onos_url = "%s:%s" % (
                    Helpers.format_url(onos_service.rest_hostname), onos_service.rest_port)
                onos_basic_auth = HTTPBasicAuth(onos_service.rest_username,
                                                onos_service.rest_password)

                url = o.name
                if url[0] == "/":
                    # strip initial /
                    url = url[1:]

                url = '%s/%s' % (onos_url, url)
                request = requests.delete(url, auth=onos_basic_auth)

                if request.status_code != 204:
                    log.error("Request failed", response=request.text)
                    raise Exception("Failed to remove config %s from ONOS:  %s" % (url, request.text))
开发者ID:opencord,项目名称:onos-service,代码行数:26,代码来源:sync_onos_service.py

示例15: sync_record

    def sync_record(self, o):
        if hasattr(o, 'service'):
            # this is a ServiceAttribute model
            if 'ONOSService' in o.service.leaf_model.class_names:
                print "sync ONOSService Attribute", o.service.leaf_model
                return self.sync_record(o.service.leaf_model)
            return  # if it's not related to an ONOSService do nothing

        onos_url = "%s:%s" % (Helpers.format_url(o.rest_hostname), o.rest_port)
        onos_basic_auth = HTTPBasicAuth(o.rest_username, o.rest_password)

        configs = self.get_service_attribute(o)
        for url, value in configs.iteritems():

            if url[0] == "/":
                # strip initial /
                url = url[1:]

            url = '%s/%s' % (onos_url, url)
            value = json.loads(value)
            request = requests.post(url, json=value, auth=onos_basic_auth)

            if request.status_code != 200:
                log.error("Request failed", response=request.text)
                raise Exception("Failed to add config %s in ONOS" % url)
开发者ID:opencord,项目名称:onos-service,代码行数:25,代码来源:sync_onos_service.py


注:本文中的helpers.Helpers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。