You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
370 B
Python
14 lines
370 B
Python
# Copyright (C) 2022 CVAT.ai Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Dict, Sequence
|
|
|
|
|
|
def filter_dict(
|
|
d: Dict[str, Any], *, keep: Sequence[str] = None, drop: Sequence[str] = None
|
|
) -> Dict[str, Any]:
|
|
return {k: v for k, v in d.items() if (not keep or k in keep) and (not drop or k not in drop)}
|