Skip to content

Commit 7c9170c

Browse files
author
Hugo Osvaldo Barrera
committed
Remove unecessary indirection
1 parent 623c053 commit 7c9170c

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

vdirsyncer/cli/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@ def sync(ctx, collections, force_delete):
125125
from .tasks import prepare_pair, sync_collection
126126

127127
for pair_name, collections in collections:
128-
prepare_pair(
128+
for collection, config in prepare_pair(
129129
pair_name=pair_name,
130130
collections=collections,
131131
config=ctx.config,
132-
force_delete=force_delete,
133-
callback=sync_collection,
134-
)
132+
):
133+
sync_collection(
134+
collection=collection,
135+
general=config,
136+
force_delete=force_delete,
137+
)
135138

136139

137140
@app.command()
@@ -147,12 +150,12 @@ def metasync(ctx, collections):
147150
from .tasks import prepare_pair, metasync_collection
148151

149152
for pair_name, collections in collections:
150-
prepare_pair(
153+
for collection, config in prepare_pair(
151154
pair_name=pair_name,
152155
collections=collections,
153156
config=ctx.config,
154-
callback=metasync_collection,
155-
)
157+
):
158+
metasync_collection(collection=collection, general=config)
156159

157160

158161
@app.command()

vdirsyncer/cli/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .utils import save_status
1616

1717

18-
def prepare_pair(pair_name, collections, config, callback, **kwargs):
18+
def prepare_pair(pair_name, collections, config):
1919
pair = config.get_pair(pair_name)
2020

2121
all_collections = dict(
@@ -34,7 +34,7 @@ def prepare_pair(pair_name, collections, config, callback, **kwargs):
3434
)
3535

3636
collection = CollectionConfig(pair, collection_name, config_a, config_b)
37-
callback(collection=collection, general=config.general, **kwargs)
37+
yield collection, config.general
3838

3939

4040
def sync_collection(collection, general, force_delete):

0 commit comments

Comments
 (0)