
                            d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlZddlZej                  j                  ej                  j                  e      d      Zej                  j                  e      r*eej                  vrej                  j                  de       dej                   v rddlZ	  ee       ddlmZ dd	lmZ ddlZddlZddlZdd
lmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ddlm'Z' ddlm(Z( ddlm)Z) ddlm*Z* ddlm+Z+ ddlm,Z, ddlm-Z- ddlm.Z. ddlm/Z/ ddlm0Z0 ddlm1Z1 ddlm2Z2 dd lm3Z3 dd!lm4Z4 dd"lm5Z6  ejn                  e       ejp                  Z8d# Z9d$ Z:e;d%k(  r ejx                          yy# e$ r ddlZ ej$                  e       Y w xY w)&z,Python script for interacting with BigQuery.    )absolute_import)division)print_functionNthird_partygoogle)flags)appcommands)bigquery_command)bq_cached_client)commands_iam)command_cancel)command_copy)command_delete)command_extract)command_head)command_info)command_init)command_insert)command_list)command_load)command_make)command_mkdef)command_partition)command_query)command_repl)command_show)command_truncate)command_undelete)command_update)command_version)command_wait)utilsc           
      x   	 t        j                          i dt        j                  dt        j
                  dt        j                  dt        j                  dt        j                  dt        j                  dt        j                  dt        j                   d	t"        j$                  d
t&        j(                  dt*        j,                  dt.        j0                  dt2        j4                  dt6        j8                  dt:        j<                  dt        j>                  dt@        jB                  t        jD                  tF        jH                  tJ        jL                  tN        jP                  tR        jT                  tV        jX                  tZ        j\                  t^        j`                  d}|jc                         D ]2  \  }}|te        jf                         vste        jh                  ||       4 y # tj        $ r*}tm        d       to        jp                  d       Y d }~y d }~wtr        $ r}tm        d|       tt        jv                  stt        jx                  r8t{        j|                          tt        jx                  st        j                          to        jp                  d       Y d }~y d }~ww xY w)Nzadd-iam-policy-bindingcancelcpextractzget-iam-policyheadinfoinitinsertloadlsmkmkdef	partitionqueryzremove-iam-policy-bindingrm)zset-iam-policyshellshowtruncateundeleteupdateversionwaitzControl-C pressed, exiting.   zError initializing bq client: )Afrontend_utilsValidateGlobalFlagsr   AddIamPolicyBindingr   Cancelr   Copyr   ExtractGetIamPolicyr   Headr   Infor   Initr   Insertr   Loadr   ListCmdr   Maker   MakeExternalTableDefinitionr   	Partitionr   QueryRemoveIamPolicyBindingr   DeleteSetIamPolicyr   Replr   Showr   Truncater   Undeleter   Updater    Versionr!   Waititemsr	   GetCommandListAddCmdKeyboardInterruptprintsysexitBaseExceptionFLAGS
debug_modeheadless	traceback	print_excpdbpost_mortem)unused_argvbq_commandscommandfunctiones        platform/bq/bq.pymainrj   O   sL   /&&( ,"B"B 	.'' 	l	
 	?** 	,33 	!! 	!! 	!! 	.'' 	!! 	l"" 	l 	:: 	&00  	$$!" 	$\%H%H#$ 	n##%& '33""!!$--$-- ''"**!!5K: )..0	224	47H- 1 
 	
'(HHQKK	 	
34 5>>^^HHQKKs+   GG: !G: :	J9 H((J94A;J44J9c                  V   t         j                  d   } t         j                  d   t         j                  | <   t        j	                         j                  t        g       D ][  }t        j                  | |       t        j                         j                  t        g       D ]  }t        j                  | |        ] t         j                  t           t         j                  d<   t        j                          t         j                  j                  |       t         j                  d<   y)aE  Function to be used as setuptools script entry point.

  Appcommands assumes that it always runs as __main__, but launching
  via a setuptools-generated entry_point breaks this rule. We do some
  trickery here to make sure that appcommands and flags find their
  state where they expect to by faking ourselves as __main__.
  r   __main__N)rZ   argvmodulesr]   flags_by_module_dictget__name__register_flag_by_modulekey_flags_by_module_dictregister_key_flag_for_moduler	   Runpop)new_nameflagkey_flags      ri   run_mainrz      s     XXa[(++j1#++h((*..x<d	!!(D1224882F((8< G =  KK1#++j//KKOOH5#++j    rl   )=__doc__
__future__r   r   r   osrb   rZ   r`   pathjoindirname__file___THIRD_PARTY_DIRisdirr*   rn   r   reload	NameError	importlibabslr   pyglibr	   bq_flagsbq_utilscredential_loaderfrontendr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r:   adopt_module_key_flagsr]   rj   rz   rq   ru    r{   ri   <module>r      sR   3 &  % 	 
 
  77<< 9=I 77==!"'7sxx'G((//!%& s{{
6N      % % ! # ! # $ ! ! ! # ! ! ! " & " ! ! % % # $ ! ,   X &5r62 z+// I 
 IVs   2F$ $GG