anyconfig.utils.utils

Misc utility functions.

anyconfig.utils.utils.noop(val, *_args, **_kwargs)

Do nothing.

Return type:

Any

>>> noop(1)
1
anyconfig.utils.utils.filter_options(keys, options)

Filter ‘options’ with given ‘keys’.

Parameters:
  • keys (Iterable[str]) – key names of optional keyword arguments

  • options (Mapping[str, Any]) – optional keyword arguments to filter with ‘keys’

>>> filter_options(("aaa", ), {"aaa": 1, "bbb": 2})
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`dict\`\\ \\\[\:py\:class\:\`str\`\, \:py\:data\:\`\~typing.Any\`\]`
{'aaa': 1}
>>> filter_options(("aaa", ), {"bbb": 2})
{}