Copilot commented on code in PR #7161: URL: https://github.com/apache/hbase/pull/7161#discussion_r2211595417
########## hbase-examples/src/main/python/thrift1/DemoClient.py: ########## @@ -96,16 +96,16 @@ def demo_client(host, port, is_framed_transport): columns.append(col) try: - print "creating table: %s" %(t) + print("creating table: %s" %(t)) client.createTable(t, columns) - except AlreadyExists, ae: - print "WARN: " + ae.message + except AlreadyExists as ae: + print("WARN: " + ae.message) cols = client.getColumnDescriptors(t) - print "column families in %s" %(t) - for col_name in cols.keys(): + print("column families in %s" %(t)) + for col_name in list(cols.keys()): Review Comment: [nitpick] You can iterate directly over the dict (e.g., `for col_name in cols:`) without wrapping `cols.keys()` in `list()`, which avoids an unnecessary copy and is more Pythonic. ```suggestion for col_name in cols: ``` ########## hbase-examples/src/main/python/thrift1/DemoClient.py: ########## @@ -187,15 +187,15 @@ def demo_client(host, port, is_framed_transport): r = client.get(t, row, "entry:foo", dummy_attributes) # just to be explicit, we get lists back, if it's empty there was no matching row. if len(r) > 0: - raise "shouldn't get here!" + raise Exception("shouldn't get here!") columnNames = [] - for (col, desc) in client.getColumnDescriptors(t).items(): - print "column with name: "+desc.name - print desc + for (col, desc) in list(client.getColumnDescriptors(t).items()): Review Comment: [nitpick] The `items()` view in Python 3 is already iterable; you can remove the `list()` wrapper to improve readability and reduce memory overhead. ```suggestion for (col, desc) in client.getColumnDescriptors(t).items(): ``` ########## hbase-examples/src/main/python/thrift1/demo_hbase_thrift_over_http_tls.py: ########## @@ -37,35 +37,35 @@ from hbase.ttypes import Mutation from hbase.ttypes import IOError as HBaseIOError -print "[INFO] setup connection" +print("[INFO] setup connection") transport = THttpClient.THttpClient("https://{0}:{1}".format(sys.argv[1], 9090)) Review Comment: [nitpick] Consider using an f-string for clarity and consistency, e.g., `f"https://{sys.argv[1]}:9090"`. ```suggestion transport = THttpClient.THttpClient(f"https://{sys.argv[1]}:9090") ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org