OwlCyberSecurity - MANAGER
Edit File: locks.cpython-39.pyc
a ���e � @ s� d Z ddlZdZdd� Zejdk�r"ddlZddlmZmZm Z m Z mZmZm Z mZmZ ddlmZmZmZ dZd Zd Zee �ee�kr�eZne ZeZG dd� de�ZG d d� de �ZG dd� de�Zee�Ze d�ZejZee_eeeeeege_ ej!Z!ee!_eeeeege!_ dd� Z"dd� Z#ndzddl$Z$e$jZe$jZe$jZW n4 e%e&f�yt d Z ZZdd� Z"dd� Z#Y n0 dd� Z"dd� Z#dS )am Portable file locking utilities. Based partially on an example by Jonathan Feignberg in the Python Cookbook [1] (licensed under the Python Software License) and a ctypes port by Anatoly Techtonik for Roundup [2] (license [3]). [1] https://code.activestate.com/recipes/65203/ [2] https://sourceforge.net/p/roundup/code/ci/default/tree/roundup/backends/portalocker.py # NOQA [3] https://sourceforge.net/p/roundup/code/ci/default/tree/COPYING.txt Example Usage:: >>> from django.core.files import locks >>> with open('./file', 'wb') as f: ... locks.lock(f, locks.LOCK_EX) ... f.write('Django') � N)�LOCK_EX�LOCK_SH�LOCK_NB�lock�unlockc C s t | d�r| �� S | S )zCGet a filedescriptor from something which could be a file or an fd.�fileno)�hasattrr ��f� r �X/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/core/files/locks.py�_fd s r �nt) �POINTER� Structure�Union�WinDLL�byref�c_int64�c_ulong�c_void_p�sizeof)�BOOL�DWORD�HANDLE� � c @ s e Zd ZdefdefgZdS )�_OFFSETZOffsetZ OffsetHighN)�__name__� __module__�__qualname__r �_fields_r r r r r 9 s r c @ s"