1
0

Compare commits

..

No commits in common. "45233bd593d93843574d157fb5b8f615a800d2fc" and "2e2a52e33eecdffe7a18f5b7dcd23b86d04e3e90" have entirely different histories.

6 changed files with 10 additions and 14 deletions

View File

@ -19,9 +19,7 @@ def filter_samples(
samples: list[ActivitySample], samples: list[ActivitySample],
sample_filter: set[str], sample_filter: set[str],
) -> list[ActivitySample]: ) -> list[ActivitySample]:
if not sample_filter: assert len(sample_filter) > 0
error_message = 'sample_filter must not be empty'
raise ValueError(error_message)
return [s for s in samples if set(s.labels).intersection(sample_filter)] return [s for s in samples if set(s.labels).intersection(sample_filter)]
@ -85,6 +83,7 @@ def load_samples(args) -> set[ActivitySample]:
shared_time_stamps_set |= set( shared_time_stamps_set |= set(
git_repo.iterate_samples_from_git_repository(repo_path), git_repo.iterate_samples_from_git_repository(repo_path),
) )
del repo_path
# CSV Files # CSV Files
for csv_path in args.csv_files: for csv_path in args.csv_files:
@ -92,6 +91,7 @@ def load_samples(args) -> set[ActivitySample]:
shared_time_stamps_set |= set( shared_time_stamps_set |= set(
csv_file.iterate_samples_from_csv_file(csv_path), csv_file.iterate_samples_from_csv_file(csv_path),
) )
del csv_path
return shared_time_stamps_set return shared_time_stamps_set

View File

@ -1,6 +1,7 @@
import datetime
import json
import logging import logging
from pathlib import Path from pathlib import Path
import bottle import bottle
from personal_data import csv_import from personal_data import csv_import
@ -18,7 +19,7 @@ def newest_entry(csv_type: str):
finds the newest entry based on the 'time.current' column, and returns it as JSON. finds the newest entry based on the 'time.current' column, and returns it as JSON.
""" """
path = ROOT_DIRECTORY / f'{csv_type}.csv' path = ROOT_DIRECTORY/f'{csv_type}.csv'
bottle.response.content_type = 'application/json' bottle.response.content_type = 'application/json'
@ -40,10 +41,7 @@ def newest_entry(csv_type: str):
else: else:
newest = data[-1] newest = data[-1]
return { return {csv_import.csv_safe_value(k):csv_import.csv_safe_value(v) for k,v in newest.items()}
csv_import.csv_safe_value(k): csv_import.csv_safe_value(v)
for k, v in newest.items()
}
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1 +0,0 @@
# This file marks the scripts directory as a package.

View File

@ -32,9 +32,9 @@ def parse_results(response) -> list[Result]:
link = cells[0].a link = cells[0].a
if link is None: if link is None:
continue continue
simfile_id = link['href'].removeprefix('viewsimfile.php?simfileid=') id = link['href'].removeprefix('viewsimfile.php?simfileid=')
levels = cells[1].get_text().strip() levels = cells[1].get_text().strip()
results.append(Result(title, int(simfile_id), levels)) results.append(Result(title, int(id), levels))
return results return results

View File

@ -1 +0,0 @@
# This file marks the tests directory as a package.

View File

@ -4,7 +4,7 @@ from personal_data.fetchers.myanimelist import parse_name
@pytest.mark.parametrize( @pytest.mark.parametrize(
('input_str', 'expected_group1', 'expected_group2'), 'input_str, expected_group1, expected_group2',
[ [
('"Soundscape"', 'Soundscape', None), ('"Soundscape"', 'Soundscape', None),
('"Soundscape (サウンドスケープ)"', 'Soundscape', 'サウンドスケープ'), ('"Soundscape (サウンドスケープ)"', 'Soundscape', 'サウンドスケープ'),