From a6af6fd665d46f7223a4bb6e3efd10b52f8bc563 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 31 Jan 2020 16:42:15 +0100 Subject: [PATCH] remove dead code (#39430) --- tests/test_wcs.py | 7 +++++++ wcs_olap/feeder.py | 38 -------------------------------------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/tests/test_wcs.py b/tests/test_wcs.py index 60c7962..29399c0 100644 --- a/tests/test_wcs.py +++ b/tests/test_wcs.py @@ -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 = [ diff --git a/wcs_olap/feeder.py b/wcs_olap/feeder.py index f2e2456..283830c 100644 --- a/wcs_olap/feeder.py +++ b/wcs_olap/feeder.py @@ -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],