ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/__pycache__/pwiz.cpython-38.pyc

U

���_3�@s�ddlZddlZddlmZddlmZddlTddlmZddlmZddl	TdZ
edd	ged
dge
dd
giZedd�eD��Zdd�Zd(dd�Zdd�Zdd�Zdd�Zdd�Zedk�r�ejZe�Ze��\ZZej�rzddlm Z Wn(e!k
�red�e�"d �YnXe#e�d k�r@ed!�e�$�e�"d �ee�Z%ed"Z&dZ'ej'�rrd#d$�ej'�(d%�D�Z'eej)e&fe%�Z*ej+�r�d&�,ed d��Z-ee-e*�ee*e'ejd'�dS))�N)�getpass)�OptionParser)�*)�print_)�__version__z�from peewee import *%s

database = %s('%s', **%s)

class UnknownField(object):
    def __init__(self, *_, **__): pass

class BaseModel(Model):
    class Meta:
        database = database
ZmysqlZmysqldbZpostgres�
postgresqlZsqliteZsqlite3ccs$|]}t|D]}||fVqqdS�N)�DATABASE_ALIASES)�.0�key�value�r
�/pwiz.py�	<genexpr>s
�rcKsV|tkr(tdd�t����t�d�|�dd�}t|}||f|�}tj||d�S)Nz)Unrecognized database, must be one of: %s�, ��schema)r)	�DATABASE_MAP�err�join�keys�sys�exit�popZIntrospectorZ
from_database)Z
database_typeZ
database_name�kwargsrZ
DatabaseClassZdbr
r
r�make_introspector#s�
rFcs��j|d��tt������j���t����f�d����fdd�	�t	�}t
�j���D]"}||kr^|rv||kr^�||�q^dS)N)Ztable_namescs�|pg}�j|}|D]Z}|j}||kr<||kr<td|�||kr||kr|�|�||kr�||||g�qtd�j|��j|��}�s�t|�}�j|�|D]^\}}t	|�k|dkt
��dk|j�jkg�}	|	r�q�|j
r�t
��dkr�d|_
td|���q�td�td�td	|���|�}
|
�r|td
�t|
�D]*\}}tdd�d
d�|D��|f��qHtd��j�r�td�j�t
��dk�r�t�fdd�|D��}
d�dd�|
D��}td|�td�|�|�dS)Nz# Possible reference cycle: %szclass %s(BaseModel):�idrFz    %s�z    class Meta:z        db_table = '%s'z        indexes = (z            ((%s), %s),rcss|]}d|VqdS�z'%s'Nr
)r
�fieldr
r
rresz5print_models.<locals>._print_table.<locals>.<genexpr>z	        )z        schema = '%s'csg|]\}}|�kr|j�qSr
)�name)r
�colr��primary_keysr
r�
<listcomp>ms�z6print_models.<locals>._print_table.<locals>.<listcomp>css|]}d|VqdSrr
)r
Zpkr
r
rrpsz&        primary_key = CompositeKey(%s))�foreign_keysZ
dest_tabler�add�model_names�columns�items�sortedr#�all�lenZfield_classZ
pk_classesZprimary_keyZ	get_field�multi_column_indexesrr)�table�seenZaccumr%Zforeign_key�destr(r �column�skipr-Zfields�uniqueZpk_field_namesZpk_list��_print_table�database�introspector�preserve_orderr"rr57sb




�
��z"print_models.<locals>._print_table)N)
Z
introspectr�TEMPLATEZget_additional_importsZget_database_class�__name__�get_database_name�reprZget_database_kwargs�setr*r'r)r7�tablesr8r/r.r
r4r�print_models.s
�?r?cCsXtj��}td�td|�td|�d��td|���tdt�td�dS)Nz# Code generated by:z# python -m pwiz %sz
# Date: %sz%B %d, %Y %I:%M%pz# Database: %sz# Peewee version: %sr)�datetimeZnowr�strftimer;�peewee_version)�cmd_liner7Z	timestampr
r
r�print_header|s
rDcCstj�d|�tj��dS)Nz%s
)r�stderr�write�flush)�msgr
r
rr�srcCs�tdd�}|j}|dddd�|ddd	d
d�|dd
dd�|ddddd�tt�}|dddd|dd�|dddd�|dddd d!�|d"d#d$dd%d&�|d'd(dd)d*d+�|S),Nz$usage: %prog [options] database_name)Zusagez-Hz--host�host)r0z-pz--port�port�int)r0�typez-uz--user�userz-Pz
--password�password�
store_true)r0�actionz-ez--engine�enginerzIDatabase type, e.g. sqlite, mysql or postgresql. Default is "postgresql".)r0�default�choices�helpz-sz--schemarz-tz--tablesr>zWOnly generate the specified tables. Multiple table names should be separated by commas.)r0rTz-iz--info�infozIAdd database information and other metadata to top of the generated file.)r0rPrTz-oz--preserve-orderr8z6Model definition column ordering matches source table.)rPr0rT)rZ
add_optionr*r)�parserZaoZenginesr
r
r�get_option_parser�s*
��
�
�rWcs.d}t�fdd�|D��}�jr*t�|d<|S)N)rIrJrMrc3s&|]}t�|�r|t�|�fVqdSr)�getattr)r
�o��optionsr
rr�s
z%get_connect_kwargs.<locals>.<genexpr>rN)�dictrNr)r[Zopsrr
rZr�get_connect_kwargs�s

r]�__main__)�OrderedDictz&Preserve order requires Python >= 2.7.rz%Missing required parameter "database"���cCsg|]}|��r|���qSr
)�strip)r
r.r
r
rr$�s�r$�,� )r8)NF).r@rrZoptparserZpeeweerrrBZplayhouse.reflectionr9Z
MySQLDatabaseZPostgresqlDatabaseZSqliteDatabaser	r\rrr?rDrrWr]r:�argvZraw_argvrV�
parse_argsr[�argsr8�collectionsr_�ImportErrorrr,Z
print_helpZconnectr6r>�splitrQr7rUrrCr
r
r
r�<module>s`
��
N





Zerion Mini Shell 1.0