
    H              7       l   S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSK	r	SSK
JrJrJrJrJrJr  SSKrSSKJr  SSKJr  SSKrSS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSKJ!r!   StS\RD                  S\\#\#4   S\\$   S\\$   4S jjr%S\RD                  4S jr&        SuS\RD                  S\\ RN                  RP                     S\\$   S\\#   S\\\\#   \#4      S\\#   S\\#   S\\)   S\\#   4S jjr*        SuS\RD                  S\\ RN                  RP                     S\\$   S\\#   S\\\\#   \#4      S\\#   S\\#   S\\)   S\\#   4S jjr+      SvS\RD                  S \\ RN                  RX                     S!\ RN                  RX                  S"\\#   S#\\#   S$\\)   S%\\#   S&\\#   4S' jjr-S\RD                  S\ RN                  R\                  S(\)4S) jr/ SwS\RD                  S\ RN                  R\                  S*\\)   4S+ jjr0    SxS\RD                  S,\\#   S-\\#   S.\\#   S/\\#   4
S0 jjr1                      SyS\RD                  S1\#S2\\)   S3\\)   S4\\)   S5\\#   S6\\$   S\\$   S7\\$   S8\\$   S9\\$   S:\\2   S,\\#   S;\\)   S/\\#   S<\\RD                  Rf                     S=\\#   S>\\)   4$S? jjr4     SzS\RD                  S.\\#   S,\\#   S\\$   S7\\$   S/\\#   4S@ jjr5    SxS\RD                  S,\\#   S-\\#   S.\\#   S/\\#   4
SA jjr6     SzS\RD                  SB\\)   S,\\#   S-\\#   S.\\#   S/\\#   4SC jjr7   S{S\RD                  S,\\#   S.\\#   S/\\#   4SD jjr8SE\Rr                  S4S\RD                  SF\ RN                  R\                  SG\#SH\$SI\\/ \Rt                  4      4
SJ jjr;  S|S\RD                  SF\ RN                  R\                  SG\#SH\$4SK jjr<S\RD                  S\$S\$4SL jr=SSSSSS\Rr                  SSSSSSSSSSS4S\RD                  S1\#S2\\)   S3\\)   S4\\)   S5\\#   S6\\$   S\\$   SH\$S:\\2   SI\\/ \Rt                  4      SM\\$   S/\\#   S<\\RD                  Rf                     S=\\#   S8\\$   S9\\$   4"SN jjr>                              S}S\RD                  S1\#SO\\#   S"\\#   S#\\#   SP\\#   S4\\)   SQ\\)   S2\\)   S3\\)   S:\\2   SR\\)   SS\\$   S6\\$   S;\\)   ST\\\#      SU\\\#\#4      S8\\$   S9\\$   S>\\)   S<\\RD                  Rf                     S=\\#   4,SV jjr? S~S\RD                  S=\\#   SW\)S(\\#   4SX jjr@                                         SS\RD                  SY\ RN                  RX                  SZ\#S"\\#   S#\\#   S[\\#   S\\\)   S]\\#   S^\\#   S_\\$   S`\\)   Sa\\#   Sb\\)   Sc\\)   Sd\\)   Se\\\#      Sf\\)   ST\\\#      Sg\\#   Sh\\\#      Si\\)   Sj\\#   S=\\#   Sk\\)   Sl\\#   Sm\\A\$      44Sn jjrB        SuS\RD                  S\ RN                  RX                  So\#Sp\\)   S[\\#   Sq\\#   Sr\\#   Si\\)   S=\\#   4Ss jjrCg)z$The BigQuery CLI job client library.    )absolute_import)division)print_functionN)AnyCallableDictListOptionalUnion)flags)http)bigquery_client)table_reader)utils)wait_printer)bq_error)bq_id_utils)bq_processor_utilsbqclientjob_dict	start_rowmax_rowsc                    Uc  [        S5      eUc  [        S5      eU(       d  SnO*[        R                  R                  R                  " S0 UD6n[
        R                  R                  (       a5  U(       a.  [        R                  " U R                  U R                  UU5      nO,[        R                  " U R                  U R                  U5      nUR                  X#5      $ )a9  Convenience method to get the schema and rows from job query result.

Arguments:
  bqclient: A BigqueryClient to get state and request clients from.
  job_dict: job reference dictionary.
  start_row: first row to read.
  max_rows: number of rows to read.
  result_first_page: the first page of the result of a query job.

Returns:
  A tuple where the first item is the list of fields and the
  second item a list of rows.
Raises:
  ValueError: will be raised if start_row is not explicitly provided.
  ValueError: will be raised if max_rows is not explicitly provided.
Nzstart_row is requiredzmax_rows is required )
ValueErrorr   ApiClientHelperJobReferenceCreater   FLAGS$jobs_query_use_results_from_responsebq_table_readerQueryTableReader	apiclientmax_rows_per_requestJobTableReaderReadSchemaAndRows)r   r   r   r   result_first_pagejob_refreaders          !platform/bq/clients/client_job.pyReadSchemaAndJobRowsr+      s    . 
,
--
+
,,	8<G))66==IIG
[[55:K--%%	F ++H997F 
	!	!
     c           
      \    [        [        [        R                  [	        U 40 UD65      5      $ N)listmapr   ConstructObjectReferenceListJobs)r   kwdss     r*   ListJobRefsr4   M   s-    		

5
5
8
$t
$
 r,   	referencemax_results
page_tokenstate_filtermin_creation_timemax_creation_time	all_usersparent_job_idc	                 .    [        U UUUUUUUU5	      S   $ )aJ  Return a list of jobs.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  reference: The ProjectReference to list jobs for.
  max_results: The maximum number of jobs to return.
  page_token: Current page token (optional).
  state_filter: A single state filter or a list of filters to apply. If not
    specified, no filtering is applied.
  min_creation_time: Timestamp in milliseconds. Only return jobs created after
    or at this timestamp.
  max_creation_time: Timestamp in milliseconds. Only return jobs created
    before or at this timestamp.
  all_users: Whether to list jobs for all users of the project. Requesting
    user must be an owner of the project to list all jobs.
  parent_job_id: Retrieve only child jobs belonging to this parent; None to
    retrieve top-level jobs.

Returns:
  A list of jobs.
results)ListJobsWithTokenAndUnreachable)	r   r5   r6   r7   r8   r9   r:   r;   r<   s	            r*   r2   r2   V   s7    B 
)

 

 
r,   c	                    [         R                  " XS9n[        R                  " U[        R                  R
                  SS9  Ub$  U[        R                  :  a  [        R                  n[        R                  " XU5      n	UbE  [        U[        5      (       a  UR                  5       nOU V
s/ s H  oR                  5       PM     nn
[        R                  " U	SUUUS9  Ub  XYS'   Ub  XiS'   U R                  R                  5       R                  " S0 U	D6R!                  5       nUR#                  S/ 5      nUb  S	U;   a  [%        U5      U:  a  U[%        U5      -
  U	S
'   US	   U	S'   U R                  R                  5       R                  " S0 U	D6R!                  5       nUR'                  UR#                  S/ 5      5        S	U;   a  [%        U5      U:  a  M  [)        US9nS	U;   a  US	   US'   SU;   a  US   US'   U$ s  sn
f )a  Return a list of jobs.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  reference: The ProjectReference to list jobs for.
  max_results: The maximum number of jobs to return.
  page_token: Current page token (optional).
  state_filter: A single state filter or a list of filters to apply. If not
    specified, no filtering is applied.
  min_creation_time: Timestamp in milliseconds. Only return jobs created after
    or at this timestamp.
  max_creation_time: Timestamp in milliseconds. Only return jobs created
    before or at this timestamp.
  all_users: Whether to list jobs for all users of the project. Requesting
    user must be an owner of the project to list all jobs.
  parent_job_id: Retrieve only child jobs belonging to this parent; None to
    retrieve top-level jobs.

Returns:
  A dict that contains enytries:
    'results': a list of jobs
    'token': nextPageToken for the last page, if present.
)id_fallbacksr5   r2   methodfull)
projectionr8   r;   r<   minCreationTimemaxCreationTimejobsnextPageToken
maxResults	pageToken)r>   tokenunreachabler   )bq_client_utilsNormalizeProjectReferencer   	typecheckr   ProjectReferencer   MAX_RESULTSPrepareListRequest
isinstancestrlowerApplyParametersr#   rH   r/   executegetlenextenddict)r   r5   r6   r7   r8   r9   r:   r;   r<   requestsresultr>   responses                 r*   r?   r?      s   F 77) !!22
 '333&22k11j' ,$$!'')l)56Aggil6$$! "!2"!2""$))4G4<<>&JJvr"'
