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


Python utils.get_version函数代码示例

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


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

示例1: renderDefinitions

 def renderDefinitions(self):
     """Render field definition."""
     self.append(rst_title("Definitions", 2))
     self.append(LI + ' CUs: Concurrent users or number of concurrent threads'
                 ' executing tests.')
     self.append(LI + ' Request: a single GET/POST/redirect/XML-RPC request.')
     self.append(LI + ' Page: a request with redirects and resource'
                 ' links (image, css, js) for an HTML page.')
     self.append(LI + ' STPS: Successful tests per second.')
     self.append(LI + ' SPPS: Successful pages per second.')
     self.append(LI + ' RPS: Requests per second, successful or not.')
     self.append(LI + ' maxSPPS: Maximum SPPS during the cycle.')
     self.append(LI + ' maxRPS: Maximum RPS during the cycle.')
     self.append(LI + ' MIN: Minimum response time for a page or request.')
     self.append(LI + ' AVG: Average response time for a page or request.')
     self.append(LI + ' MAX: Maximmum response time for a page or request.')
     self.append(LI + ' P10: 10th percentile, response time where 10 percent'
                 ' of pages or requests are delivered.')
     self.append(LI + ' MED: Median or 50th percentile, response time where half'
                 ' of pages or requests are delivered.')
     self.append(LI + ' P90: 90th percentile, response time where 90 percent'
                 ' of pages or requests are delivered.')
     self.append(LI + ' P95: 95th percentile, response time where 95 percent'
                 ' of pages or requests are delivered.')
     self.append(LI + Apdex.description_para)
     self.append(LI + Apdex.rating_para)
     self.append('')
     self.append('Report generated with FunkLoad_ ' + get_version() +
                 ', more information available on the '
                 '`FunkLoad site <http://funkload.nuxeo.org/#benching>`_.')
开发者ID:MaxCDN,项目名称:FunkLoad,代码行数:30,代码来源:ReportRenderRst.py

示例2: about_clicked

	def about_clicked (self, arg):
		about_dialog = Gtk.AboutDialog ()
		about_dialog.set_name ("Labyrinth")
		about_dialog.set_version (utils.get_version())
		if os.name != 'nt':
			try:
				about_dialog.set_logo_icon_name("labyrinth")
			except:
				pass
		else:
			about_dialog.set_logo (GdkPixbuf.Pixbuf.new_from_file("images\\labyrinth-24.png"))
		about_dialog.set_license (
	"Labyrinth is free software; you can redistribute it and/or modify "
	"it under the terms of the GNU General Public Licence as published by "
	"the Free Software Foundation; either version 2 of the Licence, or "
	"(at your option) any later version."
	"\n\n"
	"Labyrinth is distributed in the hope that it will be useful, "
	"but WITHOUT ANY WARRANTY; without even the implied warranty of "
	"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
	"GNU General Public Licence for more details."
	"\n\n"
	"You should have received a copy of the GNU General Public Licence "
	"along with Labyrinth; if not, write to the Free Software Foundation, Inc., "
	"59 Temple Place, Suite 330, Boston, MA  02111-1307  USA")
		about_dialog.set_wrap_license (True)
		about_dialog.set_copyright ("2006-2008 Don Scorgie et. al")
		about_dialog.set_authors (AUTHORS)
		about_dialog.set_website ("http://code.google.com/p/labyrinth")
		about_dialog.set_translator_credits (_("Translation by Don Scorgie"))
		about_dialog.run ()
		about_dialog.hide ()
		del (about_dialog)
		return
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:34,代码来源:Browser.py

