File: //usr/lib/python3/dist-packages/mercurial/__pycache__/windows.cpython-310.pyc
o
�]LbW � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z ddl
mZ ddlm
Z
ddlmZmZmZmZmZ z d dlZej W n
eyV d dlZY nw e�d�ZejZejZejZejZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%j&Z&ej'Z'ej(Z(dZ)G d d
� d
e*�Z+G dd� de*�Z,dcdd�Z-ej.Z.dd� Z/dd� Z0G dd� de*�Z1dd� Z2dd� Z3dd� Z4dd� Z5ddd d!�Z6d"d#� Z7d$d%� Z8d&d'� Z9d(d)� Z:d*d+� Z;d,d-� Z<d.d/� Z=e�>d0�Z?e�>d1�Z@d2d3� ZAejBjCZDejEZFd4d5� ZGd6d7� ZHdaIdaJd8d9� ZKd:d;� ZLd<d=� ZMd>d?� ZNd@dA� ZOejPejQhZRdBdC� ZSdedDdE�ZTdedFdG�ZUdHdI� ZVdJdK� ZWdLdM� ZXdNdO� ZYdPdQ� ZZdRdS� Z[G dTdU� dUe*�Z\dfdVdW�Z]dXZ^dYdZ� Z_d[d\� Z`d]d^� Zad_d`� Zbdadb� ZcdS )g� )�absolute_importN� )�_)�getattr)�encoding�error�policy�pycompat�win32�osutil� c @ s| e Zd ZdZdZdZdZdd� Zdd� Zd d
� Z dd� Z
d
d� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� ZdS )�mixedfilemodewrappera) Wraps a file handle when it is opened in read/write mode.
fopen() and fdopen() on Windows have a specific-to-Windows requirement
that files opened with mode r+, w+, or a+ make a call to a file positioning
function when switching between reads and writes. Without this extra call,
Python will raise a not very intuitive "IOError: [Errno 0] Error."
This class wraps posixfile instances when the file is opened in read/write
mode and automatically adds checks or inserts appropriate file positioning
calls when necessary.
r r � c C s t �| d|� t �| dd� d S )N�_fp�_lastopr )�object�__setattr__��self�fp� r �3/usr/lib/python3/dist-packages/mercurial/windows.py�__init__J s zmixedfilemodewrapper.__init__c C � | j �� | S �N�r � __enter__�r r r r r N s
zmixedfilemodewrapper.__enter__c C � | j �|||� d S r �r �__exit__)r �exc_type�exc_val�exc_tbr r r r R � zmixedfilemodewrapper.__exit__c C � t | j|�S r �r r �r �namer r r �__getattr__U � z mixedfilemodewrapper.__getattr__c C s | j �||�S r )r r )r r( �valuer r r r X � z mixedfilemodewrapper.__setattr__c C s | j �dtj� d S )Nr )r �seek�os�SEEK_CURr r r r � _noopseek[ r$ zmixedfilemodewrapper._noopseekc O s"