Saravanan666/pypi-org huggingface dataset:
Package: pytils-functions
pytilsUtils for data python projects. Simple, straightforward, but time saving.pickledays- decorator of class. Save the object state to the filesystem after it's initialization for some defined time. Load object after another call.singleton- decorator of class. Share object to all calls. There will be only one instance.logger- log the info messages to file, stream and discord.log- decorator of function. Log the function call into the logger.configurator- additional method for Dynaconf, which create variable in settings file.pandas_table- additional method for pandas, which save the DataFrame to specific sheet. Differs from standard df.to_excel by saving other sheets.InstallationFrom thePiPy:pip install pytils-functionsDirectly from github:pip install git+https://github.com/Whisperes/pytils.gitHow to logStraight logsLog to the handlers:discord webhook,streamhandlertimerotation file.For each handler you can set your own log level in the settings.toml file in your project (see Dynaconf package)from pytils.logger import logger

logger.debug("this is a debugging message")
logger.success("this is a success message")
logger.info("this is an informational message")
logger.warning("this is a warning message")
logger.notice("this is a notice message")
logger.error("this is an error message")
logger.critical("this is a critical message")
logger.log(89, "this is a number message")How to decorate functionsfrom pytils.logger import log

@log()
def my_function(a=[1,3], b=2, c=3):
    //do something

answer = my_function([11, 'beta'], 2, c=3)It will be loged like this:2022-09-02 18:13:25 my-pc |[3812] DEBUG Processing my_function: ([11, 'beta'], 2), {'c': 3}2022-09-02 18:13:25 my-pc |[3812] SUCCESS my_function: ([11, 'beta'], 2), {'c': 3}Add log levelAdditional levels added to logging module:SUCCESS (15)NOTICE (25)from pytils.logger import addLoggingLeveladdLoggingLevel('MY_LOG_LEVEL', 45)CasheCashe object to the diskfrom pytils.pickler import pickledays

@pickledays(period=2)
class A:
    def __init__(self, var):
        self.var = var

a = A(2)Object A will be saved for 2 days. New call A(2) will take the state of object from pickle file. Req: object have to be immutable.No duplicatesfrom pytils.singleton import Singleton_args


@Singleton_args
class A:
    def __init__(self, var):
        self.var = var

