Saravanan666/pypi-org huggingface dataset:
Package: timeoutlib
Python Timeout LibraryThis is the source for thetimeoutlibpython library.The library solves the following problem: given a computational budget in seconds, and a function that performs some
work, ensure that the computation does not take longer than the budgeted durationIn the event that a function times out, you can choose to return a default value, raise an exception or return a default
from adefault_factory.UsageYou can use a decorator or functional syntax to wrap your functionimporttimeimporttimeoutlib# Decorator syntax# will raise timeoutlib.OperationTimedOut if 5s exceeded@timeoutlib.timeout(max_duration=5)defworker(simulated_duration):time.sleep(simulated_duration)# will return False if 5s exceeded@timeoutlib.timeout(max_duration=5,default=False)defworker_default_value(simulated_duration):time.sleep(simulated_duration)returnTrue# will call list() to return a new empty list as a default value if 5s exceeded@timeoutlib.timeout(max_duration=5,default_factory=list)defworker_default_value(simulated_duration):time.sleep(simulated_duration)returnTrue# will raise a RuntimeError if 5s exceeded@timeoutlib.timeout(max_duration=5,exception=RuntimeError)defworker_default_value(simulated_duration):time.sleep(simulated_duration)returnTrue# The two alternative syntax below are equal@timeoutlib.timeout(max_duration=2)defworker_decorator(simulated_duration):time.sleep(simulated_duration)returnTrue# Given some function that you want to decorate dynamicallydefworker_functional(simulated_duration):time.sleep(simulated_duration)returnTrueworker_functional=timeoutlib.timeout(max_duration=2)(worker_functional)# worker_functional and worker_decorated behave the sameCaveats / NotesOnly supports integer durations (no fractional seconds)Uses SIGALRM under the hood (unix only - will not work on Windows)timeoutlib.OperationTimedOutsubclasses the builtin TimeoutErrorThe default_factory assumes a function with zero args that returns a new default valueAccuracy of the timeout duration depends on the underlying OS, Hardware, and some overhead from the decorator itself.
Package: timeout-sampler
TimeoutSamplerUtility class for waiting to any function output and interact with it in given time.Installationpip3installtimeout-samplerUsagefromrandomimportrandintfromtimeout_samplerimportTimeoutSamplerdefrandom_number(start,end):returnrandint(start,end)samples=TimeoutSampler(wait_timeout=60,sleep=1,func=random_number,start=1,end=10,)forsampleinsamples:ifsample==5:break
Package: timeoutthreadpoolexecutor
This library tries to solve my issue with 1000+ idle threads in Python 3.7 by using a backported
ThreadPoolExecutor (with thread reuse) and giving threads a TTL.There is probably no reason to use this for short-lived threads.UsageThere are two ways to use this library, overwrite the default TheadPoolExecutor or use it directly.To overwrite the default, do this as the first thing before any other thing your project does.fromtimeoutthreadpoolexecutorimportTimeoutThreadPoolExecutorfromconcurrent.futuresimportthreadthread.ThreadPoolExecutor=TimeoutThreadPoolExecutororfromtimeoutthreadpoolexecutorimportTimeoutThreadPoolExecutorasThreadPoolExecutorLicenseSame as Python, I guess.
Package: timeout-timer
Installationpython setup.py installTimeout TimerAdd a timeout function to a function or statement and raise a exception if time limit runs out, can work as
a context or decorator, support loop nesting and should use diff exception class, if use signal timer,
outside timer will fired after the inside signal timer finish the work(raise exception or normal finish).Support signal timer and thread timer, signal timer can only work on main thread, if not on main thread use
thread timer, thread timer may cost longer time than time out seconds settled if the user’s function is busy
in a system call (time.sleep(), socket.accept()…), exception will fired after system call done.Usagesupport nested loopfrom timeout_timer import timeout, TimeoutInterrupt

class TimeoutInterruptNested(TimeoutInterrupt):
    pass

