summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2019-10-29 10:05:56 -0700
committerGitHub <noreply@github.com>2019-10-29 10:05:56 -0700
commit0f969aba0cbf9b1a93c679a442e74e13f00a1702 (patch)
treeb4b08211e571ce8eef47645249552aa705c7aca1
parentf3dc23a94b57ccd7c1909dc32174b3bc8c501919 (diff)
parent6b2e8df8bd73f0815722bc8c967740b2d3ca3e74 (diff)
Merge pull request #1118 from mmtj/logging-cleanup
Logging cleanup
-rw-r--r--AUTHORS1
-rw-r--r--pgcli/magic.py2
-rw-r--r--pgcli/main.py32
-rw-r--r--release.py8
-rw-r--r--tests/features/db_utils.py4
-rw-r--r--tests/features/environment.py12
-rw-r--r--tests/features/fixture_utils.py2
-rwxr-xr-xtests/features/wrappager.py4
8 files changed, 32 insertions, 33 deletions
diff --git a/AUTHORS b/AUTHORS
index 33d77fa2..14b745bc 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -100,6 +100,7 @@ Contributors:
* Pablo A. Bianchi (pabloab)
* Sebastian Janko (sebojanko)
* Pedro Ferrari (petobens)
+ * Martin Matejek (mmtj)
Creator:
--------
diff --git a/pgcli/magic.py b/pgcli/magic.py
index 3e9a4021..f58f4150 100644
--- a/pgcli/magic.py
+++ b/pgcli/magic.py
@@ -43,7 +43,7 @@ def pgcli_line_magic(line):
conn._pgcli = pgcli
# For convenience, print the connection alias
- print ("Connected: {}".format(conn.name))
+ print("Connected: {}".format(conn.name))
try:
pgcli.run_cli()
diff --git a/pgcli/main.py b/pgcli/main.py
index d5f6bd89..0d9fcce5 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -132,14 +132,13 @@ class PGCli(object):
if configured_pager:
self.logger.info(
- 'Default pager found in config file: "{}"'.format(configured_pager)
+ 'Default pager found in config file: "%s"', configured_pager
)
os.environ["PAGER"] = configured_pager
elif os_environ_pager:
self.logger.info(
- 'Default pager found in PAGER environment variable: "{}"'.format(
- os_environ_pager
- )
+ 'Default pager found in PAGER environment variable: "%s"',
+ os_environ_pager,
)
os.environ["PAGER"] = os_environ_pager
else:
@@ -672,7 +671,7 @@ class PGCli(object):
if self.pgspecial.timing_enabled:
# Only add humanized time display if > 1 second
if query.total_time > 1:
- print (
+ print(
"Time: %0.03fs (%s), executed in: %0.03fs (%s)"
% (
query.total_time,
@@ -682,7 +681,7 @@ class PGCli(object):
)
)
else:
- print ("Time: %0.03fs" % query.total_time)
+ print("Time: %0.03fs" % query.total_time)
# Check if we need to update completions, in order of most
# to least drastic changes
@@ -711,10 +710,10 @@ class PGCli(object):
self.prompt_app = self._build_cli(history)
if not self.less_chatty:
- print ("Server: PostgreSQL", self.pgexecute.server_version)
- print ("Version:", __version__)
- print ("Chat: https://gitter.im/dbcli/pgcli")
- print ("Home: http://pgcli.com")
+ print("Server: PostgreSQL", self.pgexecute.server_version)
+ print("Version:", __version__)
+ print("Chat: https://gitter.im/dbcli/pgcli")
+ print("Home: http://pgcli.com")
try:
while True:
@@ -758,7 +757,7 @@ class PGCli(object):
except (PgCliQuitError, EOFError):
if not self.less_chatty:
- print ("Goodbye!")
+ print("Goodbye!")
def _build_cli(self, history):
key_bindings = pgcli_bindings(self)
@@ -1200,7 +1199,7 @@ def cli(
warn,
):
if version:
- print ("Version:", __version__)
+ print("Version:", __version__)
sys.exit(0)
config_dir = os.path.dirname(config_location())
@@ -1212,12 +1211,11 @@ def cli(
if os.path.exists(os.path.expanduser("~/.pgclirc")):
if not os.path.exists(config_full_path):
shutil.move(os.path.expanduser("~/.pgclirc"), config_full_path)
- print ("Config file (~/.pgclirc) moved to new location", config_full_path)
+ print("Config file (~/.pgclirc) moved to new location", config_full_path)
else:
- print ("Config file is now located at", config_full_path)
- print (
- "Please move the existing config file ~/.pgclirc to",
- config_full_path,
+ print("Config file is now located at", config_full_path)
+ print(
+ "Please move the existing config file ~/.pgclirc to", config_full_path,
)
if list_dsn:
try:
diff --git a/release.py b/release.py
index 9ac18d24..0444983e 100644
--- a/release.py
+++ b/release.py
@@ -36,11 +36,11 @@ def run_step(*args):
global DRY_RUN
cmd = args
- print (" ".join(cmd))
+ print(" ".join(cmd))
if skip_step():
- print ("--- Skipping...")
+ print("--- Skipping...")
elif DRY_RUN:
- print ("--- Pretending to run...")
+ print("--- Pretending to run...")
else:
subprocess.check_output(cmd)
@@ -99,7 +99,7 @@ if __name__ == "__main__":
checklist(checks)
ver = version("pgcli/__init__.py")
- print ("Releasing Version:", ver)
+ print("Releasing Version:", ver)
parser = OptionParser()
parser.add_option(
diff --git a/tests/features/db_utils.py b/tests/features/db_utils.py
index 4eba6063..7f8a2e7d 100644
--- a/tests/features/db_utils.py
+++ b/tests/features/db_utils.py
@@ -48,7 +48,7 @@ def create_cn(hostname, password, username, dbname, port):
host=hostname, user=username, database=dbname, password=password, port=port
)
- print ("Created connection: {0}.".format(cn.dsn))
+ print("Created connection: {0}.".format(cn.dsn))
return cn
@@ -79,4 +79,4 @@ def close_cn(cn=None):
"""
if cn:
cn.close()
- print ("Closed connection: {0}.".format(cn.dsn))
+ print("Closed connection: {0}.".format(cn.dsn))
diff --git a/tests/features/environment.py b/tests/features/environment.py
index 0133ab01..349e9dd6 100644
--- a/tests/features/environment.py
+++ b/tests/features/environment.py
@@ -29,8 +29,8 @@ def before_all(context):
)
fixture_dir = os.path.join(context.package_root, "tests/features/fixture_data")
- print ("package root:", context.package_root)
- print ("fixture dir:", fixture_dir)
+ print("package root:", context.package_root)
+ print("fixture dir:", fixture_dir)
os.environ["COVERAGE_PROCESS_START"] = os.path.join(
context.package_root, ".coveragerc"
@@ -123,14 +123,14 @@ def before_all(context):
def show_env_changes(env_old, env_new):
"""Print out all test-specific env values."""
- print ("--- os.environ changed values: ---")
+ print("--- os.environ changed values: ---")
all_keys = set(list(env_old.keys()) + list(env_new.keys()))
for k in sorted(all_keys):
old_value = env_old.get(k, "")
new_value = env_new.get(k, "")
if new_value and old_value != new_value:
- print ('{}="{}"'.format(k, new_value))
- print ("-" * 20)
+ print('{}="{}"'.format(k, new_value))
+ print("-" * 20)
def after_all(context):
@@ -181,7 +181,7 @@ def after_scenario(context, scenario):
try:
context.cli.expect_exact(pexpect.EOF, timeout=15)
except pexpect.TIMEOUT:
- print ("--- after_scenario {}: kill cli".format(scenario.name))
+ print("--- after_scenario {}: kill cli".format(scenario.name))
context.cli.kill(signal.SIGKILL)
if hasattr(context, "tmpfile_sql_help") and context.tmpfile_sql_help:
context.tmpfile_sql_help.close()
diff --git a/tests/features/fixture_utils.py b/tests/features/fixture_utils.py
index 6cb74b2d..25204544 100644
--- a/tests/features/fixture_utils.py
+++ b/tests/features/fixture_utils.py
@@ -22,7 +22,7 @@ def read_fixture_files():
"""Read all files inside fixture_data directory."""
current_dir = os.path.dirname(__file__)
fixture_dir = os.path.join(current_dir, "fixture_data/")
- print ("reading fixture data: {}".format(fixture_dir))
+ print("reading fixture data: {}".format(fixture_dir))
fixture_dict = {}
for filename in os.listdir(fixture_dir):
if filename not in [".", ".."]:
diff --git a/tests/features/wrappager.py b/tests/features/wrappager.py
index e98ea979..51d49095 100755
--- a/tests/features/wrappager.py
+++ b/tests/features/wrappager.py
@@ -3,13 +3,13 @@ import sys
def wrappager(boundary):
- print (boundary)
+ print(boundary)
while 1:
buf = sys.stdin.read(2048)
if not buf:
break
sys.stdout.write(buf)
- print (boundary)
+ print(boundary)
if __name__ == "__main__":