本文整理匯總了Python中version.__version__方法的典型用法代碼示例。如果您正苦於以下問題:Python version.__version__方法的具體用法?Python version.__version__怎麽用?Python version.__version__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類version
的用法示例。
在下文中一共展示了version.__version__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: parse_args
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def parse_args(args):
"""
解析命令參數
"""
parser = argparse.ArgumentParser(
prog=version.__prog_name__,
description=version.__description__
)
parser.add_argument('-v', '--version', action='version',
version='%(prog)s ' + version.__version__)
parser.add_argument('-d', '--debug', action='store_true',
default=DEFAULT_DEBUG_MODE, help='print debug information')
parser.add_argument('-p', '--port', type=int, default=DEFAULT_SERVICE_PORT,
metavar='port', help='specify the port to listen')
parser.add_argument('-s', '--save', default=DEFAULT_DATEBASE,
metavar='database', dest='database', help='specify the database file')
parser.add_argument('-c', '--cache', default=DEFAULT_CACHE_PATH,
metavar='cache', dest='cache', help='specify the cache path')
parser.add_argument('-l', '--log', default=DEFAULT_LOG_PATH,
metavar='log', dest='log', help='specify the log files path')
parser.add_argument('-q', '--quiet', action='store_true',
default=DEFAULT_SILENT_MODE, help='switch on silent mode')
return parser.parse_args(args)
示例2: install_game
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def install_game(self, game_id):
if not self.authentication_client.is_authenticated():
raise AuthenticationRequired()
installed_game = self.local_client.get_installed_games().get(game_id, None)
if installed_game and os.access(installed_game.install_path, os.F_OK):
log.warning("Received install command on an already installed game")
return await self.launch_game(game_id)
if game_id in [classic.uid for classic in Blizzard.CLASSIC_GAMES]:
if SYSTEM == pf.WINDOWS:
platform = 'windows'
elif SYSTEM == pf.MACOS:
platform = 'macos'
webbrowser.open(f"https://www.blizzard.com/download/confirmation?platform={platform}&locale=enUS&version=LIVE&id={game_id}")
return
try:
self.local_client.refresh()
log.info(f'Installing game of id {game_id}')
self.local_client.install_game(game_id)
except ClientNotInstalledError as e:
log.warning(e)
await self.open_battlenet_browser()
except Exception as e:
log.exception(f"Installing game {game_id} failed: {e}")
示例3: __init__
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def __init__(self, reader, writer, token):
super().__init__(Platform.Bethesda, __version__, reader, writer, token)
self._http_client = AuthenticatedHttpClient(self.store_credentials)
self.bethesda_client = BethesdaClient(self._http_client)
self.local_client = LocalClient()
self.local_client.local_games_cache = self.persistent_cache.get('local_games')
if not self.local_client.local_games_cache:
self.local_client.local_games_cache = {}
self.products_cache = product_cache
self.owned_games_cache = None
self._asked_for_local = False
self.update_game_running_status_task = None
self.update_game_installation_status_task = None
self.betty_client_process_task = None
self.check_for_new_games_task = None
self.running_games = {}
self.launching_lock = None
self._tick = 1
示例4: version
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def version(bot, event, *args):
"""get the version of the bot and dependencies (admin-only)"""
version_info = []
commit = _git_status()
version_info.append(_("Bot Version: **{}**").format(__version__)) # hangoutsbot
if commit:
version_info.append(_("Git: **{}**").format(commit))
version_info.append(_("Python Version: **{}**").format(sys.version.split()[0])) # python
# display extra version information only if user is an admin
admins_list = bot.get_config_suboption(event.conv_id, 'admins')
if event.user.id_.chat_id in admins_list:
# depedencies
modules = args or [ "aiohttp", "appdirs", "emoji", "hangups", "telepot" ]
for module_name in modules:
try:
_module = importlib.import_module(module_name)
version_info.append(_("* {} **{}**").format(module_name, _module.__version__))
except(ImportError, AttributeError):
pass
yield from bot.coro_send_message(event.conv, "\n".join(version_info))
示例5: inc_version
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def inc_version():
"""
Increment micro release version (in 'major.minor.micro') in version.py and re-import it.
Major and minor versions must be incremented manually in version.py.
:return: list with current version numbers, e.g., [0,1,23].
"""
new_version = version.__version__
values = list(map(lambda x: int(x), new_version.split('.')))
values[2] += 1
with open("version.py", "w") as f:
f.write(f'__version__ = "{values[0]}.{values[1]}.{values[2]}"\n')
f.write(f'__pkgname__ = "{project_name}"\n')
with open(f"{project_name}/version.py", "w") as f:
f.write(f'__version__ = "{values[0]}.{values[1]}.{values[2]}"\n')
f.write(f'__pkgname__ = "{project_name}"\n')
importlib.reload(version)
print(f'Package {version.__pkgname__} current version: {version.__version__}')
return values
示例6: git_push
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def git_push(ctx):
"""
Push new version and corresponding tag to origin
:return:
"""
# get current version
new_version = version.__version__
values = list(map(lambda x: int(x), new_version.split('.')))
# Push to origin new version and corresponding tag:
# * commit new version
# * create tag
# * push version,tag to origin
local(ctx, f'git add {project_name}/version.py version.py')
local(ctx, 'git commit -m "updated version"')
local(ctx, f'git tag {values[0]}.{values[1]}.{values[2]}')
local(ctx, 'git push origin --tags')
local(ctx, 'git push')
示例7: main
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def main():
if len(sys.argv) > 1 and sys.argv[1] == '-test':
return False
version = __version__
check_for_uncommitted_files()
create_version_tag_and_push(version)
filename = version + '.tar.gz'
download_tar(filename)
sha256 = calc_sha256(filename)
content = create_brew_formula_file_content(version, sha256)
sha = get_sha_of_old_macprefs_formula()
upload_new_brew_formula(content, version, sha)
cleanup()
download_macprefs()
verify_macprefs()
print('Success')
return True
示例8: GlobalTemplateVariables
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def GlobalTemplateVariables():
data = {"Version": __version__, "Author": __author__, "Email": __email__, "Doc": __doc__}
return data
示例9: main
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def main():
args = docopt.docopt(__doc__, version='Scan PDF %s' % __version__ )
script = ScanPdf()
print(args)
script.go(args)
示例10: __init__
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def __init__(self, quiet=False, doc=__doc__):
"""
CLI constructor is responsible for parsing sys.argv to collect configuration information.
If you need to change the config file from the default name set the property 'config_filename'
from the constructor.
quiet: is provided to suppress output, primarily for unit testing
"""
self.quiet = quiet
self.args = docopt(doc, version='environmentbase %s' % version.__version__)
# Parsing this config filename here is required since
# the file is already loaded in self.update_config()
self.config_filename = self.args.get('--config-file')
示例11: main
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def main():
log_filename = "keyrotator" + time.strftime("-%Y-%m-%d-%H%M") + ".log"
logging.basicConfig(filename=log_filename, level=logging.INFO)
logging.getLogger("").addHandler(logging.StreamHandler())
logging.info("Logging established in %s.", log_filename)
dispatch(__doc__, version=__version__)
示例12: GlobalTemplateVariables
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def GlobalTemplateVariables():
data = {"Version": __version__, "Author": __author__, "Email": __email__, "Doc": __doc__, "sso_server": SSO["sso_server"].strip("/")}
return data
示例13: __init__
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def __init__(self, reader, writer, token):
super().__init__(Platform.Battlenet, version, reader, writer, token)
self.local_client = LocalClient(self._update_statuses)
self.authentication_client = AuthenticatedHttpClient(self)
self.backend_client = BackendClient(self, self.authentication_client)
self.watched_running_games = set()
self.local_games_called = False
示例14: update
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def update(self):
""" load the websocket with updated info """
if not self.kpro.status: # if kpro is down try to reconnect
self.kpro.find_and_connect()
self.odo.save(self.kpro.vss["kmh"])
self.style.update(self.kpro.tps)
return {
"bat": self.kpro.bat,
"gear": self.kpro.gear,
"iat": self.kpro.iat[self.iat_unit],
"tps": self.kpro.tps,
"ect": self.kpro.ect[self.ect_unit],
"rpm": self.kpro.rpm,
"vss": self.kpro.vss[self.vss_unit],
"o2": self.kpro.o2[self.o2_unit],
"cam": self.kpro.cam,
"mil": self.kpro.mil,
"fan": self.kpro.fanc,
"bksw": self.kpro.bksw,
"flr": self.kpro.flr,
"eth": self.kpro.eth,
"scs": self.kpro.scs,
"fmw": self.kpro.firmware,
"map": self.kpro.map[self.map_unit],
"an0": self.an0_formula(self.kpro.analog_input(0))[self.an0_unit],
"an1": self.an1_formula(self.kpro.analog_input(1))[self.an1_unit],
"an2": self.an2_formula(self.kpro.analog_input(2))[self.an2_unit],
"an3": self.an3_formula(self.kpro.analog_input(3))[self.an3_unit],
"an4": self.an4_formula(self.kpro.analog_input(4))[self.an4_unit],
"an5": self.an5_formula(self.kpro.analog_input(5))[self.an5_unit],
"an6": self.an6_formula(self.kpro.analog_input(6))[self.an6_unit],
"an7": self.an7_formula(self.kpro.analog_input(7))[self.an7_unit],
"time": self.time.get_time(),
"odo": self.odo.get_mileage()[self.odo_unit],
"style": self.style.status,
"ver": __version__,
}
示例15: __init__
# 需要導入模塊: import version [as 別名]
# 或者: from version import __version__ [as 別名]
def __init__(self, sub_list, black_list, top_sort_method, score_limit, sample_size, existing_users, save_path,
imgur_client, previously_found):
"""
A class that searches supplied subreddits for top posts (of the user set period) and collects the names of users
who have submitted posts that scored above the set score limit. It will then download the user specified sample
size of posts and display them on the second page. Also has methods to add any found users to the main download
users list as well as methods to exclude certain users that the user wishes not to include. Parts of this class
work similar to the parts of the main program, but on a smaller scale. For instance, when a user is found an
instance of the User class is created for them with preset settings supplied. This class is only used
temporarily and if the user is added to the main list the instance is destroyed and a new instance made with the
proper overall settings.
:param sub_list: The sub list supplied by the UserFinderGUI which is to be searched for top posts
:param black_list: A list of users who are not to be included even if their posts reach the score limit
:param top_sort_method: The period of top posts to be searched (eg: day, week, etc.)
:param score_limit: The limit that post scores must be above to be considered
:param sample_size: The number of posts that are to be downloaded if the conditions are met
:param existing_users: A list of users already added to the main GUI lists that will be emitted from search
:param save_path: The save path of the special UserFinder directory where the user finder posts are stored
:param imgur_client: An instance of the imgure client that is supplied to temporarily created users
:param previously_found: A list of users that have been previously found and will not be included in the search
"""
super().__init__()
self._r = praw.Reddit(user_agent='python:DownloaderForReddit:%s (by /u/MalloyDelacroix)' % __version__,
client_id='frGEUVAuHGL2PQ', client_secret=None)
self.sub_list = sub_list
self.black_list = black_list
self.top_sort_method = top_sort_method
self.score_limit = score_limit
self.sample_size = sample_size
self.existing_users = existing_users
self.save_path = save_path
self.imgur_client = imgur_client
self.previously_found_users = previously_found
self.validated_subreddits = []
self.found_users = []
self.queue = Queue()
self.content_count = 0