Your IP : 216.73.216.213
��Y- � @ sw d d l Z d d l Z d d l Z d Z e j d k rH d d � Z n d d l Z d d � Z Gd d � d � Z d S)
� Nz0.3.2� c C s | S)N� )�xr r �B/opt/alt/python35/lib/python3.5/site-packages/sdnotify/__init__.py�_b s r c C s t j | � d S)Nr )�codecs�latin_1_encode)r r r r r s c @ s1 e Z d Z d Z d d d � Z d d � Z d S)�SystemdNotifierz�This class holds a connection to the systemd notification socket
and can be used to send messages to systemd using its notify method.Fc
C s� | | _ yb t j t j t j � | _ t j d � } | d d k rZ d | d d � } | j j | � Wn d | _ | j r� � Yn Xd S)a� Instantiate a new notifier object. This will initiate a connection
to the systemd notification socket.
Normally this method silently ignores exceptions (for example, if the
systemd notification socket is not available) to allow applications to
function on non-systemd based systems. However, setting debug=True will
cause this method to raise any exceptions generated to the caller, to
aid in debugging.
Z
NOTIFY_SOCKETr �@� � N)�debug�socketZAF_UNIXZ
SOCK_DGRAM�os�getenvZconnect)�selfr
Zaddrr r r �__init__ s
zSystemdNotifier.__init__c C s5 y | j j t | � � Wn | j r, � Yn Xd S)a" Send a notification to systemd. state is a string; see
the man page of sd_notify (http://www.freedesktop.org/software/systemd/man/sd_notify.html)
for a description of the allowable values.
Normally this method silently ignores exceptions (for example, if the
systemd notification socket is not available) to allow applications to
function on non-systemd based systems. However, setting debug=True will
cause this method to raise any exceptions generated to the caller, to
aid in debugging.N)r Zsendallr r
)r �stater r r �notify- s
zSystemdNotifier.notifyN)�__name__�
__module__�__qualname__�__doc__r r r r r r r s r )r )r r �sys�__version__�version_infor r r r r r r �<module> s