a = A(2)Just singleton this. Your object with sspecific set of args will be be the only one through the whole code.
Package: pytim
Pytim is a cross-platform python implementation of several methods
for the detection of fluid interfaces in molecular simulations: it
allows to identify interfacial molecules from the trajectories of
major molecular dynamics simulation packages, and run some analyses
specifically conceived for interfacial molecules, such as intrinsic
profiles.So far the following methods have been implemented:ITIMGITIMWillard ChandlerChacon TarazonaDBSCAN filteringPytim relies on the MDAnalysis package for reading/writing trajectories,
and work therefore seamlessly for a number of popular trajectory
formats, including:GROMACSCHARMM/NAMDLAMMPSAMBERDL_Poly
Package: pytimbr
timbr Python connector sample fileThis project is a sample connecting to timbr using Python.DependenciesPython 3.7.13+ or 3.8.x or 3.9.xJava 8 or Java 11InstallationInstall as clone repository:Install Python:https://www.python.org/downloads/release/python-3713/Install Java:https://www.oracle.com/il-en/java/technologies/javase/jdk11-archive-downloads.htmlRun the following command to install the Python dependencies:pip install -r requirements.txt(optional install pandas to run pandas example)Download the following jar tojarspath:https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/2.3.9/hive-jdbc-2.3.9-standalone.jarInstall using pip and git:pip install git+https://github.com/WPSemantix/timbr_python_connectorInstall using pip:pip install pytimbrSample usageFor an example of how to use the Python connector for Timbr, follow thisExample fileFor an example of using the Timbr Python connector with Pandas:Make sure you have the pandas library installed, or you can install it by runningpip install pandasFollow thisPandas Example FileCreate basic connectionCreate JDBC connection# username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.username='<TIMBR_USER>'# userpass - Should be the token value if using a token as a username, otherwise its the user's password.userpass='<TIMBR_PASSWORD>'# hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).hostname='<TIMBR_IP/HOST>'# port - Timbr default port 11000port='<TIMBR_PORT>'# ontology - the ontology / knowledge graph to connect to.ontology='<ONTOLOGY_NAME>'# enabled_ssl - Change to true if SSL is enabled.enabled_ssl='false'# Create new JDBC connectionconn=pytimbr.getJdbcConnection(f"jdbc:hive2://{hostname}:{port}/{ontology};transportMode=http;ssl={enabled_ssl};httpPath=/timbr-server",username,userpass)# Use the connection to execute a querywithconn.cursor()ascurs:# Execute querycurs.execute('SHOW CONCEPTS')# Fetch resultsconcepts=curs.fetchall()# Print the resultsforconceptinconcepts:print(concept)Create connection with params# username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.# userpass - Should be the token value if using a token as a username, otherwise its the user's password.# hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).# port - Timbr default port 11000# ontology - the ontology / knowledge graph to connect to.# enabled_ssl - Change to true if SSL is enabled.conn=pytimbr.getConnection(hostname='<TIMBR_IP/HOST>',port='<TIMBR_PORT>',ontology='<ONTOLOGY_NAME>',username='<TIMBR_USER>',password='<TIMBR_PASSWORD>',enabled_ssl='false')# Use the connection to execute a querywithconn.cursor()ascurs:# Execute querycurs.execute('SHOW CONCEPTS')# Fetch resultsconcepts=curs.fetchall()# Print the resultsforconceptinconcepts:print(concept)
Package: pytimbr-api
timbr REST API connector sample fileThis project is a sample connecting to timbr using REST API from Python.DependenciesPython 3.7.13+ or 3.8.x or 3.9.xInstallationInstall as clone repository:Install Python:https://www.python.org/downloads/release/python-3713/Install using pip and git:pip install git+https://github.com/WPSemantix/timbr_python_httpInstall using pip:pip install pytimbr-apiSample usageFor an example of how to use the REST API connector for Timbr, follow thisExample fileExecute query with http connection# For http connectionsresponse=timbr.executeQuery(hostname='<TIMBR_IP/HOST>',port='<TIMBR_PORT>',ontology='<ONTOLOGY_NAME>',token='<USER_TOKEN>',query='<TIMBR_QUERY>',enabled_ssl=False,verify_ssl=<True/False>,nested='<true/false>')# hostname - The IP / Hostname of the Timbr platform.# port - Timbr default port 443# ontology - the ontology / knowledge graph to connect to.# token - Timbr token value.# query - The query that you want to execute.# nested - Change to true if nested flag needs to be enabled.print(response)Execute query with https connection# For https connectionsresponse=timbr.executeQuery(hostname='<TIMBR_IP/HOST>',port='<TIMBR_PORT>',ontology='<ONTOLOGY_NAME>',token='<USER_TOKEN>',query='<TIMBR_QUERY>',enabled_ssl=True,verify_ssl=<True/False>,nested='<true/false>')# hostname - string - The IP / Hostname of the Timbr platform.# port - string - Timbr default port 443.# ontology - string - The ontology / knowledge graph to connect to.# token - string - Timbr token value.# query - string - The query that you want to execute.# enabled_ssl - boolean - Use True for https connection and False for http connection.# verify_ssl - boolean - Verifying the target server’s SSL Certificate, use False to diable this proccess.# nested - string - Change to 'true' if nested flag needs to be enabled. make sure this flag contains string value not bool value.print(response)
Package: pytime
PyTime is an easy-use Python module which aims to operate
date/time/datetime by string.PyTime allows you using nonregular datetime string to generate and
calculate datetime at most situation.It Also provides you some simple useful methods for getting datetime you
want.InstallpipinstallpytimeSample UsageCalculatedatetimeall by string, accept unit for short or overall
length, support out of order or in capital unit:>>>frompytimeimportpytime>>>>>>pytime.before('2015.5.17','2years 3mon 23week 3d 2hr')# 2years 3months 23weeks 3days 2hours before 2015.5.17datetime.datetime(2012,9,5,22,0)>>>>>>pytime.after(pytime.tomorrow('15.5.17'),'23month3dy29minu')# 23months 3days 29minutes after 2015-5-17's next daydatetime.datetime(2017,4,21,0,29)Parse nonregular datetime string to datetime:>>>pytime.parse('April 3rd 2015')datetime.date(2015,4,3)>>>pytime.parse('Oct, 1st. 2015')datetime.date(2015,10,1)>>>pytime.parse('NOV21th2015')datetime.date(2015,11,21)>>>>>>pytime.parse('2015517')datetime.date(2015,5,17)>>>>>>pytime.parse('5/17/15')datetime.date(2015,5,17)>>>>>>pytime.parse('92-11-2')datetime.date(1992,11,2)>>>>>>pytime.parse(1432310400)# support datetimestamp for all functiondatetime.datetime(2015,5,23,0,0)Calculate week and month in a easy way. Normally we want to use these
binate date in script, from Monday to next Monday which means
00:00:00-23:59:59, and Month from 1st to next 1st in the same way, but
if you want clean date interval, you could setpytime.next_week(clean=True)to get the clean date for next week
etc.>>>pytime.this_week()(datetime.date(2015,5,11),datetime.date(2015,5,18))>>>pytime.next_week('2015-6-14')# 2015-6-14's next week for script(datetime.date(2015,6,15),datetime.date(2015,6,23))>>>pytime.last_week(pytime.mother(2013),True)# 2013 Mother's Day's last week(datetime.date(2013,5,13),datetime.date(2013,5,20))>>>pytime.next_month('2015-10-1')(datetime.date(2015,11,1),datetime.date(2015,12,1))Pytime support calculate timedelta by string even betweendateanddatetime, merely set thedateto that day’s midnight:>>>pytime.count('2015-5-17 23:23:23',pytime.tomorrow())datetime.timedelta(1,84203)Get common festivals for designated year:>>>pytime.father()# Father's Daydatetime.date(2015,6,21)>>>>>>pytime.mother(2016)# 2016 Mother's Daydatetime.date(2016,5,8)>>>>>>pytime.easter(1999)# 1999 Easterdatetime.date(1999,4,4)>>>pytime.vatertag(2020)# Fater's Day in Germanydatetime.date(2020,5,21)Get days between two date.>>>pytime.days_range('2015-5-17','2015-5-23')[datetime.date(2015,5,23),datetime.date(2015,5,22),datetime.date(2015,5,21),datetime.date(2015,5,20),datetime.date(2015,5,19),datetime.date(2015,5,18),datetime.date(2015,5,17)]…and other useful methods.ContributorsSinuxfelipevolponefyJoshua DongDinko PeharLicenseMIT
Package: pytimeago
Convert time deltas into phrases like “5 minutes ago”,
“3 hours ago”, “2 days ago” etc.This package has a number of modules in it, each for separate
language.  It is standard that module pytimeago.X has function
X, which accepts at least on argument – number of seconds
between two events.  It may also accept extra keywords, which
should be documented in the docstring of the function.
Returned is always unicode string.Usage pattern:from pytimeago.english import english
from time import time, sleepa = time()
# …do something here…
delta = int(time() - a)  # could use sometimedetal.total_seconds()
print “job started %s” % english(delta)Prints, e.g.job started 15 minutes agoAvailable languages are:from pytimeago.english import english
from pytimeago.english import english_short
from pytimeago.french import frenchLicenced under GNU Lesser General Public License,
you can get a copy at:http://www.gnu.org/licenses/lgpl.htmlWritten by Adomas Paltanavicius (adomas.paltanavicius@gmail.com).
Packaged, french added, and computation enhanced by Stephane “Twidi” Angel (s.angel@twidi.com)
Package: py-time-between
py-time-betweenOrdinary package to say if a time variable falls between two given times.Motivation: I was working in a test to a job opening, and I needed it, but I did not want google this. I know that exists a lot of code like this.Usage:is_time_between(testing_time, start_time_inclusive, end_time_inclusive)from datetime import time
from timebetween import is_time_between


