conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Implement `sort_dict_by_value`. It should sort a dict by its values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must b... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `sort_dict_by_value` which sort a dict by its values. "
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Add a function `sort_dict_by_value` that sort a dict by its values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be... | dict_collections |
[
{
"role": "user",
"content": "Develop `sort_dict_by_value` such that it sort a dict by its values. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must b... | dict_collections |
[
{
"role": "user",
"content": "Write code for `sort_dict_by_value` (a dict d) that sort a dict by its values. "
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n ... | dict_collections |
[
{
"role": "user",
"content": "Write `sort_dict_by_value` in Python. It should sort a dict by its values. Use only the standard library."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError... | dict_collections |
[
{
"role": "user",
"content": "Help me write `sort_dict_by_value` that sort a dict by its values. Use only the standard library."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d mus... | dict_collections |
[
{
"role": "user",
"content": "Write code for `sort_dict_by_value` (a dict d) that sort a dict by its values. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise Typ... | dict_collections |
[
{
"role": "user",
"content": "Write `sort_dict_by_value`: sort a dict by its values. "
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return dict(sorted(d.i... | dict_collections |
[
{
"role": "user",
"content": "Build a function `sort_dict_by_value` that sort a dict by its values, with edge-case handling. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n ... | dict_collections |
[
{
"role": "user",
"content": "Write `sort_dict_by_value` handling edge cases; it should sort a dict by its values. "
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\... | dict_collections |
[
{
"role": "user",
"content": "Implement `sort_dict_by_value` with proper validation: sort a dict by its values. Use only the standard library."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise Ty... | dict_collections |
[
{
"role": "user",
"content": "Write `sort_dict_by_value` in Python. It should sort a dict by its values. Include basic type checks."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d... | dict_collections |
[
{
"role": "user",
"content": "Write `sort_dict_by_value`: sort a dict by its values. Include basic type checks."
},
{
"role": "assistant",
"content": "def sort_dict_by_value(d: dict, reverse: bool = False) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n... | dict_collections |
[
{
"role": "user",
"content": "Write `nested_get` handling edge cases; it should safely get a nested dict value. "
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `nested_get` (a dict d and path list) -> the value or default. Add a brief docstring."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict... | dict_collections |
[
{
"role": "user",
"content": "Make a function `nested_get` to safely get a nested dict value. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in... | dict_collections |
[
{
"role": "user",
"content": "Formulate `nested_get` to safely get a nested dict value. Keep it efficient."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n c... | dict_collections |
[
{
"role": "user",
"content": "Please provide `nested_get` that safely get a nested dict value. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\... | dict_collections |
[
{
"role": "user",
"content": "Formulate `nested_get` to safely get a nested dict value. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key ... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `nested_get`: safely get a nested dict value. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and k... | dict_collections |
[
{
"role": "user",
"content": "Formulate `nested_get` to safely get a nested dict value. Include basic type checks."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Create a robust `nested_get` that safely get a nested dict value. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) ... | dict_collections |
[
{
"role": "user",
"content": "Formulate `nested_get` to safely get a nested dict value. Use only the standard library."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Draft a Python function `nested_get` to safely get a nested dict value. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and ... | dict_collections |
[
{
"role": "user",
"content": "Help me write `nested_get` that safely get a nested dict value. Add a brief docstring."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Help me write `nested_get` that safely get a nested dict value. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `nested_get` which safely get a nested dict value. Include basic type checks."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dic... | dict_collections |
[
{
"role": "user",
"content": "Write code for `nested_get` (a dict d and path list) that safely get a nested dict value. Use only the standard library."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstan... | dict_collections |
[
{
"role": "user",
"content": "Please provide `nested_get` that safely get a nested dict value. Keep it efficient."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Help me write `nested_get` that safely get a nested dict value. "
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n cur = cur[key... | dict_collections |
[
{
"role": "user",
"content": "Code a function `nested_get` to safely get a nested dict value. Use only the standard library."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in c... | dict_collections |
[
{
"role": "user",
"content": "Implement `nested_get(a dict d and path list)` to safely get a nested dict value. Add a brief docstring."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) an... | dict_collections |
[
{
"role": "user",
"content": "Make a function `nested_get` to safely get a nested dict value. Keep it efficient."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Build a function `nested_get` that safely get a nested dict value, with edge-case handling. Keep it efficient."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, di... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `nested_get`: safely get a nested dict value. Use only the standard library."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) ... | dict_collections |
[
{
"role": "user",
"content": "Construct `nested_get` to safely get a nested dict value. "
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n cur = cur[key]\n ... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `nested_get` which safely get a nested dict value. Use only the standard library."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur,... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `nested_get` which safely get a nested dict value. "
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:\n ... | dict_collections |
[
{
"role": "user",
"content": "Code a function `nested_get` to safely get a nested dict value. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) an... | dict_collections |
[
{
"role": "user",
"content": "Implement `nested_get`. It should safely get a nested dict value. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in... | dict_collections |
[
{
"role": "user",
"content": "Implement `nested_get`. It should safely get a nested dict value. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key in cur:... | dict_collections |
[
{
"role": "user",
"content": "Implement `nested_get` with proper validation: safely get a nested dict value. Keep it efficient."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and key i... | dict_collections |
[
{
"role": "user",
"content": "Write `nested_get` in Python. It should safely get a nested dict value. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and ... | dict_collections |
[
{
"role": "user",
"content": "Create `nested_get(a dict d and path list)` returning the value or default. Include basic type checks."
},
{
"role": "assistant",
"content": "def nested_get(d: dict, path: list, default=None):\n cur = d\n for key in path:\n if isinstance(cur, dict) and ... | dict_collections |
[
{
"role": "user",
"content": "Write a Python function `deep_merge` that deeply merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeErr... | dict_collections |
[
{
"role": "user",
"content": "I need a Python helper `deep_merge` that deeply merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"i... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `deep_merge`: deeply merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"i... | dict_collections |
[
{
"role": "user",
"content": "Produce a clean implementation of `deep_merge`: deeply merge two dictionaries. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise... | dict_collections |
[
{
"role": "user",
"content": "Create a robust `deep_merge` that deeply merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must... | dict_collections |
[
{
"role": "user",
"content": "Help me write `deep_merge` that deeply merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs mus... | dict_collections |
[
{
"role": "user",
"content": "Define a function `deep_merge` taking dicts a and b and returning a merged dict. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n ... | dict_collections |
[
{
"role": "user",
"content": "Build a function `deep_merge` that deeply merge two dictionaries, with edge-case handling. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, di... | dict_collections |
[
{
"role": "user",
"content": "Construct `deep_merge` to deeply merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `deep_merge`: deeply merge two dictionaries. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise Typ... | dict_collections |
[
{
"role": "user",
"content": "Provide a Python solution for `deep_merge`: deeply merge two dictionaries. "
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must be dicts\")... | dict_collections |
[
{
"role": "user",
"content": "Construct `deep_merge` to deeply merge two dictionaries. "
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must be dicts\")\n result = dic... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `deep_merge` (dicts a and b) -> a merged dict. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(... | dict_collections |
[
{
"role": "user",
"content": "Write a reusable function `deep_merge` which deeply merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise Type... | dict_collections |
[
{
"role": "user",
"content": "Produce a clean implementation of `deep_merge`: deeply merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise T... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `deep_merge` (dicts a and b) -> a merged dict. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs... | dict_collections |
[
{
"role": "user",
"content": "Write `deep_merge` in Python. It should deeply merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"i... | dict_collections |
[
{
"role": "user",
"content": "Please provide `deep_merge` that deeply merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must ... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `deep_merge` (dicts a and b) -> a merged dict. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeErro... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `deep_merge` which deeply merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeEr... | dict_collections |
[
{
"role": "user",
"content": "Make a function `deep_merge` to deeply merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"input... | dict_collections |
[
{
"role": "user",
"content": "Construct `deep_merge` to deeply merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must be dicts\")... | dict_collections |
[
{
"role": "user",
"content": "Construct `deep_merge` to deeply merge two dictionaries. Add a brief docstring."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must be dict... | dict_collections |
[
{
"role": "user",
"content": "Implement `deep_merge` with proper validation: deeply merge two dictionaries. Use only the standard library."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise Ty... | dict_collections |
[
{
"role": "user",
"content": "Code a function `deep_merge` to deeply merge two dictionaries. Include basic type checks."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs mu... | dict_collections |
[
{
"role": "user",
"content": "Add a function `deep_merge` that deeply merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs mu... | dict_collections |
[
{
"role": "user",
"content": "Write `deep_merge` in Python. It should deeply merge two dictionaries. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError... | dict_collections |
[
{
"role": "user",
"content": "Implement `deep_merge`. It should deeply merge two dictionaries. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs m... | dict_collections |
[
{
"role": "user",
"content": "Implement `deep_merge(dicts a and b)` to deeply merge two dictionaries. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeEr... | dict_collections |
[
{
"role": "user",
"content": "Help me write `deep_merge` that deeply merge two dictionaries. Keep it efficient."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"inputs must be di... | dict_collections |
[
{
"role": "user",
"content": "Implement `deep_merge`. It should deeply merge two dictionaries. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def deep_merge(a: dict, b: dict) -> dict:\n if not (isinstance(a, dict) and isinstance(b, dict)):\n raise TypeError(\"i... | dict_collections |
[
{
"role": "user",
"content": "Write `filter_dict` handling edge cases; it should filter a dict by a predicate. Add a brief docstring."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\"... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `filter_dict` (a dict d and predicate) -> a filtered dict. Use only the standard library."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict` returning a filtered dict given a dict d and predicate. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict`. It should filter a dict by a predicate. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict... | dict_collections |
[
{
"role": "user",
"content": "Construct `filter_dict` to filter a dict by a predicate. "
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {k: v for k, v in d.items() if p... | dict_collections |
[
{
"role": "user",
"content": "Can you write code for `filter_dict` that filter a dict by a predicate? Keep it efficient."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return... | dict_collections |
[
{
"role": "user",
"content": "Help me write `filter_dict` that filter a dict by a predicate. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict` returning a filtered dict given a dict d and predicate. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict(a dict d and predicate)` to filter a dict by a predicate. Add a brief docstring."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\"... | dict_collections |
[
{
"role": "user",
"content": "Please provide `filter_dict` that filter a dict by a predicate. Use only the standard library."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n re... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict`. It should filter a dict by a predicate. Use only the standard library."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n r... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `filter_dict` (a dict d and predicate) -> a filtered dict. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be... | dict_collections |
[
{
"role": "user",
"content": "Build a function `filter_dict` that filter a dict by a predicate, with edge-case handling. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict`. It should filter a dict by a predicate. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n r... | dict_collections |
[
{
"role": "user",
"content": "Write `filter_dict`: filter a dict by a predicate. Include basic type checks."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {k: v for k,... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict`. It should filter a dict by a predicate. Include basic type checks."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n retur... | dict_collections |
[
{
"role": "user",
"content": "Implement the function `filter_dict` (a dict d and predicate) -> a filtered dict. Include basic type checks."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a d... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `filter_dict` which filter a dict by a predicate. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must ... | dict_collections |
[
{
"role": "user",
"content": "Implement `filter_dict` with proper validation: filter a dict by a predicate. Add a brief docstring."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n... | dict_collections |
[
{
"role": "user",
"content": "Build a function `filter_dict` that filter a dict by a predicate, with edge-case handling. "
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n retur... | dict_collections |
[
{
"role": "user",
"content": "Build a function `filter_dict` that filter a dict by a predicate, with edge-case handling. Add a brief docstring."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must b... | dict_collections |
[
{
"role": "user",
"content": "Help me write `filter_dict` that filter a dict by a predicate. Keep it efficient."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a dict\")\n return {k: v fo... | dict_collections |
[
{
"role": "user",
"content": "Create a utility function named `filter_dict` which filter a dict by a predicate. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a di... | dict_collections |
[
{
"role": "user",
"content": "Produce a clean implementation of `filter_dict`: filter a dict by a predicate. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def filter_dict(d: dict, predicate) -> dict:\n if not isinstance(d, dict):\n raise TypeError(\"d must be a ... | dict_collections |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.