df XddlZddlZddlZddlmZddlmZddlTddlmZddlmZ ddl m Z ddl TdZ d Zd Ze gd ed d geddgeddgiZedeDZdZ d"dZdZdZdZdZedkr.ejZeZe \Z!Z"e#e"dkr/ede$ej%dee!Z&e"dZ'dZ(e!j(r$de!j()d DZ(e!j*Z*e*ej+,e'rdndZ*ee*e'fie&Z-e!j.r)d!/eddZ0ee0e-ee-e(e!j1e!j2e!j3e!j4 dSdS)#N)getpass) OptionParser)*)print_) __version__)CockroachDatabasez.from peewee import *%s database = %s('%s'%s) zDclass BaseModel(Model): class Meta: database = database zCclass UnknownField(object): def __init__(self, *_, **__): pass ) cockroach cockroachdbcrdbmysqlmysqldbpostgres postgresqlsqlitesqlite3c#>K|]}t|D]}||fV dSN)DATABASE_ALIASES).0keyvalues d/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pwiz.py r'sT88!1#!688CL8888888c D|tvrPtddtzt jd|dd}t|}||fi|}t||S)Nz)Unrecognized database, must be one of: %s, schema)r) DATABASE_MAPerrjoinkeyssysexitpop Introspector from_database) database_type database_namekwargsr DatabaseClassdbs rmake_introspectorr-+sL(( 7 IIl'')) * * + , , ,  ZZ$ ' 'F /M } / / / /B  % %b % 8 88rFTcB ||| }tj|rdt|zndfz}t|sttttd fd t}t j D]} | |vr|r| |vr  | |dS)N) table_names include_views snake_casez, **%sc|pg}j|}|D]W}|j}||vr||vrtd|z||vr0||vr,||||kr||||gzXtdj|zj|}st|}j||D]\}}t|v|dktdk|j j vg} | r>|j rtdkrd|_ |j tu} | r(r&|jd|jpd} td| ztd |ztd td td |z|} | rftd t| D]8\} }tddd| Dd|d9tdjrtdjztdkrMtfd|D}dd|D}td|znstdtd ||dS)Nz# Possible reference cycle: %szclass %s(BaseModel):idrFz - ?z # %sz %sr2z class Meta:z table_name = '%s'z indexes = (z ((rc3 K|] }d|zV dSz'%s'N)rfields rrz5print_models.._print_table..|s&AAfunAAAAAArz), z),z )z schema = '%s'c,g|]\}}|v |jSr8)name)rcolr9 primary_keyss r z6print_models.._print_table..s4%(%(%()sE,&& &&&rc3 K|] }d|zV dSr7r8)rpks rrz5print_models.._print_table..s&EE EEEEEErz& primary_key = CompositeKey(%s)z primary_key = False) foreign_keys dest_tableradd model_namescolumnsitemssortedr=alllen field_class pk_classes primary_key UnknownFieldr;raw_column_type get_fieldmulti_column_indexesr!r)tableseenaccumrA foreign_keydestrEr;columnskip is_unknowndisprPfieldsuniquepk_field_namespk_listr= _print_tabledatabaseignore_unknown introspectorpreserve_orders @rr^z"print_models.._print_tableIs ,U3 ' > >K)Du}}e!3!37$>???4D$5$55== LtUeW_===%(  IIAA&AAAAAAAFF ;      D ,|/BB C C C |  q #%(%(%(%(-4%(%(%())NiiEEnEEEEEG ;gE F F F F 2 0 1 1 1r  rr) introspectget_database_kwargsHEADERget_additional_importsget_database_class__name__get_database_namereprr UNKNOWN_FIELD BASE_MODELsetrGrDr") ratablesrbr0r`r1 db_kwargsheaderrRrQr^r_s ` ` ` @@r print_modelsrq6sj&&65B2<'>>H0022I ++--''))2&&((&/74 ??""R 99F  6NNN } :DDDDDDDDDDL 55D,113344**    *Uf__ UD)))**rcbtj}tdtd|ztd|dztd|ztdt ztddS)Nz# Code generated by:z# python -m pwiz %sz # Date: %sz%B %d, %Y %I:%M%pz# Database: %sz# Peewee version: %sr2)datetimenowrstrftimeripeewee_version)cmd_linera timestamps r print_headerrys!%%''I !""" 8 +,,, <),,-@AA ABBB l<<>> >??? !N 2333 2JJJJJrctjd|ztjdS)Nz %s )r#stderrwriteflush)msgs rr r s8J*S0111Jrctd}|j}|ddd|ddd d |d d d|ddddtt}|ddd|d|ddd|dddd |d!d"d#dd$%|d&d'd(dd)%|d*d+dd,d-.|d/d0dd1d2.|d3d4dd5d6.|S)7Nz$usage: %prog [options] database_name)usagez-Hz--hosthost)rUz-pz--portportint)rUtypez-uz--useruserz-Pz --passwordpassword store_true)rUactionz-ez--engineenginezVDatabase type, e.g. sqlite, mysql, postgresql or cockroachdb. Default is "postgresql".)rUchoiceshelpz-sz--schemarz-tz--tablesrnzWOnly generate the specified tables. Multiple table names should be separated by commas.)rUrz-vz--viewsviewsz7Generate model classes for VIEWs in addition to tables.)rUrrz-iz--infoinfozIAdd database information and other metadata to top of the generated file.z-oz--preserve-orderrbz6Model definition column ordering matches source table.)rrUrz-Iz--ignore-unknownr`z.Ignore fields whose type cannot be determined.z-Lz--legacy-naming legacy_namingz-Use legacy table- and column-name generation.)r add_optionrGr)parseraoenginess rget_option_parserrs  F G G GF  BBtXF####BtXF////BtXF####Bt\ <@@@@\""GBtZh(****BtZh''''BtZh'))))BtYW\ EGGGGBtXF<!!!!Bt  ;K DFFFFBt  ;K <>>>>Bt |/ ;==== Mrcrd}tfd|D}jrt|d<|S)N)rrrrc3\K|]&}t||t|fV'dSr)getattr)rooptionss rrz%get_connect_kwargs..sAOOq77A;N;NO1ggq))*OOOOOOrr)dictrr)ropsr*s` rget_connect_kwargsrsH ,C OOOOCOOO O OF'$YYz Mr__main__rz%Missing required parameter "database"c^g|]*}||+Sr8)strip)rrQs rr>r>s<$$$E[[]]$%++--$$$r, )NFFFT)5rsosr#roptparserpeeweerrrvplayhouse.cockroachdbrplayhouse.reflectionrerlrk MySQLDatabasePostgresqlDatabaseSqliteDatabaserrrr-rqryr rrrhargvraw_argvr parse_argsrargsrI print_helpr$connectr_rnsplitrpathexistsrarr!rwrbrr`rr8rrrs !!!!!!000000333333""""    ;;;GY'\2Xy) t88/88888  9 9 9