def test_is_time_between():
    t, s, e = time(0), time(0), time(0)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 1), time(0), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 1), time(0, 0, 0, 1), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 0, 2), time(0, 0, 0, 1), time(0, 0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(0, 0, 1), time(23, 59, 59), time(0, 0, 2)
    assert is_time_between(t, s, e)

    t, s, e = time(12, 0, 0), time(23, 59, 59), time(0, 0, 0)
    assert is_time_between(t, s, e)

    t, s, e = time(23, 59, 57), time(23, 59, 59), time(23, 59, 57)
    assert is_time_between(t, s, e)

    t, s, e = time(23, 59, 58), time(23, 59, 59), time(23, 59, 57)
    assert not is_time_between(t, s, e)

    t, s, e = time(22), time(22), time(5, 59, 59)
    assert is_time_between(t, s, e)

    # Hey, did you see a uncovered test case?
    # Please, open a PR.
Package: pytimechart
pyTimechart is aimed at helping kernel developer to browse into large scale traces.Based on very powerful and efficient plotting libraryChaco, pytimechart UI feels very smooth.Based on the python language, its plugin based architecture allow developer to very quickly implement
parsing and representation of new trace-event function-trace or trace_printkKernel traces are parsed as trace-events, and organised into processes, each process
is displayed in its own line. The x-axis representing the time, process is represented
as intervals when it is scheduled in the system.pyTimechart processes are not onlyprocessin the common unix sense, it can be any group
of activities in the system. Thus pytimechart display activities of:cpuidle statescpufreq statesruntime_pmirqstaskletsworkstimerskernel threadsuser processwhatever there is a plugin forpyTimechart also represent graphically the wakeup events between two process.
Package: pytimecode.py
Module for manipulating SMPTE timecode. Supports 60, 59.94, 50, 30, 29.97, 25, 24, 23.98 frame rates in drop and non-drop where applicable, and milliseconds. It also supportsoperator overloading for addition, subtraction, multiplication, and division.iter_return sets the format that iterations return, the options are "tc" for a timecode string,"frames" for a int total frames, and "tc_tuple" for a tuple of ints in the following format,(hours, minutes, seconds, frames).Notes: *There is a 24 hour SMPTE Timecode limit, so if your time exceeds that limit, it will roll over.*2 PyTimeCode objects of the same frame rate is the only supported way to combine PyTimeCode objects,for example adding them together.Copyright Joshua Banton
Package: pytime-converter
PyTime ConverterEasily manage differenttime interval valuesand convert them tomilliseconds.How To useAvailable time formatsUnit MeasureAllowed Siglesdefaultmillisecondsms,milliseconds,secXsecondsseconds,s,secminutesmin,minute,minuteshoursh,hours,hrs,hourdaysd,days,dayyearsy,years,yrs,yearSimply using theget_milliseconds_value_for_inputwith the string value to convert. The below example use the number value90and the sigles.frompytime_converter.service.convert_serviceimportget_milliseconds_value_for_inputjob_time='90 seconds'assert90000==get_milliseconds_value_for_input(job_time)When the time measure unit is missing the default value ismillisecondsfrompytime_converter.service.convert_serviceimportget_milliseconds_value_for_inputassert90==get_milliseconds_value_for_input('90')# Using secondsassert9000==get_milliseconds_value_for_input('9 seconds')assert9000==get_milliseconds_value_for_input('9 s')assert9000==get_milliseconds_value_for_input('9 sec')Getting StartedThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.PrerequisitesPoetry >=0.12Python ^3.5Virtualenvwrapper or other virtualenv environmentmake utilityInstallingInstall it with pypipip install pytime-converterOr Clone/download the repositorygit clone https://github.com/massicer/Env-Time-Converter.gitInstall project packagemake installor without the make utilitypoetry installRunning the testsClone the rempo and simply typemake testAuthorsMassimiliano Ceriani-Initial work-PYTime ConverterLicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for details
Package: py-timed-cache
timed-cachePure Python timed-cache that behaves like a regulardict.
Can also be used as a decorator to cache function calls (works for async functions as well).Installationpip install py-timed-cacheExamplefromtimedcacheimportTimedCachemy_cache=TimedCache(1)# 1 second cachemy_cache["foo"]="bar"# all dict methods works as if it was a normal dictfork,vinmy_cache.items():print(k,v)# will print foo bar# Also works for functions@TimedCache(5)deffoo(number):# some expensive compute...print("begin computation...")result=number*10**30print("end computation")returnresbig_number=foo(42)# cache MISS ==> this will print both statements abovebig_number_again=foo(42)# Called with same argument(s) ==> cache HIT, returns immediatelyPython versionsPython >= 3.6 are supportedTestsThis project usesunittest.Runpython tests/test_timedcache.py
Package: pytimeextractor
The project was developed byDigamma.ai. The goal of the project is
to develop a library to find and extract time/date information from
textual documents.Why Should I Use This?The main goal is to identify texts fragments that are related to
time/date/period (exact date, time of day, day of the week, months,
seasons, time intervals, etc.) and make structural forms from them. We
tried to detect a variety of textual representations and handle things
like recurring times (e.g. “every Wednesday”).Installation$ pip install pytimeextractorYou can also download or checkout the latest code and install from the source:$ python setup.py installUsageTo use it, simply do:>>> from pytimeextractor import ExtractionService
>>> text = "from winter to summer"
>>> ExtractionService.extract(text)APySettingscan be applied to specify some additional extraction
options, like setting local user date/time, time-zone offset, filtering
extraction rules and finding latest dates.PySettingsBuilderis used for constructingPySettingsinstance
when you need to set configuration options other than the default.PySettingsBuilderis best used by creating it, and then invoking its
various configuration methods, and finally calling build method.>>> from pytimeextractor import PySettingsBuilder
>>> settings = (PySettingsBuilder()
...          .addRulesGroup('DateGroup')
...          .excludeRules("relativeDateRule")
...          .addUserDate("2017-10-23T18:40:40.931Z")
...          .addTimeZoneOffset("2")
...          .includeOnlyLatestDates(True)
...          .build()
...         )
>>> ExtractionService.extract(text, settings)
Package: pytimeir
pytimeirA simple package to get events and holidays fromtime.irGetting StartedInstall the package with:pip install pytimeirUsageimportpytimeir# get holidays for a yeardf=pytimeir.get_holidays(1401)# get holidays for a range of yearsdf=pytimeir.get_holidays(1390,1410)# get events for a yeardf=pytimeir.get_events(1401)# get events for a range of yearsdf=pytimeir.get_events(1390,1410)
Package: pytimekr
PyTimeKR은PyTime의 포크로 대한민국의 공휴일 등 을 추가하였습니다.설치pipinstallpytimekr간단 사용법>>>frompytimekrimportpytimekr>>>>>>chuseok=pytimekr.chuseok()# 추석>>>printchuseokdatetime.date(2015,9,27)>>>>>>pytimekr.red_days(chuseok)# 추석 연휴[datetime.date(2015,9,26),datetime.date(2015,9,27),datetime.date(2015,9,28),datetime.date(2015,9,29)]>>>>>>ly=pytimekr.lunar_newyear(1995)# 1995년도 설날>>>printlydatetime.date(1995,1,31)다른 공휴일>>>pytimekr.hangul()# 한글날datetime.date(2015,10,9)>>>>>>pytimekr.children()# 어린이날datetime.date(2015,5,5)>>>>>>pytimekr.independence()# 광복절datetime.date(2015,8,15)>>>>>>pytimekr.memorial()# 현충일datetime.date(2015,6,6)>>>>>>pytimekr.buddha()# 석가탄신일datetime.date(2015,5,25)>>>>>>pytimekr.samiljeol()# 삼일절datetime.date(2015,3,1)>>>>>>pytimekr.constitution()# 제헌절datetime.datetime(2015,7,17)>>>>>>pytimekr.constitution()# 제헌절datetime.datetime(2015,7,17)LicenseMIT
Package: pytimelib
pytimelibpytimelib is a simple model for python to do time conversion.python 3It is base on arrow library and pytz libraty, making it easy to use aware time and native time conversion.InstallationFrom PyPi:$ pip install pytimelibBasic Usagecover datetime to timestamp:importtimeimportdatetimefrompytimelibimportTimeLibdate_time=datetime.datetime.now()timestamp=TimeLib.datetime_to_timestamp(date_time)date_time=TimeLib.timestamp_to_datetime(timestamp)datetime to timestamp conversion by timezone:for example:importtimeimportdatetimefrompytimelibimportTimeLibdate_time=datetime.datetime.utcnow()print("datetime to timestamp by timezone(from UTC):")timestamp=TimeLib.datetime_to_timestamp_by_timezone(date_time,from_tz="UTC")print(timestamp)print("timestamp to datetime by timezone(UTC to Los Angeles):")date_time=TimeLib.timestamp_to_datetime_by_timezone(timestamp,to_tz="America/Los_Angeles")print(date_time)datetime and timeString conversion by timezone:for example:importtimeimportdatetimefrompytimelibimportTimeLib# datetime and timeString by timezoneprint("datetime to timeString by timezone(UTC to Los Angeles):")date_time=datetime.datetime.utcnow()time_str=TimeLib.datetime_to_datetime_str_by_timezone(date_time,to_tz="America/Los_Angeles")print(time_str)print("timeString to datetime by timezone(Los Angeles to UTC):")date_time=TimeLib.datetime_str_to_datetime_by_timezone(time_str,from_tz="America/Los_Angeles",to_tz="UTC")print(date_time)Learning moreCheck the documentation for more examples or read test cases in unit test code.Change LogChange LogDiscussingsubmit issueemail:henry_czh@foxmail.com
Package: pytime-manager
Improves work with time.# Time Manager.frompytime_managerimport*frompytime_manager.ucimport*# Translate one year into days.print(translate_time(1,YEAR,DAY))# => 365# Or...print(translate_time_y(1,DAY))# => 365# Make sure to add this line so everything will work!set_translate_time(translate_time)# translate_time is located in time_manager.uc.# Print 'Hello!' after three seconds.time_thread(call_after(lambda:print('Hello!'),3# or Delay((3, SECOND))))# Print 'Hello!' and after three seconds print 'Bye!'.time_thread(call_after2(lambda:print('Hello!'),lambda:print('Bye!'),3# or Delay((3, SECOND))))# Print message for three seconds.time_thread(do_for(lambda:print('Print me for three seconds.'),3# or Delay((3, SECOND))))# Print message three times with one second delay.time_thread(do(lambda:print('print me 3 times with one second delay'),1,3))# Print message and wait three seconds.do_and_wait(lambda:print('Hi!'),3)# Blocking Time Thread VS Time Thread.blocking_time_thread(do(lambda:print('Hello 1'),1,5))# Uses virtual 'main' thread.print('Application thread is unblocked but still unable to call blocking another time thread.')blocking_time_thread(do(lambda:print('Hello 2 (Not going to print because its blocked for me)'),1,5))# Uses virtual 'main' thread.blocking_time_thread(do(lambda:print('Hello 3 (I\'m from another thread so I don\'t care.)'),1,5),thread='other_thread')# Uses virtual 'other_thread' thread.time_thread(do(lambda:print('I\'m going to be printed because i\'m free time thread.'),1,5))# Schedule function calling.time_thread(do_every(lambda:print('Hello!'),Delay((1,MINUTE),(30,SECOND),(2.5,SECOND)),# 1min 32.5s (92.5s) [example: [(1, DAY), (12, HOUR)] => 1 day, 12 hours] : OR : 60 + 30 + 2.5 = 32.5s (32.5 [float]).False# Once?))# Do some things while blocked.time_thread(do_while_blocked(lambda:print('Blocked!'),lambda:wait(3)))Adds more than 15 functions to improve work with time, and a lot more things.TimeManager Cheatsheet.UnitConverter Cheatsheet.