Saravanan666/pypi-org huggingface dataset:
Package: timedfunc
timedfuncAn easy way to measure execution time of Python functions using decorators.InstallationpipinstalltimedfuncExamplefromtimedfuncimporttimedfunc@timedfuncdefmy_function(x):print("doing stuff that takes some time...")importtimetime.sleep((x+1)*0.100)# simulate a computationforiinrange(3):my_function(i)output:doing stuff that takes some time...
doing stuff that takes some time...
doing stuff that takes some time...
--------------------------------+----------+--------------+--------------+--------------
 timed functions                |    calls |          min |         mean |          max
--------------------------------+----------+--------------+--------------+--------------
 my_function                    |        3 |      0.111 s |      0.207 s |      0.310 s
--------------------------------+----------+--------------+--------------+--------------
Package: timed-functions
timed-functionsDecorator to print how long each decorated function takes to complete.How to usefromtimed_functionsimporttiming@timingdefsay_hello(name):print(f"Hello{name}")Output:HelloWorld@timing-'say_hello'functiontook0.023msHow to deploypython3 -m pip install --user --upgrade setuptools wheel
python3 -m pip install --user --upgrade twine

rm -rf build dist timed_functions.egg-info
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
Package: timedict
Time DictionaryNow objects age too! -
Automatically manage your objects based on ageHow to install> pip install timedictOverviewThis module implements self-updating structure that is able to handle updating and removing object based on age.
Objects added to this structure are assigned timestamp at insertion, then when age of object is exceeded optional
action function is called and object is removed from the structure.NOTEWhen using this structure you must explicitly delete it due to thread locking either by
callingdestroy()method or deleting it asdel dor the interpreter will hang at exitExample Usagefromtime_dictimportTimeDictcache=TimeDict(action_time=2,poll_time=0.5)key='1'cache[key]=1keyincachedelcacheMain parameters are:action_time - which specifies age in second at which objects should be deleted - 
            time when actions should be performed and object will be deleted from structure

poll_time - frequency in seconds of polling the objects for age timeout,
            experimentally should be around 1/4 of the action_time or less. 
            Please not that too frequent polling
            may negatively affect you application performance

action  -   function that is called on object age timeout. 
            Signature is 'fn(key:Any, value:Any) -> None'