示例3: parseArgs

    def parseArgs(self, argv):
        """Parse programs args."""
        parser = OptionParser(self.USAGE, formatter=TitledHelpFormatter(),
                              version="FunkLoad %s" % get_version())
        parser.add_option("-v", "--verbose", action="store_true",
                          help="Verbose output")
        parser.add_option("-p", "--port", type="string", dest="port",
                          default=self.port, help="The proxy port.")
        parser.add_option("-i", "--tcp-watch-input", type="string",
                          dest="tcpwatch_path", default=None,
                          help="Path to an existing tcpwatch capture.")
        parser.add_option("-l", "--loop", type="int",
                          dest="loop", default=1,
                          help="Loop mode.")

        options, args = parser.parse_args(argv)
        if len(args) == 1:
            test_name = args[0]
        else:
            test_name = None

        self.verbose = options.verbose
        self.tcpwatch_path = options.tcpwatch_path
        self.port = options.port
        if not test_name and not self.tcpwatch_path:
            self.loop = options.loop
        if test_name:
            test_name = test_name.replace('-', '_')
            class_name = ''.join([x.capitalize()
                                  for x in re.split('_|-', test_name)])
            self.test_name = test_name
            self.class_name = class_name
            self.script_path = './test_%s.py' % class_name
            self.configuration_path = './%s.conf' % class_name
开发者ID:jasongrout,项目名称:FunkLoad,代码行数:34,代码来源:Recorder.py

示例4: process_page

def process_page(s, rcnturl, li):
    name = li.a.text
    ao_url = urljoin(rcnturl, li.a['href'])
    LOG.info(ao_url)
    try:
        ao_resp = s.get(ao_url)
    except requests.exceptions.ReadTimeout:
        LOG.error('Read timeout: Internet connected?')
        sys.exit(1)
    except ConnectionResetError:
        LOG.error('Connection reset, skipping')
        return None
    ao_soup = BeautifulSoup(ao_resp.text, "html.parser")

    det = ao_soup.find('div', class_='main-details')

    cfurl = det.find('li', class_='curseforge').a.get('href')
    if cfurl[0:2] == '//':
        # They started returning url's without http(s)
        cfurl = "http:" + cfurl
    cfresp = s.get(cfurl)
    cfsoup = BeautifulSoup(cfresp.text, 'html.parser')

    # the curseforge page has an info pane with a lot of stuff we want
    cfip = cfsoup.find('div', class_='lastUnit')
    cfdl = urljoin(cfresp.url, cfip.find('li', class_='user-action-download').a.get('href'))
    # cffacts = cfip.find('div', class_='content-box-inner')
    cffacts = cfip.find('h3', text='Facts').parent
    # this gets us a unix timestamp for created date
    cfcreated = cffacts.find('dt', text="Date created").find_next('dd').span.get('data-epoch')
    cfupdated = cffacts.find('dt', text="Last update").find_next('dd').span.get('data-epoch')
    cflicurl = cffacts.find('a', class_='license').get('href')
    cflicname = cffacts.find('a', class_='license').text

    # find the most recent download
    # TODO older releases, notes, etc
    cfdlresp = s.get(cfdl)
    cfdlsoup = BeautifulSoup(cfdlresp.text, 'html.parser')
    cfdlfile = cfdlsoup.find('li', class_='user-action-download').a.get('href')
    CACHE.get(cfdlfile)

    # TODO need more ways of getting tags
    addon = {
        'name': name,
        'tags': [det.find('a', class_='main-category').get('title')],
        'authors': [x.li.a.text for x in det.find_all('ul', class_='authors')],
        'wowver': det.find('li', class_='version').text.split(' ')[-1],
        'forge': det.find('li', class_='curseforge').a.get('href'),
        'relqual': det.find('li', class_='release').text.split(' ')[-1],
        'latest': get_version(det.find('li', class_='newest-file').text),
        'created': cfcreated,
        'updated': cfupdated,
        'license': (cflicname, cflicurl),
        'download': cfdlfile,
        'datetime': datetime.datetime.now(),
    }

    return addon
开发者ID:iggy,项目名称:adonis-cli,代码行数:58,代码来源:generate_addon_dbs.py

示例5: setUpClass

    def setUpClass(cls):
        distro, _version = get_version()
        if distro == "debian":
            os.environ["LIBBLOCKDEV_SKIP_DEP_CHECKS"] = ""

        if not BlockDev.is_initialized():
            BlockDev.init(cls.requested_plugins, None)
        else:
            BlockDev.reinit(cls.requested_plugins, True, None)
