Project

General

Profile

0001-convert-enumerate-generator-into-list-before-checkin.patch

Frédéric Péters, 13 Apr 2019 10:27 AM

Download (1.05 KB)

View differences:

Subject: [PATCH] convert enumerate/generator into list before checking it't
 not empty (#32259)

 wcs_olap/feeder.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
wcs_olap/feeder.py
392 392
                ids = range(next_id, next_id + len(to_insert))
393 393
                labels = zip(ids, to_insert)
394 394

  
395
        if labels:
395
        if labels is not None:
396
            # turn enumerate generator object into a proper list
396 397
            labels = list(labels)
398

  
399
        if labels:
397 400
            tmpl = ', '.join(['(%s, %s)'] * len(labels))
398 401
            query_str = 'INSERT INTO {name} (id, label) VALUES %s' % tmpl
399 402
            self.ex(query_str, ctx={'name': name}, vars=list(itertools.chain(*labels)))
400
-