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


Python LDSUtilities.assessNone方法代码示例

本文整理汇总了Python中lds.LDSUtilities.LDSUtilities.assessNone方法的典型用法代码示例。如果您正苦于以下问题:Python LDSUtilities.assessNone方法的具体用法?Python LDSUtilities.assessNone怎么用?Python LDSUtilities.assessNone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lds.LDSUtilities.LDSUtilities的用法示例。


在下文中一共展示了LDSUtilities.assessNone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: buildIndex

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def buildIndex(self):
     '''Builds an index creation string for a new full replicate in PG format'''
     tableonly = self.dst_info.ascii_name.split('.')[-1]
     ALLOW_CONSTRAINT_CREATION=False
     #SpatiaLite doesnt have a unique constraint but since we're using a pk might a well declare it as such
     if ALLOW_CONSTRAINT_CREATION and LDSUtilities.assessNone(self.dst_info.pkey):
         #spatialite won't do post create constraint additions (could to a re-create?)
         cmd = 'ALTER TABLE {0} ADD PRIMARY KEY {1}_{2}_PK ({2})'.format(self.dst_info.ascii_name,tableonly,self.dst_info.pkey)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.pkey,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise        
     
     #Unless we select SPATIAL_INDEX=no as a Layer option this should never be needed
     #because gcol is also used to determine whether a layer is spatial still do this check   
     if LDSUtilities.assessNone(self.dst_info.geocolumn) and 'SPATIAL_INDEX=NO' in [opt.replace(' ','').upper() for opt in self.sl_local_opts]:
         cmd = "SELECT CreateSpatialIndex('{}','{}')".format(self.dst_info.ascii_name,self.DEFAULT_GCOL)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}. NB Cannot override Geo-Column Name.".format(tableonly,self.DEFAULT_GCOL,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise
开发者ID:josephramsay,项目名称:LDS,代码行数:31,代码来源:SpatiaLiteDataStore.py

示例2: buildIndex

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def buildIndex(self):
     '''Builds an index creation string for a new full replicate in PG format'''
     tableonly = self.dst_info.ascii_name.split('.')[-1]
     ALLOW_TABLE_INDEX_CREATION=True
     #SpatiaLite doesnt have a unique constraint but since we're using a pk might a well declare it as such
     if ALLOW_TABLE_INDEX_CREATION and LDSUtilities.assessNone(self.dst_info.pkey):
         #spatialite won't do post create constraint additions (could to a re-create?)
         cmd = 'CREATE INDEX {0}_{1}_PK ON {0}({1})'.format(tableonly,self.dst_info.pkey)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.pkey,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise        
     
     #Unless we select SPATIAL_INDEX=no as a Layer option this should never be needed
     #because gcol is also used to determine whether a layer is spatial still do this check   
     if LDSUtilities.assessNone(self.dst_info.geocolumn):
         #untested and unlikely to work
         cmd = "CREATE INDEX {0}_{1}_SK ON {0}({1})".format(self.dst_info.ascii_name,self.dst_info.geocolumn)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}.".format(tableonly,self.dst_info.geocolumn,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise
开发者ID:josephramsay,项目名称:LDS,代码行数:32,代码来源:FileGDBDataStore.py

示例3: buildIndex

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def buildIndex(self):
     '''Builds an index creation string for a new full replicate'''
     tableonly = self.dst_info.ascii_name.split('.')[-1]
     
     if LU.assessNone(self.dst_info.pkey):
         cmd = 'ALTER TABLE {0} ADD CONSTRAINT {1}_{2}_PK UNIQUE({2})'.format(self.dst_info.ascii_name,tableonly,self.dst_info.pkey)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.pkey,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise        
             
     if LU.assessNone(self.dst_info.geocolumn):
         cmd = 'CREATE SPATIAL INDEX {1}_{2}_GK ON {0}({2})'.format(self.dst_info.ascii_name,tableonly,self.dst_info.geocolumn)
         cmd += ' WITH (BOUNDING_BOX = (XMIN = {0},YMIN = {1},XMAX = {2},YMAX = {3}))'.format(self.BBOX['XMIN'],self.BBOX['YMIN'],self.BBOX['XMAX'],self.BBOX['YMAX'])
         #cmd = 'CREATE SPATIAL INDEX ON {}'.format(tableonly)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.geocolumn,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise
