From 4bc69ee5c95539f86ecf7ddb6d8a9660aa7e099b Mon Sep 17 00:00:00 2001 From: Torben <59419684+entorb@users.noreply.github.com> Date: Sat, 18 Mar 2023 11:37:17 +0100 Subject: [PATCH] ruff and fixed --- .pre-commit-config.yaml | 28 +++++++++++++++++----------- 1fetch.py | 4 ++-- 2analyze.py | 3 ++- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37c4d8e..456d267 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,6 +51,23 @@ repos: # - id: sort-simple-yaml - id: trailing-whitespace + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.33.0 + hooks: + - id: markdownlint + args: ["--disable", "MD013"] + + # - repo: https://github.com/markdownlint/markdownlint + # rev: v0.12.0 + # hooks: + # - id: markdownlint + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.0.257" + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - repo: https://github.com/asottile/add-trailing-comma rev: v2.4.0 hooks: @@ -141,16 +158,5 @@ repos: # hooks: # - id: codespell - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 - hooks: - - id: markdownlint - args: ["--disable", "MD013"] - - # - repo: https://github.com/markdownlint/markdownlint - # rev: v0.12.0 - # hooks: - # - id: markdownlint - default_language_version: python: python3.10 diff --git a/1fetch.py b/1fetch.py index 3f32b02..a12c0ff 100755 --- a/1fetch.py +++ b/1fetch.py @@ -35,11 +35,11 @@ def fetch_data_summaries() -> None: print(f"fetching {data_summary_set} data") # url = "https://api.ouraring.com/v1/sleep" # -> last week - url = f"https://api.ouraring.com/v1/{data_summary_set}?start={config['date_start']}" + url = f"https://api.ouraring.com/v1/{data_summary_set}?start={config['date_start']}" # noqa: E501 # start=YYYY-MM-DD # end=YYYY-MM-DD headers = { - # "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0 ", + # "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0 ", # noqa: E501 "Authorization": f"Bearer {token}", } cont = requests.get(url, headers=headers, timeout=3).content diff --git a/2analyze.py b/2analyze.py index 9fe4ff0..aa0ebcd 100755 --- a/2analyze.py +++ b/2analyze.py @@ -85,7 +85,8 @@ def prep_data_sleep() -> pd.DataFrame: df["time to fall asleep"] = df["onset_latency"] / 60 - # df["time to fall asleep"].where(df["time to fall asleep"] > 100, 100, inplace=True) + # df["time to fall asleep"].where(df["time to fall asleep"] + # > 100, 100, inplace=True) df["time awake"] = df["awake"] / 60