开发者ID:cathay4t,项目名称:libblockdev,代码行数:9,代码来源:mpath_test.py

示例6: parseArgs

 def parseArgs(self, argv):
     """Parse programs args."""
     parser = OptionParser(self.usage, formatter=TitledHelpFormatter(),
                           version="FunkLoad %s" % get_version())
     parser.add_option("-q", "--quiet", action="store_true",
                       help="Verbose output")
     options, args = parser.parse_args(argv)
     if len(args) != 3:
         parser.error("Missing argument")
     return args[1], args[2], options
开发者ID:SMFOSS,项目名称:FunkLoad,代码行数:10,代码来源:XmlRpcBase.py

示例7: _sendmessage

 def _sendmessage(self, message, sock=None, trans_id=None, lock=None):
     message["v"] = get_version()
     if trans_id:
         message["t"] = trans_id
     encoded = bencode(message)
     if sock:
         if lock:
             with lock:
                 sock.sendto(encoded, (self.host, self.port))
         else:
             sock.sendto(encoded, (self.host, self.port))
开发者ID:wycstar,项目名称:dht,代码行数:11,代码来源:node.py

示例8: crawl_blog_post

def crawl_blog_post(blog_id, log_no, tags, written_time=None, verbose=True):

    def get_title(root):
        result = ''
        try:
            result = root.xpath('//h3[@class="tit_h3"]/text()')[0].strip()
        except Exception:
            pass
        if result != '':
            return result

        try:
            result = root.xpath('//h3[@class="se_textarea"]/text()')[0].strip()
        except Exception:
            pass
        #return root.xpath('//h3[@class="tit_h3"]/text()')[0].strip()
        return result

    def get_page_html(url):
        try:
            page = requests.get(url, headers=headers)
            root = html.fromstring(page.content)
            elem = root.xpath('//div[@class="_postView"]')[0]
            html_ = etree.tostring(elem)
            return (BeautifulSoup(html_, 'lxml'), get_title(root))
        except IOError:
            print ''
            return (None, None)

    #if blog_id.startswith('http'):
    #    url = blog_id
    #else:
    url = mobileurl % (blog_id, log_no)

    (doc, title)    = get_page_html(url)

    if doc:
        crawled_time    = utils.get_today_str()
        crawler_version = utils.get_version()
        #url             = posturl % (blog_id, log_no)
        post_tags       = tags[(blog_id, log_no)]
        directory_seq   = None  # NOTE: No directory sequence given for query crawler

        post = btc.make_structure(blog_id, log_no, None, doc, crawled_time,
                crawler_version, title, written_time, url, post_tags, directory_seq)
        if not verbose:
            del post['directorySeq']
            del post['sympathyCount']
        return post

    else:
        print 'No doc in %s' % posturl
        return None
开发者ID:AppleHolic,项目名称:naver-blog-crawler,代码行数:53,代码来源:blog_query_crawler.py

示例9: _funkload_init

    def _funkload_init(self):
        """Initialize a funkload test case using a configuration file."""
        # look into configuration file
        config_path = getattr(self._options, 'config', None)
        if not config_path:
          config_directory = os.getenv('FL_CONF_PATH', '.')
          config_path = os.path.join(config_directory,
                                     self.__class__.__name__ + '.conf')
        config_path = os.path.abspath(os.path.expanduser(config_path))
        if not os.path.exists(config_path):
            config_path = "Missing: "+ config_path
        config = ConfigParser()
        config.read(config_path)
        self._config = config
        self._config_path = config_path
        self.conf = ConfSectionFinder(self)
        self.default_user_agent = self.conf_get('main', 'user_agent',
                                                'FunkLoad/%s' % get_version(),
                                                quiet=True)
        if self.in_bench_mode:
            section = 'bench'
        else:
            section = 'ftest'
        self.setOkCodes( self.conf_getList(section, 'ok_codes',
                                           [200, 301, 302, 303, 307],
                                           quiet=True) )
        self.sleep_time_min = self.conf_getFloat(section, 'sleep_time_min', 0)
        self.sleep_time_max = self.conf_getFloat(section, 'sleep_time_max', 0)
        self._simple_fetch = self.conf_getInt(section, 'simple_fetch', 0,
                                              quiet=True)
        self.log_to = self.conf_get(section, 'log_to', 'console file')
        self.log_path = self.conf_get(section, 'log_path', 'funkload.log')
        self.result_path = os.path.abspath(
            self.conf_get(section, 'result_path', 'funkload.xml'))

        # init loggers
        if self.in_bench_mode:
            level = logging.INFO
        else:
            level = logging.DEBUG
        self.logger = get_default_logger(self.log_to, self.log_path,
                                         level=level)
        self.logger_result = get_default_logger(log_to="xml",
                                                log_path=self.result_path,
                                                name="FunkLoadResult")
        #self.logd('_funkload_init config [%s], log_to [%s],'
        #          ' log_path [%s], result [%s].' % (
        #    self._config_path, self.log_to, self.log_path, self.result_path))

        # init webunit browser (passing a fake methodName)
        self._browser = WebTestCase(methodName='log')
        self.clearContext()