no_delete - do not delete objects when actions was calledClassPARTIALLYimplements dictionary interface, implementations allows for:d=TimeDict(action_time=2,poll_time=0.5)insertion:d[key]=valueupdating:NOTE:updatingonlychangesthevalue,ageremainsunchangedd[key]=valuedeletion:deld[key]testingformembership:keyindcheckinglength:len(d)All of the above method have optimistic time complexity of O(1)Rest of the dictionary interface is not implemented by design.Methods are:clear() → NoneSafely clear all data in the structure :raises Exceptiondestroy() → NoneDestroys the structure, must be called to properly deinitialize itflush() → NoneFlush all the objects by calling the action function,
does not remove objects Does not respect object age,
calls action method on all objects :raises Exception if updated thread died
Package: timediffusion
TimeDiffusion - Unified Framework for Multiple Time Series TasksSupports 2D (image) and 3D (video) data as input for research purposes.ContentsInstallQuick StartExamplesPhilosophyBase ModelsModel architectureInstallpipinstalltimediffusionQuick StartForecasting time series# train sequence in shape [channels, sequence_length]model=TD(input_dims=train.shape).to(device=device)training_losses=model.fit(train)# horizon : int - how many future values to forecastpredictions=model.forecast(horizon)Creating synthetic time series# sequence in shape [channels, sequence_length]model=TD(input_dims=seq.shape).to(device=device)training_losses=model.fit(seq)# proximity - how close to original, samples - total synthetic time seriessynthetic_data=model.synth(proximity=0.9,samples=3,batch_size=2,step_granulation=10)Time series Imputation# sequence in shape [channels, sequence_length]model=TD(input_dims=seq.shape).to(device=device)# mask - binary array of same shape, as sequence, with 1 in positions, that are unknowntraining_losses=model.fit(seq,mask=mask)restored_seq=model.restore(example=seq,mask=mask)ExamplesTime series: multiple tasks exampleForecasting bitcoin price examplePhilosophyMain synopsis behind TimeDiffusion model is that in reality, when working with time series we don’t have many samples, as it could be in other machine learning fields (e.g. cv, nlp). Thus, classical autoregressive approaches like ARIMA has the most suitable approach of fitting / training only on original sequence (maybe with some exogenous data).TimeDiffusion takes inspiration from these established methods and only trains on the input sample. Model incorporates most powerful modern deep learning techniques such as diffusion process, exponential dilated convolutions, residual connections and attention mechanism (in one of the versions)Base ModelsTimeDiffusionProjector- exponential dilated convolutions + residual connections.Currently main model in useTimeDiffusionAttention- attention mechanism on top ofTimeDiffusionProjector(q, k, v) projectors.Currently not viableTimeDiffusionLiquid- exponential dilated convolutions with shared middle convolutional layer weight.Lightweight, fast, but less accurate than the main model.Model architecturePresented below are diagrams depicting model components, each new scheme representing a higher level of abstraction.Temporal BlockTimeDiffusionProjectorTimeDiffusionAttention
Package: timedinput
timedinputA Python module that waits for a specified amount of time for user input. If no input is received within the given timeout period, the module sets the variable value as per the default or raises an exception. This module is similar to theinputtimeoutmodule, but with a few differences.UsageThe timedinput function takes three optional arguments: prompt, timeout, and default.fromtimedinputimporttimedinput# Prompt the user for input with a timeout of 10 secondsuser_input=timedinput("Enter something: ",timeout=10)# Prompt the user for input with a timeout of 5 seconds and a default value of "default"user_input=timedinput("Enter something: ",timeout=5,default="default")If the user enters input within the specified timeout, the function returns the user's input as a string. If the user does not enter input within the specified timeout, the function returns the default value (if one was provided) or raises a TimeoutOccurred exception.InstallationThetimedinputmodule can be installed using pip.pip install timedinputCompatibilityWorks on all platforms, including Windows and Unix-like operating systems.LicenseReleased under the MIT License. See the LICENSE file for more information.
Package: timedisplay
timedisplayauthor: Cyril Guilloud ESRF BCU 2013-2019timedisplayis a python library to format a time duration in a
human-readable way.Units managed are :microsecondsmillisecondssecondsminuteshoursdayssee also:https://github.com/jmoiron/humanize/but:https://github.com/jmoiron/humanize/issues/75conda-packagedsee also:https://github.com/tehmaze/naturalno conda packageexamples% ./timedisplay.py

--------------------{ timedisplay }----------------------------------
       0.000123 -> "123μs"
       0.123000 -> "123ms"
     123.000000 -> "2mn 3s"
     123.456789 -> "2mn 3s 456ms 789μs"
  123456.000000 -> "1day 10h 17mn 36s"
 1234567.000000 -> "14days 6h 56mn 7s"installationusageimporttimedisplayprint(f"duration:{timedisplay.duration_format(123.456789)}")result:duration: 2mn 3s 456ms 789μs
