Skip to content

Commit

Permalink
remove unnecessary function and todo comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mustaballer committed Jul 22, 2023
1 parent 18a4918 commit 9b7f7af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 28 deletions.
1 change: 0 additions & 1 deletion openadapt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def getenv_fallback(var_name):
ROOT_DIRPATH = pathlib.Path(__file__).parent.parent.resolve()
DB_FPATH = ROOT_DIRPATH / DB_FNAME # type: ignore # noqa
DB_URL = f"sqlite:///{DB_FPATH}"
DT_FMT = "%Y-%m-%d_%H-%M-%S"
DIRNAME_PERFORMANCE_PLOTS = "performance"
DATA_DIRECTORY_PATH = ROOT_DIRPATH / "data"
RECORDING_DIRECTORY_PATH = DATA_DIRECTORY_PATH / "recordings"
Expand Down
3 changes: 0 additions & 3 deletions openadapt/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ def export_recording_to_folder(recording_id: int) -> None:
Returns:
str: The path of the created zip file.
"""
# TODO: replace with alternative, e.g.:
# - https://stackoverflow.com/questions/28238785/sqlalchemy-python-multiple-databases
# - https://github.com/bigbag/sqlalchemy-multiple-db
recording_db_path = db.export_recording(recording_id)

assert recording_db_path, recording_db_path
Expand Down
32 changes: 8 additions & 24 deletions openadapt/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import Counter, defaultdict
from datetime import datetime, timedelta
from io import BytesIO
from collections import Counter, defaultdict
from logging import StreamHandler
import base64
import fire
import inspect
import os
import sys
Expand All @@ -11,11 +11,11 @@

from loguru import logger
from PIL import Image, ImageDraw, ImageFont
import fire
import matplotlib.pyplot as plt
import mss
import mss.base
import numpy as np
from logging import StreamHandler

from openadapt import common, config

Expand All @@ -24,23 +24,6 @@
_logger_lock = threading.Lock()


def get_now_dt_str(dt_format=config.DT_FMT):
"""
Get the current date and time as a formatted string.
Args:
dt_format (str): The format to use for the date and time string.
Returns:
str: The current date and time formatted as a string.
"""
# Get the current date and time
now = datetime.datetime.now()

# Format the date and time according to the specified format
dt_str = now.strftime(dt_format)

return dt_str


def configure_logging(logger, log_level):
# TODO: redact log messages (https://github.com/Delgan/loguru/issues/17#issuecomment-717526130)
log_level_override = os.getenv("LOG_LEVEL")
Expand Down Expand Up @@ -468,9 +451,7 @@ def plot_performance(recording_timestamp: float = None) -> None:
event_type = perf_stat.event_type
start_time = perf_stat.start_time
end_time = perf_stat.end_time
type_to_proc_times[event_type].append(
end_time - start_time
)
type_to_proc_times[event_type].append(end_time - start_time)
event_types.add(event_type)
type_to_timestamps[event_type].append(start_time)

Expand All @@ -491,7 +472,10 @@ def plot_performance(recording_timestamp: float = None) -> None:

memory_ax = ax.twinx()
memory_ax.plot(
timestamps, mem_usages, label="memory usage", color="red",
timestamps,
mem_usages,
label="memory usage",
color="red",
)
memory_ax.set_ylabel("Memory Usage (bytes)")

Expand Down

0 comments on commit 9b7f7af

Please sign in to comment.