开发者ID:Sketch,项目名称:FunkLoad,代码行数:52,代码来源:FunkLoadTestCase.py

示例10: on_about

 def on_about(self, sender):
     ad = gtk.AboutDialog()
     ad.set_name("Chessmemory")
     ad.set_comments("Open Source Chess Viewer and Database Tool")
     ad.set_version(utils.get_version())
     ad.set_copyright("Copyright © 2006 Daniel Borgmann")
     ad.set_authors([
         "Daniel Borgmann <[email protected]>",
         "Nils R Grotnes <[email protected]>",
     ])
     ad.set_license(utils.get_license())
     ad.set_logo_icon_name("chessmemory")
     ad.run()
开发者ID:btrent,项目名称:chessmemory,代码行数:13,代码来源:mainwindow.py

示例11: parseArgs

    def parseArgs(self, argv):
        """Parse programs args."""
        parser = OptionParser(self.usage, formatter=TitledHelpFormatter(),
                              version="FunkLoad %s" % get_version())
        parser.add_option("-v", "--verbose", action="store_true",
                          help="Verbose output")
        parser.add_option("-d", "--debug", action="store_true",
                          help="debug mode, server is run in forground")

        options, args = parser.parse_args(argv)
        if len(args) != 2:
            parser.error("Missing configuration file argument")
        return args[1], options
开发者ID:MaxCDN,项目名称:FunkLoad,代码行数:13,代码来源:XmlRpcBase.py

示例12: main

def main():
    setup(
        name                 = 'veusz_plugins',
        version              = get_version('veusz_plugins/__init__.py'),
        description          = 'A collection of miscellaneous plugins for the veusz graphing application',
        long_description     = description('README.rst'),
        author               = 'Dave Hughes',
        author_email         = '[email protected]',
        url                  = 'https://github.com/waveform80/veusz_plugins',
        packages             = find_packages(exclude=['distribute_setup', 'utils']),
        install_requires     = ['xlrd'],
        platforms            = 'ALL',
        zip_safe             = False,
        classifiers          = classifiers
    )
开发者ID:waveform80,项目名称:veusz_plugins,代码行数:15,代码来源:setup.py

示例13: reqs_yml

    def reqs_yml(self):
        """
        Export a requirements file in yml format.
        """
        default_yml_item = """
- src:     '%src'
  name:    '%name'
  scm:     '%scm'
  version: '%version'
"""

        role_lines = "---\n"
        for role in sorted(self.report["roles"]):
            name = utils.normalize_role(role, self.config)
            galaxy_name = "{0}.{1}".format(self.config["scm_user"], name)
            yml_item = default_yml_item

            if self.config["scm_host"]:
                yml_item = yml_item.replace("%name",
                                            "{0}".format(galaxy_name))
                if self.config["scm_repo_prefix"]:
                    role = self.config["scm_repo_prefix"] + name

                src = os.path.join(self.config["scm_host"],
                                   self.config["scm_user"], role)
            else:
                src = galaxy_name
                yml_item = yml_item.replace("  name: '%name'\n", "")
                yml_item = yml_item.replace("  scm: '%scm'\n", "")

            yml_item = yml_item.replace("%src", src)

            if self.config["scm_type"]:
                yml_item = yml_item.replace("%scm", self.config["scm_type"])
            else:
                yml_item = yml_item.replace("  scm: '%scm'\n", "")

            version_path = os.path.join(self.roles_path, role, "VERSION")
            version = utils.get_version(version_path)
            yml_item = yml_item.replace("%version", version)

            role_lines += "{0}".format(yml_item)

        if self.out_file:
            utils.string_to_file(self.out_file, role_lines)
        else:
            print role_lines
