remove dead code (#39430)

This commit is contained in:
Benjamin Dauvergne 2020-01-31 16:42:15 +01:00
parent dce418d99d
commit a6af6fd665
2 changed files with 7 additions and 38 deletions

View File

@ -9,6 +9,13 @@ import utils
def test_wcs_fixture(wcs, postgres_db, tmpdir, olap_cmd, caplog):
# create temp schema remnant to see if it's cleaned
with postgres_db.conn() as conn:
with conn.cursor() as c:
c.execute('CREATE SCHEMA olap_temp')
c.execute('CREATE TABLE olap_temp.coin()')
c.execute('COMMIT')
olap_cmd()
expected_schema = [

View File

@ -32,17 +32,6 @@ class Context(object):
def __init__(self):
self.stack = []
def __getitem__(self, key):
if not self.stack:
raise KeyError(key)
for d in self.stack[::-1]:
try:
return d[key]
except KeyError:
pass
else:
raise KeyError(key)
def push(self, d):
self.stack.append(d)
@ -324,13 +313,6 @@ class WcsOlapFeeder(object):
self.logger.debug('SQL: %s VARS: %s', sql, vars)
self.cur.execute(sql, vars=vars)
def exmany(self, query, varslist, ctx=None):
ctx = ctx or {}
ctx.update(self.default_ctx)
sql = query.format(**(ctx or {}))
self.logger.debug('SQL: %s VARSLIST: %s', sql, varslist)
self.cur.executemany(sql, varslist)
def do_schema(self):
self.ex('SET search_path = public')
self.logger.debug('dropping schema %s', self.schema + '_temp')
@ -434,26 +416,6 @@ CREATE TABLE public.dates AS (SELECT
res[label] = id_
return res
def tpl(self, o, ctx=None):
ctx = ctx or {}
ctx.update(self.default_ctx)
def helper(o):
if isinstance(o, six.string_types):
return o.format(**ctx)
elif isinstance(o, dict):
return dict((k, helper(v)) for k, v in o.items())
elif isinstance(o, list):
return [helper(v) for v in o]
elif isinstance(o, (bool, int, float)):
return o
else:
assert False, '%s is not a valid value for JSON' % o
return helper(o)
def add_dim(self, **kwargs):
self.dimensions.append(self.tpl(kwargs))
def do_base_table(self):
# channels
self.create_labeled_table('channel', [[c[0], c[2]] for c in self.channels],