开发者ID:josephramsay,项目名称:LDS,代码行数:29,代码来源:MSSQLSpatialDataStore.py

示例4: buildIndex

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def buildIndex(self):
     '''Builds an index creation string for a new full replicate in PG format'''
     tableonly = self.dst_info.ascii_name.split('.')[-1]
     
     if LDSUtilities.assessNone(self.dst_info.pkey):
         cmd = 'ALTER TABLE {0} ADD CONSTRAINT {1}_{2}_PK UNIQUE({2})'.format(self.dst_info.ascii_name,tableonly,self.dst_info.pkey)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.pkey,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise
                     
     #If a spatial index has already been created don't try to create another one
     if self.SPATIAL_INDEX == 'OFF' and LDSUtilities.assessNone(self.dst_info.geocolumn):
         cmd = 'CREATE INDEX {1}_{2}_GK ON {0} USING GIST({2})'.format(self.dst_info.ascii_name,tableonly,self.dst_info.geocolumn)
         try:
             self.executeSQL(cmd)
             ldslog.info("Index = {}({}). Execute = {}".format(tableonly,self.dst_info.geocolumn,cmd))
         except RuntimeError as rte:
             if re.search('already exists', str(rte)): 
                 ldslog.warn(rte)
             else:
                 raise
开发者ID:josephramsay,项目名称:LDS,代码行数:28,代码来源:PostgreSQLDataStore.py

示例5: readLayerProperty

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def readLayerProperty(self,layer,key):
     try:
         if isinstance(layer,tuple) or isinstance(layer,list):
             value = () 
             for l in layer:
                 value += (LU.assessNone(self.cp.get(l, key)),)
         else:
             value = LU.assessNone(self.cp.get(layer, key))
     except:
         '''return a default value otherwise none which would also be a default for some keys'''
         #the logic here may be a bit suss, if the property is blank return none but if there is an error assume a default is needed?
         return {'pkey':'ID','name':layer,'geocolumn':'SHAPE'}.get(key)
     return value
开发者ID:josephramsay,项目名称:LDS,代码行数:15,代码来源:ReadConfig.py

示例6: fetchLayerInfo

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def fetchLayerInfo(cls,url,ver=None,proxy=None):
     '''Non-GDAL static method for fetching LDS layer ID's using etree parser.'''
     res = []
     content = None
     wfs_ns = cls.NS['wfs20'] if re.match('^2',ver) else cls.NS['wfs11']
     ftxp = "//{0}FeatureType".format(wfs_ns)
     nmxp = "./{0}Name".format(wfs_ns)
     ttxp = "./{0}Title".format(wfs_ns)
     kyxp = "./{0}Keywords/{0}Keyword".format(cls.NS['ows'])
     
     try:            
         if not LDSUtilities.assessNone(proxy): install_opener(build_opener(ProxyHandler(proxy)))
         #content = urlopen(url)#bug in lxml doesnt close url/files using parse method
         with closing(urlopen(url)) as content:
             tree = etree.parse(content)
             for ft in tree.findall(ftxp):
                 name = ft.find(nmxp).text#.encode('utf8')
                 title = ft.find(ttxp).text#.encode('utf8')
                 #keys = [x.text.encode('utf8') for x in ft.findall(kyxp)]
                 keys = [x.text for x in ft.findall(kyxp)]
                 
                 res += ((name,title,keys),)
             
     except XMLSyntaxError as xe:
         ldslog.error('Error parsing URL;'+str(url)+' ERR;'+str(xe))
         
     return res
开发者ID:josephramsay,项目名称:LDS,代码行数:29,代码来源:LDSDataStore.py

示例7: writesecline

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def writesecline(self,section,field,value):
     try:            
         self.cp.set(section,field,value if LU.assessNone(value) else '')
         with codecs.open(self.fn, 'w','utf-8') as configfile:
             self.cp.write(configfile)
         ldslog.debug(str(section)+':'+str(field)+'='+str(value))                                                                                        
     except Exception as e:
         ldslog.warn('Problem writing GUI prefs. {} - sfv={}'.format(e,(section,field,value)))
