本文整理汇总了Python中version.version方法的典型用法代码示例。如果您正苦于以下问题:Python version.version方法的具体用法?Python version.version怎么用?Python version.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类version
的用法示例。
在下文中一共展示了version.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: baselevels
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def baselevels(self, s, maxlevel=1, brackets="()"):
"""strip parts of a string above a given bracket level
- return a modified (some parts might be removed) version of the string s
where all parts inside brackets with level higher than maxlevel are
removed
- if brackets do not match (number of left and right brackets is wrong
or at some points there were more right brackets than left brackets)
just return the unmodified string"""
level = 0
highestlevel = 0
res = ""
for c in s:
if c == brackets[0]:
level += 1
if level > highestlevel:
highestlevel = level
if level <= maxlevel:
res += c
if c == brackets[1]:
level -= 1
if level == 0 and highestlevel > 0:
return res
示例2: Ping
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def Ping(self, request, context):
if self._is_local_request(context):
self._last_ping = datetime.now()
self._stats_dialog.update(request.stats)
if request.stats.daemon_version != version:
self._version_warning_trigger.emit(request.stats.daemon_version, version)
else:
with self._remote_lock:
_, addr, _ = context.peer().split(':')
if addr in self._remote_stats:
self._remote_stats[addr].update(request.stats)
else:
self._new_remote_trigger.emit(addr, request.stats)
return ui_pb2.PingReply(id=request.id)
示例3: report
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def report(self, path, analysis, powerDeviationMatrix = True, scatterMetric=True):
self.analysis = analysis
book = xlwt.Workbook()
sh = book.add_sheet("Anonymous Report", cell_overwrite_ok=True)
sh.write(0, 0, "PCWG Tool Version Number:")
sh.write(0, 1, self.version)
sh.write(0, 2, xlwt.Formula('HYPERLINK("http://www.pcwg.org";"PCWG Website")'))
row = 1
if powerDeviationMatrix:
row = self.report_power_deviation_matrix(sh,analysis,book)
if scatterMetric:
row = self.report_scatter_metric(sh,analysis,row, analysis.turbRenormActive)
book.save(path)
示例4: get_lastest_version
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def get_lastest_version(self):
try:
r = requests.get("https://github.com/peterdougstuart/PCWG/releases/latest")
#note the above will forward to a URL like: https://github.com/peterdougstuart/PCWG/releases/tag/v0.5.13
data = r.url.split("/")
return Version(data[-1])
except Exception as e:
Status.add("Cannot determine latest version: {0}".format(e))
return Version(None)
示例5: download_version
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def download_version(self, version):
try:
Status.add("Downloading latest version")
zip_file = "pcwg_tool-{0}.zip".format(version.version)
url = "https://github.com/peterdougstuart/PCWG/releases/download/{0}/{1}".format(version.tag, zip_file)
Status.add(url)
urllib.urlretrieve (url, Updator.update_zip)
Status.add("Download complete")
except Exception as e:
Status.add("Cannot download latest version: {0}".format(e))
示例6: __init__
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def __init__(self):
global active_canvases
self.__xmax = -InvalidCoord
self.__xmin = InvalidCoord
self.__ymax = -InvalidCoord
self.__ymin = InvalidCoord
self.__clip_box = (-InvalidCoord, -InvalidCoord, InvalidCoord, InvalidCoord)
self.__clip_stack = []
self.__nr_gsave = 0
self.title = theme.title or re.sub("(.*)\\.py$", "\\1", sys.argv[0])
self.creator = theme.creator or "pychart %s" % (version.version,)
self.creation_date = theme.creation_date or \
time.strftime("(%m/%d/%y) (%I:%M %p)")
self.author = theme.author
self.aux_comments = theme.aux_comments or ""
active_canvases.append(self)
示例7: __init__
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def __init__(self, fname):
basecanvas.T.__init__(self)
self.__out_fname = fname
self.__xmin, self.__xmax, self.__ymin, self.__ymax = 0,0,0,0
self.__doc = Document()
self.__doc.appendChild(self.__doc.createComment
('Created by PyChart ' + version.version + ' ' + version.copyright))
self.__svg = self.__doc.createElement('svg') # the svg doc
self.__doc.appendChild(self.__svg)
self.__defs = self.__doc.createElement('defs') # for clip paths
self.__svg.appendChild(self.__defs)
self.__cur_element = self.__svg
self.gsave() # create top-level group for dflt styles
self.__update_style(font_family = theme.default_font_family,
font_size = theme.default_font_size,
font_style = 'normal',
font_weight = 'normal',
font_stretch = 'normal',
fill = 'none',
stroke = 'rgb(0,0,0)', #SVG dflt none, PS dflt blk
stroke_width = theme.default_line_width,
stroke_linejoin = 'miter',
stroke_linecap = 'butt',
stroke_dasharray = 'none')
示例8: run
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def run(self):
try:
httpResponse = urllib.request.urlopen("https://api.github.com/repos/ArtificialQualia/PyEveLiveDPS/releases").read()
except urllib.error.URLError as e:
logging.exception('Exception checking for new releases:')
logging.exception(e)
return
releases = json.loads(httpResponse.decode('utf-8'))
logging.info('Current version: ' + version.version)
logging.info('Latest release: ' + releases[0]['name'])
if releases[0]['name'] != version.version.split('-')[0] and releases[0]['name'] != settings.disableUpdateReminderFor:
UpdateNotificaitonWindow(releases)
示例9: _open
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def _open(self):
""" Open connection to remote host. """
if self._process is not None:
return
cmd = [
'ssh',
self._host,
'sudo',
'buttersink',
'--server',
'--mode',
self._mode,
self._directory
]
logger.debug("Connecting with: %s", cmd)
self._process = subprocess.Popen(
cmd,
stdin=subprocess.PIPE,
stderr=sys.stderr,
# stdout=sys.stdout,
stdout=subprocess.PIPE,
)
version = self.version()
logger.info("Remote version: %s", version)
示例10: version
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def version(self):
""" Return kernel and btrfs version. """
return dict(
buttersink=theVersion,
btrfs=self.butterStore.butter.btrfsVersion,
linux=platform.platform(),
)
示例11: write
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def write(self, file, writer, registry):
if time.timezone < 0:
# divmod on positive numbers, otherwise the minutes have a different sign from the hours
timezone = "-%02i'%02i'" % divmod(-time.timezone/60, 60)
elif time.timezone > 0:
timezone = "+%02i'%02i'" % divmod(time.timezone/60, 60)
else:
timezone = "Z00'00'"
def pdfstring(s):
r = ""
for c in s:
if 32 <= ord(c) <= 127 and c not in "()[]<>\\":
r += c
else:
r += "\\%03o" % ord(c)
return r
file.write("<<\n")
if writer.title:
file.write("/Title (%s)\n" % pdfstring(writer.title))
if writer.author:
file.write("/Author (%s)\n" % pdfstring(writer.author))
if writer.subject:
file.write("/Subject (%s)\n" % pdfstring(writer.subject))
if writer.keywords:
file.write("/Keywords (%s)\n" % pdfstring(writer.keywords))
file.write("/Creator (PyX %s)\n" % version.version)
file.write("/CreationDate (D:%s%s)\n" % (time.strftime("%Y%m%d%H%M"), timezone))
file.write(">>\n")
示例12: parse
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def parse(argv):
'''
Parse the input command line.
Parameters
----------
argv - string
Input command line string.
Notes
-----
Returns directory and field for initialization.
'''
parser = argparse.ArgumentParser(
description="Start ARTview - the ARM Radar Toolkit Viewer.")
parser.add_argument('-v', '--version', action='version',
version='ARTview version %s' % (VERSION))
# Directory argument now optional
parser.add_argument('-d', '--directory', type=str,
help='Open specified directory', default=os.getcwd())
parser.add_argument('-f', '--field', type=str,
help='Name of field to show on open',
default=None)
parser.add_argument('-F', '--file', type=str,
help='File to show on open',
default=None)
parser.add_argument(
'-s', '--script', type=str, default=None,
help=('Select from artview.scripts a script to execute. '
'Possibilities include: standard, layout, grid, radar '))
# Parse the args
args = parser.parse_args(argv[1::])
return args.script, args.directory, args.file, args.field
示例13: __init__
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def __init__(self, parent=None):
QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint)
self.setupUi(self)
self.setWindowTitle("OpenSnitch v%s" % version)
self._cfg = Config.get()
self._lock = threading.Lock()
self._con = None
self._rule = None
self._local = True
self._peer = None
self._prompt_trigger.connect(self.on_connection_prompt_triggered)
self._timeout_trigger.connect(self.on_timeout_triggered)
self._tick_trigger.connect(self.on_tick_triggered)
self._tick = self._cfg.default_timeout
self._tick_thread = None
self._done = threading.Event()
self._apps_parser = LinuxDesktopParser()
self._app_name_label = self.findChild(QtWidgets.QLabel, "appNameLabel")
self._app_icon_label = self.findChild(QtWidgets.QLabel, "iconLabel")
self._message_label = self.findChild(QtWidgets.QLabel, "messageLabel")
self._src_ip_label = self.findChild(QtWidgets.QLabel, "sourceIPLabel")
self._dst_ip_label = self.findChild(QtWidgets.QLabel, "destIPLabel")
self._uid_label = self.findChild(QtWidgets.QLabel, "uidLabel")
self._pid_label = self.findChild(QtWidgets.QLabel, "pidLabel")
self._args_label = self.findChild(QtWidgets.QLabel, "argsLabel")
self._apply_button = self.findChild(QtWidgets.QPushButton, "applyButton")
self._apply_button.clicked.connect(self._on_apply_clicked)
self._action_combo = self.findChild(QtWidgets.QComboBox, "actionCombo")
self._what_combo = self.findChild(QtWidgets.QComboBox, "whatCombo")
self._duration_combo = self.findChild(QtWidgets.QComboBox, "durationCombo")
示例14: _on_diff_versions
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def _on_diff_versions(self, daemon_ver, ui_ver):
if self._version_warning_shown == False:
self._msg.setIcon(QtWidgets.QMessageBox.Warning)
self._msg.setWindowTitle("OpenSnitch version mismatch!")
self._msg.setText(("You are running version <b>%s</b> of the daemon, while the UI is at version " + \
"<b>%s</b>, they might not be fully compatible.") % (daemon_ver, ui_ver))
self._msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
self._msg.show()
self._version_warning_shown = True
示例15: create_stats_dict
# 需要导入模块: import version [as 别名]
# 或者: from version import version [as 别名]
def create_stats_dict(self, nb_failed, nb_injected, payment_cycle, payment_logs, total_attempts):
n_f_type = len([pl for pl in payment_logs if pl.type == TYPE_FOUNDER])
n_o_type = len([pl for pl in payment_logs if pl.type == TYPE_OWNER])
n_d_type = len([pl for pl in payment_logs if pl.type == TYPE_DELEGATOR])
n_m_type = len([pl for pl in payment_logs if pl.type == TYPE_MERGED])
stats_dict = {}
stats_dict['tot_amnt'] = int(sum([rl.amount for rl in payment_logs]) / 1e+9) # in 1K tezos
stats_dict['nb_pay'] = int(len(payment_logs) / 10)
stats_dict['nb_failed'] = nb_failed
stats_dict['nb_unkwn'] = nb_injected
stats_dict['tot_attmpt'] = total_attempts
stats_dict['nb_f'] = n_f_type
stats_dict['nb_o'] = n_o_type
stats_dict['nb_m'] = n_m_type
stats_dict['nb_d'] = n_d_type
stats_dict['cycle'] = payment_cycle
stats_dict['m_fee'] = 1 if self.delegator_pays_xfer_fee else 0
stats_dict['trdver'] = version.version
if self.args:
stats_dict['m_run'] = 1 if self.args.background_service else 0
stats_dict['m_prov'] = 0 if self.args.reward_data_provider == 'tzscan' else 1
m_relov = 0
if self.args.release_override > 0:
m_relov = 1
elif self.args.release_override < 0:
m_relov = -1
stats_dict['m_relov'] = m_relov
stats_dict['m_offset'] = 1 if self.args.payment_offset != 0 else 0
stats_dict['m_clnt'] = 1 if self.args.docker else 0
return stats_dict
开发者ID:tezos-reward-distributor-organization,项目名称:tezos-reward-distributor,代码行数:32,代码来源:payment_consumer.py