Skip to content

Commit

Permalink
address pr comments: None return type annotation, take stdev of adjus…
Browse files Browse the repository at this point in the history
…ted data
  • Loading branch information
Sophie Zhang committed May 24, 2024
1 parent 5ab3ec8 commit dc67eae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions experiments/13-connect-overhead/measure_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def run_client(

average_latencies.append(latency)

return np.mean(adjusted_data(average_latencies)), np.std(average_latencies)
adjusted_average_latencies = adjusted_data(average_latencies)
return np.mean(adjusted_average_latencies), np.std(adjusted_average_latencies)


def build_dataframe() -> pd.DataFrame:
Expand Down Expand Up @@ -114,7 +115,7 @@ def plot_from_csv(filename: str) -> None:
fig.savefig("measurement_comparisons_plot.png", bbox_inches="tight")


def main():
def main() -> None:
dataframe = build_dataframe()
csv_filename = "measurement_comparisons.csv"
print_to_csv(dataframe, csv_filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from brad.flight_sql_client_odbc import BradFlightSqlClientOdbc


def main():
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--repetitions", type=int, default=1000)
parser.add_argument("--host", type=str, default="localhost")
Expand Down
10 changes: 5 additions & 5 deletions src/brad/flight_sql_client_odbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ class BradFlightSqlClientOdbc:

RowList = List[Tuple[Any, ...]]

def __init__(self, host="localhost", port=31337):
def __init__(self, host="localhost", port=31337) -> None:
self._host = host
self._port = port
self._connection = None
self._cursor = None

def __enter__(self):
def __enter__(self) -> None:
self.connect()
return self

def __exit__(self, exc_type, exc_value, traceback):
def __exit__(self, exc_type, exc_value, traceback) -> None:
self.close()

def connect(self):
def connect(self) -> None:
self._connection = pyodbc.connect(
"DRIVER={Arrow Flight SQL ODBC Driver};USEENCRYPTION=false;"
+ f"HOST={self._host};"
Expand All @@ -38,7 +38,7 @@ def connect(self):
)
self._cursor = self._connection.cursor()

def close(self):
def close(self) -> None:
self._cursor.close()
self._connection.close()

Expand Down
10 changes: 5 additions & 5 deletions src/brad/sqlite_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ class BradSqliteClient:

RowList = List[Tuple[Any, ...]]

def __init__(self, database: str):
def __init__(self, database: str) -> None:
self._database = database
self._connection = None
self._cursor = None

def __enter__(self):
def __enter__(self) -> None:
self.connect()
return self

def __exit__(self, exc_type, exc_value, traceback):
def __exit__(self, exc_type, exc_value, traceback) -> None:
self.close()

def connect(self):
def connect(self) -> None:
self._connection = sqlite3.connect(self._database)
self._cursor = self._connection.cursor()

def close(self):
def close(self) -> None:
self._cursor.close()
self._connection.close()

Expand Down

0 comments on commit dc67eae

Please sign in to comment.