_make_resource() — langchain Function Reference
Architecture documentation for the _make_resource() function in test_shell_execution_policies.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 06707227_971c_bfbd_5596_639762857cca["_make_resource()"] 6b16168d_9880_7f41_060c_9fcd5b337996["test_shell_execution_policies.py"] 06707227_971c_bfbd_5596_639762857cca -->|defined in| 6b16168d_9880_7f41_060c_9fcd5b337996 703d5a74_c3d7_7421_4f0b_a44a1a223516["test_host_policy_applies_prlimit()"] 703d5a74_c3d7_7421_4f0b_a44a1a223516 -->|calls| 06707227_971c_bfbd_5596_639762857cca 2cdaab2e_55db_85c9_963a_c0aed2e8a42b["test_host_policy_uses_preexec_on_macos()"] 2cdaab2e_55db_85c9_963a_c0aed2e8a42b -->|calls| 06707227_971c_bfbd_5596_639762857cca a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102["test_host_policy_respects_process_group_flag()"] a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102 -->|calls| 06707227_971c_bfbd_5596_639762857cca 1aea1c6e_6e21_31eb_09d1_ea16754ea9cf["test_host_policy_falls_back_to_rlimit_data()"] 1aea1c6e_6e21_31eb_09d1_ea16754ea9cf -->|calls| 06707227_971c_bfbd_5596_639762857cca 30b1f2af_e7ce_4dbf_9320_fca84a8ea1dc["setrlimit()"] 06707227_971c_bfbd_5596_639762857cca -->|calls| 30b1f2af_e7ce_4dbf_9320_fca84a8ea1dc dd7a82ae_f1e7_9a9d_7b95_f6649528b63a["prlimit()"] 06707227_971c_bfbd_5596_639762857cca -->|calls| dd7a82ae_f1e7_9a9d_7b95_f6649528b63a style 06707227_971c_bfbd_5596_639762857cca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py lines 25–54
def _make_resource(
*,
with_prlimit: bool,
has_rlimit_as: bool = True,
) -> Any:
"""Create a fake ``resource`` module for testing."""
class _BaseResource:
RLIMIT_CPU = 0
RLIMIT_DATA = 2
if has_rlimit_as:
RLIMIT_AS = 1
def __init__(self) -> None:
self.prlimit_calls: list[tuple[int, int, tuple[int, int]]] = []
self.setrlimit_calls: list[tuple[int, tuple[int, int]]] = []
def setrlimit(self, resource_name: int, limits: tuple[int, int]) -> None:
self.setrlimit_calls.append((resource_name, limits))
if with_prlimit:
class _Resource(_BaseResource):
def prlimit(self, pid: int, resource_name: int, limits: tuple[int, int]) -> None:
self.prlimit_calls.append((pid, resource_name, limits))
return _Resource()
return _BaseResource()
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _make_resource() do?
_make_resource() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py.
Where is _make_resource() defined?
_make_resource() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py at line 25.
What does _make_resource() call?
_make_resource() calls 2 function(s): prlimit, setrlimit.
What calls _make_resource()?
_make_resource() is called by 4 function(s): test_host_policy_applies_prlimit, test_host_policy_falls_back_to_rlimit_data, test_host_policy_respects_process_group_flag, test_host_policy_uses_preexec_on_macos.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free