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


Python utils.warning函数代码示例

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


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


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