@@ -80,7 +80,7 @@ def connect(self, parent=None):
8080 conn_name = self .connectionName ()
8181 settings = QgsSettings ()
8282 settings .beginGroup (u"/{0}/{1}" .format (
83- self .connectionSettingsKey (), conn_name ))
83+ self .connectionSettingsKey (), conn_name ))
8484
8585 if not settings .contains ("database" ): # non-existent entry?
8686 raise InvalidDataException (
@@ -408,18 +408,12 @@ def getValidQgisUniqueFields(self, onlyOne=False):
408408 for idx in indexes :
409409 if idx .isUnique and len (idx .columns ) == 1 :
410410 fld = idx .fields ()[idx .columns [0 ]]
411- if (fld .dataType == u"NUMBER"
412- and not fld .modifier
413- and fld .notNull
414- and fld not in ret ):
411+ if (fld .dataType == u"NUMBER" and not fld .modifier and fld .notNull and fld not in ret ):
415412 ret .append (fld )
416413
417414 # and finally append the other suitable fields
418415 for fld in self .fields ():
419- if (fld .dataType == u"NUMBER"
420- and not fld .modifier
421- and fld .notNull
422- and fld not in ret ):
416+ if (fld .dataType == u"NUMBER" and not fld .modifier and fld .notNull and fld not in ret ):
423417 ret .append (fld )
424418
425419 if onlyOne :
@@ -519,15 +513,12 @@ def __init__(self, row, table):
519513
520514 # find out whether fields are part of primary key
521515 for con in self .table ().constraints ():
522- if (con .type == ORTableConstraint .TypePrimaryKey
523- and self .name == con .column ):
516+ if con .type == ORTableConstraint .TypePrimaryKey and self .name == con .column :
524517 self .primaryKey = True
525518 break
526519
527520 def type2String (self ):
528- if (u"TIMESTAMP" in self .dataType
529- or self .dataType in [u"DATE" , u"SDO_GEOMETRY" ,
530- u"BINARY_FLOAT" , u"BINARY_DOUBLE" ]):
521+ if (u"TIMESTAMP" in self .dataType or self .dataType in [u"DATE" , u"SDO_GEOMETRY" , u"BINARY_FLOAT" , u"BINARY_DOUBLE" ]):
531522 return u"{}" .format (self .dataType )
532523 if self .charMaxLen in [None , - 1 ]:
533524 return u"{}" .format (self .dataType )
@@ -564,7 +555,6 @@ def update(self, new_name, new_type_str=None, new_not_null=None,
564555
565556
566557class ORTableConstraint (TableConstraint ):
567-
568558 TypeCheck , TypeForeignKey , TypePrimaryKey , \
569559 TypeUnique , TypeUnknown = list (range (5 ))
570560
0 commit comments