We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Args and Kwargs Practice

Doc2Doc should be extensible to allow for third-party plugins. These plugins will be configurable.

Assignment

Complete the configure_plugin_decorator function. It decorates a function that expects keyword arguments, but it should return a wrapper that accepts positional arguments.

The positional arguments passed to the wrapper will be key-value tuples. For example, after configure_backups is decorated, this call:

plugin_config: dict[str, str] = configure_backups(
    ("path", "~/duplicates"), ("prefix", "duplicate_"), ("extension", ".rtf")
)

should behave like this call to the original function:

plugin_config: dict[str, str] = configure_backups(
    path="~/duplicates", prefix="duplicate_", extension=".rtf"
)

And the returned plugin_config should be:

{
    "path": "~/duplicates",
    "prefix": "duplicate_",
    "extension": ".rtf",
}