def test_timeout_nested_loop_both_timeout(timer):
    cnt = 0
    try:
        with timeout(5, timer=timer):
            try:
                with timeout(2, timer=timer, exception=TimeoutInterruptNested):
                    sleep(2)
            except TimeoutInterruptNested:
                cnt += 1
            time.sleep(10)
    except TimeoutInterrupt:
        cnt += 1
    assert cnt == 2use as decorator@timeout(2):
def f():
    time.sleep(3)
    time.sleep(2)LicenseCode released under theMIT license
Package: timeout-urllib2
Protocol based timeout facility for urllib2.Currently only support HTTP and HTTPS.Achived by inheriting httplib.HTTPConnection and httplib.HTTPSConnection
classes and provide a timeout version for both. Timeout has been carefully
implemented per connection base. A HTTPConnectionTimeoutError or
HTTPSConnectionTimeoutError would be raised instead of the general socket.error
so that urlib2 wouldn’t throw out URLError exception when timeout is hit.
Package: timeout_wrapper
Timeout wrapperTimeout decorator with defaults and exceptions.DocumentationUsage of this decorator is really simple - to set the timeout, just add@timeout(time)decorator to your function definition:@timeout(3)  # 3 seconds
def myfunc(..):
    ..If themyfunc()call timeouts,TimeoutExceptionis raised.Optionally, you can also set your own message for exception:@timeout(3, exception_message="Oh noez")
def myfunc(..):
    ..or use default value, instead of exception:@timeout(3, False):
def myfunc(..):
    ..Thats all.Changelog0.1.0Project created.
