conversations listlengths 2 2 | source stringclasses 8
values |
|---|---|
[
{
"role": "user",
"content": "Develop `read_if_exists` such that it read a file if it exists. Include basic type checks."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path,... | file_io |
[
{
"role": "user",
"content": "Help me write `read_if_exists` that read a file if it exists. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(p... | file_io |
[
{
"role": "user",
"content": "I need a Python helper `read_if_exists` that read a file if it exists. Use only the standard library."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with... | file_io |
[
{
"role": "user",
"content": "Make a function `read_if_exists` to read a file if it exists. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(p... | file_io |
[
{
"role": "user",
"content": "Implement `read_if_exists(a path)` to read a file if it exists. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, ... | file_io |
[
{
"role": "user",
"content": "Provide a Python solution for `read_if_exists`: read a file if it exists. Use only the standard library."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n w... | file_io |
[
{
"role": "user",
"content": "Please provide `read_if_exists` that read a file if it exists. Include basic type checks."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, ... | file_io |
[
{
"role": "user",
"content": "Please provide `read_if_exists` that read a file if it exists. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(... | file_io |
[
{
"role": "user",
"content": "Create a robust `read_if_exists` that read a file if it exists. Keep it efficient."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\", ... | file_io |
[
{
"role": "user",
"content": "Construct `read_if_exists` to read a file if it exists. "
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\", encoding=\"utf-8\") as f:\... | file_io |
[
{
"role": "user",
"content": "Write `read_if_exists` in Python. It should read a file if it exists. Use only the standard library."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with ... | file_io |
[
{
"role": "user",
"content": "Write `read_if_exists`: read a file if it exists. "
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\", encoding=\"utf-8\") as f:\n ... | file_io |
[
{
"role": "user",
"content": "Code a function `read_if_exists` to read a file if it exists. Add a brief docstring."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\"... | file_io |
[
{
"role": "user",
"content": "Produce a clean implementation of `read_if_exists`: read a file if it exists. Include basic type checks."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n w... | file_io |
[
{
"role": "user",
"content": "Write code for `read_if_exists` (a path) that read a file if it exists. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with ope... | file_io |
[
{
"role": "user",
"content": "Write `read_if_exists` handling edge cases; it should read a file if it exists. "
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\", en... | file_io |
[
{
"role": "user",
"content": "Implement `read_if_exists` returning contents or default given a path. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open... | file_io |
[
{
"role": "user",
"content": "I need a Python helper `read_if_exists` that read a file if it exists. "
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(path, \"r\", encoding=\"... | file_io |
[
{
"role": "user",
"content": "Write `read_if_exists` handling edge cases; it should read a file if it exists. Keep it efficient."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with op... | file_io |
[
{
"role": "user",
"content": "Implement `read_if_exists` with proper validation: read a file if it exists. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return d... | file_io |
[
{
"role": "user",
"content": "Implement the function `read_if_exists` (a path) -> contents or default. Add a brief docstring."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(... | file_io |
[
{
"role": "user",
"content": "Implement `read_if_exists`. It should read a file if it exists. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open... | file_io |
[
{
"role": "user",
"content": "Create `read_if_exists(a path)` returning contents or default. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with open(... | file_io |
[
{
"role": "user",
"content": "Implement the function `read_if_exists` (a path) -> contents or default. Include basic type checks."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n with o... | file_io |
[
{
"role": "user",
"content": "Implement `read_if_exists`. It should read a file if it exists. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return default\n w... | file_io |
[
{
"role": "user",
"content": "Write a reusable function `read_if_exists` which read a file if it exists. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "import os\n\ndef read_if_exists(path: str, default=None):\n if not os.path.exists(path):\n return def... | file_io |
[
{
"role": "user",
"content": "Write `copy_file` handling edge cases; it should copy a file. "
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `copy_file` in Python. It should copy a file. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a utility function named `copy_file` which copy a file. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "I need a Python helper `copy_file` that copy a file. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `copy_file(source and destination paths)` to copy a file. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Make a function `copy_file` to copy a file. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `copy_file`: copy a file. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a reusable function `copy_file` which copy a file. Add a brief docstring."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `copy_file` handling edge cases; it should copy a file. Add a brief docstring."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `copy_file` with proper validation: copy a file. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `copy_file`. It should copy a file. Add a brief docstring."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `copy_file` returning None given source and destination paths. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a utility function named `copy_file` which copy a file. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Generate a Python function `copy_file` for copy a file. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a Python function `copy_file` that copy a file. Keep it efficient."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a Python function `copy_file` that copy a file. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a robust `copy_file` that copy a file. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "I need a Python helper `copy_file` that copy a file. "
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `copy_file` with proper validation: copy a file. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `copy_file` (source and destination paths) -> None. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `copy_file` (source and destination paths) -> None. Add a brief docstring."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Formulate `copy_file` to copy a file. Keep it efficient."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Code a function `copy_file` to copy a file. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `copy_file` (source and destination paths) -> None. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Provide a Python solution for `copy_file`: copy a file. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Provide a Python solution for `copy_file`: copy a file. Avoid mutating the input."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `copy_file` handling edge cases; it should copy a file. Keep it efficient."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a Python function `copy_file` that copy a file. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `copy_file` in Python. It should copy a file. Use only the standard library."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Can you write code for `copy_file` that copy a file? Add a brief docstring."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Develop `copy_file` such that it copy a file. Include basic type checks."
},
{
"role": "assistant",
"content": "import shutil\n\ndef copy_file(src: str, dst: str) -> None:\n shutil.copyfile(src, dst)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Define a function `read_text` taking a file path and returning the file contents. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
... | file_io |
[
{
"role": "user",
"content": "Provide a Python solution for `read_text`: read entire file as string. "
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `read_text` returning the file contents given a file path. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Produce a clean implementation of `read_text`: read entire file as string. Keep it efficient."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Can you write code for `read_text` that read entire file as string? Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Construct `read_text` to read entire file as string. Use only the standard library."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Construct `read_text` to read entire file as string. Keep it efficient."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `read_text` with proper validation: read entire file as string. Keep it efficient."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "I need a Python helper `read_text` that read entire file as string. Include basic type checks."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write `read_text`: read entire file as string. "
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Make a function `read_text` to read entire file as string. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a utility function named `read_text` which read entire file as string. Avoid mutating the input."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a utility function named `read_text` which read entire file as string. Include basic type checks."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `read_text(a file path)` to read entire file as string. Include basic type checks."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Please provide `read_text` that read entire file as string. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write code for `read_text` (a file path) that read entire file as string. Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `read_text`. It should read entire file as string. Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create `read_text(a file path)` returning the file contents. Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `read_text` (a file path) -> the file contents. Keep it efficient."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Add a function `read_text` that read entire file as string. Keep it efficient."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Draft a Python function `read_text` to read entire file as string. Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `read_text` (a file path) -> the file contents. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Construct `read_text` to read entire file as string. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Define a function `read_text` taking a file path and returning the file contents. Make it robust to invalid input."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\... | file_io |
[
{
"role": "user",
"content": "Please provide `read_text` that read entire file as string. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create a utility function named `read_text` which read entire file as string. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.rea... | file_io |
[
{
"role": "user",
"content": "Create a robust `read_text` that read entire file as string. Return sensible defaults for edge cases."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Draft a Python function `read_text` to read entire file as string. Use only the standard library."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Build a function `read_text` that read entire file as string, with edge-case handling. Add a brief docstring."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
... | file_io |
[
{
"role": "user",
"content": "Write `read_text`: read entire file as string. Use only the standard library."
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `read_text` (a file path) -> the file contents. "
},
{
"role": "assistant",
"content": "def read_text(path: str) -> str:\n with open(path, \"r\", encoding=\"utf-8\") as f:\n return f.read()\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `write_text` (a path and text) -> None. "
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement `write_text` with proper validation: write text to a file. Use only the standard library."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
... | file_io |
[
{
"role": "user",
"content": "Implement `write_text` with proper validation: write text to a file. Include basic type checks."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a Python function `write_text` that write text to a file. Handle empty input gracefully."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Provide a Python solution for `write_text`: write text to a file. "
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Add a function `write_text` that write text to a file. Add a brief docstring."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Implement the function `write_text` (a path and text) -> None. Keep it efficient."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Draft a Python function `write_text` to write text to a file. "
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a reusable function `write_text` which write text to a file. Use only the standard library."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}... | file_io |
[
{
"role": "user",
"content": "Define a function `write_text` taking a path and text and returning None. Keep it efficient."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Write a reusable function `write_text` which write text to a file. Include basic type checks."
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
[
{
"role": "user",
"content": "Create `write_text(a path and text)` returning None. "
},
{
"role": "assistant",
"content": "def write_text(path: str, text: str) -> None:\n with open(path, \"w\", encoding=\"utf-8\") as f:\n f.write(text)\n"
}
] | file_io |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.