Ruff
This commit is contained in:
parent
b690ffc51c
commit
2636127045
|
@ -194,8 +194,9 @@ def import_activity_samples(
|
||||||
group_category: str | None = None,
|
group_category: str | None = None,
|
||||||
default_estimated_duration: datetime.timedelta | None = None,
|
default_estimated_duration: datetime.timedelta | None = None,
|
||||||
) -> int:
|
) -> int:
|
||||||
samples = heuristically_realize_samples(raw_samples,
|
samples = heuristically_realize_samples(
|
||||||
default_estimated_duration=default_estimated_duration)
|
raw_samples, default_estimated_duration=default_estimated_duration,
|
||||||
|
)
|
||||||
|
|
||||||
if group_category is not None:
|
if group_category is not None:
|
||||||
samples = merge_adjacent_samples(list(samples), group_category)
|
samples = merge_adjacent_samples(list(samples), group_category)
|
||||||
|
@ -233,6 +234,7 @@ def import_activity_samples(
|
||||||
|
|
||||||
return num_updated
|
return num_updated
|
||||||
|
|
||||||
|
|
||||||
def import_activity_sample_csv(
|
def import_activity_sample_csv(
|
||||||
vault: ObsidianVault,
|
vault: ObsidianVault,
|
||||||
rows: Rows,
|
rows: Rows,
|
||||||
|
@ -273,7 +275,11 @@ def import_wanikani_events(vault: ObsidianVault, rows: Rows):
|
||||||
for row in rows:
|
for row in rows:
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if k in row:
|
if k in row:
|
||||||
raw_samples.append(ActivitySample([Label('application.name', 'WaniKani')], None, row[k]))
|
raw_samples.append(
|
||||||
|
ActivitySample(
|
||||||
|
[Label('application.name', 'WaniKani')], None, row[k],
|
||||||
|
),
|
||||||
|
)
|
||||||
del k
|
del k
|
||||||
del row
|
del row
|
||||||
|
|
||||||
|
@ -285,9 +291,14 @@ def import_wanikani_events(vault: ObsidianVault, rows: Rows):
|
||||||
comment='',
|
comment='',
|
||||||
)
|
)
|
||||||
|
|
||||||
return import_activity_samples(vault, raw_samples, mapper,
|
return import_activity_samples(
|
||||||
group_category='application.name',
|
vault,
|
||||||
default_estimated_duration=datetime.timedelta(minutes=5))
|
raw_samples,
|
||||||
|
mapper,
|
||||||
|
group_category='application.name',
|
||||||
|
default_estimated_duration=datetime.timedelta(minutes=5),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
PATH_WATCHED = Path('output/show_episodes_watched.csv')
|
PATH_WATCHED = Path('output/show_episodes_watched.csv')
|
||||||
PATH_PLAYED = Path('output/games_played.csv')
|
PATH_PLAYED = Path('output/games_played.csv')
|
||||||
|
@ -300,7 +311,11 @@ PATH_STEPMANIA = Path('output/stepmania.csv')
|
||||||
|
|
||||||
|
|
||||||
IMPORTERS = [
|
IMPORTERS = [
|
||||||
{'path': PATH_WANIKANI, 'standard_variant': True, 'import_rows': import_wanikani_events},
|
{
|
||||||
|
'path': PATH_WANIKANI,
|
||||||
|
'standard_variant': True,
|
||||||
|
'import_rows': import_wanikani_events,
|
||||||
|
},
|
||||||
{'path': PATH_WORKOUT, 'standard_variant': True, 'import_rows': import_workout_csv},
|
{'path': PATH_WORKOUT, 'standard_variant': True, 'import_rows': import_workout_csv},
|
||||||
{'path': PATH_STEP_COUNTS, 'import_rows': import_step_counts_csv},
|
{'path': PATH_STEP_COUNTS, 'import_rows': import_step_counts_csv},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user