Saravanan666/pypi-org huggingface dataset:
Package: time-interpret
Time Interpret (tint)This library expands thecaptum librarywith a specific
focus on time series. For more details, please see the documentation and ourpaper.InstallTime Interpret can be installed with pip:pipinstalltime_interpretPlease see the documentation for alternative installation modes.Quick-startFirst, let's load an Arma dataset:fromtint.datasetsimportArmaarma=Arma()arma.download()# This method generates the datasetWe then load some test data from the dataset and the
corresponding true saliency:inputs=arma.preprocess()["x"][0]true_saliency=arma.true_saliency(dim=1)[0]We can now load an attribution method and use it to compute the saliency:fromtint.attrimportTemporalIntegratedGradientsexplainer=TemporalIntegratedGradients(arma.get_white_box)baselines=inputs*0attr=explainer.attribute(inputs,baselines=baselines,additional_forward_args=(true_saliency,),temporal_additional_forward_args=(True,),).abs()Finally, we evaluate our method using the true saliency and a white box metric:fromtint.metrics.white_boximportaupprint(f"{aup(attr,true_saliency):.4}")MethodsAugmentedOcclusionBayesKernelShapBayesLimeDiscretized Integrated GradientsDynaMaskExtremalMaskFitLofKernelShapLofLimeNon-linearities TunnelOcclusionRetainSequentialIntegratedGradientsTemporalAugmentedOcclusionTemporalOcclusionTemporalIntegratedGradientsTimeForwardTunnelThis package also provides several datasets, models and metrics. Please refer to the documentation for more details.Paper: Learning Perturbations to Explain Time Series PredictionsThe experiments for the paper:Learning Perturbations to Explain Time Series Predictionscan be found on these folders:HMMMimic3Paper: Sequential Integrated Gradients: a simple but effective method for explaining language modelsThe experiments for the paper:Sequential Integrated Gradients: a simple but effective method for explaining language modelscan be found on theNLPsection of the experiments.TSInterpretMore methods to interpret predictions of time series classifiers have been grouped
intoTSInterpret, another library with a specific
focus on time series.
We developed Time Interpret concurrently, not being aware of this library at the time.AcknowledgmentJonathan Crabbefor the DynaMask implementation.Sana Tonekabonifor the fit implementation.INK Labfor the discretized integrated gradients' implementation.Dylan Slackfor the BayesLime and BayesShap implementations.
Package: time-it
Time It!pip install time-itto installPython Decorator for timing functions. Its fast, and fun!fromtime_itimporttime_def@time_defdeftime_max(A):returnmax(A)time_max([1,4,2,5,3,3])# prints execution time of time_max function and returns max valueWith a logger# setup loggerlogger=logging.getLogger("gen")logger.setLevel(logging.DEBUG)stdh=logging.StreamHandler(sys.stdout)stdh.setLevel(logging.DEBUG)formatter=logging.Formatter('%(asctime)s-%(name)s-%(levelname)s-%(message)s')stdh.setFormatter(formatter)logger.addHandler(stdh)# add decorator to function@time_def(log_name="gen")deftime_with_log(A):returnmax(A)time_with_log([1,4,2,5,3,3])
Package: timeit2
timeit2このパッケージは処理時間の計測moduletimeitを使いやすくしたものです。以下の特徴があります。引数を使い回しません(timeitは引数を書き換える処理をした時にそのまま次に渡します)複数の関数を1度に計測して相対的な速度差を視覚化できます処理時間の桁数を変えられます(0.00374567より0.0037の方が見やすい)返り値を一緒にprintできますInstall$ pip install timeit2Examplefromtimeit2importti2arg=range(10**6)ti2(max,sum,args=[arg],floor=4,print_return=True,return_label="ret: ",relative=True,)# max:#         0.0356 sec#         ret: 999999# sum:#         0.0249 sec#         ret: 499999500000# relative:#         sum:#                 1#         max:#                 1.43最小限の使い方fromtimeit2importti2deff():li=[]foriinrange(10**5):li.append(i*i)returnliti2(f)# f:#         0.015094 sec配列作成にlist.append,list.insert,dequeをそれぞれ使った処理時間と相対評価fromcollectionsimportdequefromtimeit2importti2defappend_(n):li=[]foriinrange(n):li.append(i)returnlidefinsert_(n):li=[]foriinrange(n):li.insert(0,i)returnlidefdeque_right(n):li=deque()foriinrange(n):li.append(i)returnlidefdeque_left(n):li=deque()foriinrange(n):li.appendleft(i)returnliti2(append_,insert_,deque_right,deque_left,args=[10**4],relative=True,)# append_:#         0.001118 sec# insert_:#         0.021187 sec# deque_right:#         0.000891 sec# deque_left:#         0.000855 sec# relative:#         deque_left:#                 1#         deque_right:#                 1.04#         append_:#                 1.31#         insert_:#                 24.77APIti2(*fn:Callable,args:list=[],number:int=100,floor:int=6,relative:bool=False,print_return:bool=False,return_label:str="",)argumentfnType: Callable計測する関数、可変長引数なので複数指定が可能。
引数がある場合はargs=で指定する。OptionsargsType: listDefault: []fnに渡す引数のlistnumberType: intDefault: 100各関数を計測する回数、結果はその最速値が表示されるfloorType: intDefault: 6表示する小数点以下の桁数relativeType: boolDefault: False計測結果に相対評価を追加するprint_returnType: boolDefault: False計測結果に関数の返り値を追加するreturn_labelType: str
Default: ""print_return=Trueの場合、返り値のラベルを指定するaliasti2, ti, timeit, timeit2 をimportできますが、全て同じものです。fromtimeit2importti2,ti,timeit,timeit2RelatedtimeitLicenseMIT © 2021atu4403
Package: timeitd
# timeitdA timeit decorator which makes benchmark scripts easy## Installation```$ pip install timeitd```## Example```python# bench_myfunction.pyfrom timeitd import timeitfrom some_module import myfunction@timeit(number=10000, unit="ns")def bench_myfunction():v = do_something()myfunction(v)```Output of this benchmark script is:```bench_myfunction execution avg: 1100.312300004589 ns```Dependent on `timeit` module.Time unit is available for ms, us and ns.
Package: timeit-plus
This is intended as decorator version of the built-intimeitPython module.Extras include sending emails when time thresholds are exceeded and capability of using your ownlogger.Logger()instance to log messages.Built with Django in mind, but can be used with Python in general.Usage:fromtimeit_plusimporttplus@tplus()deffoo(bar):returnbarOptional keyword arguments you can pass to thetplus()decorator:max_time: TBCemail_config: TBClogger: TBCThis README is still wip, check out decorator docstring for more info.
Package: timeitpoj
Timeitpojyet another random library for measuring python performanceUsage in productionif you do not need to measure performance of your code in a production environment, simply set the environment
variableTIME_ITtofalseExamplefromtimeitpoj.timeitimportTimeItfromtimeimportsleepBASE_TIME=0.1withTimeIt("my timer")astimer:print("Executing my timer....")sleep(BASE_TIME)withtimer("my subtimer"):print("Executing my subtimer....")sleep(BASE_TIME)withtimer("my nested subtimer"):print("Executing my nested subtimer....")sleep(BASE_TIME)for_inrange(2):withtimer("my super nested subtimer 2"):sleep(BASE_TIME)for_inrange(5):withtimer("my nested subtimer 2"):sleep(BASE_TIME)withtimer("my subtimer 992"):print("Executing my subtimer 2....")sleep(BASE_TIME)withtimer("my subtimer 4"):print("Executing my subtimer 4....")sleep(BASE_TIME)# Something that is not covered by the timersleep(BASE_TIME*2)Output================= [my timer] TIMEIT REPORT =================
[TIMEIT] my timer took 1.403 seconds
└── [81.80%] my subtimer ; 0.902 seconds
    ├── [37.49%] my nested subtimer ; 0.300 seconds
        └── my super nested subtimer 2 ; 0.200 seconds ; 2 times ; avg 0.100 seconds
    └── [62.51%] my nested subtimer 2 ; 0.501 seconds ; 5 times ; avg 0.100 seconds
