B
    `y                 @   s  d Z ddlZddlZddlmZ ddlmZ yddlmZ W n  ek
r\   ddl	mZ Y nX yddl
ZW n ek
r   ddlZY nX yeZW n ek
r   eZY nX yeZW n ek
r   eZY nX yeZW n ek
r   eZY nX yddlmZ W n" ek
r    ddlmZ Y nX yddlmZ W n" ek
rT   ddlmZ Y nX y
ej W n  ek
r   eeefZY nX eeejfZydd	lm Z! W n" ek
r   dd	l"m Z! Y nX yddl#Z#W n ek
r   ddl$Z#Y nX y
i j% W n& ek
r   d
d Z&dd Z'Y nX dd Z&dd Z'ye(g j) W n ek
r\   dd Z*Y n
X dd Z*ej+rdd Z,dd Z-dd Z.dd Z/dd Z0n(dd Z,dd Z-dd Z.d d Z/d!d Z0yej1d" Z2W n  e3k
r   ej1d# Z2Y nX yddl4Z4ddl5Z4dZ6W n ek
r"   dZ4Y nX ye4j7j8Z9W n" e:k
rR   ddl6Z6dZ9Y nX ye4j7j;Z<W n ek
r~   e6= Z<Y nX d$d% Z>ydd&l?m@Z@ W n$ ek
r   G d'd( d(Z@Y nX d)d* ZAd+d, ZBd/d-d.ZCdS )0z:Add things to old Pythons so I can pretend they are newer.    N)datetime)env)StringIO)zip_longest)izip_longest)	get_ident)quotec             C   s   |   S )z Produce the items from dict `d`.)items)d r   Y/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/coverage/backward.pyiitems\   s    r   c             C   s   t |  S )z%Return a list of items from dict `d`.)listr	   )r
   r   r   r   litems`   s    r   c             C   s   |   S )z Produce the items from dict `d`.)	iteritems)r
   r   r   r   r   e   s    c             C   s   |   S )z%Return a list of items from dict `d`.)r	   )r
   r   r   r   r   i   s    c             C   s
   t | jS )z1Get the `next` function for iterating over `seq`.)iter__next__)seqr   r   r   iternextq   s    r   c             C   s
   t | jS )z1Get the `next` function for iterating over `seq`.)r   next)r   r   r   r   r   u   s    c             C   s
   |  dS )zConvert string `s` to bytes.utf8)encode)sr   r   r   to_bytes|   s    r   c             C   s
   |  dS )zConvert bytes `b` to string.r   )decode)br   r   r   	to_string   s    r   c             C   s   t | S )z7Produce a byte string with the ints from `byte_values`.)bytes)byte_valuesr   r   r   binary_bytes   s    r   c             C   s   | S )z4Turn a byte indexed from a bytes object into an int.r   )byter   r   r   byte_to_int   s    r!   c             C   s   | S )z,Turn a bytes object into a sequence of ints.r   )bytes_valuer   r   r   bytes_to_ints   s    r#   c             C   s   | S )z+Convert string `s` to bytes (no-op in 2.x).r   )r   r   r   r   r      s    c             C   s   | S )zConvert bytes `b` to string.r   )r   r   r   r   r      s    c             C   s   d dd | D S )z7Produce a byte string with the ints from `byte_values`. c             s   s   | ]}t |V  qd S )N)chr).0r   r   r   r   	<genexpr>   s    zbinary_bytes.<locals>.<genexpr>)join)r   r   r   r   r      s    c             C   s   t | S )z4Turn a byte indexed from a bytes object into an int.)ord)r    r   r   r   r!      s    c             c   s   x| D ]}t |V  qW dS )z,Turn a bytes object into a sequence of ints.N)r)   )r"   r    r   r   r   r#      s    
__builtin__builtinsc             C   s"   y| j S  tk
r   | jS X dS )z$Get the code object from a function.N)	func_codeAttributeError__code__)fnr   r   r   code_object   s    r0   )SimpleNamespacec               @   s    e Zd ZdZdd Zdd ZdS )r1   z7Python implementation of SimpleNamespace, for Python 2.c             K   s   | j | d S )N)__dict__update)selfkwargsr   r   r   __init__   s    zSimpleNamespace.__init__c                s4   t  j} fdd|D }dt jd|S )Nc             3   s    | ]}d  | j| V  qdS )z{}={!r}N)formatr2   )r&   k)r4   r   r   r'      s    z+SimpleNamespace.__repr__.<locals>.<genexpr>z{}({})z, )sortedr2   r7   type__name__r(   )r4   keysr	   r   )r4   r   __repr__   s    
zSimpleNamespace.__repr__N)r;   
__module____qualname____doc__r6   r=   r   r   r   r   r1      s   r1   c          	   C   s2   y|   dS  ttfk
r,   | dS X dS )zReturn a string with local timezone representing the date.
    If python version is lower than 3.6, the time zone is not included.
    z%Y-%m-%d %H:%M %zz%Y-%m-%d %H:%MN)
astimezonestrftime	TypeError
ValueError)dtr   r   r   format_local_datetime   s    rF   c               C   s   t rtt drt   dS )z7Invalidate any import caches that may or may not exist.invalidate_cachesN)	importlibhasattrrG   r   r   r   r   invalidate_import_caches   s    rJ   c          	   C   s   yddl m} W n tk
r(   d}Y nX |dkr:| d }|rl|| |}||}|tj| < |j| nFxt	
 D ]}|d dkrvP qvW t|d}t	| |||}W dQ R X |S )zImport a local file as a module.

    Opens a file in the current directory named `modname`.py, imports it
    as `modname`, and returns the module object.  `modfile` is the file to
    import if it isn't in the current directory.

    r   Nz.pyr)importlib.utilutilImportErrorspec_from_file_locationmodule_from_specsysmodulesloaderexec_moduleimpget_suffixesopenload_module)modnameZmodfileZimportlib_utilspecmodsufffr   r   r   import_local_file   s"    


r^   )N)Dr@   osrQ   r   Zcoverager   	cStringIOr   rN   ioConfigParserconfigparser
basestringZstring_class	NameErrorstrunicodeZunicode_classxrangerange	itertoolsr   r   threadr   Zget_thread_id	threadingPathLiker-   r   Z
path_typesshlexr   shlex_quoteZpipesreprlibreprr   r   r   r   r   r   PY3r   r   r   r!   r#   rR   ZBUILTINSKeyErrorrH   rL   rU   rM   	find_specZimportlib_util_find_spec	ExceptionMAGIC_NUMBERZPYC_MAGIC_NUMBER	get_magicr0   typesr1   rF   rJ   r^   r   r   r   r   <module>   s   