Package: timedop
A module to roughly measure the amount of time Python operations take.
There is also atimed_callfunction that will enforce a time limit
on function calls.ExamplesBasicfromtimedopimportTimedOpwithTimedOp(label='Elapsed: ')ast:# Some long operation?busy_work()print(t)Output:Elapsed: 0.24Timed Callfromtimedopimporttimed_call,TimedOutdefbusy_work(stop,increment=1):""" A dummy function, to simulate some work. """start=0whilestart<stop:start+=incrementreturnstart# Allow 2 seconds for busy_work() to return:try:result=timed_call(busy_work,args=(100000000000,),kwargs={'increment':2},timeout=2)exceptTimedOutasex:print('Uh oh.')print(ex)else:# Doesn't happen on my machine.print(result)Output:Uh oh.
Operation timed out. (busy_work(100000000000, increment=2), 2 seconds)APITimedOpATimedOpis just a timer that you canstartandstop. You
can initialise aTimedOpwith an optionallabel, which will be
used forstr()orrepr().t=TimedOp(label='Time elapsed: ').start()something()print(t.stop())ATimedOpcan also be used as a context manager. Thestartmethod is called on__enter__, andstopis called on__exit__.withTimedOp(label='Elapsed: ')ast:something()# Prints the time elapsed while inside the `with` block.print(t)TimedOp Methods:elapsed: Return the number of seconds since theTimedOpstarted.set_format(fmt): Set the default format string for the elapsed
seconds and returnsself. Default:'{:0.2f}'sleep(seconds): Shortcut fortime.sleep(seconds)start: Starts the timer, and returnsself.stop: Stops the timer, and returnsself.TimedOutAn exception that is raised fromtimed_call, containing information
about the timed function call such as:self.func: The function object.self.args: The arguments provided to the function.self.kwargs: The keyword arguments provided to the function.self.timeout: The timeout that was set for the timed call.self.formatted: A string representing all of the above
information. Used forstr(TimedOut).timed_calltimed_call(func,args=None,kwargs=None,timeout=DEFAULT_TIMEOUT)Calls a function (func), and raisesTimedOutif the function
call takes more thantimeoutseconds. The default timeout is set totimedop.DEFAULT_TIMEOUT(4 seconds).Returns the result from callingfunc(*args,**kwargs)unless it
times out.timed_call Argumentsfunc: The function to call.args: Alist/tupleof arguments to use when calling the
function (func).kwargs: Adictof keyword arguments to use when calling the
function (func).timeout: The number of seconds to wait before raising aTimedOutexception. This is set totimedop.DEFAULT_SECONDSby
default (4 seconds).
Package: timedotc
IntroThis is an experimental auth library. It has not been tested in production yet. The scope of this experiment is to provide an auth method where the user can remember a target pin (much like a cipher) and calculate a one time code (otc) relative to the current time.ForewordFrom a security standpoint, this is not very secure, but does prevent brute forcing to some extent.Problem 1:If a third party knows the code and the timestamp of the code, they can easily compute the target and validate whenever they want.Problem 2:Once the code has been computed, it is incremental, meaning that depending on the method, the code increments or decrements by 1 every minute.Problem 3:Every day at the same time of the day the code will be the same if the target does not change.How it worksGiven a pin only the user knows which will be referenced as the "target", validation is done by manually computing a code based on the difference between the current time and a code they manually compute.Depending on the method, subtracting or adding, the code is calculated differently.Given the method is addingIf the target is 1111 and the current time is 12:34, the code would be 0987.If the method is subtractingUsing the same approach, the code would be 0123.The code is then hashed and compared to the hash of the target.How to useInstallpip install timedotcImportfrom timedotc import timedotcCreate the auth objectmethod = "sub"
auth = timedotc(
    method=method,
    secret_key=secret_key,
)

