/usr/local/lib64/python3.6/site-packages/pyarrow/tests/__pycache__
NameSizeModeActions
arrow_7980.cpython-36.pyc3550644editdlrm
conftest.cpython-36.pyc59140644editdlrm
deserialize_buffer.cpython-36.pyc2980644editdlrm
pandas_examples.cpython-36.pyc34180644editdlrm
pandas_threaded_import.cpython-36.pyc8030644editdlrm
strategies.cpython-36.pyc87220644editdlrm
test_adhoc_memory_leak.cpython-36.pyc11250644editdlrm
test_array.cpython-36.pyc768100644editdlrm
test_builder.cpython-36.pyc15540644editdlrm
test_cffi.cpython-36.pyc89060644editdlrm
test_compute.cpython-36.pyc660710644editdlrm
test_convert_builtin.cpython-36.pyc617110644editdlrm
test_csv.cpython-36.pyc461740644editdlrm
test_cuda.cpython-36.pyc186650644editdlrm
test_cuda_numba_interop.cpython-36.pyc59110644editdlrm
test_cython.cpython-36.pyc41370644editdlrm
test_dataset.cpython-36.pyc1001270644editdlrm
test_deprecations.cpython-36.pyc1990644editdlrm
test_extension_type.cpython-36.pyc208300644editdlrm
test_feather.cpython-36.pyc207410644editdlrm
test_filesystem.cpython-36.pyc15740644editdlrm
test_flight.cpython-36.pyc676060644editdlrm
test_fs.cpython-36.pyc413060644editdlrm
test_gandiva.cpython-36.pyc94470644editdlrm
test_hdfs.cpython-36.pyc128840644editdlrm
test_io.cpython-36.pyc484880644editdlrm
test_ipc.cpython-36.pyc272610644editdlrm
test_json.cpython-36.pyc94520644editdlrm
test_jvm.cpython-36.pyc90860644editdlrm
test_memory.cpython-36.pyc41490644editdlrm
test_misc.cpython-36.pyc45770644editdlrm
test_orc.cpython-36.pyc60300644editdlrm
test_pandas.cpython-36.pyc1300600644editdlrm
test_plasma.cpython-36.pyc257740644editdlrm
test_plasma_tf_op.cpython-36.pyc24970644editdlrm
test_scalars.cpython-36.pyc185350644editdlrm
test_schema.cpython-36.pyc176720644editdlrm
test_serialization.cpython-36.pyc359570644editdlrm
test_serialization_deprecated.cpython-36.pyc12260644editdlrm
test_sparse_tensor.cpython-36.pyc116150644editdlrm
test_strategies.cpython-36.pyc17670644editdlrm
test_table.cpython-36.pyc449460644editdlrm
test_tensor.cpython-36.pyc56270644editdlrm
test_types.cpython-36.pyc294600644editdlrm
test_util.cpython-36.pyc9210644editdlrm
util.cpython-36.pyc104380644editdlrm
__init__.cpython-36.pyc1490644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/pyarrow/tests/__pycache__/util.cpython-36.pyc (10438B)
3 9%Eg3#@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZ ddZejddZddZd d Zd d Zd dZd(ddZddZddZejddZejddZejddZdd ZGd!d"d"ZGd#d$d$e jj Z!d%d&Z"dS))z Utility functions for testing NcCs tjdS)zLRandomly choose either 1 or -1. Returns ------- sign : int )rr)randomchoicerr>/usr/local/lib64/python3.6/site-packages/pyarrow/tests/util.pyrandsign'src cs.tj}tj|z dVWdtj|XdS)aSet the random seed inside of a context manager. Parameters ---------- seed : int The seed to set Notes ----- This function is useful when you want to set a random seed but not affect the random state of other functions using the random module. N)rgetstateseedsetstate)r Zoriginal_staterrr random_seed1s   r cCsd|kodkns td|dkr0tdd||d}tj| |}|s\tj|Sd|d}tjd|}tjdj|t|j|dS) aGenerate a random decimal value with specified precision and scale. Parameters ---------- precision : int The maximum number of digits to generate. Must be an integer between 1 and 38 inclusive. scale : int The maximum number of digits following the decimal point. Must be an integer greater than or equal to 0. Returns ------- decimal_value : decimal.Decimal A random decimal.Decimal object with the specified precision and scale. r&z,precision must be between 1 and 38 inclusiverzHranddecimal does not yet support generating decimals with negative scale z{}.{}0) AssertionError ValueErrorrrandintdecimalDecimalformatstrrjust)Z precisionZscaleZmax_whole_valueZwholeZmax_fractional_valueZ fractionalrrr randdecimalGs    rcCsttjjdd|ddS)NA{i1)sizedtype)bytesnprr)lengthrrr random_asciilsr!cCs4tjttjtjtjdfd}djtjj ||S)z% Generate one random string. r)r) rarrayliststring ascii_lettersdigitsZstr_joinrr)ZncharsZ RANDS_CHARSrrrrandspsr)csJddl}d|jfddtjddD|jddtDd}|S) Nrcsi|]}tjj|qSr)rrZrandn).0col)Nrr ~sz"make_dataframe..cSsg|] }tdqS)r)r))r+_rrr sz"make_dataframe..)index)ZpandasZ DataFramer%ascii_uppercaseIndexrange)pddfr)r-rmake_dataframeys r8rssrrcsdddl}|jfddfdd}x(t|D]||dkr@|q@WdS)a Execute the function and try to detect a clear memory leak either internal to Arrow or caused by a reference counting problem in the Python binding implementation. Raises exception if a leak detected Parameters ---------- f : callable Function to invoke on each iteration metric : {'rss', 'vms', 'shared'}, default 'rss' Attribute of psutil.Process.memory_info to use for determining current memory use threshold : int, default 128K Threshold in number of bytes to consider a leak iterations : int, default 10 Total number of invocations of f check_interval : int, default 1 Number of invocations of f in between each memory use check rNcstjtjS)N)gcZcollectgetattrZ memory_infor)metricprocrr_get_usesz#memory_leak_check.._get_usecs*}|kr&tdj|dS)NzDMemory leak detected. Departure from baseline {} after {} iterations) Exceptionr)Z current_use)r? baseline_usei thresholdrr _leak_checks z&memory_leak_check.._leak_check)psutilProcessr5)fr=rCZ iterationsZcheck_intervalrErDr)r?rArBr=r>rCrmemory_leak_checks rHcCsZtjj}|jdd}tjjtjjtjjtj}|rJtj j ||f}n|}||d<|S)N PYTHONPATHr") osenvironcopygetpathabspathdirnamepa__file__pathsepr()envZexisting_pythonpath module_pathZnew_pythonpathrrr get_modified_env_with_pythonpaths  rVcGsNt}tjjtjjt}tjj||}tj|g}|j |t j ||ddS)N)rT) rVrJrNrPrealpathrRr(sys executableextend subprocess check_call) script_nameargsZsubprocess_envZdir_pathZ python_filecmdrrr invoke_scripts   r`c csDtjj|}|tj|<z dVWd|dkr4tj|=n |tj|<XdS)zA Temporarily set environment variable *name* to *value*. N)rJrKrM)namevalueZ orig_valuerrrchanged_environs    rcc cs2tj}tjt|z dVWdtj|XdS)N)rJgetcwdchdirr)rNcurdirrrr change_cwds  rgc cs"tjz dVWdtjXdS)N)r;disableenablerrrr disabled_gcs rjcCs$tjdkrdj|}n dj|}|S)Nntz file:///{}z file://{})rJrar)rNurirrr_filesystem_uris   rmc@seZdZddZddZdS)FSProtocolClasscCs ||_dS)N)_path)selfrNrrr__init__szFSProtocolClass.__init__cCs t|jS)N)rro)rprrr __fspath__szFSProtocolClass.__fspath__N)__name__ __module__ __qualname__rqrrrrrrrnsrnc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&S)' ProxyHandlerz A dataset handler that proxies to an underlying filesystem. Useful to partially wrap an existing filesystem with partial changes. cCs ||_dS)N)_fs)rpfsrrrrqszProxyHandler.__init__cCst|tr|j|jkStS)N) isinstancervrwNotImplemented)rpotherrrr__eq__s  zProxyHandler.__eq__cCst|tr|j|jkStS)N)ryrvrwrz)rpr{rrr__ne__ s  zProxyHandler.__ne__cCs d|jjS)Nzproxy::)rw type_name)rprrr get_type_nameszProxyHandler.get_type_namecCs |jj|S)N)rwnormalize_path)rprNrrrrszProxyHandler.normalize_pathcCs |jj|S)N)rw get_file_info)rppathsrrrrszProxyHandler.get_file_infocCs |jj|S)N)rwr)rpselectorrrrget_file_info_selectorsz#ProxyHandler.get_file_info_selectorcCs|jj||dS)N) recursive)rw create_dir)rprNrrrrrszProxyHandler.create_dircCs |jj|S)N)rw delete_dir)rprNrrrr!szProxyHandler.delete_dircCs |jj|S)N)rwdelete_dir_contents)rprNrrrr$sz ProxyHandler.delete_dir_contentscCs|jjdddS)Nr"T)Zaccept_root_dir)rwr)rprrrdelete_root_dir_contents'sz%ProxyHandler.delete_root_dir_contentscCs |jj|S)N)rw delete_file)rprNrrrr*szProxyHandler.delete_filecCs|jj||S)N)rwmove)rpsrcdestrrrr-szProxyHandler.movecCs|jj||S)N)rw copy_file)rprrrrrr0szProxyHandler.copy_filecCs |jj|S)N)rwopen_input_stream)rprNrrrr3szProxyHandler.open_input_streamcCs |jj|S)N)rwopen_input_file)rprNrrrr6szProxyHandler.open_input_filecCs|jj||dS)N)metadata)rwopen_output_stream)rprNrrrrr9szProxyHandler.open_output_streamcCs|jj||dS)N)r)rwopen_append_stream)rprNrrrrr<szProxyHandler.open_append_streamN)rsrtru__doc__rqr|r}rrrrrrrrrrrrrrrrrrrrvs&rvcCs6tjdkrtjStjdkr&tjdn dd}|SdS)Nrkz$test requires Python 3.8+ on WindowscSstjtj|dS)N)rJkillgetpid)signumrrr raise_signalIsz&get_raise_signal..raise_signal)rr)rX version_infosignalrrJrapytestskip)rrrrget_raise_signal@s    r)r9rrr)#r contextlibrr;ZnumpyrrJrrr%r[rXrZpyarrowrQZ pyarrow.fsrcontextmanagerr rr!r)r8rHrVr`rcrgrjrmrnrxZFileSystemHandlerrvrrrrrs< %   *    A