Saravanan666/pypi-org huggingface dataset:
Package: time_travel
time-travel - time and I/O mocking librarytime-travelis a python library that helps users write deterministic
tests for time sensitive and I/O intensive code.time-travelsupports python 2.7, 3.4, 3.5, 3.6 and pypy2 on both Linux
and Windows.Install$pipinstalltime_travelTesting Time Sensitive CodeImagine testing a state machine that times out after some time passes.
One way to test it would be:deftest_state_timeout():sm.handle_event(event=...)time.sleep(5)sm.handle_event(event=...)assertsm.state==TIMEOUTThis is bad for several reasons:Your test takes 5 seconds to run. That’s a no-no.time.sleep()promises that the process will sleepxsecondsat most. This test might fail randomly, depending on how sensitive your
state machine is.There’s nothing worse than a heisenbuild (well, perhaps aSLOWheisenbuild).
Here’s abetterway to do this usingtime-travel:deftest_state_timeout():withTimeTravel()astt:sm.handle_event(event=...)tt.clock.time+=5sm.handle_event(event=...)assertsm.state==TIMEOUTWhen thehandle_eventmethod is called it will probably check the time
using one oftimeordatetimemodules. These modules are patched bytime-traveland return the value stored inTimeTravel.clock.time.From now on, your time sensitive tests will run faster, accurately, and your
build will be consistent.Testing I/O Codetime-travelalso mocks I/O event interfaces such asselectandpoll.Testing code that usesselectis easy - you just inject a real socket object
and send data to it from your test code. But what about timeouts? Testing
behaviour that occurs on timeout forces you to actuallywait! That’s bananas!Here’s how you’d do it withtime-travel:deftest_select_timeout():withTimeTravel()astt:sock=socket.socket()tt.add_future_event(2,sock,tt.event_types.select.WRITE)start=time.time()assertselect.select([sock],[sock],[])==([],[sock],[])# This will be satisfied after "2 seconds"asserttime.time()==start+2# You see? 2 seconds!assertselect.select([sock],[sock],[],100)==([],[],[])# This is the "timeout"asserttime.time()==start+2+100Once again, this code will run instantly.Oh yes,sockdoesn’t even have to be a socket object :)For detailed information and usage examples, see thefull documentation. You know
you want to.LinksFull documentationPyPI project page
Package: timetravelpdb
timetravelpdb=============Enhances the Python Debugger to add the ability to travel back in time.Have you ever been using PDB to step through a program and suddenlyrealize you wish you could jump back in time and know what a variableused to contain?This version of PDB adds the ability to jump back in time to the stateof your program as it was in the past. You can examine variables andeven continue execution from that point forward (though that isdangerous because it may harm the time space continuum.)How it works:As you know, time is the 4th dimension. Every moment is anotheruniverse. Pretty trippy, eh?TTPDB simply records a pointer to the current universe before displayingthe input prompt. As you step through your program, each step records apointer to the past universes. The last 100 pointers are remembered. Youcan jump into any of those universes. Once in those universes you canexamine variables. Heck you can do anything you want because you arereally in that universe.Once you are done with that universe you can "pop up" back to theuniverse you left thanks to our time portal technology.Q: When I'm in another universe, can I run the code? A: Yes. However ifyou modify anything outside of your python process there's a chance youwill create a hole in the time-space continuum and destroy the universe.Q: Can I use the "record universe" function while in another universe?A: Of course! In fact, while in those past universes do a "ulist" to seethe universes recorded so far. You'll notice that there are fewer itemson the list. That's because when you were in that moment of time, theothers hadn't been recorded yet. Stepping through the program will nowmake a new branch of history. You can jump between those universes, popup back to where you came from, and so on. It can be a little confusingbut, heck, time travel always is.Q: Why did you release this on April Fools Day? A: Seemed like a goodidea at the time.Q: Is this to promote your "Time Management for System Administrators"book? A: This one? http://everythingsysadmin.com/books.html No, not atall. It's to promote my next book which won't be out until October 2014:The Practice of Cloud Administration.http://everythingsysadmin.com/2014/03/sneak-preview.html Oh, and itcertainly isn't promoting my RFC April Fools book: http://rfchumor.com/Q: Are you really traveling back in time? A: No. Everyone knows it isn'tpossible to actually travel back in time. All we have of the past is ourmemories. What this does is use a feature of the Unix kernel that hasbeen there since the 1970s to record a snapshot of absolutely everythingabout the process and jump between these memories. This feature isgreatly misunderstood by most Unix users.| The truth is that we can't go back in time. It would be nice if wecould. But we can't.| Instead we have our old memories and that has to be good enough. And,to be honest, what most of us need more than the abilty to travel backin time is the ability to let go of the past.Changes=========0.1.0 (2015-04-02)------------------- First version of timetravelpdb that can be installed from PyPI
Package: timetree
General transformation to make python objects persistentFree software: MIT licenseInstallationpip install timetreeDocumentationhttps://timetree.readthedocs.io/DevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.1.0 (2017-10-28)First release on PyPI.
Package: timetree-sdk
TimeTree SDK for PythonTimeTree APISDK for Python.Installing$ pip install timetree-sdkUsagefromtimetree_sdkimportTimeTreeApiapi=TimeTreeApi('API_ACCESS_TOKEN')calendar=api.get_calendar('CALENDAR_ID')print(calendar.data.attributes.name)# calendar nameAPIOauthget_oauth_authorize_urloauth_authorize_url=TimeTreeApi.get_oauth_authorize_url('CLIENT_ID','REDIRECT_URI','RESPONSE_TYPE','STATE')Userget_current_useruser=api.get_current_user()print(user.data.attributes.name)# user nameCalendarget_calendarscalenders=api.get_calendars()print(calenders.data[0].attributes.name)# first calender nameget_calendarcalendar=api.get_calendar('CALENDAR_ID')print(calendar.data.attributes.name)# calendar nameget_calendar_labelslabels=api.get_calendar_labels('CALENDAR_ID')print(labels.data[0].attributes.name)# first calender's label nameget_calendar_membersmembers=api.get_calendar_members('CALENDAR_ID')print(members.data[0].attributes.name)# first calender's member nameEventget_eventevent=api.get_event('CALENDAR_ID','EVENT_ID')print(event.data.attributes.title)# event titleget_upcoming_eventsevents=api.get_upcoming_events('CALENDAR_ID','Asia/Tokyo',7)print(events.data[0].attributes.title)# most recent event title in 7 dayscreate_eventevent=Event(data=EventData(attributes=EventAttributes(title='Title',category='schedule',all_day=False,start_at='2020-04-04T11:00:00.000Z',end_at='2020-04-04T13:00:00.000Z',description='Description',location='Location',start_timezone='Japan',end_timezone='Japan'),relationships=EventRelationships(label=EventRelationshipsLabel(data=EventRelationshipsLabelData(id='LABEL_ID',type='label')),attendees=EventRelationshipsAttendees(data=[EventRelationshipsAttendeesData(id='USER_ID',type='user')]))))response=api.create_event('CALENDAR_ID',event)print(response.data.attributes.title)# Titledelete_eventstatus_code=api.delete_event('CALENDAR_ID','EVENT_ID')print(status_code)# 204 on successupdate eventevent=Event(data=EventData(attributes=EventAttributes(title='Updated Title',category='schedule',all_day=False,start_at='2020-04-04T11:30:00.000Z',end_at='2020-04-04T13:30:00.000Z',description='Description',location='Location',start_timezone='Japan',end_timezone='Japan'),relationships=EventRelationships(label=EventRelationshipsLabel(data=EventRelationshipsLabelData(id='LABEL_ID',type='label')),attendees=EventRelationshipsAttendees(data=[EventRelationshipsAttendeesData(id='USER_ID',type='user')]))))response=api.create_event('CALENDAR_ID','EVENT_ID',event)print(response.data.attributes.title)# Updated TitleEvent Commentcreate comment to eventcomment=EventComment(data=EventCommentData(attributes=EventCommentAttributes(content='Hello, world')))event_comment=api.create_event_comment('CALENDAR_ID','EVENT_ID',comment)print(event_comment.data.attributes.content)# Hello, worldDocumentationOfficial API documentationEnglish:https://developers.timetreeapp.com/en/docs/apiJapanese:https://developers.timetreeapp.com/ja/docs/api
Package: timetric
A client for Timetric (http://timetric.com).Requirements (easy-installable, listed as prereqs in setup.py):httplib2python-dateutilsimplejsonOptionally, if you want to use OAuth authentication:oauthThis isnotlisted as a prereq, so it won’t be installed by default.Authentication setupYou’ll provide authentication information to theTimetricClientin a config
dict. Timetric supports two types of authentication: OAuth and API tokens. You
can choose a method using the'authtype'key to the config dict. The value
of this key can be'oauth'or'apitoken'; if not given it defaults to'oauth'.If an API token is being used, there must be keys for:‘apitoken_key’‘apitoken_secret’If OAuth is being used, there must also be keys for:‘consumer_key’‘consumer_secret’and if you have already done the necessary key exchange, then this can also
contain:‘access_key’‘access_token’OAuth setupThe first time you use the OAuth protocol, you’ll need to do some key exchange
with Timetric to set up your tokens.>>> import timetric# You need a config dict with at minimum your secret and key from Timetric
# (see the “Applications” pane of the settings page). In a real app you’ll
# want to make this config persistant (the shelve module is a lightweight
# place to start) because the library will store OAuth authentication
# information back to this config.
>>> conf = {‘authtype’:’oauth’,
…         ‘consumer_key: ‘XXX’,
…         ‘consumer_secret’: ‘XXX’}
>>> client = timetric.TimetricClient(conf)# The first time through you’ll need to authorize your key with Timetric
# by sending the user to an authorization request page.
>> token = client.get_request_token()
>>> import webbrowser
>>> webbrowser.open(client.get_authorize_url(token))# Once the user has authorized at that page, you can continue.
>>> access_token = client.get_access_token(token)# You can now re-authorize to use this token:
>>> conf.update({‘oauth_key’:access_token.key,
…              ‘oauth_secret’:access_token.secret})
>>> client = timetric.TimetricClient(conf)API token setup>>> import timetric# Having got your config dict from somewhere:
>>> conf = {‘authtype’:’apitoken’,
…         ‘apitoken_key’: ‘XXX’,
..          ‘apitoken-secret’: ‘XXX’}# you initialize the timetric client:
>>> client = timetric.TimetricClient(conf)Usage# There's no API method to get a list of a particular
# user's series, so you need to somehow "know" the series ID.
>>> series = client.series('p-DpewL0TO-iBE4nMBCTsQ')

# Get the latest value
>>> series.latest()
(1236707269.0, 2.0)

# Iterate over the whole dataset
>>> for (timestamp, value) in series:
...     print timestamp, value
1236463646.39 3.0
1236486562.94 5.0
1236493503.37 6.0

# Update given a single value
>>> series.update(14)

# Update given an iterable of (time, value) pairs
>>> import time
>>> data = [(time.time() - 100, 11), (time.time() + 100, 15)]
>>> series.update(data)

# Update given a file of CSV data
>>> series.update(open('/tmp/data.csv'))

# Clear all the data out of the series
>>> series.delete()
Package: timetunnel
timetunnel – An event collection and dispatching µservice.time-tunnel accepts timestamped events with loosely defined semantics
over a set of common APIs, and then dispatches those events on a
best-effort basis to various event sinks according to a ruleset that
is part of the configuration.The main goal is to offer clients a way to easily push their events to
one uniform event submission API of their choosing, and then go back and
concentrate on their actual task. Once those events hit the dispatcher,
they can be filtered and duplicated according to the needs of the event sinks.There’s a set of built-in implementations for both delivery APIs and
event sinks, and they can be extended with custom ones via a plugin system.Copyright ⓒ  2015 1&1 GroupLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: time-until
time-until-cliApplication that calculate time duration until reach a given date.Main objective: Understanding the logic ofPythonapp publishing and documenting it on a simple project.Usagetime_until22hApplication flow & use casesUsing CLI to calculate time duration to a given input date or timestamp.InputOutput / Responsetime-until 23hTime remaining: 8 hour(s) 22 minute(s) 42 second(s)time-until 2023-02-27Time remaining: 04 month(s) 14 day(s) 8 hour(s) 22 minute(s) 42 second(s)Main goalsBuild a Python app that works as a CLI (Command-line Interface) that receives a future date or time and returns a calculation of remaining time from now until that given date or time.Once working, this project must be configured and submitted as Python package thru PyPI Modules. The process of development, build, release and publishing is the core of the project, to understand it and provice ideas and thoghts of process automation.Feel free to initiate a discusison, open a issue or a pull request to this project. All kinds of contributions and ideas are welcome.Let's code!
Package: timeutilities
timeutilitiesDescriptiontimeutilities is for time manipulation and management with classes designed for handling multiple time functions.Installationpip3installtimeutilitiesExamplesGet current timefromtimeutilitiesimportTimenow=Time.now()From DateTimefromtimeutilitiesimportTimefromdatetimeimportdatetimenow=Time.from_datetime(datetime.now())Arithmetic operationsfromtimeutilitiesimportTimefromtimeimportsleepprevious_time=Time.now()sleep(5)current_time=Time.now()#Additiontotal_time=current_time+previous_timeprint(total_time)#Subtractiondifference=current_time-previous_timeprint(total_time)#Comparisonprint(current_time>previous_time)print(current_time<previous_time)print(current_time>=previous_time)print(current_time<=previous_time)DocumentationAvailiable athttp://astraldev.github.io/timeutilities
Package: timeutils
timeutilstimeutils is a Python package providing a set of methods and classes to
accurately measure elapsed time.DocumentationThe documentation is hosted onhttp://timeutils.readthedocs.ioInstallationLatest from thesource:git clone https://gitlab.com/cmick/timeutils.git
cd timeutils
python setup.py installUsingPyPI:pip install timeutilsExamples>>>fromtimeutilsimportStopwatch>>>sw=Stopwatch(start=True)>>>sw.elapsed_seconds16.282313108444214>>>str(sw.stop())'0:01:30.416023'>>>sw.elapsed.human_str()'1 min, 30 secs'
Package: time-utils
time_utilsBasic python package to time processes similar to a stopwatch.  This package also includes various pre-formated timestamps for sql, s3 key prefixes, and s3 glues prefixes.stopWatchA class intended to minimic the functionality of a stop watch.  The lap function will return a human readable string of how much total time was elapsed as well as the lap time.basic usage:>>>fromtime_utilsimporttime_utilsastu>>>sw=tu.stopWatch()>>>sw.lap()TotalTime:4second(s)Lap1:4second(s)datetime.timedelta(seconds=4,microseconds=218298)>>>sw.lap()TotalTime:15second(s)Lap2:11second(s)datetime.timedelta(seconds=11,microseconds=440822)preformatted datetime outputsAll functions default to utcnow(), however a datetime object can be passed in to any function.ts_dict>>>tu.time_utils.ts_dict(){'year':'2019','month':'12','day':'29','hour':'00','min':'24','sec':'43'}sql_ts>>>tu.time_utils.sql_ts()'2019-12-29 00:25:00's3_ts>>>tu.time_utils.s3_ts()'/2019/12/29/'s3_glue_ts>>>tu.time_utils.s3_glue_ts()'/year=2019/month=12/day=29/'
Package: time-util-wj
将 python 的 requests 代码转换成 curl 命令安装pipinstalltime-util-wj使用fromtime_util_wjimportTimeUtilprint(TimeUtil.get_current_time_str())###获取当前字符串格式化时间print(TimeUtil.get_current_time_unix())###获取当前时间戳print(TimeUtil.get_seven_days_ago_time_unix())print(TimeUtil.str_time_to_unix("2022-07-07 20:28:50"))print(TimeUtil.unix_time_to_str(1657197749260))print(TimeUtil.get_recently_day(-7,'unix'))print(TimeUtil.get_day_begin_unix())print(TimeUtil.get_day_end_unix(-4))print(TimeUtil.get_month_datetime_begin(datetime.datetime.now()))print(TimeUtil.get_month_datetime_end(datetime.datetime.now()))print(TimeUtil.compare_time(datetime.datetime.fromisoformat('2022-07-01 00:00:00'),datetime.datetime.fromisoformat('2022-05-31 23:59:59')))
Package: timevalue
TimevalueTimevalue is a simple Python package for finding the time value of moneypipinstalltimevalueFuture & Present Cli CommandsFind future value of money for $1000$ at $0.03%$ interest for $2$ periods:future1000.032#returns 1060.90Find present value of money for $1000$ at $0.03%$ interest for $2$ periods:present1000.032#returns 942.60Annuity Cli CommandAnnuities are payments are that are paid to you as a steady stream of income. Heres an example annuity.Q1. Find the future value of an annuity cash flow of $1000$ with and interest rate of $0.06$ for $3$ periods.annuity--future_value--cash_flow1000--interest_rate0.06--time3# returns 2673.011949461636Say we want calculate the annuity present value given the cash flow as the result from Q1, use the--present_valueand--pvflag to get the cash flow value:annuity--present_value--cash_flow2673.011949461636--interest_rate0.06--time3--pvHeres an example of growing annuity due.annuity--future_value--due--cash_flow1000--interest_rate0.06--time3--growth_rate.10Output:3709.576You can access the help by usingannuity --help.Import timevalue packageIn[1]:fromtimevalue.investingimporttime_value_moneyIn[2]:initialize=time_value_money.TimeValueOfMoney()In[3]:initialize.future_value_of_money(1000,.03,2)Out[3]:1060.9In[4]:initialize.present_value_of_money(1000,.03,2)Out[4]:942.5959091337544See moreexamples.
Package: timevec
timevecFunctions to create time vectorsDescriptionTime has a periodic nature due to the rotation of the earth and the position of the sun.
This affects human behavior in various ways.Seasonality ... periodicity in a year (seasonal distinction)Daily periodicity ... periodicity in a day (distinction between day and night)Day of the week ... periodicity in a week (distinction between weekdays and holidays)When dealing with these, it is desirable to vectorize with periodicity in mind.
That is, at 23:59 on a given day, it is desirable that the value is close to 00:00 on the next day.
To achieve this, the time is represented as a combination of cos and sin.
This is called a time vector.InstallationpipinstalltimevecUsageimporttimevec.numpyastvimportdatetimedt=datetime.datetime(2020,1,1,0,0,0)vec=tv.year_vec(dt)# array([1., 0.])Modulestimevec.numpyprovides functions that return numpy.ndarray.timevec.numpy_datetime64provides functions that return numpy.datetime64.timevec.builtin_mathprovides functions that return tuple of float.FunctionsAlmost same functions are provided intimevec.numpy,timevec.numpy_datetime64, andtimevec.builtin_math.
The difference is the return type.year_vecyear_vec(dt:datetime.datetime)Create a time vector for a year.
This is a vector that has periodicity like seasonality.
(Summer, Autumn, Winter, Spring)month_vecmonth_vec(dt:datetime.datetime)Create a time vector for a month.
This is a vector that has periodicity in a month.
You can express periodicity such as the beginning of the month, the end of the month, and the salary day.week_vecweek_vec(dt:datetime.datetime)Create a time vector for a week.
This is a vector that has periodicity in a week.
You can express periodicity such as weekdays and holidays.day_vecday_vec(dt:datetime.datetime)Create a time vector for a day.
This is a vector that has periodicity in a day.
You can express periodicity such as morning, noon, and night.Otherslong_time_vec... 1 to 5001 years periodmillennium_vec... one millennium (1000 years) periodcentury_vec... one century (100 years) perioddecade_vec... one decade (10 years) periodLicenseBSD 3-Clause License
Package: timew
A Python API for Timewarrior, originally by Tjaart van der Walt@tjaartvdwalt, now maintained here.  Archived original ison gitlab.InstallationFor this API to work, you needTimewarriorinstalledInstallation is easy from thePython Package IndexpipinstalltimewAPI DocumentationDocumentation is generated by Sphinx apidocs, from embedded docstrings
in napoleon format.  We generate.rstfiles, which are checked into
the repository and can be previewed online.Thetimewarriormodule contains the interesting docs, while the formal
doctree are rendered to anindexand a more concisemodulesfile.Examples>>>fromtimewimportTimeWarrior>>>timew=TimeWarrior()>>>timew.start(time=datetime(2018,8,15,9,0,0),tags=['my tag'])Tracking "my tag"
Started 2018-09-06T09:00:00
Current         07T13:20:45
Total              28:20:45>>>timew.cancel()Canceled active time tracking.>>>timew.delete(1)Deleted @1>>>timew.join(1,2)Joined @1 and @2>>>fromtimewimportDuration>>>fromdatetimeimporttimedelta>>>timew.lengthen(1,Duration(timedelta(minutes=30)))Lengthened @1 by 0:30:00>>>timew.move(1,datetime(2018,8,15,9,0,0))Moved @1 to 2018-09-05T09:00:00>>>timew.shorten(1,Duration(timedelta(minutes=10)))Shortened @1 by 0:10:00>>>timew.split(1)Split @1>>>timew.start(tags=['my tag'])Tracking "my tag"
Started 2018-09-07T13:37:00
Current               40:22
Total               0:03:22>>>timew.stop()Recorded "my tag"
Started 2018-09-07T13:37:00
Ended                 40:53
Total               0:03:53>>>timew.track(start_time=datetime(2018,9,7,11,0,0),end_time=datetime(2018, 9, 7, 12, 0, 0))
Tracking "from 20180907T110000 - 20180907T120000"
Started 2018-09-07T13:42:27
Current                  27
Total               0:00:00ContributingReport bugs, submit inquiries, or request features viaissues.Please submit apull requestfor modifications.  Make sure thedist,testanddocsMakefile targets work.  Docs need to be
kept generated during development, because they are checked in assets.The build environment and tools will contain themselves in a venv within
the source tree, and should not pollute your system.CommitsUse the following format for commit messages:X subsystem: summary description of change

long description text paragraphs
...where X is a single character from the following:/fix^removal-task/chore+feature/new=comment/code-equalAll text should [usually] be wrapped by 79 characters, especially the
summary line.For subsystem, use your best judgement, and look at previous commits
withgit log –onelineto get an idea and for consistency with
previous changes.  More than one level of subsystem can make sense.Please use interactive rebase to make commits look nice and have one
logical change each, with no merge commits.Thanks.