Compare commits
5 Commits
2e2a52e33e
...
45233bd593
Author | SHA1 | Date | |
---|---|---|---|
45233bd593 | |||
82cfd45878 | |||
f38923e8fb | |||
b60b8c7416 | |||
0e1779cca0 |
|
@ -19,7 +19,9 @@ def filter_samples(
|
||||||
samples: list[ActivitySample],
|
samples: list[ActivitySample],
|
||||||
sample_filter: set[str],
|
sample_filter: set[str],
|
||||||
) -> list[ActivitySample]:
|
) -> 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)]
|
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(
|
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:
|
||||||
|
@ -91,7 +92,6 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
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
|
||||||
|
@ -41,7 +40,10 @@ def newest_entry(csv_type: str):
|
||||||
else:
|
else:
|
||||||
newest = data[-1]
|
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__':
|
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
|
link = cells[0].a
|
||||||
if link is None:
|
if link is None:
|
||||||
continue
|
continue
|
||||||
id = link['href'].removeprefix('viewsimfile.php?simfileid=')
|
simfile_id = link['href'].removeprefix('viewsimfile.php?simfileid=')
|
||||||
levels = cells[1].get_text().strip()
|
levels = cells[1].get_text().strip()
|
||||||
results.append(Result(title, int(id), levels))
|
results.append(Result(title, int(simfile_id), levels))
|
||||||
return results
|
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(
|
@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', 'サウンドスケープ'),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user