开发者ID:ContentSquare,项目名称:ansigenome,代码行数:47,代码来源:export.py

示例14: stats_mode

def stats_mode(args):
    first_completed = []
    time_to_completion = []
    num_packets_sent = []
    num_adv_sent = []
    num_req_sent = []
    num_data_sent = []

    for f in args.files:
        lines = utils.get_log_lines([f])
        lines = utils.sync_timings(lines)
        nodes = utils.get_nodes(lines)
        version = utils.get_version(lines)
        t_min = utils.get_t_min(lines)
        total_pages = utils.get_total_pages(lines, version)
        start_times = utils.get_start_times(lines, nodes, t_min)
        completion_times = utils.get_completion_times(lines, nodes, total_pages, version)
        final_times = utils.get_final_times(lines, nodes, total_pages, version)
        time_taken = utils.get_time_taken(nodes, start_times, final_times)
        packets_sent = utils.get_packets_sent(lines, nodes, start_times, final_times)

        num_adv_sent.append(sum(v[0] for v in packets_sent.values()))
        num_req_sent.append(sum(v[1] for v in packets_sent.values()))
        num_data_sent.append(sum(v[2] for v in packets_sent.values()))
        num_packets_sent.append(sum(sum(v) for v in packets_sent.values()))
        time_to_completion.append(max(time_taken.values()).total_seconds())
        first_completed.append(min(v.total_seconds() for v in time_taken.values() if v.total_seconds()))
    avg_time_to_completion = sum(time_to_completion) / len(time_to_completion)
    print "Average Time to Completion:", avg_time_to_completion
    avg_first_completed = sum(first_completed) / len(first_completed)
    print "Average Time for first node:", avg_first_completed
    print "Average Delta:", avg_time_to_completion - avg_first_completed

    avg_packets_sent = float(sum(num_packets_sent)) / len(num_packets_sent)
    avg_adv_sent = sum(num_adv_sent) / len(num_adv_sent)
    avg_req_sent = sum(num_req_sent) / len(num_req_sent)
    avg_data_sent = sum(num_data_sent) / len(num_data_sent)

    print "Average Packets Sent:", avg_packets_sent
    print "Total ADV Sent:", avg_adv_sent
    print "Total REQ Sent:", avg_req_sent
    print "Total DATA Sent:", avg_data_sent

    print "Average ADV Sent %:", 100 * avg_adv_sent / avg_packets_sent
    print "Average REQ Sent %:", 100 * avg_req_sent / avg_packets_sent
    print "Average DATA Sent %:", 100 * avg_data_sent / avg_packets_sent
开发者ID:ymichael,项目名称:xbns,代码行数:46,代码来源:results.py

示例15: reqs_txt

    def reqs_txt(self):
        """
        Export a requirements file in txt format.
        """
        role_lines = ""

        for role in sorted(self.report["roles"]):
            name = utils.normalize_role(role, self.config)
            galaxy_name = "{0}.{1}".format(self.config["scm_user"], name)

            version_path = os.path.join(self.roles_path, role, "VERSION")
            version = utils.get_version(version_path)
            role_lines += "{0},{1}\n".format(galaxy_name, version)

        if self.out_file:
            utils.string_to_file(self.out_file, role_lines)
        else:
            print role_lines
开发者ID:ContentSquare,项目名称:ansigenome,代码行数:18,代码来源:export.py


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