本文整理汇总了Python中utils.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _on_add_collection
def _on_add_collection (self, widget):
name = utils.InputDialog (None, _("Nome per la nuova collezione:")).run ()
if impostazioni.get_collection (name) != None:
utils.warning (_("Esiste gia' una collezione con lo stesso nome"))
return
elif name == None:
utils.warning (_("Devi fornire un nome per la nuova collezione"))
return
else:
keys = ('ph', 'kh', 'gh', 'no2', 'no3', 'con', 'am', 'fe', 'ra', 'fo', 'cal', 'mag', 'den')
collection = {}
if self.combo.get_active () == 0:
# Nessun modello di base
for i in keys:
collection[i] = [None, None, None]
else:
base = impostazioni.get_collection (self.combo.get_active_text ())
if not base:
for i in keys:
collection[i] = [None, None, None]
else:
collection = copy (base)
# Aggiungiamo la nostra collection
self.store.append ([name])
impostazioni.add_collection (name, collection)
开发者ID:BackupTheBerlios,项目名称:py-acqua-svn,代码行数:30,代码来源:inserisci.py
示例2: complete
def complete():
"""
Show complete message
"""
utils.check_or_exit("Have you pushed the version update to master?")
warning("Release process is now complete.")
开发者ID:xuzhaokui,项目名称:calico-docker,代码行数:7,代码来源:do_release.py
示例3: __import__
def __import__(module): # pylint: disable=W0622
utils.debug("module to import: %s" % module, 2)
if not os.path.isfile(module):
try:
return __builtin__.__import__(module)
except ImportError as e:
utils.warning("import failed for module %s: %s" % (module, e.message))
return None
else:
sys.path.append(os.path.dirname(module))
modulename = os.path.basename(module).replace(".py", "")
suff_index = None
for suff in imp.get_suffixes():
if suff[0] == ".py":
suff_index = suff
break
if suff_index is None:
utils.die("no .py suffix found")
with open(module) as fileHdl:
try:
return imp.load_module(modulename.replace(".", "_"), fileHdl, module, suff_index)
except ImportError as e:
utils.warning("import failed for file %s: %s" % (module, e.message))
return None
开发者ID:KDE,项目名称:emerge-history,代码行数:27,代码来源:portage.py
示例4: missingLayers
def missingLayers(self, layers):
def showError():
html = ["<h1>Missing Layers</h1>", "<ul>"]
for layer in layers:
html.append("<li>{}</li>".format(layer))
html.append("</ul>")
self.errorreport.updateHTML("".join(html))
message = "Seems like {} didn't load correctly".format(utils._pluralstring('layer', len(layers)))
utils.warning("Missing layers")
map(utils.warning, layers)
self.widget = self.iface.messageBar().createMessage("Missing Layers",
message,
QIcon(":/icons/sad"))
button = QPushButton(self.widget)
button.setCheckable(True)
button.setChecked(self.errorreport.isVisible())
button.setText("Show missing layers")
button.toggled.connect(showError)
button.toggled.connect(functools.partial(self.errorreport.setVisible))
self.widget.destroyed.connect(self.hideReports)
self.widget.layout().addWidget(button)
self.iface.messageBar().pushWidget(self.widget, QgsMessageBar.WARNING)
开发者ID:vpicavet,项目名称:Roam,代码行数:26,代码来源:plugin.py
示例5: onCheckUpdate
def onCheckUpdate(self, data, response):
# TODO: controlla gli altri stati e se la response != 200
# blocca l'aggiornamento e porta alla pagine di
# riepilogo con un warning
if response.status != 200:
self.riepilogo_label.set_text(_("Impossibile scaricare la lista degli aggiornamenti"))
try:
new_schema = SchemaUpdateInterface(parseString(data))
old_schema = SchemaUpdateInterface.getCurrentSchema()
if ret == 0:
self.riepilogo_label.set_text(_("Nessun aggiornamento disponibile."))
if ret == 1:
# versioni compatibili possiamo aggiornare
self.__checkFileToUpdate(new_schema)
if ret == 2:
# TODO: Una choice ..
# come una clean install
utils.warning(_("Le versioni sono potenzialmente compatibili\nma _NON_ viene garantito il perfetto aggiornamento"))
pass
if ret == 3:
utils.error(_("Versioni incompatibili per procedere con l'aggiornamento"))
pass
except:
utils.error(_("Impossibile interpretare il file xml"))
return
开发者ID:BackupTheBerlios,项目名称:py-acqua-svn,代码行数:27,代码来源:updater.py
示例6: getPackageInstance
def getPackageInstance(self, category, package):
"""return instance of class Package from package file"""
fileName = getFilename( category, package )
pack = None
mod = None
if fileName.endswith(".py") and os.path.isfile(fileName):
if not fileName in self._packageDict:
utils.debug( "module to import: %s" % fileName, 2 )
if not os.path.isfile( fileName ):
try:
mod = builtins.__import__( fileName )
except ImportError as e:
utils.warning( 'import failed for module %s: %s' % (fileName, str(e)) )
mod = None
else:
modulename = os.path.basename( fileName )[:-3].replace('.', '_')
loader = importlib.machinery.SourceFileLoader(modulename, fileName)
try:
mod = loader.load_module()
except Exception as e:
raise PortageException("Failed to load file %s" % fileName, category, package, e)
if not mod is None:
subpackage, package = getSubPackage( category, package )
self._CURRENT_MODULE = ( fileName, category,subpackage, package, mod )
pack = mod.Package( )
self._packageDict[ fileName ] = pack
else:
raise PortageException("Failed to find package", category, package)
else:
pack = self._packageDict[ fileName ]
return pack
开发者ID:pombredanne,项目名称:emerge-1,代码行数:31,代码来源:portage.py
示例7: enterSourceDir
def enterSourceDir(self):
if ( not os.path.exists( self.sourceDir() ) ):
return False
utils.warning("entering the source directory!")
os.chdir( self.sourceDir() )
if utils.verbose() > 0:
print("entering: %s" % self.sourceDir())
开发者ID:pombredanne,项目名称:emerge-1,代码行数:7,代码来源:EmergeBase.py
示例8: projectXML
def projectXML(wiki, parser, verbose=False):
"""Produce the main project file"""
if verbose:
print "Parsing main project information"
mainData = parser.getListAsDict(parser.getSection (wiki, "Main data", 2))
t = Template("""
<projectname> ${Projectname} </projectname>
<projectshort> ${Acronym} </projectshort>
<duration> ${Duration} </duration>
<call> ${Call} </call>
<instrument> ${Instrument} </instrument>
<topics> ${Topics}</topics>
<coordinatorname> ${CoordinatorName} </coordinatorname>
<coordinatoremail> ${CoordinatorEmail} </coordinatoremail>
<coordinatorphone> ${CoordinatorPhone} </coordinatorphone>
#include<partners.xml>
""")
try:
res = t.safe_substitute (mainData)
except KeyError as k:
print "In the main project setup, an entry was missing: ", k.__str__()
utils.warning("In the main project setup, an entry was missing: ", k.__str__())
raise
# print res
return res
开发者ID:hkarl,项目名称:propgen,代码行数:30,代码来源:generateXML.py
示例9: settings
def settings(self):
settings = os.path.join(self.folder, "settings.config")
try:
with open(settings,'r') as f:
return yaml.load(f)
except IOError as e:
utils.warning(e)
return None
开发者ID:NathanW2,项目名称:qmap,代码行数:8,代码来源:project.py
示例10: complete
def complete():
"""
Show complete message
"""
para("Step 5 of 5: Complete release.")
utils.check_or_exit("Have you pushed the version updates to master?")
warning("Release process is now complete.")
开发者ID:xdongp,项目名称:calico-docker,代码行数:8,代码来源:do_release.py
示例11: unset_var
def unset_var(varname):
if not os.getenv(varname) == None:
print
utils.warning(
"%s found as environment variable. you cannot override emerge"
" with this - unsetting %s locally" % (varname, varname)
)
os.environ[varname] = ""
开发者ID:KDE,项目名称:emerge-history,代码行数:8,代码来源:emerge.py
示例12: setBeeeOnSegmentTestfw
def setBeeeOnSegmentTestfw(self, test):
newTestsDict = test.getSupportedTests()
self.allTestsDict.update(newTestsDict)
if len(self.allTestsDict) > len(set(self.allTestsDict)):
print utils.warning("extension conflict!")
sys.stdout.flush()
return False
开发者ID:BeeeOn,项目名称:common,代码行数:9,代码来源:beeeon_test_runner.py
示例13: from_folder
def from_folder(cls, rootfolder):
settings = os.path.join(rootfolder, "settings.config")
project = cls(rootfolder, {})
try:
with open(settings, 'r') as f:
settings = yaml.load(f)
project.settings = settings
except IOError as e:
project.valid = False
project.error = "No settings.config found in {} project folder".format(rootfolder)
utils.warning(e)
return project
开发者ID:NathanW2,项目名称:Roam,代码行数:12,代码来源:project.py
示例14: bindByName
def bindByName(self, controlname, value):
"""
Binds a value to a control based on the control name.
controlname - Name of the control to bind
value - QVariant holding the value.
"""
control = self.getControl(controlname)
try:
self.bindValueToControl(control, value)
except BindingError as er:
warning(er.reason)
开发者ID:spanc29,项目名称:qmap,代码行数:13,代码来源:form_binder.py
示例15: run_command
def run_command(cmd, internal=False, retval=False, progress=False):
global _request
if internal is False and not os.path.exists(config.CONFIG_KEY):
run_command('get_key', True)
data = None
cfg = config.load_user_config()
url = utils.parse_url(cfg.url)
if _request:
req = _request
else:
if url['scheme'].lower() == 'https':
req = https.HTTPSConnection(url['host'], int(url['port'] or 443))
else:
req = httplib.HTTPConnection(url['host'], int(url['port'] or 80))
_request = req
original_cmd = cmd
cmd = urllib.quote(json.dumps(cmd))
query = '{0}run?{1}={2}'.format(url['path'] or '/', 'c' if internal is True else 'q', cmd)
headers = sign_request(cfg.apikey, 'GET', query)
headers.update({
'User-Agent': 'dotcloud/cli (version: {0})'.format(VERSION),
'X-DotCloud-Version': VERSION
})
trace_id = None
try:
req.request('GET', query, headers=headers)
resp = req.getresponse()
info = resp.getheader('X-Dotcloud-Info')
trace_id = resp.getheader('X-Dotcloud-TraceID')
data = resp.read()
req.close()
if _export is True:
print data
return
if info:
utils.warning(info.replace(';', '\n'))
if _trace and trace_id:
utils.info('TraceID for "{0}": {1}'.format(
original_cmd, trace_id))
data = json.loads(data)
if data['type'] == 'cmd':
return run_remote(data['data'])
if 'data' in data and len(data['data']) > 0:
if progress:
sys.stderr.write('\r')
print data['data']
elif progress:
sys.stderr.write('.')
except socket.error, e:
utils.die('Cannot reach DotCloud service ("{0}").\n' \
'Please check the connectivity and try again.'.format(str(e)))
开发者ID:elrapha,项目名称:DotCloudWin,代码行数:51,代码来源:cli.py
示例16: system
def system( self, command, errorMessage="", debuglevel=1, **kw):
"""convencience function for running system commands.
This method prints a debug message and then runs a system command.
If the system command returns with errors the method prints an error
message and exits if @ref self.subinfo.options.exitOnErrors is true"""
utils.debug( str(command), debuglevel )
if utils.system( command, **kw):
return True
if self.subinfo.options.exitOnErrors:
utils.warning( "while running %s cmd: %s" % (errorMessage, str(command)) )
else:
utils.warning( "while running %s cmd: %s" % (errorMessage, str(command)) )
return False
开发者ID:pombredanne,项目名称:emerge-1,代码行数:14,代码来源:EmergeBase.py
示例17: getAllPackages
def getAllPackages( self, category ):
"""returns all packages of a category except those that are listed in a file 'dont_build.txt' in the category directory
in case the category doesn't exist, nothing is returned"""
if self.isCategory( category ):
plist = copy.copy(self.categories[ category ])
if os.path.exists( os.path.join( rootDirForCategory( category ), category, "dont_build.txt" ) ):
with open( os.path.join( rootDirForCategory( category ), category, "dont_build.txt" ), "r" ) as f:
for line in f:
try:
plist.remove( line.strip() )
except ValueError:
utils.warning( "couldn't remove package %s from category %s's package list" % ( line.strip(), category ) )
return plist
else:
return
开发者ID:matlinuxer2,项目名称:kde-windows-emerge,代码行数:15,代码来源:portage.py
示例18: populateProgramIter
def populateProgramIter(self, data, response, index):
#TODO: unlock interface
it = self.getIterFromIndex(index)
model = self.tree.get_model()
#print response.status, data
if data == None or response.status != 200:
self.reportError(data, response, index, STEP_PROGRAM)
#self.status.push(0, _("Errore durante lo scaricamento della lista dei file(HTTP %d)") % response.status)
model.set_value(it, COL_COLO, self.color_error)
return
#try:
# TODO: in pratica qui dovremmo leggere la revisione e piazzarla nella colonna
# infatti suggerisco di modificare il nome delle colonne eliminando la col per l'md5
# e inserirne solo 2 una per la revision nuova e una per la vecchia
# NOTA: una sola colonna contenente revision tipo 1.2-r2
new_schema = ReportReader(data)
old_schema = ReportReader(None, os.path.join(utils.DHOME_DIR, "pyacqua.xml"))
a = (new_schema.get("mainversion"), new_schema.get("secondversion"), new_schema.get("revision"))
model.set_value(it, COL_NREV, self.versionize(a))
ret = old_schema.checkDiff(new_schema)
if ret == 0:
# messaggio nessun aggiornamento disponibile ecc...
utils.info(_("Nessun aggiornamento disponibile"))
if ret == 1:
# versioni compatibili possiamo aggiornare
self.__checkFileToUpdate(new_schema)
if ret == 2:
# TODO: Una choice ..
# come una clean install
utils.warning(_("Le versioni sono potenzialmente compatibili\nma _NON_ viene garantito il perfetto aggiornamento"))
pass
if ret == 3:
utils.error(_("Versioni incompatibili per procedere con l'aggiornamento"))
pass
#except:
# self.status.push(0, _("Impossibile interpretare il file xml"))
# return
self.update_btn.set_sensitive(True)
开发者ID:kucukkose,项目名称:py-acqua,代码行数:47,代码来源:webupdate.py
示例19: plot_results
def plot_results():
utils.command_assert(['scons', '-C', utils.dir_rejit, 'flot_js'])
print("Plotting results...")
html_file_results = open(join(utils.dir_benchmarks, 'benchmarks_results.html'), 'w')
html_file_header = open(join(utils.dir_benchmarks_resources_html, 'benchmarks_results.html.header'), 'r')
html_file_results.write(html_file_header.read())
html_file_header.close()
html_file_results.write('<h2>Info</h2>\n')
html_file_results.write('Date: %s<br/>\n' % datetime.datetime.now().strftime("%Y/%m/%d %H:%M"))
html_file_results.write('Command: <code>%s</code><br/>\n' % ' '.join(sys.argv))
iter_args = copy.deepcopy(vars(args))
iter_args.pop('machine_description')
html_file_results.write('Arguments: <code>%s</code><br/>\n' % iter_args)
if args.machine_description:
if not os.path.isfile(args.machine_description):
utils.warning("Could not open '%s'" % args.machine_description)
else:
desc_file = open(args.machine_description, 'r')
html_file_results.write('<h3>Machine description</h3>\n\n')
html_file_results.write(desc_file.read())
desc_file.close()
html_file_results.write('<h3>Engines versions</h3>\n\n')
html_file_results.write('<table style="text-align:right;">\n')
html_file_results.write('<tr><td>engine</td><td style="padding-left:50px;">commit</td></tr>')
for engine in engines:
html_file_results.write('<tr>\n')
html_file_results.write(' <td>%s</td><td style="padding-left:50px;"><pre style="padding:0 0 0 0;margin:0 0 0 0;">%s</pre></td>\n' % (engine.name, engine.commit_id()))
html_file_results.write('</tr>\n')
html_file_results.write('</table>\n')
html_file_results.write('<h2>Results</h2>\n\n')
html_file_results.write('<table>\n')
for res in results:
html_file_results.write(res.plot())
html_file_results.write('</table>\n')
html_file_footer = open(join(utils.dir_benchmarks_resources_html, 'benchmarks_results.html.footer'), 'r')
html_file_results.write(html_file_footer.read())
html_file_footer.close()
html_file_results.close()
开发者ID:Kelimion,项目名称:rejit,代码行数:47,代码来源:run.py
示例20: bindFeature
def bindFeature(self, qgsfeature, mandatory_fields=True, editing=False):
"""
Binds a features values to the form. If the control has the mandatory
property set then it will be added to the mandatory group.
qgsfeature - A QgsFeature to bind the values from
mandatory_fields - True if mandatory fields should be respected (default)
"""
self.feature = qgsfeature
self.connectControlsToSQLCommands()
defaults = self.getDefaults()
for index, value in qgsfeature.attributeMap().items():
field = self.fields[index]
try:
control = self.getControl(field.name())
except ControlNotFound as ex:
warning(ex.message)
continue
if mandatory_fields:
mandatory = control.property("mandatory").toBool()
if mandatory:
buddy = self.getBuddy(control)
self.mandatory_group.addWidget(control, buddy)
info("Binding %s to %s" % (control.objectName(), value.toString()))
isdefaultset = False
if not editing:
try:
# Get the default value from the database and use that instead.
value = defaults[control]
isdefaultset = control in defaults
except KeyError:
pass
try:
self.bindValueToControl(control, value)
except BindingError as er:
warning(er.reason)
self.bindSaveValueButton(control, indefaults=isdefaultset)
self.createHelpLink(control)
self.fieldtocontrol[index] = control
开发者ID:spanc29,项目名称:qmap,代码行数:46,代码来源:form_binder.py
注:本文中的utils.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论