Package: timeparse
An argparse-extension for parsing command-line arguments as time-, date-,
datetime-, or timedelta-objects.Latest VersionThe latest version of this project can be found at :http://github.com/thomst/timeparse.InstallationOption 1 : Install via pippip install timeparseOption 2 : If you have downloaded the sourcepython setup.py installDokumentaion:Please visit the documentation on readthedocs.org:https://timeparse.readthedocs.org/en/latest/index.htmlUsageHow to use?>>> import argparse
>>> from timeparse import ParseDatetime
>>>
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--datetime', action=ParseDatetime, nargs='+')
>>>
>>> parser.parse_args("--datetime 2.4.2013 23:02".split()).datetime
datetime.datetime(2013, 4, 2, 23, 2)Reporting BugsPlease report bugs at github issue tracker:https://github.com/thomst/timeparse/issuesAuthorthomst <thomaslfuss@gmx.de>
Thomas Leichtfußhttp://github.com/thomst
Package: timeparse-plus
NoteThis is a fork ofpytimeparse. Only changes being support for months and years.
This was specifically forked for use in piqueserver.Copyright (c) 2014 Will Roberts <wildwilhelm@gmail.com>Licensed under the MIT License (see source filetimeparse.pyfor
details).A small Python library to parse various kinds of time expressions,
inspired bythis StackOverflow question.The single functionpytimeparse.timeparse.timeparsedefined in the
library (also available aspytimeparse.parse) parses time
expressions like the following:32m2h32m3d2h32m1w3d2h32m1w 3d 2h 32m1 w 3 d 2 h 32 m4:134:13:024:13:02.2662:04:13:02.2662 days,  4:13:02(uptimeformat)2 days,  4:13:02.2665hr34m56s5 hours, 34 minutes, 56 seconds5 hrs, 34 mins, 56 secs2 days, 5 hours, 34 minutes, 56 seconds1.2 m1.2 min1.2 mins1.2 minute1.2 minutes172 hours172 hr172 h172 hrs172 hour1.24 days5 d5 day5 days5.6 wk5.6 week5.6 weeksIt returns the time as a number of seconds (an integer value if
possible, otherwise a floating-point number):>>> from pytimeparse import parse
>>> parse('1.2 minutes')
72A number of seconds can be converted back into a string using thedatetimemodule in the standard library, as noted inthis other StackOverflow question:>>> from pytimeparse import parse
>>> import datetime
>>> parse('1 day, 14:20:16')
138016
>>> str(datetime.timedelta(seconds=138016))
'1 day, 14:20:16'Future workGive the user more flexibility over which characters to use as
separators between fields in a time expression (e.g.,+might
be useful).Internationalisation?Wow,https://github.com/bear/parsedatetime.
Package: timeparser
Parse strings to objects of the datetime-module.This module intends to make string-parsing to objects of the datetime-module as
easy as possible while allowing a fine configuration about which kind of formats
are supported.Latest VersionThe latest version of this project can be found at :http://github.com/thomst/timeparser.InstallationOption 1 : Install via pippip install timeparserOption 2 : If you have downloaded the sourcepython setup.py installDokumentaion:Please visit the documentation on readthedocs.org:https://timeparser.readthedocs.org/en/latest/index.htmlUsageHow to use?>>> import timeparser
>>>
>>> timeparser.parsedate('24.4.13')
datetime.date(2013, 4, 24)
>>>
>>> timeparser.parsedate('24 Apr 2013')
datetime.date(2013, 4, 24)
>>>
>>> timeparser.parsetime('234405')
datetime.time(23, 44, 5)
>>>
>>> timeparser.TimeFormats.config(allow_no_sep=False)
>>> timeparser.parsetime('234405')
ValueError: couldn't parse 234405 as time
>>>
>>> timeparser.parsedatetime('24-04-13_23:44:05')
datetime.datetime(2013, 4, 24, 23, 44, 5)Changes in v0.7The formats-classes accept an keyword try_hard, which means they try
to build formats for what ever kind of string was passed -regardless
of any configurationReporting BugsPlease report bugs at github issue tracker:https://github.com/thomst/timeparser/issuesAuthorthomst <thomaslfuss@gmx.de>
Thomas Leichtfußhttp://github.com/thomst
Package: timeperiod2
Python module for determining if a datetime is within a time
period.Based on theoriginal TimePeriod modulewritten by Paul Boyd <boyd.paul2@gmail.com>.Installation$sudopipinstalltimeperiod2Usageimportdatetimeimporttimeperiod# will return True iff we have Monday, Tuesday or Thursday:timeperiod.in_period('wd {mon tue thu}')# will return True iff we have "office time"timeperiod.in_period('wd {Mon-Fri} hr {9-17}',datetime.datetime.now())LicenseReleased under the LGPL:http://www.gnu.org/licenses/#LGPLAlso see the LICENSE file.
Package: timepiece
A DSL to assist with writing specifications describing intervals and durations
of time with filters.Why the name?Because time_spec was uninspiring and a good friend suggestedtimepiece.Naming things is difficult!But why?Because I wanted to represent when scheduled actions should take place and I
was starting to have too many columns in my database representing everything I
wanted to be able to do.InstallationUse pip!:pipinstalltimepieceOr if you’re developing it:pipinstall-e.pipinstall-e".[tests]"UsageJust create the timepiece and give it a specification!fromtimepiece.specimportmake_timepiecefromdatetimeimportdatetimetimepiece=make_timepiece()obj=timepiece.time_spec_to_object("between(start: now()) & interval(every: amount(num:1 size: hour))")print("Next time is: ",obj.following(datetime.utcnow()))See The docs athttps://timepiece.readthedocs.iofor more information!TestsTo run the tests in this project, just use the helpful script:./test.shOr run tox:tox
Package: timepilot
TimePilot Lib 311x-012TimePilot is a simple Python 3.11 library that helps you work with timezones and format them in different ways. With TimePilot, you can display the current time in a specific timezone or format a range of dates and times to appear in a particular way.InstallationYou can easily install TimePilot using pip. Simply run the following command:pipinstalltimepilotHow to UseHere's an example of how you can use TimePilot to display the current time in the Eastern Timezone:importtimepilot# Specify the timezone and formatting option you want to usetime_zone="US/Eastern"time_format="hour_minute"# Get the current time in the specified timezone and formatcurrent_time=timepilot.get_current_time(time_zone,time_format)# Print out the current timeprint(f"The current time in{time_zone}is{current_time}")We should get an output of something like this:The current time in US/Eastern is 3:30 PMAvailable Formatting OptionsTimePilot provides several formatting options for displaying timezones, including:hour_minute: displays the hour and minute (e.g. 3:30 PM)hour_minute_second: displays the hour, minute, and second (e.g. 3:30:45 PM)minute_second: displays the minute and second (e.g. 30:45)hour: displays the hour (e.g. 3 PM)second: displays the second (e.g. 45)You can specify the formatting option when calling get_current_time or format_datetime.VersionThe current version of TimePilot is 311x-012, indicating that it is compatible with Python 3.11 and all sub-versions and the library version is 0.1.LicenseTimePilot is released under the MIT License. You can find the license information in the LICENSE file.
Package: timepipe
TimepipeTimepipe is a package that visualize running time in realtime systems.This package is intended for high speed systems where all kinds of events happends and temporal relationship is important.Create an event in advance, check it in your code at where you care about when something happened. You can also attach it as a part of a pipeline, so a set of events could be visualized conveniently and nicely.To install, simply run:
pip install timepipe
Package: timeplus-leptons
leptonsleptons records all openAI api calls by adding an api hook that sends request/response to Timeplus cloud.to install leptons, runpip install timeplus-leptonsto use leptons, refer to following sample codeimport os
import openai
from leptons import agent

