diff --git a/pgcli/completion_refresher.py b/pgcli/completion_refresher.py index 1039d515..957f6da9 100644 --- a/pgcli/completion_refresher.py +++ b/pgcli/completion_refresher.py @@ -6,7 +6,6 @@ from .pgcompleter import PGCompleter class CompletionRefresher: - refreshers = OrderedDict() def __init__(self): diff --git a/pgcli/main.py b/pgcli/main.py index cb8d4c1e..dfffc5fe 100644 --- a/pgcli/main.py +++ b/pgcli/main.py @@ -302,7 +302,6 @@ class PGCli: raise PgCliQuitError def register_special_commands(self): - self.pgspecial.register( self.change_db, "\\c", @@ -474,7 +473,6 @@ class PGCli: return [(None, None, None, message, "", True, True)] def initialize_logging(self): - log_file = self.config["main"]["log_file"] if log_file == "default": log_file = config_location() + "log" diff --git a/pgcli/packages/sqlcompletion.py b/pgcli/packages/sqlcompletion.py index be4933a7..b78edd6d 100644 --- a/pgcli/packages/sqlcompletion.py +++ b/pgcli/packages/sqlcompletion.py @@ -290,7 +290,6 @@ def suggest_special(text): def suggest_based_on_last_token(token, stmt): - if isinstance(token, str): token_v = token.lower() elif isinstance(token, Comparison): @@ -399,7 +398,6 @@ def suggest_based_on_last_token(token, stmt): elif (token_v.endswith("join") and token.is_keyword) or ( token_v in ("copy", "from", "update", "into", "describe", "truncate") ): - schema = stmt.get_identifier_schema() tables = extract_tables(stmt.text_before_cursor) is_join = token_v.endswith("join") and token.is_keyword @@ -436,7 +434,6 @@ def suggest_based_on_last_token(token, stmt): try: prev = stmt.get_previous_token(token).value.lower() if prev in ("drop", "alter", "create", "create or replace"): - # Suggest functions from either the currently-selected schema or the # public schema if no schema has been specified suggest = [] diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py index e66c3dc2..f2000acf 100644 --- a/pgcli/pgcompleter.py +++ b/pgcli/pgcompleter.py @@ -157,7 +157,6 @@ class PGCompleter(Completer): self.all_completions.update(additional_keywords) def extend_schemata(self, schemata): - # schemata is a list of schema names schemata = self.escaped_names(schemata) metadata = self.dbmetadata["tables"] @@ -226,7 +225,6 @@ class PGCompleter(Completer): self.all_completions.add(colname) def extend_functions(self, func_data): - # func_data is a list of function metadata namedtuples # dbmetadata['schema_name']['functions']['function_name'] should return @@ -260,7 +258,6 @@ class PGCompleter(Completer): } def extend_foreignkeys(self, fk_data): - # fk_data is a list of ForeignKey namedtuples, with fields # parentschema, childschema, parenttable, childtable, # parentcolumns, childcolumns @@ -283,7 +280,6 @@ class PGCompleter(Completer): parcolmeta.foreignkeys.append(fk) def extend_datatypes(self, type_data): - # dbmetadata['datatypes'][schema_name][type_name] should store type # metadata, such as composite type field names. Currently, we're not # storing any metadata beyond typename, so just store None @@ -697,7 +693,6 @@ class PGCompleter(Completer): return self.find_matches(word_before_cursor, conds, meta="join") def get_function_matches(self, suggestion, word_before_cursor, alias=False): - if suggestion.usage == "from": # Only suggest functions allowed in FROM clause diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index 31a9113d..2addb738 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -76,7 +76,6 @@ class ProtocolSafeCursor(psycopg.Cursor): class PGExecute: - # The boolean argument to the current_schemas function indicates whether # implicit schemas, e.g. pg_catalog search_path_query = """ @@ -180,7 +179,6 @@ class PGExecute: dsn=None, **kwargs, ): - conn_params = self._conn_params.copy() new_params = { diff --git a/tests/test_main.py b/tests/test_main.py index 9b3a84b2..9635fc04 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -216,7 +216,6 @@ def pset_pager_mocks(): with mock.patch("pgcli.main.click.echo") as mock_echo, mock.patch( "pgcli.main.click.echo_via_pager" ) as mock_echo_via_pager, mock.patch.object(cli, "prompt_app") as mock_app: - yield cli, mock_echo, mock_echo_via_pager, mock_app @@ -371,7 +370,6 @@ def test_quoted_db_uri(tmpdir): def test_pg_service_file(tmpdir): - with mock.patch.object(PGCli, "connect") as mock_connect: cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile"))) with open(tmpdir.join(".pg_service.conf").strpath, "w") as service_conf: