(VfiQHddlmZddlmZddlZddlmZddlZddlm Z m Z m Z ddl Z ddl mZddlmZmZddlmZdd lmZdd lmZe rdd lmZdd lmZmZmZed&dZed'dZe d(d)dZ ed*d Z!ed+d,d!Z"d-d$Z#d.d%Z$dS)/) annotations)contextmanagerN)Path)IO TYPE_CHECKINGAny)using_copy_on_write)PYPYWARNING_CHECK_DISABLED)ChainedAssignmentError) set_option) get_handle) Generator) BaseBufferCompressionOptionsFilePathpathFilePath | BaseBuffer compressionrreturn Generator[IO[bytes], None, None]c#tKt|d|d5}|jVddddS#1swxYwYdS)a& Open a compressed file and return a file object. Parameters ---------- path : str The path where the file is read from. compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd', None} Name of the decompression to use Returns ------- file object rbF)ris_textN)rhandle)rrrs Gc:\PYTHON\DbComparer\venv\Lib\site-packages\pandas/_testing/contexts.pydecompress_filer$s& D$K G G G6ms -11tzstrGenerator[None, None, None]c#Kddldfd }tjd}|| dV||dS#||wxYw)a Context manager for temporarily setting a timezone. Parameters ---------- tz : str A string representing a valid timezone. Examples -------- >>> from datetime import datetime >>> from dateutil.tz import tzlocal >>> tzlocal().tzname(datetime(2021, 1, 1)) # doctest: +SKIP 'IST' >>> with set_timezone('US/Eastern'): ... tzlocal().tzname(datetime(2021, 1, 1)) ... 'EST' rNrNonectdrH|! tjd=dS#t$rYdSwxYw|tjd<dSdS)NtzsetTZ)hasattrosenvironKeyErrorr$)rtimes rsetTZzset_timezone..setTZSsz 4 ! ! z 4(((DD$& 4    s $ 22r%)rr")r*r'r(get)rr+orig_tzr*s @r set_timezoner.;s,KKK      jnnT""G E"III  ggs A AFreturn_filelikeboolkwargsrGenerator[Any, None, None]c+Kttj}|d}tt j|z}||z }|t|}|dd}|r3|dd| d|dvrd}t|fd|i|} |Vt|ts| | r| dSdS#t|ts| | r| wwxYw)az Gets a temporary path and agrees to remove on close. This implementation does not use tempfile.mkstemp to avoid having a file handle. If the code using the returned path wants to delete the file itself, windows requires that no program has a file handle to it. Parameters ---------- filename : str (optional) suffix of the created file. return_filelike : bool (default False) if True, returns a file-like which is *always* cleaned. Necessary for savefig and other functions which want to append extensions. **kwargs Additional keywords are passed to open(). Nencodingmodezw+bbzutf-8)rtempfile gettempdirruuiduuid4touchpop setdefaultopen isinstancecloseis_fileunlink)filenamer/r1folderr handle_or_strr5s r ensure_cleanrGfsv,(%'' ( (F4:<<  8+H H DJJLLL!$iiMzz*d++H@&%(((  6&> 9 9HT??H??? --- "    ! ! ! <<>>  KKMMMMM  --- "    ! ! ! <<>>  KKMMMM s >DAE+namec+Kddl}hd}||vrtd|j|fi| dV||dS#||wxYw)au Context manager to temporarily register a CSV dialect for parsing CSV. Parameters ---------- name : str The name of the dialect. kwargs : mapping The parameters for the dialect. Raises ------ ValueError : the name of the dialect conflicts with a builtin one. See Also -------- csv : Python's CSV library. rN> excel-tabunixexcelz Cannot override builtin dialect.)csv ValueErrorregister_dialectunregister_dialect)rHr1rM_BUILTIN_DIALECTSs rwith_csv_dialectrRs(JJJ666    ;<<<C(((((%  t$$$$$t$$$$s AAc#Kddlm}||j}|j}|j}t d|||_ dV||_t d|dS#||_t d|wxYw)Nr) expressionszcompute.use_numexpr)pandas.core.computationrT _MIN_ELEMENTS USE_NUMEXPRr )use min_elementsexprolduseoldmins r use_numexprr]s;;;;;;)  F  F$c***%D2 #(&11111$(&1111s AA.Tclddlm}|sddlm}|Stst r|sddlm}|Stst r"|r ||d|Str t}d}n t}d}|r|g|R}||d|g|RS)Nrassert_produces_warning nullcontext|)matchzYA value is trying to be set on a copy of a DataFrame or Series through chained assignmentr ) pandas._testingra contextlibrcr r joinr r FutureWarning)warnextra_warnings extra_matchrarcwarningres rraises_chained_assignment_errorrns.777777 ******{}}  &  ******{}}  ( n && ((;''     -,G- E $G,E  1000G&& ((E0K0011    c hddlm}|rtrddlm}|S|sd}|t fd|i|S)aq Assert that a warning is raised in the CoW warning mode. Parameters ---------- warn : bool, default True By default, check that a warning is raised. Can be turned off by passing False. match : str The warning message to match against, if different from the default. kwargs Passed through to assert_produces_warning rr`rbzSetting a value on a viewre)rfrar rgrcri)rjrer1rarcs rassert_cow_warningrqso877777 )******{}} ,+ " "= H H H H HHro)rrrrrr)rrrr )NF)r/r0r1rrr2)rHrrr )N)rr )Tr^r^)TN)% __future__rrgrr'pathlibrr8typingrrrr:pandas._configr pandas.compatr r pandas.errorsr pandasr pandas.io.commonrcollections.abcrpandas._typingrrrrr.rGrRr]rnrqr^rorr|s1""""""%%%%%%   ......100000'''''')))))),''''T+0,,,,,^%%%%B22222"! ! ! ! HIIIIIIro