Home / Function/ atomic_open() — requests Function Reference

atomic_open() — requests Function Reference

Architecture documentation for the atomic_open() function in utils.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  81958e94_0b68_fef6_ea31_76646323e79a["atomic_open()"]
  2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"]
  81958e94_0b68_fef6_ea31_76646323e79a -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c
  43bfb55b_6419_5997_8140_872a62e09796["extract_zipped_paths()"]
  43bfb55b_6419_5997_8140_872a62e09796 -->|calls| 81958e94_0b68_fef6_ea31_76646323e79a
  style 81958e94_0b68_fef6_ea31_76646323e79a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/utils.py lines 294–303

def atomic_open(filename):
    """Write a file to the disk in an atomic fashion"""
    tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename))
    try:
        with os.fdopen(tmp_descriptor, "wb") as tmp_handler:
            yield tmp_handler
        os.replace(tmp_name, filename)
    except BaseException:
        os.remove(tmp_name)
        raise

Domain

Subdomains

Frequently Asked Questions

What does atomic_open() do?
atomic_open() is a function in the requests codebase, defined in src/requests/utils.py.
Where is atomic_open() defined?
atomic_open() is defined in src/requests/utils.py at line 294.
What calls atomic_open()?
atomic_open() is called by 1 function(s): extract_zipped_paths.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free