V
#G{(B)CL8gl#O4gk!!&&(--88@@BfnnVZZ+,	 V
#G{(B
 '"(/HW f$]3H]	/9 7s   .Hsource_referencesdest_referencecreate_dispositionwrite_dispositionignore_already_existsoperation_typedestination_expiration_timec	                    U H1  n
[         R                  " U
[         R                  R                  SS9  M3     [         R                  " U[         R                  R                  SS9  [	        U5      U V
s/ s H  n
[	        U
5      PM     sn
S.nU(       a  XkS'   U(       a  X{S'   U(       a  XS'   [
        R                  " UUUS9   [        U SU040 U	D6$ s  sn
f ! [        R                   a  nU(       a   S	nAg	UeS	nAff = f)
a  Copies a table.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  source_references: TableReferences of source tables.
  dest_reference: TableReference of destination table.
  create_disposition: Optional. Specifies the create_disposition for the
    dest_reference.
  write_disposition: Optional. Specifies the write_disposition for the
    dest_reference.
  ignore_already_exists: Whether to ignore "already exists" errors.
  encryption_configuration: Optional. Allows user to encrypt the table from
    the copy table command with Cloud KMS key. Passed as a dictionary in the
    following format: {'kmsKeyName': 'destination_kms_key'}
  **kwds: Passed on to ExecuteJob.

Returns:
  The job description, or None for ignored errors.

Raises:
  BigqueryDuplicateError: when write_disposition 'WRITE_EMPTY' is
    specified and the dest_reference table already exists.
	CopyTablerB   )destinationTablesourceTables"destinationEncryptionConfigurationoperationTypedestinationExpirationTime)rc   rd   copyN)
r   rP   r   TableReferencer\   r   rW   
ExecuteJobr   BigqueryDuplicateError)r   ra   rb   rc   rd   re   encryption_configurationrf   rg   r3   src_refcopy_configes                r*   ri   ri      s   F #g##22 # !!00 ~.4EF4EtG}4EF+ 8P45#1  /J+,$$+)h 5>>>% G& 
	(	( 
Gs$   4CC D.C<:C<<Dreturnc                    [         R                  " U[         R                  R                  SS9   U R                  R                  5       R                  " S0 [        U5      D6R                  5       $ ! [        R                   a     gf = f)zReturns true if the job exists.	JobExistsrB   Fr   )r   rP   r   r   r#   rH   rY   r\   rX   r   BigqueryNotFoundError)r   r5   s     r*   ry   ry   "  sr    
 ,,99+""$((;4	?;CCEE		'	' s   A A1 1BBignore_not_foundc                 (   [         R                  " U[         R                  R                  SS9   U R                  R                  5       R                  " S0 [        U5      D6R                  5         g! [        R                   a    U(       d  e  gf = f)aq  Deletes JobReference reference.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  reference: the JobReference to delete.
  ignore_not_found: Whether to ignore "not found" errors.

Raises:
  BigqueryTypeError: if reference is not a JobReference.
  bq_error.BigqueryNotFoundError: if reference does not exist and
    ignore_not_found is False.
	DeleteJobrB   Nr   )r   rP   r   r   r#   rH   deleter\   rX   r   rz   )r   r5   r{   s      r*   r}   r}   0  sw    " ,,99+$$7tI7??A		'	'  s   AA2 2BB
project_idupload_filejob_idlocationc                    U=(       d    U R                   nU(       d  [        R                  " S5      eUR                  5       nU R                  (       a  [        S U R                   5       5      US'   SU0nU=(       d    U R                  n[        U[        R                  5      (       a  UR                  U5      nUb  XBS.nXvS'   U(       a  XWS'   SnU(       aH  U R                  n	[        R                  " U5      R                  S	:X  a  S
n	[        R                   " USU	S9nU R"                  R%                  5       R'                  XhUS9n
U(       a  W	(       a  [(        R*                  " U
5      nU$ U
R-                  5       nU$ )a  Start a job with the given configuration.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  configuration: The configuration for a job.
  project_id: The project_id to run the job under. If None,
    bqclient.project_id is used.
  upload_file: A file to include as a media upload to this request. Only valid
    on job requests that expect a media upload file.
  job_id: A unique job_id to use for this job. If a JobIdGenerator, a job id
    will be generated from the job configuration. If None, a unique job_id
    will be created for this request.
  location: Optional. The geographic location where the job should run.

Returns:
  The job resource returned from the insert job request. If there is an
  error, the jobReference field will still be filled out with the job
  reference used in the request.

Raises:
  bq_error.BigqueryClientConfigurationError: if project_id and
    bqclient.project_id are None.
z(Cannot start a job without a project id.c              3   N   #    U  H  oR                  S 5      SSS2   v   M     g7f)=r   N   )	partition).0props     r*   	<genexpr>StartJob.<locals>.<genexpr>w  s&      '.CdsADqD!.Cs   #%
propertiesconfiguration)jobId	projectIdjobReferencer    r   Fzapplication/octet-stream)filenamemimetype	resumable)body
media_bodyr   )r   r    BigqueryClientConfigurationErrorro   job_propertyr\   job_id_generatorrT   rN   JobIdGeneratorGenerateenable_resumable_uploadsosstatst_sizehttp_requestMediaFileUploadr#   rH   insertr   execute_in_chunks_with_progressrX   )r   r   r   r   r   r   job_requestjob_referencemedia_uploadr   r]   r_   s               r*   StartJobr   Q  sn   > 0X00*	

3
32   $$&-"& '.6.C.C' #M, !-0+ .X..&6677__]+F$>M"/"*J,11I 
ww{##q(i//+L
 ##%,,: - ' Y99'BF 
- __F	-r,   querydry_run	use_cachepreserve_nulls
request_idmaximum_bytes_billed
timeout_msjob_timeout_ms	max_slotsmin_completion_ratiouse_legacy_sqljob_creation_modereservation_idcreate_sessionc                 F   U=(       d    U R                   nU(       d  [        R                  " S5      eSU0nU(       a  UUS'   U(       a  UUS'   U R                  (       a#  [        R
                  " U R                  5      US'   Uc=  [        R                  R                  (       a  [        [        R                  " 5       5      n[        U U5      n[        R                  " U40 SU_SU_S	U_S
U_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_SUc  SO
U(       a  SOS_6  [        R                  " UUS9  [        R                  " UUS9  [        R                   " SUUU5        U R"                  R%                  5       R&                  " SUUS.UD6R)                  5       $ )a  Executes the given query using the rpc-style query api.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  query: Query to execute.
  dry_run: Optional. Indicates whether the query will only be validated and
    return processing statistics instead of actually running.
  use_cache: Optional. Whether to use the query cache. Caching is best-effort
    only and you should not make assumptions about whether or how long a query
    result will be cached.
  preserve_nulls: Optional. Indicates whether to preserve nulls in input data.
    Temporary flag; will be removed in a future version.
  request_id: Optional. The idempotency token for jobs.query
  maximum_bytes_billed: Optional. Upper limit on the number of billed bytes.
  max_results: Maximum number of results to return.
  timeout_ms: Timeout, in milliseconds, for the call to query().
  job_timeout_ms: Optional. How long to let the job run.
  max_slots: Optional. Cap on target rate of slot consumption by the query.
  min_completion_ratio: Optional. Specifies the minimum fraction of data that
    must be scanned before a query returns. This value should be between 0.0
    and 1.0 inclusive.
  project_id: Project id to use.
  external_table_definitions_json: Json representation of external table
    definitions.
  udf_resources: Array of inline and external UDF code resources.
  use_legacy_sql: The choice of using Legacy SQL for the query is optional. If
    not specified, the server will automatically determine the dialect based
    on query information, such as dialect prefixes. If no prefixes are found,
    it will default to Legacy SQL.
  location: Optional. The geographic location where the job should run.
  connection_properties: Optional. Connection properties to use when running
    the query, presented as a list of key/value pairs. A key of "time_zone"
    indicates that the query will be run with the default timezone
    corresponding to the value.
  job_creation_mode: Optional. An option for job creation. The valid values
    are JOB_CREATION_REQUIRED and JOB_CREATION_OPTIONAL.
  reservation_id: Optional. An option to set the reservation to use when
    execute the job. Reservation should be in the format of
    "project_id:reservation_id", "project_id:location.reservation_id", or
    "reservation_id".
  create_session: Optional. True to create a session for the query.
  query_parameters: parameter values for use_legacy_sql=False queries.
  positional_parameter_mode: If true, set the parameter mode to POSITIONAL
    instead of the default NAMED.
  destination_encryption_configuration: Optional. Allows user to encrypt the
    table created from a query job with a Cloud KMS key.
  **kwds: Extra keyword arguments passed directly to jobs.Query().

Returns:
  The query response.

Raises:
  bq_error.BigqueryClientConfigurationError: if project_id and
    bqclient.project_id are None.
  bq_error.BigqueryError: if query execution fails.
z(Cannot run a query without a project id.r   tableDefinitionsuserDefinedFunctionResourcesdefaultDatasetNr   r   r   use_query_cacher   r   r   r6   r   r   r   reservationr   r   query_parameters$destination_encryption_configurationparameter_mode
POSITIONALNAMEDconnection_properties)r   z3Calling bqclient.apiclient.jobs().query(%s, %s, %s))r   r   r   )r   r   r   
dataset_idrN   GetQueryDefaultDatasetr   r   jobs_query_use_request_idrU   uuiduuid4_GetReservationPathr   rW   loggingdebugr#   rH   r   rX   )r   r   r   r   r   r   r   r6   r   r   r   r   r   external_table_definitions_jsonudf_resourcesr   r   r   r   r   r   r   positional_parameter_moder   r3   r]   reservation_paths                              r*   _StartQueryRpcr     s    j 0X00*	

3
32  e'$"AG.;G*+ / F F!G EKKAATZZ\"J(
 $$#  0	
    $   $ 0 * #  $  (!" ,P#& 
#	* 5L7), $$%: $$Wg>	--;
	 u 9Z9379wyr,   c           	         U=(       d    U R                   nU(       d  [        R                  " S5      e0 n[        R                  " UUUUUUS9  U R
                  R                  5       R                  " S0 UD6R                  5       $ )a.  Waits for a query job to run and returns results if complete.

By default, waits 10s for the provided job to complete and either returns
the results or a response where jobComplete is set to false. The timeout can
be increased but the call is not guaranteed to wait for the specified
timeout.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  job_id: The job id of the query job that we are waiting to complete.
  project_id: The project id of the query job.
  max_results: The maximum number of results.
  timeout_ms: The number of milliseconds to wait for the query to complete.
  location: Optional. The geographic location of the job.

Returns:
  The getQueryResults() result.

Raises:
  bq_error.BigqueryClientConfigurationError: if project_id and
    bqclient.project_id are None.
z.Cannot get query results without a project id.)r   r   r   r6   r   r   )	r   r   r   r   rW   r#   rH   getQueryResultsrX   )r   r   r   r6   r   r   r3   s          r*   GetQueryResultsr   2  s    < 0X00*	

3
38  
$$$
 
			 	 	"	2	2	:T	:	B	B	DDr,   c           	          [        U UUUUUS9nUS   S   S:w  a!  [        R                  " U5      n[        X5      n[        R
                  " U5      $ )a  Starts a job and waits for it to complete.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  configuration: The configuration for a job.
  project_id: The project_id to run the job under. If None,
    bqclient.project_id is used.
  upload_file: A file to include as a media upload to this request. Only valid
    on job requests that expect a media upload file.
  job_id: A unique job_id to use for this job. If a JobIdGenerator, a job id
    will be generated from the job configuration. If None, a unique job_id
    will be created for this request.
  location: Optional. The geographic location where the job should run.

Returns:
  job, if it did not fail.

Raises:
  BigQueryError: if the job fails.
r   r   r   r   statusstateDONE)r   r   r1   WaitJobrN   RaiseIfJobError)r   r   r   r   r   r   r_   r   s           r*   RunJobSynchronouslyr   a  s_    8 & Hg&(&??GMX-F		(	(	00r,   syncc           	          Uc  U R                   nU(       a  [        U UUUUUS9nU$ [        U UUUUUS9n[        R                  " U5        U$ )z,Execute a job, possibly waiting for results.r   )r   r   r   rN   r   )r   r   r   r   r   r   r   jobs           r*   rq   rq     sk     
\==D	
C$ 
* C ##C(	*r,   c                    U=(       d    U R                   nU(       d  [        R                  " S5      eU(       d  [        R                  " S5      e[        R                  R
                  R                  XUS9nU R                  R                  5       R                  " S	0 [        U5      D6R                  5       S   nUS   S   S:w  a0  U R                  (       a  [        R                  " U5      n[        XS9nU$ )
a  Attempt to cancel the specified job if it is running.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  project_id: The project_id to the job is running under. If None,
    bqclient.project_id is used.
  job_id: The job id for this job.
  location: Optional. The geographic location of the job.

Returns:
  The job resource returned for the job for which cancel is being requested.

Raises:
  bq_error.BigqueryClientConfigurationError: if project_id or job_id
    are None.
z)Cannot cancel a job without a project id.z%Cannot cancel a job without a job id.)r   r   r   r   r   r   r   )r   r   )r   r   r   r   r   r   r   r#   rH   cancelr\   rX   r   r   r1   r   )r   r   r   r   r   r_   s         r*   	CancelJobr     s    , 0X00*	

3
33  


3
3/  --::AA8 B - &&=m)<=EEGN 	 Hg&(X]]&??GMX;F	-r,   r   r   r   waitwait_printer_factoryc                 .   [         R                  " U[         R                  R                  SS9  [        R                  " 5       nSnU(       a  U" 5       nOU R                  5       n[        R                  " [        R                  " SS5      [        SSS5      [        R                  " S5      5      nS	n	S
n
SnX::  a   [        XX#S9u  pUS   S   n
SnU(       a  UR                  UR                  X5        O| [        ['        U5      5       HM  n[        R                  " 5       U-
  n	UR                  UR                  X5        [        R(                  " S5        MO     X::  a  M  [+        SU
< 35      eUR-                  5         U$ ! [        R                   a!  n[        R                   " SU5         SnANSnAf[        R"                   a!  n[        R                   " SU5         SnANSnAf[        R$                   a  nU(       a  e Sn SnAGNSnAff = f)a  Poll for a job to run until it reaches the requested status.

Arguments:
  bqclient: A BigqueryClient to get state and request clients from.
  job_reference: JobReference to poll.
  status: (optional, default 'DONE') Desired job status.
  wait: (optional, default maxint) Max wait time.
  wait_printer_factory: (optional, defaults to bqclient.wait_printer_factory)
    Returns a subclass of WaitPrinter that will be called after each job poll.

Returns:
  The job object returned by the final status call.

Raises:
  StopIteration: If polling does not reach the desired state before
    timing out.
  ValueError: If given an invalid wait value.
r   rB   N      r         r   UNKNOWNF)r   r   r   r   z+Transient error during job status check: %sTz1Wait timed out. Operation not finished, in state )r   rP   r   r   timer   	itertoolschainrepeatrangePollJobprintr   r   BigqueryCommunicationErrorr   warningBigqueryBackendErrorBigqueryServiceErrornextsleepStopIterationdone)r   r   r   r   r   
start_timer   printerwaitscurrent_waitcurrent_statusin_error_stater   rv   _s                  r*   r   r     s   6 !!..
 yy{*#"$G++-G
 //aU1b!_b% ,..(&Lid8}W-nn	m))<H 
" 4;YY[:-lmmM''F
jjm  - 	6 	  
,,.	*1 .. HooCQGG(( HooCQGG((  
ns0   =9F HF55HG((H?
HHc                 (   [         R                  " U[         R                  R                  SS9  [        R
                  " U5      nU R                  R                  5       R                  " S0 [        U5      D6R                  5       nUS   S   nXR:H  U4$ )a  Poll a job once for a specific status.

Arguments:
  bqclient: A BigqueryClient to get state and request clients from.
  job_reference: JobReference to poll.
  status: (optional, default 'DONE') Desired job status.
  wait: (optional, default 0) Max server-side wait time for one poll call.

Returns:
  Tuple (in_state, job) where in_state is True if job is
  in the desired state.

Raises:
  ValueError: If given an invalid wait value.
r   rB   r   r   r   )r   rP   r   r   rN   NormalizeWaitr#   rH   rY   r\   rX   )r   r   r   r   r   currents         r*   r   r   -  s    * !!..
 
	&	&t	,$!%%<](;<DDF#M'"'

S	!!r,   c                 X    [        U5      nSUS'   [        U 40 UD6n[        U US   UUS9$ )aH  Run a query job synchronously, and return the result.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  start_row: first row to read.
  max_rows: number of rows to read.
  **kwds: Passed on to Query.

Returns:
  A tuple where the first item is the list of fields and the
  second item a list of rows.
Tr   r   )r   r   )r\   Queryr+   )r   r   r   r3   new_kwdsr   s         r*   RunQueryr  R  sD    $ $Z((6h#(##		.	
 r,   max_single_waitc                    U R                   (       d  [        R                  " S5      eU(       d  [        R                  " S5      eUb5  [        R                  R
                  (       d  [        R                  " S5      eU
(       a  U
" 5       nOU R                  5       n[        R                  " 5       nSnSnSn  Uc  SO[        R                  " 5       U-
  nUU-
  nUb.  [        [        UU5      S-  5      nUS:  a  [        R                  nUS:  a  [        S5      eUc  UnU R                  b/  Uc  U R                  nO[        U R                  [        U5      5      n[        S)0 SU _S	U_S
U_SU_SU_SU_SU_SU	_SU_SU_SU_SU_SU_SU_SU_SU_SU_UD6nU(       aG  [        [        [        US   S9S9S9nSU;   a  US   US   S	   S'   SU;   a  US   US   S	   S'   / / U4$ S U;   a-  [         R"                  R$                  R&                  " S)0 US    D6nO4UR)                  UR*                  US!5        [-        U UR*                  UUUS"9nUS#   (       a=  [/        U U(       a  [        U5      O0 SUUS$9u  nn0 n S%U;   a  US%   U S%'   S&U US'.nUUU4$  GM  ! [        R0                   a!  n![2        R4                  " S(U!5         Sn!A!N3Sn!A!f[        R6                   a!  n![2        R4                  " S(U!5         Sn!A!NfSn!A!ff = f)*a%  Executes the given query using the rpc-style query api.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  query: Query to execute.
  dry_run: Optional. Indicates whether the query will only be validated and
    return processing statistics instead of actually running.
  use_cache: Optional. Whether to use the query cache. Caching is best-effort
    only and you should not make assumptions about whether or how long a query
    result will be cached.
  preserve_nulls: Optional. Indicates whether to preserve nulls in input data.
    Temporary flag; will be removed in a future version.
  request_id: Optional. Specifies the idempotency token for the request.
  maximum_bytes_billed: Optional. Upper limit on maximum bytes billed.
  max_results: Optional. Maximum number of results to return.
  wait: (optional, default maxint) Max wait time in seconds.
  min_completion_ratio: Optional. Specifies the minimum fraction of data that
    must be scanned before a query returns. This value should be between 0.0
    and 1.0 inclusive.
  wait_printer_factory: (optional, defaults to bqclient.wait_printer_factory)
    Returns a subclass of WaitPrinter that will be called after each job poll.
  max_single_wait: Optional. Maximum number of seconds to wait for each call
    to query() / getQueryResults().
  external_table_definitions_json: Json representation of external table
    definitions.
  udf_resources: Array of inline and remote UDF resources.
  location: Optional. The geographic location where the job should run.
  connection_properties: Optional. Connection properties to use when running
    the query, presented as a list of key/value pairs. A key of "time_zone"
    indicates that the query will be run with the default timezone
    corresponding to the value.
  job_creation_mode: Optional. An option for job creation. The valid values
    are JOB_CREATION_REQUIRED and JOB_CREATION_OPTIONAL.
  reservation_id: Optional. An option to set the reservation to use when
    execute the job. Reservation should be in the format of
    "project_id:reservation_id", "project_id:location.reservation_id", or
    "reservation_id".
  job_timeout_ms: Optional. How long to let the job run.
  max_slots: Optional. Cap on target rate of slot consumption by the query.
  **kwds: Passed directly to ExecuteSyncQuery.

Raises:
  bq_error.BigqueryClientError: if no query is provided.
  StopIteration: if the query does not complete within wait seconds.
  bq_error.BigqueryError: if query fails.

Returns:
  A tuple (schema fields, row results, execution metadata).
    For regular queries, the execution metadata dict contains
    the 'State' and 'status' elements that would be in a job result
    after FormatJobInfo().
    For dry run queries schema and rows are empty, the execution metadata
    dict contains statistics
z7Running RPC-style query asynchronously is not supportedNo query string providedNzrequest_id is not yet supportedr   i  z#Wait timed out. Query not finished.r   r   r   r   r   r   r   r   r   r   r6   r   r   r   r   r   r   totalBytesProcessed)r	  )r   )
statisticscacheHitr
  schemar   RUNNING)r6   r   r   jobComplete)r   r   r'   errorsSUCCESS)Stater   r   z Transient error during query: %sr   )r   r   BigqueryClientErrorr   r   r   r   r   intminsysmaxsizer   r$   r   r\   r   r   r   r   r   r   r   r+   r   r   r   r   )"r   r   r   r   r   r   r   r6   r   r   r   r  r   r   r   r   r   r   r   r   r3   r   r   elapsed_timer   current_wait_msremaining_timerows_to_readr_   	executionr  rowsr   rv   s"                                     r*   RunQueryRpcr  p  s   b 


&
&A  


&
&'A
BBEKK$I$I

&
&'H
II"$G++-Gyy{*,-/\='/QTYY[:5Mll*n		$ c./BTIJQKK/	!	ABB		 #((4!#88Lx<<c,>OPL 


 *
 "	

 "6
  
 
 "6
 *
  
 %
 -L
 (
 
 #8
  0!
" *%
( *01F*G) 6!;A*;MIl#G,Z89?9IIl#G,X6b)$
$V#%55BBII ~&- 	m))<C #&
 
	-#0Db $
 v#H-&
)
	
 i((% 
K 	p .. =oo8!<<(( =oo8!<<=s,   9D0J *B.J L1KL$L  Ldestination_tablepriorityallow_large_resultsflatten_resultsmaximum_billing_tierschema_update_optionslabelsc                  X   U(       d  [         R                  " S5      eSU0n!U R                  (       a#  [        R                  " U R                  5      U!S'   U(       a  UU!S'   U(       a  UU!S'   U(       a#   [        R
                  " XS9n"[        U"5      U!S
'   U(       a  UU!S'   U(       a  UU!S'   U(       a  UR                  U!S'   [        R                  " U!40 SU_SU_SU_SU_SU_SU	_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU
_SU_SU_S U_6  [        R                  " U!US!9  SU!0n$[        U US"S#9n%[        R                  " U$UUUU%S$9  [        R                  " U$US%9  [        U U$40 U D6$ ! [         R                   a#  n#[         R                  " SU< SU#< 35      eS	n#A#ff = f)&a$  Execute the given query, returning the created job.

The job will execute synchronously if sync=True is provided as an
argument or if bqclient.sync is true.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  query: Query to execute.
  destination_table: (default None) If provided, send the results to the given
    table.
  create_disposition: Optional. Specifies the create_disposition for the
    destination_table.
  write_disposition: Optional. Specifies the write_disposition for the
    destination_table.
  priority: Optional. Priority to run the query with. Either 'INTERACTIVE'
    (default) or 'BATCH'.
  preserve_nulls: Optional. Indicates whether to preserve nulls in input data.
    Temporary flag; will be removed in a future version.
  allow_large_results: Enables larger destination table sizes.
  dry_run: Optional. Indicates whether the query will only be validated and
    return processing statistics instead of actually running.
  use_cache: Optional. Whether to use the query cache. If create_disposition
    is CREATE_NEVER, will only run the query if the result is already cached.
    Caching is best-effort only and you should not make assumptions about
    whether or how long a query result will be cached.
  min_completion_ratio: Optional. Specifies the minimum fraction of data that
    must be scanned before a query returns. This value should be between 0.0
    and 1.0 inclusive.
  flatten_results: Whether to flatten nested and repeated fields in the result
    schema. If not set, the default behavior is to flatten.
  external_table_definitions_json: Json representation of external table
    definitions.
  udf_resources: Array of inline and remote UDF resources.
  maximum_billing_tier: Upper limit for billing tier.
  maximum_bytes_billed: Upper limit for bytes billed.
  use_legacy_sql: The choice of using Legacy SQL for the query is optional. If
    not specified, the server will automatically determine the dialect based
    on query information, such as dialect prefixes. If no prefixes are found,
    it will default to Legacy SQL.
  schema_update_options: schema update options when appending to the
    destination table or truncating a table partition.
  labels: an optional dict of labels to set on the query job.
  query_parameters: parameter values for use_legacy_sql=False queries.
  time_partitioning: Optional. Provides time based partitioning specification
    for the destination table.
  clustering: Optional. Provides clustering specification for the destination
    table.
  destination_encryption_configuration: Optional. Allows user to encrypt the
    table created from a query job with a Cloud KMS key.
  range_partitioning: Optional. Provides range partitioning specification for
    the destination table.
  script_options: Optional. Options controlling script execution.
  job_timeout_ms: Optional. How long to let the job run.
  continuous: Optional. Whether the query should be executed as continuous
    query.
  job_creation_mode: Optional. An option for job creation. The valid values
    are JOB_CREATION_REQUIRED and JOB_CREATION_OPTIONAL.
  reservation_id: Optional. An option to set the reservation to use when
    execute the job. Reservation should be in the format of
    "project_id:reservation_id", "project_id:location.reservation_id", or
    "reservation_id". If reservation_id is "none", the job will be executed
    without assigned reservation using the on-demand slots.
  **kwds: Passed on to ExecuteJob.

Raises:
  bq_error.BigqueryClientError: if no query is provided.

Returns:
  The resulting job info.
r  r   r   r   r   )rA   
identifierzInvalid value z for destination_table: Nrj   rl   scriptOptionsjobCreationModer   rc   r   r  rd   r   r!  r"  r   r   r#  r   time_partitioning
clusteringr   r   
continuousr   range_partitioningr   F)check_reservation_project)r   r$  r   r   )r   )r   r  r   rN   r   GetTableReferenceBigqueryErrorr\   namer   rW   r   rq   )&r   r   r  rc   rd   r  r   r   r   r   r   r!  r   r   r"  r   r   r#  r$  r   r)  r   r*  r,  script_optionsr   r   r   r   r+  r   r   r3   query_configr5   rv   r]   r   s&                                         r*   r  r  4  sJ   X 


&
&'A
BB5!,%4%K%K&L!" %'FL#$3@L/0!33i (,IL#$), 56 $2L!&7&<&<L"#$$- , $	
  *   & 0 0 $ 2 ( *   $!" 0#$ %& *'( ,), $$*? l#'( %
 $$#" $$ 
Hg	.	..o !! "":KQ
O s   6E2 2F)F$$F)r-  c                     Ub  US:X  a  U$ [         R                  " U U[        R                  R                  US9nUR                  5       $ )a  Converts the reservation_id from the format `<project_id>:<location>.<reservation_id>` to the fully qualified reservation path `projects/<project_id>/locations/<location>/reservations/<reservation_id>`.

The special value "none" is returned as is.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  reservation_id: The reservation id to convert.
  check_reservation_project: Whether to validate the reservation project.

Returns:
  The fully qualified reservation path or "none" if reservation_id is "none".
nonerA   r&  default_locationr-  )rN   GetReservationReferencebq_flagsLOCATIONvaluepath)r   r   r-  r5   s       r*   r   r     sN    " ~755((.. 9	) 
	r,   destination_table_referencesourcefield_delimiterskip_leading_rowsencodingquotemax_bad_recordsallow_quoted_newlinessource_formatallow_jagged_rows!preserve_ascii_control_charactersignore_unknown_valuesprojection_fields
autodetectnull_markernull_markersuse_avro_logical_typesjson_extensioncopy_files_onlysource_column_matchtimestamp_target_precisionc,                    [         R                  " U[         R                  R                  5        S[	        U5      0n-[
        R                  " U5      n.U.S   R                  [
        R                  5      (       a  U.U-S'   Sn/OU.S   n/Ub  S[        R                  " U5      0U-S'   Ub  UU-S'   Ub  UU-S'   U$b  U$U-S	'   Ub  UU-S
'   Ub  UU-S'   U&b  U&U-S'   UU-S'   U(       a  UU-S'   Ub  UU-S'   U b  U U-S'   U!b  U!U-S'   U"b  U"U-S'   U#b  U#U-S'   U*b  U*U-S'   U+b  U+U-S'   [
        R                  " U-40 SU_SU_SU_SU_SU_SU	_SU
_SU_SU_SU_S U_S!U_S"U_S#U_S$U_S%U_S&U_S'U_S(U_S)U_S*U_S+U%_S,U'_S-U)_S.U&_6  S/U-0n0U(bB  [        R                  " U U([        R                  R                  S0S19n1U1R!                  5       U0S2'   [#        U 4U0U/S3.U,D6$ )4a  Load the given data into BigQuery.

The job will execute synchronously if sync=True is provided as an
argument or if bqclient.sync is true.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  destination_table_reference: TableReference to load data into.
  source: String specifying source data to load.
  schema: (default None) Schema of the created table. (Can be left blank for
    append operations.)
  create_disposition: Optional. Specifies the create_disposition for the
    destination_table_reference.
  write_disposition: Optional. Specifies the write_disposition for the
    destination_table_reference.
  field_delimiter: Optional. Specifies the single byte field delimiter.
  skip_leading_rows: Optional. Number of rows of initial data to skip.
  encoding: Optional. Specifies character encoding of the input data. May be
    "UTF-8" or "ISO-8859-1". Defaults to UTF-8 if not specified.
  quote: Optional. Quote character to use. Default is '"'. Note that quoting
    is done on the raw binary data before encoding is applied.
  max_bad_records: Optional. Maximum number of bad records that should be
    ignored before the entire job is aborted. Only supported for CSV and
    NEWLINE_DELIMITED_JSON file formats.
  allow_quoted_newlines: Optional. Whether to allow quoted newlines in CSV
    import data.
  source_format: Optional. Format of source data. May be "CSV",
    "DATASTORE_BACKUP", or "NEWLINE_DELIMITED_JSON".
  allow_jagged_rows: Optional. Whether to allow missing trailing optional
    columns in CSV import data.
  preserve_ascii_control_characters: Optional. Whether to preserve embedded
    Ascii Control characters in CSV import data.
  ignore_unknown_values: Optional. Whether to allow extra, unrecognized values
    in CSV or JSON data.
  projection_fields: Optional. If sourceFormat is set to "DATASTORE_BACKUP",
    indicates which entity properties to load into BigQuery from a Cloud
    Datastore backup.
  autodetect: Optional. If true, then we automatically infer the schema and
    options of the source files if they are CSV or JSON formats.
  schema_update_options: schema update options when appending to the
    destination table or truncating a table partition.
  null_marker: Optional. String that will be interpreted as a NULL value.
  null_markers: Optional. List of strings that will be interpreted as a NULL
    value.
  time_partitioning: Optional. Provides time based partitioning specification
    for the destination table.
  clustering: Optional. Provides clustering specification for the destination
    table.
  destination_encryption_configuration: Optional. Allows user to encrypt the
    table created from a load job with Cloud KMS key.
  use_avro_logical_types: Optional. Allows user to override default behaviour
    for Avro logical types. If this is set, Avro fields with logical types
    will be interpreted into their corresponding types (ie. TIMESTAMP),
    instead of only using their raw types (ie. INTEGER).
  reference_file_schema_uri: Optional. Allows user to provide a reference file
    with the reader schema, enabled for the format: AVRO, PARQUET, ORC.
  range_partitioning: Optional. Provides range partitioning specification for
    the destination table.
  hive_partitioning_options: (experimental) Options for configuring hive is
    picked if it is in the specified list and if it supports the precision and
    the scale. STRING supports all precision and scale values. If none of the
    listed types supports the precision and the scale, the type supporting the
    widest range in the specified list is picked, and if a value exceeds the
    supported range when reading the data, an error will be returned. This
    field cannot contain duplicate types. The order of the
  decimal_target_types: (experimental) Defines the list of possible SQL data
    types to which the source decimal values are converted. This list and the
    precision and the scale parameters of the decimal field determine the
    target type. In the order of NUMERIC, BIGNUMERIC, and STRING, a type is
    picked if it is in the specified list and if it supports the precision and
    the scale. STRING supports all precision and scale values. If none of the
    listed types supports the precision and the scale, the type supporting the
    widest range in the specified list is picked, and if a value exceeds the
    supported range when reading the data, an error will be returned. This
    field cannot contain duplicate types. The order of the types in this field
    is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as
    ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over
    BIGNUMERIC. Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for
    the other file formats.
  json_extension: (experimental) Specify alternative parsing for JSON source
    format. To load newline-delimited JSON, specify 'GEOJSON'. Only applicable
    if `source_format` is 'NEWLINE_DELIMITED_JSON'.
  column_name_character_map: Indicates the character map used for column
    names. Specify 'STRICT' to use the latest character map and reject invalid
    column names. Specify 'V1' to support alphanumeric + underscore and name
    must start with a letter or underscore. Invalid column names will be
    normalized. Specify 'V2' to support flexible column name. Invalid column
    names will be normalized.
  file_set_spec_type: Set how to discover files for loading. Specify
    'FILE_SYSTEM_MATCH' (default behavior) to expand source URIs by listing
    files from the underlying object store. Specify
    'NEW_LINE_DELIMITED_MANIFEST' to parse the URIs as new line delimited
    manifest files, where each line contains a URI (No wild-card URIs are
    supported).
  thrift_options: (experimental) Options for configuring Apache Thrift load,
    which is required if `source_format` is 'THRIFT'.
  parquet_options: Options for configuring parquet files load, only applicable
    if `source_format` is 'PARQUET'.
  connection_properties: Optional. ConnectionProperties for load job.
  reservation_id: Optional. An option to set the reservation to use when
    execute the job. Reservation should be in the format of
    "project_id:reservation_id", "project_id:location.reservation_id", or
    "reservation_id".
  copy_files_only: Optional. True to configures the load job to only copy
    files to the destination BigLake managed table, without reading file
    content and writing them to new files.
  source_column_match: Optional. Controls the strategy used to match loaded
    columns to the schema.
  timestamp_target_precision: Precision (maximum number of total
    digits in base 10) for second of TIMESTAMP type.
    Available for the formats: CSV.
  **kwds: Passed on to ExecuteJob.

Returns:
  The resulting job info.
rj   r   
sourceUrisNfieldsr  useAvroLogicalTypesreference_file_schema_urifileSetSpecTypejsonExtensioncolumnNameCharacterMapparquetOptionsdecimalTargetTypesrl   timeZone
dateFormatdatetimeFormat
timeFormattimestampFormatsourceColumnMatchtimestampTargetPrecisionrc   rd   r>  r?  r@  rA  rB  rD  rC  rE  rF  rG  rH  r#  rJ  rK  r)  r*  rI  r,  hive_partitioning_optionsthrift_optionsr   rN  parquet_optionsloadFr5  r   )r   r   )r   rP   r   rp   r\   r   ProcessSources
startswithGCS_SCHEME_PREFIXrN   
ReadSchemarW   r7  r8  r9  r:  r;  rq   )2r   r<  r=  r  rc   rd   r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  r#  rJ  rK  r)  r*  r   rL  rU  r,  rb  decimal_target_typesrM  column_name_character_map	time_zonedate_formatdatetime_formattime_formattimestamp_formatfile_set_spec_typerc  rd  r   r   rN  rO  rP  r3   load_configsourcesr   r   r5   s2                                                     r*   Loadrt    s
   F !;#>#>#M#M $T*E%FG+--f5'QZ-??@@ 'KK!*K%'A'A&'IJK')?K%&*/HK+,#%7K!"#1K *,EK() $3K !&:+"#), 45 'K
 +K $3K ! +K!%5K!"$':K#$+.HK*+$$+ * &	
 *   & " 2 * )J 2 * 2  !"  #$ *%& '( )* ,+, !:-. $/0 212 &34 &58 ;'-77!!**00"'	I $->>#3M- 	
+
HL
 r,   destination_urisprint_headerdestination_formatcompressionc           
         [         R                  " U[         R                  R                  [         R                  R                  4SS9  UR                  S5      nU H[  nUR                  [        R                  5      (       a  M)  [        R                  " SR                  U[        R                  5      5      e   0 n[        U[         R                  R                  5      (       a  S[        U5      0nOn[        U[         R                  R                  5      (       aE  S[        U5      0nU(       a  UR                  SSU005        U(       a  UR                  SS	U005        [        R                  " UUUUUUU	S
9  SU0nU
bB  [         R"                  " U U
[$        R&                  R(                  SS9nUR+                  5       US'   [-        U 4SU0UD6$ )a  Extract the given table from BigQuery.

The job will execute synchronously if sync=True is provided as an
argument or if bqclient.sync is true.

Args:
  bqclient: A BigqueryClient to get state and request clients from.
  reference: TableReference to read data from.
  destination_uris: String specifying one or more destination locations,
    separated by commas.
  print_header: Optional. Whether to print out a header row in the results.
  field_delimiter: Optional. Specifies the single byte field delimiter.
  destination_format: Optional. Format to extract table to. May be "CSV",
    "AVRO" or "NEWLINE_DELIMITED_JSON".
  trial_id: Optional. 1-based ID of the trial to be exported from a
    hyperparameter tuning model.
  add_serving_default_signature: Optional. Whether to add serving_default
    signature for BigQuery ML trained tf based models.
  compression: Optional. The compression type to use for exported files.
    Possible values include "GZIP" and "NONE". The default value is NONE.
  use_avro_logical_types: Optional. Whether to use avro logical types for
    applicable column types on extract jobs.
  reservation_id: Optional. An option to set the reservation to use when
    execute the job. Reservation should be in the format of
    "project_id:reservation_id", "project_id:location.reservation_id", or
    "reservation_id".
  **kwds: Passed on to ExecuteJob.

Returns:
  The resulting job info.

Raises:
  bq_error.BigqueryClientError: if required parameters are invalid.
ExtractrB   ,z2Illegal URI: {}. Extract URI must start with "{}".sourceTablesourceModelmodelExtractOptionstrialIdaddServingDefaultSignature)ru  rw  rv  r>  rx  rL  extractFr5  r   r   )r   rP   r   rp   ModelReferencesplitrg  r   rh  r   r  formatrT   r\   updaterW   rN   r7  r8  r9  r:  r;  rq   )r   r5   ru  rv  r>  rw  trial_idadd_serving_default_signaturerx  rL  r   r3   urisuriextract_configr   s                   r*   rz  rz    s   ` 

%
%
4
4

%
%
4
4  
			$$c>>,>>??((
>
E
E%77   .	;66EEFF#T)_5N)[88GGHH#T)_5N2Y4IJK$
*,I" 	
 $$+%3 n--77!!**00"'	I $->>#3M- 	H	BM	BT	BBr,   r.   )NNNNNNNN)NNFNCOPYN)F)NNNN)NNNNNNNNNNNNNNNNNNNNNN)NNNNN)NNN)r   r   )NNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)T))NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)D__doc__
__future__r   r   r   r   r   r   r  r   typingr   r   r   r	   r
   r   r   abslr   googleapiclientr   r   r8  clientsr   r   r!   r   rN   r   r   r   r   BigqueryClientrU   r  r+   r4   r   rQ   boolr2   r?   rp   ri   r   ry   r}   r   floatJobCreationModer   r   r   rq   r   r  WaitPrinterr   r   r  r  r  r   r/   rt  rz  r   r,   r*   <module>r     s   * &  %   	 
  = =   0  # 3 ,     $ ,,,,38n, }, sm	,^/88  IM!% $48'+'+ $#'+,,+33DDE+ #+ 	+
 5cC01+  }+  }+ ~+ C=+` IM!% $48'+'+ $#'R,,R33DDER #R 	R
 5cC01R  }R  }R ~R C=Rr )-'+,1!$*15F,,FK77FFGF  //>>F !	F
  }F $D>F SMF "*#FR,,**77 
" (-,,**77 tnH !%!% "I,,I I #	I
 SMI smI^ # $%) $*.!% $$(#,0 $$(%)" 	$(%)")-5R,,RR d^R ~	R
 TNR R #3-R #R R SMR }R #5/R R  TN!R" sm#R&  &&66'R, SM-R. TN/Rn ! $!% $",E,,,ESM,E ,E #	,E
 ,E sm,Ed !%!% "'1,,'1 '1 #	'1
 SM'1 sm'1Z   $!% " ,,  4.  	 
 #  SM  sm J !% "	),,)) SM) sm	)^  	P,,P..;;P P 	P
 #\---.Pl 	",,"..;;" " 	"J,, B # $%) $*.!%,0 	%)$(" 	$($(#1A=,,A=A= d^A= ~	A=
 TNA= A= #3-A= #A= A= #5/A= #\---.A= c]A=" sm#A=&  &&66'A=, SM-A=. SM/A=0 }1A=N (,(,'+"%)*." $,0&*$(*.*.%)15'+)-$(#%) 	$(Es/,,s/s/  }s/ !	s/
  }s/ sms/ TNs/ "$s/ d^s/ ~s/ #5/s/ d^s/ #3-s/  #3-!s/" TN#s/$ $DI.%s/& T#s(^$'s/4 SM5s/6 }7s/8 TN9s/>  &&66?s/D SMEs/r '+,,SM  $ c]	@ (,'+%)(,"%),0#'(,8<,0-1!%15!%(,)--1""$("$(&*)-6:Yx,,x!,!<!<!K!Kx x
 !x  }x c]x  ~x smx C=x c]x $D>x C=x  ~x (0~x  $D>!x"  S	*#x$ %x& $DI.'x( #)x* 49%+x2 %TN3x< SM=xR SMSxT d^UxV "#WxX !)c 3YxB $(%)(,"&!%-1$(_C,,_C**99_C _C 4.	_C
 c]_C !_C #_C %TN_C SM_Cr,   