File: //usr/lib/python3/dist-packages/twisted/names/__pycache__/authority.cpython-310.pyc
o
�b+A � @ s� d Z ddlZddlZddlmZ ddlmZmZmZ ddl m
Z
ddlmZm
Z
ddlmZ dd d
�ZG dd� dej�ZG d
d� de�ZG dd� de�ZdS )z
Authoritative resolvers.
� N)�defer)�common�dns�error)�failure)�execfile�nativeString)�FilePath�/tmp/twisted-names.serialc C s t �d�}t�d�}z)tj�| �s-t| d��}|�|d � W d � n1 s(w Y W t�|� nt�|� w t| ��}|�� � � \}}W d � n1 sQw Y ||kr`t
|�d pad}t| d��}|�d||f � W d � n1 s{w Y |d |f }|S )
a�
Return a monotonically increasing (across program runs) integer.
State is stored in the given file. If it does not exist, it is
created with rw-/---/--- permissions.
This manipulates process-global state by calling C{os.umask()}, so it isn't
thread-safe.
@param filename: Path to a file that is used to store the state across
program runs.
@type filename: L{str}
@return: a monotonically increasing number
@rtype: L{str}
z%Y%m%d� �wz 0N� r z%s %dz%02d)�time�strftime�os�umask�path�exists�open�write�readline�split�int)�filename�serial�o�f�
serialFile�
lastSerial�zoneID� r �9/usr/lib/python3/dist-packages/twisted/names/authority.py� getSerial s$
��
��r"