# start the monitor agent of leptons
api_key = os.environ.get("TIMEPLUS_API_KEY")
api_address = os.environ.get("TIMEPLUS_ADDRESS")
agent = Agent(api_address=api_address, api_key=api_key)
agent.start()

# your open ai calls here
openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[{"role": "user", "content": input}],
        temperature=temp
    )
Package: time-pretty-breaks
# Time, Date, DateTime Pretty BreaksSplit time range into ~N "rounded" intervals using the following logic:Divide range by N and select the closest step from below:- One year- Six months, three months, one month- Two weeks, one week- One day- Hours: 12, 6, 4, 3, 2, 1- Minutes: 30, 20, 15, 10, 5, 1- Seconds: 30, 20, 15, 10, 5, 1If the interval is greater than one year, then use Pretty Breaks algorithm for the step.Each interval starts with time multiple of step. E.g., if we have 20 min stepand the range starts at 19:43, then the first interval should starts at 19:40.## Examples| Range start         | Range end        | N  | Result                                                                                                        | Description                             ||---------------------|------------------|----|---------------------------------------------------------------------------------------------------------------|-----------------------------------------|| 2019-04-04          | 2019-05-19       | 7  | 2019-04-01, 2019-04-08, 2019-04-15, 2019-04-22, 2019-04-29, 2019-05-06, 2019-05-13, 2019-05-20                | Split by one week, starts on Monday     || 2019-03-31 02:59:02 | 2019-03-31 03:02 | 50 | 2019-03-31 02:59:00, 2019-03-31 02:59:05, 2019-03-31 02:59:10, ... , 2019-03-31 03:01:55, 2019-03-31 03:02:00 | Split by 5 sec, starts at multiple time || 2018-12-31          | 2019-12-19       | 5  | 2018-10-01, 2019-01-01, 2019-04-01, 2019-07-01, 2019-10-01, 2020-01-01                                        | Split by three months, starts at Jan. 1 |## Usage```python>>> from time_pretty_breaks import nice_dt_intervals>>> from datetime import datetime>>> nice_dt_intervals(datetime(2018, 12, 31), datetime(2019, 12, 19), 5)[datetime.datetime(2018, 10, 1, 0, 0), datetime.datetime(2019, 1, 1, 0, 0), datetime.datetime(2019, 4, 1, 0, 0), datetime.datetime(2019, 7, 1, 0, 0), datetime.datetime(2019,10, 1, 0, 0), datetime.datetime(2020, 1, 1, 0, 0)]```
Package: time-profiler
time_profilerThis is a Python module for profiling a function's time usage. It's quite useful for determining how long a function will take to execute.InstallationInstall via pip:pip install time_profilerUsageFirst decorate the function you would like to profile with@timer()and then run that file containing function.In the following example, we create a simple function calledsample_functhat allocates lists a, b and then deletes b:from time_profiler import timer

