Github user joshelser commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/186#discussion_r73024725
--- Diff: bin/sqlline-thin.py ---
@@ -18,64 +18,58 @@
# limitations under the License.
#
############################################################################
-
+from __future__ import print_function
import os
+import phoenix_utils
import subprocess
import sys
-import phoenix_utils
-import atexit
import urlparse
-global childProc
-childProc = None
-def kill_child():
- if childProc is not None:
- childProc.terminate()
- childProc.kill()
- if os.name != 'nt':
- os.system("reset")
-atexit.register(kill_child)
-
phoenix_utils.setPath()
-url = "localhost:8765"
-sqlfile = ""
-serialization_key = 'phoenix.queryserver.serialization'
-
-def usage_and_exit():
- sys.exit("usage: sqlline-thin.py [host[:port]] [sql_file]")
def cleanup_url(url):
- parsed = urlparse.urlparse(url)
- if parsed.scheme == "":
- url = "http://" + url
- parsed = urlparse.urlparse(url)
- if ":" not in parsed.netloc:
- url = url + ":8765"
+ p = urlparse.urlparse(url)
+ scheme = p.scheme if p.scheme else 'http'
+ netloc = p.netloc if ':' in p.netloc else p.netloc + '8765'
+ url = '{scheme}://{netloc}'.format(scheme, netloc)
--- End diff --
This is using the arguments positionally for substitution even though you
provided named substitutions in the format string, right? Would it make sense
to change the args to kwargs?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---