开发者ID:josephramsay,项目名称:LDS,代码行数:10,代码来源:ReadConfig.py

示例8: readParameters

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def readParameters(self):
     '''Read values out of dialogs'''
     destination = LU.assessNone(str(self.destlist[self.destcombo.currentIndex()]))
     #lgindex = self.parent.confconn.getLayerGroupIndex(self.lgcombo.currentText().toUtf8().data())
     lgindex = self.parent.confconn.getLayerGroupIndex(LQ.readWidgetText(self.lgcombo.currentText()))
     #NB need to test for None explicitly since zero is a valid index
     lgval = self.parent.confconn.lglist[lgindex][1] if LU.assessNone(lgindex) else None       
     #uconf = LU.standardiseUserConfigName(str(self.confcombo.lineEdit().text()))
     #uconf = str(self.confcombo.lineEdit().text())
     uconf = str(self.cflist[self.confcombo.currentIndex()])
     ee = self.epsgenable.isChecked()
     epsg = None if ee is False else re.match('^\s*(\d+).*',str(self.epsgcombo.lineEdit().text())).group(1)
     fe = self.fromdateenable.isChecked()
     te = self.todateenable.isChecked()
     fd = None if fe is False else str(self.fromdateedit.date().toString('yyyy-MM-dd'))
     td = None if te is False else str(self.todateedit.date().toString('yyyy-MM-dd'))
     
     return destination,lgval,uconf,epsg,fe,te,fd,td
开发者ID:josephramsay,项目名称:LDS,代码行数:20,代码来源:LDSGUI.py

示例9: readMainProperty

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
    def readMainProperty(self,driver,key):
        try:
            return LU.assessNone(self.cp.get(driver, key))
#             if LU.assessNone(value) is None:
#                 return None
        except:
            '''return a default value otherwise none which would also be a default for some keys'''
            ldslog.warn("Cannot find requested driver/key in {}; self.cp.get('{}','{}') combo".format(self.filename[self.filename.rfind('/'):],driver,key))
        return None
开发者ID:josephramsay,项目名称:LDS,代码行数:11,代码来源:ReadConfig.py

示例10: checkKeyword

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def checkKeyword(self,ktext):
     '''Checks keyword isn't null and isn't part of the LDS supplied keywords'''
     if LU.assessNone(ktext) is None:
         QMessageBox.about(self, "Keyword Required","Please enter a Keyword to assign Layer(s) to")
         return False
     if ktext in self.confconn_link.reserved:
         QMessageBox.about(self, "Reserved Keyword","'{}' is a reserved keyword, please select again".format(ktext))
         return False
     return True
开发者ID:josephramsay,项目名称:LDS,代码行数:11,代码来源:LayerConfigSelector.py

示例11: _commonURI

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def _commonURI(self,layer):
     '''Refers to common connection instance for reading or writing'''
     if hasattr(self,'conn_str') and self.conn_str:
         return self.validateConnStr(self.conn_str)
     #can't put schema in quotes, causes error but without quotes tables get created in public anyway, still need schema.table syntax
     if LDSUtilities.assessNone(self.pwd):
         if self.pwd.startswith(Encrypt.ENC_PREFIX):
             pwd = " password='{}'".format(Encrypt.unSecure(self.pwd))
         else:
             pwd = " password='{}'".format(self.pwd)
     else:
         pwd = ""
     
     sch = " active_schema={}".format(self.schema) if LDSUtilities.assessNone(self.schema) else ""
     usr = " user='{}'".format(self.usr) if LDSUtilities.assessNone(self.usr) else ""
     hst = " host='{}'".format(self.host) if LDSUtilities.assessNone(self.host) else ""
     prt = " port='{}'".format(self.port) if LDSUtilities.assessNone(self.port) else ""
     uri = "PG:dbname='{}'".format(self.dbname)+hst+prt+usr+pwd+sch
     ldslog.debug(uri)
     return uri
开发者ID:josephramsay,项目名称:LDS,代码行数:22,代码来源:PostgreSQLDataStore.py

