mirror of
https://github.com/apache/arrow.git
synced 2026-10-28 16:47:19 +08:00
Some nits
This commit is contained in:
1 parent
269590fba4
commit
d54dd7d77d
2 files changed
+7
-3
No files matched your search
@@ -24,6 +24,7 @@ import pyarrow
|
||||
import pyarrow.flight
|
||||
import pyarrow.csv as csv
|
||||
|
||||
|
||||
def list_flights(args, client):
|
||||
print('Flights\n=======')
|
||||
for flight in client.list_flights():
|
||||
@@ -69,6 +70,7 @@ def do_action(args, client):
|
||||
except pyarrow.lib.ArrowIOError as e:
|
||||
print("Error calling action:", e)
|
||||
|
||||
|
||||
def push_data(args, client):
|
||||
print('File Name:', args.file)
|
||||
my_table = csv.read_csv(args.file)
|
||||
@@ -80,6 +82,7 @@ def push_data(args, client):
|
||||
writer.write_table(my_table)
|
||||
writer.close()
|
||||
|
||||
|
||||
def get_flight(args, client):
|
||||
if args.path:
|
||||
descriptor = pyarrow.flight.FlightDescriptor.for_path(*args.path)
|
||||
@@ -124,7 +127,7 @@ def main():
|
||||
cmd_put.set_defaults(action='put')
|
||||
_add_common_arguments(cmd_put)
|
||||
cmd_put.add_argument('file', type=str,
|
||||
help="csv file to upload.")
|
||||
help="CSV file to upload.")
|
||||
|
||||
cmd_get = subcommands.add_parser('get')
|
||||
cmd_get.set_defaults(action='get')
|
||||
|
||||
@@ -46,7 +46,8 @@ class FlightServer(pyarrow.flight.FlightServerBase):
|
||||
descriptor = pyarrow.flight.FlightDescriptor.for_path(*key[2])
|
||||
|
||||
endpoints = [
|
||||
pyarrow.flight.FlightEndpoint(repr(key),
|
||||
pyarrow.flight.FlightEndpoint(
|
||||
repr(key),
|
||||
[pyarrow.flight.Location.for_grpc_tcp(self.host, self.port)]),
|
||||
]
|
||||
|
||||
@@ -104,7 +105,7 @@ class FlightServer(pyarrow.flight.FlightServerBase):
|
||||
# request
|
||||
threading.Thread(target=self._shutdown).start()
|
||||
else:
|
||||
raise KeyError("Unknown action")
|
||||
raise KeyError("Unknown action {!r}".format(action.type))
|
||||
|
||||
def _shutdown(self):
|
||||
"""Shut down after a delay."""
|
||||
|
||||
Reference in new issue
Block a user