Compare commits
5 Commits
2e2a52e33e
...
45233bd593
Author | SHA1 | Date | |
---|---|---|---|
45233bd593 | |||
82cfd45878 | |||
f38923e8fb | |||
b60b8c7416 | |||
0e1779cca0 |
|
@ -19,7 +19,9 @@ def filter_samples(
|
|||
samples: list[ActivitySample],
|
||||
sample_filter: set[str],
|
||||
) -> list[ActivitySample]:
|
||||
assert len(sample_filter) > 0
|
||||
if not sample_filter:
|
||||
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)]
|
||||
|
||||
|
||||
|
@ -83,7 +85,6 @@ def load_samples(args) -> set[ActivitySample]:
|
|||
shared_time_stamps_set |= set(
|
||||
git_repo.iterate_samples_from_git_repository(repo_path),
|
||||
)
|
||||
del repo_path
|
||||
|
||||
# CSV Files
|
||||
for csv_path in args.csv_files:
|
||||
|
@ -91,7 +92,6 @@ def load_samples(args) -> set[ActivitySample]:
|
|||
shared_time_stamps_set |= set(
|
||||
csv_file.iterate_samples_from_csv_file(csv_path),
|
||||
)
|
||||
del csv_path
|
||||
|
||||
return shared_time_stamps_set
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import datetime
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import bottle
|
||||
|
||||
from personal_data import csv_import
|
||||
|
@ -19,7 +18,7 @@ def newest_entry(csv_type: str):
|
|||
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'
|
||||
|
||||
|
@ -41,7 +40,10 @@ def newest_entry(csv_type: str):
|
|||
else:
|
||||
newest = data[-1]
|
||||
|
||||
return {csv_import.csv_safe_value(k):csv_import.csv_safe_value(v) for k,v in newest.items()}
|
||||
return {
|
||||
csv_import.csv_safe_value(k): csv_import.csv_safe_value(v)
|
||||
for k, v in newest.items()
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
1
scripts/__init__.py
Normal file
1
scripts/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# This file marks the scripts directory as a package.
|
|
@ -32,9 +32,9 @@ def parse_results(response) -> list[Result]:
|
|||
link = cells[0].a
|
||||
if link is None:
|
||||
continue
|
||||
id = link['href'].removeprefix('viewsimfile.php?simfileid=')
|
||||
simfile_id = link['href'].removeprefix('viewsimfile.php?simfileid=')
|
||||
levels = cells[1].get_text().strip()
|
||||
results.append(Result(title, int(id), levels))
|
||||
results.append(Result(title, int(simfile_id), levels))
|
||||
return results
|
||||
|
||||
|
||||
|
|
1
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
# This file marks the tests directory as a package.
|
|
@ -4,7 +4,7 @@ from personal_data.fetchers.myanimelist import parse_name
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'input_str, expected_group1, expected_group2',
|
||||
('input_str', 'expected_group1', 'expected_group2'),
|
||||
[
|
||||
('"Soundscape"', 'Soundscape', None),
|
||||
('"Soundscape (サウンドスケープ)"', 'Soundscape', 'サウンドスケープ'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user