示例12: _commonURI

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def _commonURI(self,layer):
     '''Refers to common connection instance for example in a DB where it doesn't matter whether your reading or writing'''
     if hasattr(self,'conn_str') and self.conn_str:
         return self.validateConnStr(self.conn_str)
     #return "MSSQL:server={};database={};trusted_connection={};".format(self.server, self.dbname, self.trust)
     if LU.assessNone(self.pwd):
         if self.pwd.startswith(Encrypt.ENC_PREFIX):
             pwd = ";PWD={}".format(Encrypt.unSecure(self.pwd))
         else:
             pwd = ";PWD={}".format(self.pwd)
     else:
         pwd = ""
         
     sstr = ";Schema={}".format(self.schema) if LU.assessNone(self.schema) else ""
     usr = ";UID={}".format(self.usr) if LU.assessNone(self.usr) else ""
     drv = ";Driver='{}'".format(self.odbc) if LU.assessNone(self.odbc) else ""
     tcn = ";trusted_connection={}".format(self.trust) if LU.assessNone(self.trust) else ""
     uri = "MSSQL:server={};database={}".format(self.server, self.dbname, self.odbc)+usr+pwd+drv+sstr+tcn
     ldslog.debug(uri)
     return uri
开发者ID:josephramsay,项目名称:LDS,代码行数:22,代码来源:MSSQLSpatialDataStore.py

示例13: __init__

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
    def __init__(self,parent,lg=None,ep=None,fd=None,td=None,sc=None,dc=None,cq=None,uc=None):

        self.name = 'TP{}'.format(datetime.utcnow().strftime('%y%m%d%H%M%S'))
        self.parent = parent
        self.CLEANCONF = None
        self.INITCONF = None
        
        self.src = None
        self.dst = None 
        self.lnl = None
        self.partitionlayers = None
        self.partitionsize = None
        self.sixtyfourlayers = None
        self.prefetchsize = None
        
        self.layer = None
        self.layer_total = 0
        self.layer_count = 0
        
        #only do a config file rebuild if requested
        self.clearInitConfig()
        self.clearCleanConfig()
            
        self.setEPSG(ep)
        self.setFromDate(fd)
        self.setToDate(td)

        #splitting out group/layer and lgname
        self.lgval = None
        if LU.assessNone(lg):
            self.setLayerGroupValue(lg)
            
        self.source_str = None
        if LU.assessNone(sc):
            self.parseSourceConfig(sc)
        
        self.destination_str = LU.assessNone(dc)
        self.cql = LU.assessNone(cq)
        
        self.setUserConf(uc)
开发者ID:josephramsay,项目名称:LDS,代码行数:42,代码来源:TransferProcessor.py

示例14: getLayerGroupIndex

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def getLayerGroupIndex(self,dispval,col=2):
     '''Finds a matching group/layer entry from its displayed name'''
     #0=lorg,1=value,2=display 
     compval = LU.recode(dispval)
     if not LU.assessNone(compval):
         ldslog.warn('No attempt made to find index for empty group/layer request, "{}"'.format(compval))
         return None# or 0?
         
     try:
         #print 'lgl',[type(i[1]) for i in self.lglist],'\ncv',type(compval)
         index = [i[col] for i in self.lglist].index(compval)
     except ValueError as ve:
         ldslog.warn(u'Cannot find an index in column {} for the requested group/layer, "{}", from {} layers. Returning None index'.format(col,compval,len(self.lglist)))
         index = None
     return index
开发者ID:linz,项目名称:lds_replicate,代码行数:17,代码来源:ConfigConnector.py

示例15: runLayerConfigAction

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import assessNone [as 别名]
 def runLayerConfigAction(self):
     '''Arg-less action to open a new layer config dialog'''        
     dest,lgval,uconf,_,_,_,_,_ = self.controls.readParameters()
     
     if not LU.assessNone(dest):
         self.controls.setStatus(self.controls.STATUS.IDLE,'Cannot open Layer-Config without defined Destination')
         return
         
     if self.confconn is None:
         #build a new confconn
         self.confconn = ConfigConnector(uconf,lgval,dest)
     else:
         #if any parameters have changed, re-initialise
         self.confconn.initConnections(uconf,lgval,dest)
         
     self.runLayerConfigDialog()
开发者ID:josephramsay,项目名称:LDS,代码行数:18,代码来源:LDSGUI.py


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