| Server IP : 142.11.234.102 / Your IP : 216.73.216.11 Web Server : Apache System : Linux dal-shared-66.hostwindsdns.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : krnuyqrm ( 1183) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/local/lib/python3.6/site-packages/piptools/_compat/ |
Upload File : |
# Ported from python 3.7 contextlib.py
from types import TracebackType
from typing import Optional, Type, TypeVar
_T = TypeVar("_T")
class nullcontext:
"""Context manager that does no additional processing.
Used as a stand-in for a normal context manager, when a particular
block of code is only sometimes used with a normal context manager:
cm = optional_cm if condition else nullcontext()
with cm:
# Perform operation, using optional_cm if condition is True
TODO: replace with `contextlib.nullcontext()` after Python 3.6 being dropped
"""
def __init__(self, enter_result: _T) -> None:
self.enter_result = enter_result
def __enter__(self) -> _T:
return self.enter_result
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
pass