Skip to content

Commit 391b641

Browse files
[drivers.Archive] bug fixes
1 parent adf0528 commit 391b641

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

pyroSAR/drivers.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,7 +2996,7 @@ def import_outdated(self, dbfile):
29962996
elif isinstance(dbfile, Archive):
29972997
with self.engine.begin() as conn:
29982998
scenes = conn.exec_driver_sql('SELECT scene from data')
2999-
scenes = [s.scene for s in scenes]
2999+
scenes = [s.scene for s in scenes]
30003000
self.insert(scenes)
30013001
reinsert = dbfile.select_duplicates(value='scene')
30023002
if reinsert is not None:
@@ -3267,29 +3267,28 @@ def select_duplicates(self, outname_base=None, scene=None, value='id'):
32673267
else:
32683268
raise ValueError("argument 'value' must be either 0 or 1")
32693269

3270-
if not outname_base and not scene:
3271-
# core SQL execution
3272-
with self.engine.begin() as conn:
3270+
with self.engine.begin() as conn:
3271+
if not outname_base and not scene:
3272+
# core SQL execution
32733273
scenes = conn.exec_driver_sql('SELECT * from duplicates')
3274-
else:
3275-
cond = []
3276-
arg = []
3277-
if outname_base:
3278-
cond.append('outname_base=?')
3279-
arg.append(outname_base)
3280-
if scene:
3281-
cond.append('scene=?')
3282-
arg.append(scene)
3283-
query = 'SELECT * from duplicates WHERE {}'.format(' AND '.join(cond))
3284-
for a in arg:
3285-
query = query.replace('?', ''' '{0}' ''', 1).format(a)
3286-
# core SQL execution
3287-
with self.engine.begin() as conn:
3274+
else:
3275+
cond = []
3276+
arg = []
3277+
if outname_base:
3278+
cond.append('outname_base=?')
3279+
arg.append(outname_base)
3280+
if scene:
3281+
cond.append('scene=?')
3282+
arg.append(scene)
3283+
query = 'SELECT * from duplicates WHERE {}'.format(' AND '.join(cond))
3284+
for a in arg:
3285+
query = query.replace('?', ''' '{0}' ''', 1).format(a)
3286+
# core SQL execution
32883287
scenes = conn.exec_driver_sql(query)
3289-
3290-
ret = []
3291-
for x in scenes:
3292-
ret.append(self.encode(x[key]))
3288+
3289+
ret = []
3290+
for x in scenes:
3291+
ret.append(self.encode(x[key]))
32933292

32943293
return ret
32953294

0 commit comments

Comments
 (0)