def key_values(): cli = dict() about_info = About(PKG_NAME) version_info = VersionInfo(PKG_NAME) cli['tapis_cli_name'] = about_info.project cli['tapis_cli_version'] = version_info.version_string() return cli
def __init__(self, api_manager, **options): """ In Flask-Restless, it is up to you to choose which models you would like to make available as an api. It should also be a choice to expose your datamodel, and preferably in the same intuitive way that you register your models. This object functions as a puppet model to give the user the feeling like they are registering just another model they want to expose. """ api_manager.create_api_blueprint = attach_listener( api_manager.create_api_blueprint, self) self.api_manager = api_manager vi = VersionInfo('flask-restless-datamodel') serialize_naively = options.get('serialize_naively', False) self.data_model = { 'FlaskRestlessDatamodel': { 'server_version': vi.release_string(), 'serialize_naively': serialize_naively } } self.polymorphic_info = defaultdict(dict) self.options = options self.model_renderer = None self.model_views = {} self.app = None self.cereal = Cereal(raise_load_errors=options.get( 'raise_load_errors', True), serialize_naively=serialize_naively)
def get(self): """Retrieve the Storyboard system information. Example:: curl https://my.example.org/api/v1/systeminfo """ sb_ver = VersionInfo('storyboard') return wmodels.SystemInfo(version=sb_ver.version_string())
def get_git_rev_or_version(): '''Either get the current git commit or the PyPI distribution Use pbr to get the package version''' command = ['git', 'rev-parse', 'HEAD'] try: output = subprocess.check_output( # nosec command, stderr=subprocess.DEVNULL) if isinstance(output, bytes): output = output.decode('utf-8') ver_type = 'commit' except subprocess.CalledProcessError: ver_type = 'package' output = VersionInfo('tern').version_string() return ver_type, output.split('\n').pop(0)
def print_version(): """Print version number and exit.""" from pbr.version import VersionInfo version = VersionInfo('faucet').semantic_version().release_string() message = 'Faucet %s' % version print(message) sys.exit(0)
def __init__(self, reg=None): if reg is not None: self._reg = reg version = VersionInfo('faucet').semantic_version().release_string() self.faucet_version = Gauge( # pylint: disable=unexpected-keyword-arg 'faucet_pbr_version', 'Faucet PBR version', ['version'], registry=self._reg) self.faucet_version.labels(version=version).set(1) # pylint: disable=no-member
def __init__(self, reg=None): if reg is not None: self._reg = reg # TODO: investigate faster alternative (https://bugs.launchpad.net/pbr/+bug/1688405) version = VersionInfo('faucet').semantic_version().release_string() self.faucet_version = PromGauge( # pylint: disable=unexpected-keyword-arg 'faucet_pbr_version', 'Faucet PBR version', ['version'], registry=self._reg) self.faucet_version.labels(version=version).set(1) # pylint: disable=no-member
def test_render_template_passed_vals_supercede_builtin(): """Values in a passed dict should override default/discovered values """ from pbr.version import VersionInfo from tapis_cli import PKG_NAME from tapis_cli.templating import render_template version_info = VersionInfo(PKG_NAME) version_string = version_info.version_string() source = 'Tapis CLI version {{ tapis_cli_version }} is cool' env = {} rendered = render_template(source, passed_vals=env) assert version_string in rendered # Pass over-ride value env = {'tapis_cli_version': 9000} rendered = render_template(source, passed_vals=env) assert '9000' in rendered
def __init__(self, reg=None): if reg is not None: self._reg = reg self.version = VersionInfo( 'faucet').semantic_version().release_string() self.faucet_version = PromGauge('faucet_pbr_version', 'Faucet PBR version', ['version'], registry=self._reg) self.faucet_version.labels(version=self.version).set(1) # pylint: disable=no-member self.server = None self.thread = None
def __init__(self, app: HTTPApplication): super().__init__(app=app, mount_point='/') self.fernet = MultiFernet( [Fernet(key) for key in settings.AUTH_FERNET_KEYS]) self.api_spec = APISpec( title='Sandwich Cloud API', openapi_version='3.0.0', version=VersionInfo( 'sandwichcloud-deli').semantic_version().release_string(), plugins=[ "deli.counter.http.spec.plugins.docstring", ])
def cli(package: str, inc_kwargs: dict) -> None: """Bump a MAJOR.MINOR.PATCH version string at the specified index location or 'patch' digit.""" semver = VersionInfo(package).semantic_version() # Pre-decrement a "dev" version to get the real version tuple. if 'dev' in semver.version_tuple(): semver = semver.decrement() semver = semver.increment(**inc_kwargs) click.echo(semver.release_string(), nl=False)
def create_setup_file(): lib_version = VersionInfo("spotify_tensorflow").version_string() contents_for_setup_file = """ import setuptools if __name__ == "__main__": setuptools.setup( name="spotify_tensorflow_dataflow", packages=setuptools.find_packages(), install_requires=[ "spotify-tensorflow=={version}" ]) """.format(version=lib_version) # noqa: W293 setup_file_path = os.path.join(tempfile.mkdtemp(), "setup.py") with open(setup_file_path, "w") as f: f.writelines(textwrap.dedent(contents_for_setup_file)) return setup_file_path
def test(): extras = {} for i, k in enumerate(['project_id', 'user_id'], 1): try: extras[k] = sys.argv[i] except IndexError: pass vol = { 'name': 'test-volume', 'size': 1 } vol.update(extras) MAX_SEMVER = SemanticVersion(major=3, minor=4, patch=0) semver = VersionInfo('python-novaclient').semantic_version() def list_nova_volumes(): """Conditional on python-novaclient <= 3.3.0""" return nova.volumes.list() if semver <= MAX_SEMVER else [] def get_nova_volume(volume_id): pass print('Listing volumes') vols = { 'cinderclient': cinder.volumes.list(), 'novaclient': list_nova_volumes(), } pprint(vols) print('Creating volume') print(' with: %s' % vol) # NB(kamidzi): os-vol-* attrs appear later vol = cinder.volumes.create(**vol) for state in poll_volume(vol): # wait for tenant_id attribute if str(state.status).lower() == 'available' \ and hasattr(vol, 'os-vol-tenant-attr:tenant_id'): break pprint(render_volume(vol)) print('Listing volumes') vols = { 'cinderclient': cinder.volumes.list(), 'novaclient': list_nova_volumes(), } pprint(vols)
def main(): bootstrap.execute() governance = Governance() args = cli.argparser(governance.groups()).parse_args() GeneralConfig(args.debug, args.verbose) version = VersionInfo("vigo") if args.version: print("vigo v{version}".format(version=version)) return 0 try: Analyze(args.groups, governance, args.query) except OpenstackerException as err: print(str(err)) return 1 footer = "Generated by vigo v{version}".format(version=version) print("-" * len(footer)) print(footer) print("-" * len(footer)) return 0
def main(): args = cli.argparser().parse_args() version = VersionInfo("sixectomy") if args.version: print("sixectomy v{version}".format(version=version)) return 0 filename = args.file if not filename: return 0 try: analyze = Analyze(filename) except SixectomyException as err: print(str(err)) return 1 else: report = Report() report.rendering("cli.txt", analyze) footer = "Generated by sixectomy v{version}".format(version=version) print("-" * len(footer)) print(footer) print("-" * len(footer)) return 0
methods for details. """ # same format as sys.version_info: "A tuple containing the five components of # the version number: major, minor, micro, releaselevel, and serial. All # values except releaselevel are integers; the release level is 'alpha', # 'beta', 'candidate', or 'final'. The version_info value corresponding to the # Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a # releaselevel of 'dev' for unreleased under-development code. # # If the releaselevel is 'alpha' then the major/minor/micro components are not # established at this point, and setup.py will use a version of next-$(revno). # If the releaselevel is 'final', then the tarball will be major.minor.micro. # Otherwise it is major.minor.micro~$(revno). from pbr.version import VersionInfo _version = VersionInfo('testscenarios') __version__ = _version.semantic_version().version_tuple() version = _version.release_string() __all__ = [ 'TestWithScenarios', 'WithScenarios', 'apply_scenario', 'apply_scenarios', 'generate_scenarios', 'load_tests_apply_scenarios', 'multiply_scenarios', 'per_module_scenarios', 'with_scenarios', ]
#!/usr/bin/python # Copyright (c) 2015 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing # to use, modify, copy, or redistribute it subject to the terms # and conditions of the GNU General Public License version 2. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Free # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. from pbr.version import VersionInfo version_info = VersionInfo('nexus')
""" TRAW: TestRail API Wrapper TRAW is an API wrapper for Gurrock's TestRail test management suite The intended way to begin is to instantiate the TRAW Client: .. code-block:: python import traw testrail = traw.Client(username='******', user_api_key='api_key', url='url') See the Client help documentation (`help(traw.Client)`) for more information """ import logging from pbr.version import VersionInfo from .client import Client # NOQA __version__ = VersionInfo('traw').semantic_version().release_string() __all__ = ('__version__', 'Client') logging.getLogger(__package__).addHandler(logging.NullHandler())
from pbr.version import VersionInfo # TODO: 3.8+ and later, use importlib: https://pypi.org/project/importlib-metadata/ __version__ = VersionInfo('networkml').semantic_version().release_string()
def get(self): """Retrieve the Storyboard system information. """ sb_ver = VersionInfo('storyboard') return wmodels.SystemInfo(version=sb_ver.version_string())
def get_user_agent(): sf_version = VersionInfo('shakenfist_client').version_string() return 'Mozilla/5.0 (Ubuntu; Linux x86_64) Shaken Fist/%s' % sf_version
import argparse import logging import sys from cliff.app import App from cliff.commandmanager import CommandManager from pbr.version import VersionInfo from . import settings version_info = VersionInfo('dc_cli') class CatalogApp(App): logger = logging.getLogger(__name__) if settings.LOGLEVEL is not None: logging.basicConfig(level=settings.LOGLEVEL) def __init__(self): super(CatalogApp, self).__init__( description='Data Catalog CLI', version=version_info.version_string(), command_manager=CommandManager('dc.cli'), deferred_help=True, ) def build_option_parser(self, description, version): parser = super(CatalogApp, self).build_option_parser(description, version) parser.add_argument('--host',
def __init__(self): version = VersionInfo('faucet').semantic_version().release_string() self.faucet_version = Gauge('faucet_pbr_version', 'Faucet PBR version', ['version']) # pylint: disable=no-member self.faucet_version.labels(version=version).set(1)
import warnings import logging import argparse import unittest from io import StringIO from urllib.parse import urlencode from urllib.parse import urlunparse import requests from onetimepass import get_totp from lxml import etree from pbr.version import VersionInfo _VERSION = VersionInfo('test_http').semantic_version() __version__ = _VERSION.release_string() __version_info__ = _VERSION.version_tuple() __all__ = ( "__version__", "__version_info__", "main", ) class PathException(Exception): pass
from pbr.version import VersionInfo _v = VersionInfo('pybliometrics').semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple() __citation__ = 'Rose, Michael E. and John R. Kitchin: "pybliometrics: '\ 'Scriptable bibliometrics using a Python interface to Scopus", SoftwareX '\ '10 (2019) 100263.' import pybliometrics.scopus
def print_version(): """Print version number and exit.""" version = VersionInfo('faucet').semantic_version().release_string() message = 'Faucet %s' % version print(message)
# -*- coding: utf-8 -*- # Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2016 Tobias Gruetzmacher """ Automated comic downloader. Dosage traverses comic websites in order to download each strip of the comic. The intended use is for mirroring the strips locally for ease of viewing; redistribution of the downloaded strips may violate copyright, and is not advisable unless you have communicated with all of the relevant copyright holders, described your intentions, and received permission to distribute. The primary interface is the 'dosage' commandline script. Comic modules for each comic are located in L{dosagelib.plugins}. """ from pbr.version import VersionInfo import pkg_resources AppName = u'dosage' version_info = VersionInfo(AppName) try: __version__ = version_info.version_string() # PEP 396 AppVersion = version_info.version_string_with_vcs() except pkg_resources.DistributionNotFound: __version__ = "2.15.0" AppVersion = __version__ + "-unknown"
from pbr.version import VersionInfo _v = VersionInfo('clang-build').semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple
def version(self): return VersionInfo( 'sandwichcloud-deli').semantic_version().release_string()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017-2018 The Linux Foundation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## """Configuration for Sphinx.""" import os import sys # Sys.path for RTD to resolve docs_conf package sys.path.insert(0, os.path.abspath("..")) from pbr.version import VersionInfo # noqa from docs_conf.conf import * # noqa version = str(VersionInfo("lfdocs-conf")) release = str(VersionInfo("lfdocs-conf")) linkcheck_ignore = [ # The '#' in the path makes sphinx think it's an anchor "https://gerrit.linuxfoundation.org/infra/#/admin/projects/releng/docs-conf" ]
format: "unit-<ID>" (e.g. unit-mysql/0) """ from pbr.version import VersionInfo from .fakejuju import get_filename, set_envvars, FakeJuju __all__ = [ "__version__", "get_bootstrap_spec", "get_filename", "set_envvars", "FakeJuju", ] _v = VersionInfo("fakejuju").semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple() def get_bootstrap_spec(name, admin_secret=None): """Return the BootstrapSpec instance for the given controller. @param name: The controller name to set up. @param admin_secret: The admin user password to use. """ import txjuju.cli driver = "dummy" default_series = None # Use the default. return txjuju.cli.BootstrapSpec(name, driver, default_series, admin_secret)
from .rotation_matrix_3d import rotation_from_angles from .rotation_matrix_3d import rotation_around_x from .rotation_matrix_3d import rotation_around_y from .rotation_matrix_3d import rotation_around_z from .rotation_matrix_3d import rotation_around_axis from .rotation_matrix_nd import rotation_from_angle_and_plane from .rotation_matrix_2d import rotation_from_angle from .rotation_matrix_nd import random_matrix from pbr.version import VersionInfo _v = VersionInfo('mgen').semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple()
from ldap3 import Connection, Server from ldap3 import SIMPLE, SUBTREE, MODIFY_REPLACE from ldap3.core.exceptions import LDAPBindError, LDAPConstraintViolationResult, \ LDAPInvalidCredentialsResult, LDAPUserNameIsMandatoryError, \ LDAPSocketOpenError, LDAPExceptionError from time import time from Crypto.PublicKey import RSA from pbr.version import VersionInfo import logging import os BASE_DIR = os.path.dirname(__file__) LOG = logging.getLogger(__name__) LOG_FORMAT = '%(asctime)s %(levelname)s: %(message)s' _v = VersionInfo(__name__).semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple() @get('/') def get_index(): return index_tpl() @post('/') def post_index(): form = request.forms.getunicode def error(msg): return index_tpl(username=form('username'), alerts=[('error', msg)])
#! /usr/bin/env python """WSDL parsing services package for Web Services for Python.""" ident = "$Id$" from pbr.version import VersionInfo from . import WSDLTools # noqa from . import XMLname # noqa _v = VersionInfo('wstools').semantic_version() __version__ = _v.release_string() version_info = _v.version_tuple() __all__ = ( 'WDSLTools', 'XMLname', '__version__', 'version_info' )
# # Copyright (c) 2009 Testrepository Contributors # # Licensed under either the Apache License, Version 2.0 or the BSD 3-clause # license at the users choice. A copy of both licenses are available in the # project source as Apache-2.0 and BSD. You may not use this file except in # compliance with one of these two licences. # # Unless required by applicable law or agreed to in writing, software # distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # license you chose for the specific language governing permissions and # limitations under that license. """The testrepository library. This library is divided into some broad areas. The commands package contains the main user entry points into the application. The ui package contains various user interfaces. The repository package contains the core storage code. The tests package contains tests and test specific support code. """ # Yes, this is not PEP-396 compliant. It predates that. from pbr.version import VersionInfo _v = VersionInfo('mock').semantic_version() version = _v.release_string() __version__ = _v.version_tuple()
from pbr.version import VersionInfo __version__ = VersionInfo('ipeanim').version_string() __version_info__ = VersionInfo('ipeanim').semantic_version().version_tuple()
# -*- coding: utf-8 -*- # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2015-2017 Tobias Gruetzmacher """ Automated comic downloader. Dosage traverses comic websites in order to download each strip of the comic. The intended use is for mirroring the strips locally for ease of viewing; redistribution of the downloaded strips may violate copyright, and is not advisable unless you have communicated with all of the relevant copyright holders, described your intentions, and received permission to distribute. The primary interface is the 'dosage' commandline script. Comic modules for each comic are located in L{dosagelib.plugins}. """ from __future__ import absolute_import, division, print_function from pbr.version import VersionInfo AppName = u'dosage' version_info = VersionInfo(AppName) __version__ = version_info.version_string() # PEP 396 AppVersion = version_info.release_string()