@timer()
def sample_func():
    a = [1] * (10 ** 6)
    b = [2] * (2 * 10 ** 7)
    del b
    
    return a

if __name__ == '__main__':
    sample_func()Then execute the code normally. For example, if the file name wasexample.py, this would result in:python example.pyOutput will be displayed in the terminal as follow:11-24-2021 10:07:05 AM - timer - INFO - sample_func function ran in 0.10 secsParametersThis decorator(@timer()) takes two optional paramaters.file_log: By default is set to false, which means that log file is not created but when set to true there should be a log file namedtimer.log. Breifly this argument is of boelen type.exp_time: Here you can try to estimate the time to be used. When estimated time is less than actual used time, you get warning log instead of info.DevelopmentLatest sources are available from github:https://github.com/harerakalex/timerAuthorCarlos HarerimanaLicenseMIT
Package: timeprofiles
timeprofilesThis library is designed to assist in quickly debugging bottlenecks in both single-threaded and multi-threaded operations.Installationpython -m pip install timeprofilesOverviewIt contains a class calledTimeProfileCollectionfor easily storing the time taken for each method to complete, and displaying it as either a table or a diagram. The TimeProfiler class provides two decorator methods for profiling: one for profiling the entire class, and one for profiling individual methods.@timeprofiles.profile_class_methods@timeprofiles.profile_methodThedisplay_profilesmethod is used to display all time profiles, ordered by a specified column.Name        Calls    Average (ms)    Longest (ms)    Bottleneck (ms)
--------  -------  --------------  --------------  -----------------
method_a        1          203.50          203.50             203.50
method_b        5          104.82          155.19             155.40
method_c        5           58.86           78.35             140.00
method_d        1           45.83           45.83              45.83
method_e        1           93.76           93.76              93.76Theplot_profilesandplot_mergedmethods are used to plot all time profiles as ranges, ordered by earliest method call.Example usagesTheprofile_methoddecorator is applied on individual methods or functions.importtimeprofilesastpclassExampleClass:@tp.profile_methoddefmy_method():# Method content@tp.profile_methoddefmy_other_method():# Method contentAlternatively, theprofile_class_methodsdecorator can be used to apply theprofile_methoddecorator on all class methods. This can be used in conjunction withprofile_ignoreto filter out methods you don't want to profile.importtimeprofilesastp@tp.profile_class_methodsclassExampleClass:defmy_method():# Method content@tp.profile_ignoredefmy_other_method():# Method contentAnother way of using the profiling decorators is to apply it directly onto an object. In the following example, only the methods called from the example_object will be profiled.example_obj=tp.profile_class_methods(ExampleClass())After adding the decorators and calling the methods, thedisplay_profiles,plot_profiles, orplot_mergedmethods can be called to visualize the time profiles.tp.display_profiles(order_by=tp.ORDER_BY_AVERAGE,reverse=False,full_name=True)tp.plot_profiles()tp.plot_merged()Known issuesDespite being able to addprofile_class_methodsto an object,profile_ignorecannot be used since its implementation relies on attributes, which cannot be updated on objects.# THIS WILL NOT WORKtp.profile_ignore(example_obj)
Package: timepro-timesheet
Intertec TimePro UtilsDescriptionProgrammatically get and submit timesheet data to Intertec TimePro (timesheets.com.au)InstallationInstall withpip:pipinstalltimepro-timesheetUsageCommand lineGET dataOnce installed, you can use the CLI to get your timesheet data as JSON.$timeproget-cCUST-ujohn.doe-ppassword123{"2018-08-04":[{"customer_code":"EXAMPLE","customer_description":"Example Company Pty Ltd","project_code":"EX-123","project_psid":"EX-123{:}1","project_description":"EXAMPLE - EX-123 - SOW000 - Important Business Stuff - PO 123","task_id":null,"task_description":null,"hours":8}]}You can filter the timesheet period by specifying dates for--startand--end, or by using the--this-week,--this-month,--last-weekor--last-monthflags. By default, the current week's timesheet entries are returned.POST dataData can be submitted by reading from a JSON file.$timepropost-cCUST-ujohn.doe-ppassword123-ftimesheet_entries.jsonor$cattimesheet_entries.json|timepropost-cCUST-ujohn.doe-ppassword123Pythonfromtimepro_timesheet.apiimportTimesheetAPI# Log into timesheets.com.au via the TimesheetAPI classapi=TimesheetAPI()api.login(customer_id='CUST',username='john.doe',password='password123')# Get timesheet (defaults to current month)timesheet=api.get_timesheet()# Get timesheet for a given datetimesheet=api.get_timesheet(start_date=date(2018,6,1),end_date=date(2018,6,25))# Output timesheettimesheet.json()timesheet.row_entries()timesheet.date_entries()
Package: timepulse
🚀 Timepulse: Unleash the Power of Time Series Processing and Modeling!Welcome to Timepulse, your ultimate destination for conquering the world of time series data with unprecedented ease and efficiency.Table of Contents 🌟Installation MagicJourney into the Time DimensionSpellbinding FeaturesContribute to the Time NexusLicenseCredits: Makers of TimepulseInstallation 🧙‍♂️To summon the might of Timepulse into your realm, a simple pip command shall suffice:pipinstalltimepulseTimepulse: Unleash the Power of Time Series Processing and Modeling!Witness the seamless integration of temporal mastery into your coding sanctum!Journey into the Time Dimension ⏳Embark on an odyssey through time as you harness the Timepulse magic. Transform raw time series data into insights that transcend the ordinary. Your code, now a symphony of temporal brilliance!How to use timepulseImportfrom timepulse.models.nn import MultivariateDenseWrapper
from timepulse.utils.models import run_modelRun modely_pred, result_metrics = run_model(model_instance, X_train.values, y_train, X_val.values, y_val, verbose=0)Results example[ 8287547.5 10593171.  12349981.  13229407.  10743349.   8585146.
  7701900.   6690604.5  6193717.5  5999759.   5651086.5  5573535.5
  9689985.  12014953.  14384974.  14222123. ],