├── [ 9.12%] my subtimer 992 ; 0.101 seconds
└── [ 9.08%] my subtimer 4   ; 0.100 seconds
└── [ 0.01%] internal time: 0.112 milliseconds
[78.56%% COVERAGE] time accounted for: 1.102 seconds, time unaccounted for: 0.301 seconds
[TIMEIT] report generation took 0.190 milliseconds
================= [my timer] TIMEIT REPORT =================
Package: timeit-resource
timeit_resourcetimeit_resource: Python Resource to easily capture and report time consumed by code snippets.Here is the GitHub repo:https://github.com/arunsundaram50/timeit-resourceHere is the pip command to install it:pipinstalltimeit_resourceHere’s a simple example of how you might use timeit_resource:# Write time elapsed information to stdout, with default title (prefix)withTimeIt()astimer:# Your time-consuming code herefor_inrange(1000000):passHere are examples that further explore using timeit_resource:TimeIt.prefix='  '# Write to stdout, nestedwithTimeIt("Total time taken"):fromtimeimportsleepfor_inrange(10):withTimeIt("Time taken - outer"):for_inrange(10):withTimeIt("Time taken - inner"):sleep(0.01)# Append to output.txtwithTimeIt(title="Time taken",output="output.txt")ast:# Your time-consuming code herefor_inrange(1000000):pass# Write to stderrwithTimeIt(output=sys.stderr)ast:# Your time-consuming code herefor_inrange(1000000):pass# Write to an output stream that the client owns!withopen("output.txt",'w')asf:withTimeIt(output=f)ast:# Your time-consuming code herefor_inrange(1000000):pass
Package: timeitX
timeitX - Function Execution Time LoggertimeitXis a Python decorator that logs the execution time of functions, both for synchronous and asynchronous functions.FeaturesLog the execution time of functions.Supports both synchronous and asynchronous functions.Customizable function names for logging.Precision down to milliseconds.Easy to integrate with your Python projects.InstallationYou can installtimeitXvia pip:pipinstalltimeitXUsagefromtimeitXimporttimeitX# Define your loggerimportlogginglogging.basicConfig(level=logging.INFO,format='%(asctime)s-%(name)s-%(levelname)s-%(message)s')logger=logging.getLogger("timeitX")@timeitX(name="My Function",logger=logger)defmy_function():# Your function code here# For asynchronous functions@timeitX(name="Async Function",logger=logger)asyncdefasync_function():# Your async function code here
Package: timejob
TimejobThis package provides a decorator functiontimejobthat can be used to measure the execution time of other functions in Python.InstallationYou can install this package using pip:pip install timejobUsageTo use thetimejobdecorator, simply import it from the package and apply it to the function you want to measure:fromtimejobimporttimejobdeffibonacci(n):ifn<=1:returnnelse:returnfibonacci(n-1)+fibonacci(n-2)@timejobdefshow(value:int):result=fibonacci(value)print(f"result fibonacci:{result}")show(1)show(10)show(20)When you run my_function, the decorator will print the execution time in seconds to the console.License
This package is licensed under the MIT License
Package: timekeep
timekeepA python package for defensive timeseries analytics.What istimekeepAll code needs to make assumptions about the data it uses: its shape, content, or format.
But constantly checking and re-checking the assumptions can make the code unwieldy.
Timeseries data presents additional complications in that many common python packages, such aspandasandscikitlearn, expect 2-dimensional, static data.timekeepprotects your timeseries data by providing simple decorators to check those assumptions.timekeepis heavily inspired byengarde, but does not share its assumption about
data being apandasdataframe.QuickstartHow to installtimekeepis available fromPyPi. Runpipinstalltimekeepto install.Important:timekeepis currently on version0.1.0and is in active development. As the version reflects,
the codebase is liable to change. Once main functionality has been applied, a stable version1.0.0will be released.How to usetimekeepprovides decorators to be used on functions which return a timeseries dataset.
Each decorator checks an assumption about the data and raises an error if this assumption is not met.importnumpyasnpimporttimekeep.decoratorsastkd# Check that data returned from wont_raise# has shape (-1, 10, 2)@tkd.is_shape((-1,10,2))defwont_raise():returnnp.random.random((10,10,2))# Check that data returned from will_raise is a# timeseries dataset (has three dimensions)@tkd.is_timeseriesdefwill_raise():returnnp.random.random((10,2))Another key feature oftimekeepis conversion between timeseries data formats;timekeepcan convert betweentslearnstyle timeseries dataset andsklearndatasets, with support fortsfreshdatasets in progress. The conversion functions can be applied as decorators to methods and functions to automatically
convert your data as you supply it. For example:importnumpyasnpimporttimekeep.conversionastkcfromsklearn.preprocessingimportPCA# Convert timeseries dataset to sklearn for input into sklearn.preprocessing.PCA@tkc.convert_timeseries_inputdefrun_pca_on_timeseries(data):returnPCA().fit(data)timeseries_data=np.random.random((10,100,2))run_pca_on_timeseries(timeseries_data)See theexamplesfolder for more. You can launch this repo onbinderand run the examples without any installation.ContributingAny and all help welcome. Please see thecontributing guide.
Package: timekeeper
Timekeeper is a library for instrumentation of live Python code by sending measurements to InfluxDB.Requires Python 2.7 or 3.2+, and InfluxDB 0.9.0+.Usage=====You can use a context manager or decorate a function to record the wall clock time of how long it took that function or block of code to complete:```pythonfrom timekeeper import TimeKeepertk = TimeKeeper("udp+influxdb://localhost/databasename",prefix="location-1.cluster-1.app-1.",  # if you prefer Graphite style over tagstags={"host": "location-1.cluster-1.app-1"},)@tk.decorate("some_slow_function", tags={"foo": "bar"})def slowpoke():sleep(9001)def slowpoke2():with tk.context("some_other_slow_function", tags={"foo": "baz"}):sleep(9001)```Installation============```pip install timekeeper```---![PyPI downloads](http://img.shields.io/pypi/dm/timekeeper.svg) &nbsp; ![PyPI version](http://img.shields.io/pypi/v/timekeeper.svg) &nbsp; ![Python 2.7](http://img.shields.io/badge/Python-2.7-green.svg) &nbsp; ![Python 3.2+](http://img.shields.io/badge/Python-3.2+-green.svg) &nbsp; ![License](http://img.shields.io/badge/License-ISC-red.svg)
Package: timekiller
TimekillerIt lets call any function with a timeout!InstallpipinstalltimekillerLink pypi:https://pypi.python.org/pypi/timekillerExampleCall functionimporttimekillerimporttimedeflong_function(foo,bar):whileTrue:time.sleep(10)print(foo,bar)# call(func, max_time, *args, **kwargs)timekiller.call(long_function,5,"woo",bar="Uhmm")@timekiller.timeout(5)deflong_function_with_decorator(foo,bar)whileTrue:time.sleep(10)print(foo,bar)long_function_with_decorator("woo","Uhmm")Capture exceptionimporttimekillerimporttime@timeout(1)deflong_function():try:time.sleep(10)excepttimekiller.TimeoutException:print("capture exception")long_function()TODO: - It works in main thread and processes (not work in threads)CHANGELOG0.0.3 (2016-06-15)Fix manifest.inFix pip install version0.0.2 (2016-06-15)Fix raise exception0.0.1 (2016-06-14)Initial version
Package: time-kong
TimeKongTime converter between timestamp, string and datetime.InstallationYou can installtime-kongsimply withpip:pip install time-kongUsagesTimeKongConvert time between timestamp, string and datetime:fromdatetimeimportdatetimefromtime_kongimportTimeKongts=1558883766.864879TimeKong.timestamp2string(ts,formatter="%Y-%m-%d%H:%M:%S.%f")# '2019-05-26 23:16:06.864879'TimeKong.timestamp2datetime(ts)# datetime.datetime(2019, 5, 26, 23, 16, 6, 864879)ds='2019-05-26 23:16:06.864879'TimeKong.string2timestamp(ds,formatter="%Y-%m-%d%H:%M:%S.%f")# 1558883766.864879TimeKong.string2datetime(ds,formatter="%Y-%m-%d%H:%M:%S.%f")# datetime.datetime(2019, 5, 26, 23, 16, 6, 864879)dt=datetime(year=2019,month=5,day=26,hour=22,minute=42,second=26,microsecond=864879)TimeKong.datetime2timestamp(dt)# 1558881746.864879TimeKong.datetime2string(dt,formatter="%Y-%m-%d%H:%M:%S.%f")# '2019-05-26 22:42:26.864879'Constants included:TimeKong.NANOSECONDTimeKong.MICROSECONDTimeKong.MILLISECONDTimeKong.SECONDTimeKong.MINUTETimeKong.HOURTimeKong.DAYTimeKong.WEEKTimeKong.MONTHTimeKong.YEARAuthortime-kong is developed and maintained by fanwei.zeng (stayblank@gmail.com). It can be found here:https://github.com/PurpleSun/time_kong
Package: timelapse-slicer
Timelapse SlicerWhat is this? 这是什么？This is an automated program for photographers who want to create TimeSlice pictures without installing PS plugins.这是一个帮助摄影师使用延时摄影照片自动化生成时间切片的python程序。使用此程序无需安装PS插件。ver 2.0.0 update:New feature added. Now this program can generate slicelapse photo sequence. A demo video can be foundHere2.0.0 版本更新内容：新增时间切片延时序列生成功能。演示视频Before using this tool 在使用这个程序之前Use Lightroom or other photo editing program to process the entire timelapse sequence and move all the colorgraded pictures (jpg) to one folder. LRTimelapse is recommended.使用LR或者其他图片修改软件处理延时摄影序列并导出为JPG格式，将他们放在一个文件夹中。推荐LR配合LRTimelapse使用。All the picture files should have the same dimensions.注意：所有照片需要拥有相同的尺寸。How to use this tool 如何使用这个程序Install the package. 在终端输入命令!pipinstalltimelapse_slicerImport package and run the program. 导入包，设置参数，运行程序fromtimelapse_slicerimporttimelapse_slicertimelapse_slicer.slicer(original_dir,number_of_slices,mode,ignore_mode)Parameters参数:original_dir="YOUR FILE PATH 文件夹路径"number_of_slices="INTEGER 切片数量"default=22mode="standard/gradient/timelapse/all"default=allignore_mode="early/late"为提高切片质量，程序会自动忽略部分图片，可选择序列前或后。模式说明 Mode:standard: Only standard time-slice image will be generated. 程序仅生成标准时间切片。gradient: Only gradient time-slice image will be generated. 程序仅生成无痕渐变时间切片。timelapse: Gradient time-slice image will be generated and slice-lapse sequence will be generated. 程序生成渐变时间切片及延时摄影序列。all (default默认): Standard, gradient time-slice images will be generated as well as slice-lapse sequence. 程序生成标准、渐变时间切片及延时摄影序列。忽略模式 ignore_mode:This mode is used to better create slicelapse sequence. This will choose whether the early images or the late ones will be ignored if needed. The program will automatically ignore the images might impact the sequence.这个参数是为了更好生成延时摄影序列，选择early则代表开始的照片会被忽略（如有需要），选择late则反之。The program will create several folders inside the original directory. They are Processed, Processedmulti, Final and Slicelapse. All the slices will be saved in the Processed directory. The final image will be stored in the Final directory. There will be two final images. One is the normal time slice and the other is the image with gradient transition.程序将会在你提供的文件夹内生成数个新文件夹。Processed文件夹包含所有的切片，Processedmulti包含渐变切片，Final文件夹存有最终时间切片成品。如有延时摄影，图片序列将会在slicelapse文件夹中。Sit down and ENJOY! 坐和放宽！My result 我的成果LicenseDistributed under the MIT License. SeeLICENSE.txtfor more information.ContactXi Zhao -xz3068@columbia.edu- instagram@starchaserpeteProject Link:https://github.com/petez-sufe/timelapse_slicer
Package: timeleft
Timeleft is a simple command line utility for displaying the amount of time left in a download. In the command line, one simply needs to input the file size remaining and the average download speed expected. Timeleft will output the time remaining in units that are easy to read.Usage$timeleft100MB100MBps1.0second$timeleft100MB100mbps8.0seconds$timeleft100MB100mb/s8.0seconds$timeleft100MB1kbps9.0days,11.0hours,33.0minutes,20.0seconds$3.4GB3.4MBps17.0minutes,4.0seconds$timeleft1.5YB10gbps28561641.0years,172.0days,10.0hours,21.0minutes,39.25seconds$timeleft100GB100GBPS1.0secondAs shown in the examples above, Timeleft can take a variety of inputs to produce a human-readable output.
Arguments can be input in any order: the only requirement for arguments is that one has file size units and the other has download speed units.FeaturesBoth bits and bytes are supported as file and speed units are supported (don’t let your ISP pull the wool over your eyes there). Accordingly, Timeleft is case-sensitive in that it distinguishes between B and b (i.e., 1MB = 8 Mb; all other charactersshouldbe case independent).Speed units can take the format of B/s or Bps (e.g., both 1MBps and 1MB/s are accepted).Sizes prefixes ranging from bits all the way up to yottabytes (280bytes) are currently supported.The output format only shows the largest unit necessary to display the time remaining (i.e., “0.0 minutes, 23.0 seconds” will never occur).DependenciesTimeleft is tested on Python 2.7 and 3.5 but should work on all versions 2.6 and above. There are no dependencies outside of the standard library. Testing (optionally included) is handled with Pytest.InstallationTo install Timeleft, simply:$pipinstalltimeleftAlternatively, if you would like to install from source:$pipinstallgit+https://github.com/swareham/timeleft.gitPip will automatically add the “timeleft” executable to your path and you will be ready to go!CreditsLogic for powering Timeleft: Sean WarehamTemplate for pip / setuptools support: Kenneth Reitz and all of the developers of requests athttps://github.com/kennethreitz/requests0.0.2 (2016-04-23)First Public ReleaseUpdated to use a module hierarchyAdded ability to install via pipUpdated error handling0.0.1 (2015-06-29)Original ImplementationPersonal UtilityUnpublished
Package: timelength
timelengthInspired bydurationsbyoleiade.A Python package to parse human readable lengths of time, including long form such as1 day, 5 hours, and 30 seconds, short form such as1d5h30s, and a mix thereof such as1 day 5h 30s. Includes default relaxed parsing and optional strict parsing. Supports custom abbreviations, scale factors, and more.Installationtimelengthcan be installed via pip:$pipinstalltimelengthUsageTo parse a length of time, instantiate a TimeLength object with the string of text to parse. The text should include pairs ofValuesandScales.AValueis a number.AScaleis a length of time from Milliseconds to Centuries, including short form and various other potential abbreviations associated with each scale.Acceptable separators of multipleValuesandScalesare commas, the word "and", normal spaces, and tab characters.Scale ReferenceMillisecond:ms,millisecond,millisecondsSecond:s,second,secondsMinute:m,minute,minutesHour:h,hour,hoursDay:d,day,daysWeek:w,week,weeksMonth:M,month,monthsYear:y,year,yearsDecade:D,decade,decadesCentury:c,century,centuriesVarious other abbreviations viewable withtimelength.Day().termsetcUsage ExamplefromtimelengthimportTimeLengthtime_string="5.5min, and 10 seconds"parsed_length=TimeLength(time_string)parsed_length.total_seconds# >>> 340.0parsed_length.to_hours()# >>> 0.09parsed_length.to_hours(max_precision=5)# >>> 0.09444parsed_length.strict# >>> Falseparsed_length.passed_value# >>> 5.5min, and 10 secondsparsed_length.parsed_value.valid# >>> [(5.5, 'minutes'), (10.0, 'seconds')]parsed_length.parsed_value.hours# >>> Noneparsed_length.parsed_value.minutes# >>> 5.5parsed_length.parsed_value.seconds# >>> 10time_string="5 ish minutes and uhhh, 7 seconds?"parsed_length=TimeLength(time_string)parsed_length.to_seconds()# >>> 307.0parsed_length=TimeLength(time_string,strict=True)# >>> InvalidValue: ... contains invalid values: ['ish', 'uhhh', '?']fromtimelengthimportTimeLength,Minutefromcopyimportdeepcopytime_string="5.5MiNuTeS, and 10 seconds"cust_min=deepcopy(Minute())cust_min.terms.append("MiNuTeS")parsed_length=TimeLength(time_string,custom_minute=cust_min)parsed_length.total_seconds# >>> 340.0parsed_length.passed_value# >>> 5.5MiNuTeS, and 10 secondsparsed_length.parsed_value.valid# >>> [(5.5, 'minutes'), (10.0, 'seconds')]