target = auth.hash("0000")Validatecode = "1111"
auth.verify(code, target)Usage scenariosThis might be useful for loggin into an admin panel where there is only one user intended.ImprovementsProblem 3:The target could have a parent target which depends on the current date (month and day) which once computed would modify the initial target (calulated based on H:M). This is still susceptible to problem 1 however.
Package: timedpool
timedpoolPython library adding a dictionary with a maximum size and whose elements are deleted after a delay.InstallationRun:pip install timedpoolUsageTimedPool is a dict with a maximum size whose elements are deleted after a delay.This object can be used as a dictionary:p=TimedPool()p[key]=valueifkeyinp:print(p[key])print(len(p))delp[key]The difference with a normal dictionary is that this can contain a maximum
number of objects, after which insertions will raise aFullException.
Furthermore, each item can be removed after a certain amount of time (ttl).
Items are not removed immediately, but at fixed intervals.Usingp[key] = valuewill apply the default ttl; instead,p.set(ket, value, ttl)allows to set a specific ttl.Thestop()method can be used to stop the cleaning routine.Bothmax_sizeandclean_tmust be greater or equal to 0, negative
values are rounded to 0.Theinitialparameter can be an iterable of tuples that is used to
populate the pool with some elements.
It is equivalent to adding each key-value tuple to the pool in the order
provided by the iterable. Ifinitialis a dictionary, its elements will
be added in the order provided by the dictionaryitems()method.This object supports all the methods of a python dict with the following exceptions:copysetdefaultupdatevaluesitemsImplementationThe implementation extends a python dict. A routine is run on another thread to periodically scan the elements and remove those that are expired.This implies that expired elements will be still available until the cleaning routine is run.ContributeIf you find a bug, have a feature request or suggestions, please open an issue on github.
Package: timedsorts
timedsorts-pythonAbouttimedsort is a python module that allows new coders to see the time differences in a variety of sorting algorithms. Although many people use languages such as C++ for algorithmic design, it is notorious for having a steep learning curve. Python on the otherhand is more beginner friendly. With that in mind, this module provides the ability for people to see the relative differences of sorting algorithm speeds through time.You may call help_me() to see a more detailed description!Builtin Librariestimesort uses the following builtin libraries:time: perf_counter (timer decorator)random: randint (gen_ran_int)functools: wraps (timer decorator)itertools: permutations (bogo sort)SORTING ALGORITHMStimedsort allows you to time the following sorting algorithmsbubble sortselection sortinsertion sortmerge sortheap sortquick sortcall help_me() to see the meme sorts!How to usegenerate a list of integers we can use the gen_ran_int() function!parameters format: (length, range1, range2)if range1 and range2 are ommitted, the range would automatically from 0 to twice the lengthe.g.import timedsorts as tsarr = ts.gen_ran_int(10)#[7, 24, 35, 28, 36, 37, 2, 10, 20, 0, 18, 28, 0, 0, 34, 30, 8, 19, 6, 29]arr2 = ts.gen_ran_int(5,-10,10)#[-7, -1, -1, 5, 10]You may then call a sorting function to be timed!ts.bubble(arr)outputs:[7, 24, 35, 28, 36, 37, 2, 10, 20, 0, 18, 28, 0, 0, 34, 30, 8, 19, 6, 29][0, 0, 0, 2, 6, 7, 8, 10, 18, 19, 20, 24, 28, 28, 29, 30, 34, 35, 36, 37]bubble sort time was: 0.00010280001151841134 secondsorts.bubble(arr, out = False)outputs:bubble sort time was: 7.199999527074397e-05 secondsAs one can see, it is faster because the program doesn't print the list before and after sorting. When comparing algorithms, make sure that this kwarg is the same throughout the program.More Examples:ts.bubble(arr, out = False)ts.quick(arr, out = False)outputs:bubble sort time was: 8.349999552592635e-05 secondsquick sort time was: 4.939999780617654e-05 secondsNotesIf you would like to mutate the actual list, add an underscore before the function you call! This calls the raw algorithm used to sort the list! Make sure that the argument placed for these functions is 1 list. It also does't display the time taken.suppose we have the following code:print(arr)ts._selection(arr)print(arr)ts._heap(arr)print(arr)outputs:[7, 24, 35, 28, 36, 37, 2, 10, 20, 0, 18, 28, 0, 0, 34, 30, 8, 19, 6, 29][0, 0, 0, 2, 6, 7, 8, 10, 18, 19, 20, 24, 28, 28, 29, 30, 34, 35, 36, 37][0, 0, 0, 2, 6, 7, 8, 10, 18, 19, 20, 24, 28, 28, 29, 30, 34, 35, 36, 37]This actually changes the list.ComplexitiesOne may call on the BIGO function to see an algorithm's time complexity!e.g.ts.BIGO("bubble")ts.BIGO("MeRge")It is not case sensitive!outputs:bubble sort:BEST: O(n)AVE: O(n^2)WORST: O(n)merge sort:BEST: O(n log(n))AVE: O(n log(n))WORST: O(n log(n))Appendices:Vince TiuGeek for GeeksStack OverflowmycodeschoolAbdul BariHope you enjoy!
Package: timeeval-gutenTAG
A goodTimeseriesAnomalyGenerator.GutenTAG is an extensible tool to generate time series datasets with and without anomalies.
A GutenTAG time series consists of a single (univariate) or multiple (multivariate) channels containing a base oscillation with different anomalies at different positions and of different kinds.tl;drInstall GutenTAG fromPyPI:pipinstalltimeeval-gutenTAGGutenTAG supports Python 3.7, 3.8, 3.9, 3.10, and 3.11; all otherrequirementsare installed with the pip-call above.Create a generation configuration fileexample-config.yamlwith the instructions to generate a single time series with two anomalies:
Apatternanomaly in the middle and anamplitudeanomaly at the end of the series.
You can use the following content:timeseries:-name:demolength:1000base-oscillations:-kind:sinefrequency:4.0amplitude:1.0variance:0.05anomalies:-position:middlelength:50kinds:-kind:patternsinusoid_k:10.0-position:endlength:10kinds:-kind:amplitudeamplitude_factor:1.5Execute GutenTAG with a seed and let it plot the time series:gutenTAG--config-yamlexample-config.yaml--seed11--no-save--plotYou should see the following time series:DocumentationGutenTAG's documentation can be foundhere.CitationIf you use GutenTAG in your project or research, please cite our demonstration paper:Phillip Wenig, Sebastian Schmidl, and Thorsten Papenbrock.
TimeEval: A Benchmarking Toolkit for Time Series Anomaly Detection Algorithms. PVLDB, 15(12): 3678 - 3681, 2022.
doi:10.14778/3554821.3554873@article{WenigEtAl2022TimeEval,title={TimeEval: {{A}} Benchmarking Toolkit for Time Series Anomaly Detection Algorithms},author={Wenig, Phillip and Schmidl, Sebastian and Papenbrock, Thorsten},date={2022},journaltitle={Proceedings of the {{VLDB Endowment}} ({{PVLDB}})},volume={15},number={12},pages={3678 -- 3681},doi={10.14778/3554821.3554873}}To-Donegation anomaly (does a pattern not appear)
Package: time-evolving-mpo
TimeEvolvingMPOA Python 3 package to efficiently compute non-Markovian open quantum systems.This open source project aims to facilitate versatile numerical tools to efficiently compute the dynamics of quantum systems that are possibly strongly coupled to a structured environment. It allows to conveniently apply the so called time evolving matrix product operator method (TEMPO) [1], as well as the process tensor TEMPO method (PT-TEMPO) [2].[1]A. Strathearn, P. Kirton, D. Kilda, J. Keeling and
B. W. Lovett,Efficient non-Markovian quantum dynamics using
time-evolving matrix product operators, Nat. Commun. 9, 3322 (2018).[2]G. E. Fux, E. Butler, P. R. Eastham, B. W. Lovett, and
J. Keeling,Efficient exploration of Hamiltonian parameter space for
optimal control of non-Markovian open quantum systems, arXiv2101.03071
(2021).LinksGithub:https://github.com/tempoCollaboration/TimeEvolvingMPODocumentation:https://TimeEvolvingMPO.readthedocs.ioPyPI:https://pypi.org/project/time-evolving-mpo/Tutorial:https://mybinder.org/v2/gh/tempoCollaboration/TimeEvolvingMPO/master?filepath=tutorial.ipynbInstallationYou can install TimeEvolvingMPO using pip like this:$ python3 -m pip install time_evolving_mpoSee thedocumentationfor more information.Quickstart TutorialClick thelaunch binderbutton above to start a tutorial in a browser based
jupyter notebook (no installation required) or checkout thetutorial in the documentation.ContributingContributions of all kinds are welcome! Get in touch if you ...... found a bug.... have a question on how to use the code.... have a suggestion, on how to improve the code or documentation.... would like to get involved in writing code or documentation.... have some other thoughts or suggestions.Please, feel free to file an issue in theIssuessection
on GitHub for this. Also, have a look atCONTRIBUTING.mdif you want to get involved in the development.Citing, Authors and BibliographySee the filesHOW_TO_CITE.md,AUTHORS.mdandBIBLIOGRAPHY.md.
Package: timefile
⏱️ timefileProbably the simplest time profiling in python📍 Getting startedpip install timefileTo time your functions simply importwatchlike this:fromtimefileimportwatchimporttime@watchdefo_one(n):time.sleep(n/10**4)@watchdefo_two(m):time.sleep(m**2/10**4)foriinrange(10):o_one(i)o_two(i)Check out the plots saved in thetimefiles/plots/directory for visualizations of the runtime.🍻 Feedback and ContributionsI warmly welcome any contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas.
Feel free to create issues or pull requests at thetimefile GitHub.🛣️ RoadmapTests !!!DocumentationSmall fixes / cleanupPerformance improvementsPrettier plotsMultivariable plots?Simple regression or analysis?⚠️ DisclaimerThis package is designed for simple runtime insights and isnotoptmized for performance. For more comprehensive profiling in Python, consider using more robust tools like cProfile, timeit, line_profiler, etc.
Package: timefile-test
⏱️ timefileProbably the simplest time profiling in pythonTODO:Fix project structureImplement custom logging level to avoid other modules logsAdd total time per function bar graphallow args and kwargs usingfunc.code.co_varnamesParse out constant multi kwargsAdd some way to plot with multi variable funcAdd dt tolerance to avoid too many logs~10^5 func calls Starts to get slow => 15 sec :/