{'mae': 452268.53, 'mse': 452862200000.0, 'rmse': 672950.4, 'mape': 4.8490524, 'smape': 10.239903, 'mase': 0.31943747, 'r2_score': 0.94421965}Spellbinding Features ✨Temporal Alchemy:Shape time series data effortlessly.Predictive Sorcery:Unlock the future with powerful modeling.Intuitive Elixir:Simplify complexities with an enchantingly user-friendly interface.License 📜Timepulse - The SQD LicenseCredits: Makers of Timepulse 🌈Timepulse was conjured into existence by the brilliant minds at Squaredev. Their dedication to temporal excellence knows no bounds.Embark on a journey with Timepulse – where time meets brilliance, and magic unfolds! ✨🕰️🚀
Package: timepy
The simplest ever library for measuring time of python code execution.InstallationpipinstalltimepyHow to usefromtimepyimportTimerIt’s simple:t=Timer()t.start()# Your code which you want to measuret.stop()print(t.total_time)You can give a name fro your timer:t=Timer('My second timer')Keep every moment you wantYou cant=Timer()t.start()# Some heavy work 1t.commit('Work 1 is done')# Some heave work 2t.commit('Work 2 is done')t.stop()print(t.events)# will output:# [<TimerStarted: 0.0 s>,#  <TimerCommitted: 10.0 s (Work 1 is done)>,#  <TimerCommitted: 20.0 s (Work 2 is done)>,#  <TimerStopped: 20.001 s>]Measure your iterationst=Timer()t.startforiinsome_list:# do heavy workt.lap()t.stop()print(t.laps[0])# <Lap 0: 123 s>print(t.laps)# see all lapsprint(t.average_lap)# average lap duration