Saravanan666/pypi-org huggingface dataset:
Package: bushi
BushiThis package contains functions to handle commands in aLinuxbased terminal.
The main purpose of this package is to replaceShell Scriptwith a simplierPythonbased functions.TargetVersion 1.0MajorTerminal input and output formatting.(done since0.1.0)Manage multiple sessions withtmuxcommand.(done since0.3.0)Build aROSbased package withcolconcommand.Manage aGitrepository withgitcommand.Manage anAPTpackage withapt-getcommand.Minorcmd.run()must preserve the output formating.(aborted,cmd.run()changes to not pipe output)ChangelogsVersion 0.3.0(14/03/2020)Addtmuxclass that handle multiple session with the following functionalities:Check existence of a session usingtmux.session_exist().Kill a session usingtmux.session_kill().Detach from current session usingtmux.detach().Run a separate process with output on different session usingtmux.session_run()with the following functionalities:It will callbushi-tmux-runnerthat handle how the process is called and how it return the process returncode to the parent process.It uses to replacetmux.run()where we want to do a process while viewing its output.Process failed when thetmuxsession was detached.On keyboard interrupt, or when the process failed, it will continue with detaching the current session.Modify functions inioas follow:Change how a process thread is called, it will only be created when needed, else it will be destroyed.Callio.process_stop()instead of changingio.__process_textto stop the process thread.Addio.press_enter()function that try to wait forenterkey before continue the program.Addio.ask_yes_no()function that will ask question that acceptyesornoinput and return that value asTrueandFalserespectively.
If the input is invalid, it will terminate the program.Modify a function incmdas follow:Changecmd.run()to callsubprocess.run()instead ofsubprocess.pOpen()that pipe the output to the parent process.Version 0.2.0(13/03/2020)Addcmdclass that handle subprocess run with the following functionalities:run()to run a subprocess with outputs.runmuted()to run a subprocess without any outputs.Addpathclass that handle files and directories with the following functionalities:Check existence of files and directories usingisfile(), andisdir().Get and change working directory usinggetdir()andchangedir()respectively.Some others functionality that also exist in theos.path.Modify functions in theioas follow:Change how output should behave.Modify output format for the process command.Change how process symbol be animated.Output the duration in the process command.Version 0.1.0(12/03/2020)Addioclass that handle terminal input and output with the following functionalities:Output to the terminal usinginfo(),warn(),fail(),succes(),info_list(),warn_list(),fail_list(),success_list(), andprocess().Input from the terminal usingask(), andask_secret().Both input and output will emphasize a string between*.(ex:*here*)Exit current process usingterminate().
With empty argument, this function will return0.
Else, it will output the arguments and return1.
Package: bushk
QuickstartWhat doesbushkdo?Get data of the bus stop in Hong KongGet data of route in Hong KongGet ETA of bus in Hong KongInstallbushkpipinstallbushkGet data of the bus stopHow can I get data of the bus stop?Copy or reference codeRun your Python fileExample Codeimportbushk@bushk.runnerasyncdef_stop():stop=awaitbushk.Stops.get("ID OF STOP")print(f"{stop.id}:{stop.name['en']}")Get data of the routeHow can I get data of the bus stop?Copy or reference codeRun your Python fileExample Codeimportbushk@bushk.runnerasyncdef_route():route=awaitbushk.Routes.get("NUMBER OF THE ROUTE","direction OF THE ROUTE(O, I, OUTBOUND, INBOUND, OB OR IB)(OPTIONAL)","SERVICE TYPE OF THE ROUTE(1 OR 2)(OPTIONAL)")print(f"Route:{route.route}\nNormal:{route.normal}\nBound:{route.bound}")Check ETA of BusHow can I get ETA of bus?Copy or reference codeRun your Python fileExample Codeimportbushk@bushk.runnerasyncdef_eta():route=awaitbushk.Routes.get("NUMBER OF ROUTE WHICH YOU WANT TO CHECK THE ETA OF THE BUS")foretainawaitbushk.ETA.get_route(route):print(f"{bushk.Stops.get(route.stops_id[eta.seq]).name['en']}:{eta.arrive_at}({eta.rmk})")
Package: busie-consumer
Busie ConsumerA base consumer package for Busie projects. Abstracts polling and configuration setup away from the end user and exposes basic api for starting the poll process.Installationpip install busie-consumerUsagefrombusie_consumerimportBaseConsumerCONFIG={'bootstrap.servers':'localhost:9092',# Other Config as necessary}consumer=BaseConsumer(topics=['some-topic','another'],config=CONFIG)formessageinconsumer.start():handle_message(message)# It may also be helpful to extend this base class and provide helper methodsclassHigherLevelConsumer(Consumer):defhandle_message(self,message):# process the messagereply_topic,reply=determine_reply(message)self.send_reply(topic=reply_topic,message=reply,key=message.key())consumer=HigherLevelConsumer(topics=['topic'],config=CONFIG)formsginconsumer.start():consumer.handle_message(msg)APIBaseConsumerPublic MethodsBaseConsumer(topics=None, config=None): Constructorrequiredparamtopics: An iterable of strings containing topic namesrequiredparamconfig: Adictcontaining Kafka configNoteconfigmust havebootstrap.serversandgroup.identriesstart(): Generator methods. initiates polling. returns a generatorclose(): Closes the consumersend_reply(topic=None, message=None, key=None): Invokes a producer and uses it to send a reply to the desired topic. Especially helpful for theSaga OrchestratorPatternNoteThe producer assumes the same config as the consumer classrequiredparamtopic: A string representing the desired topic namerequiredparammessage: The data to send to the desired topic.requiredparamkey: The desired key for the message
Package: busie-random-password-generator
Random Password GeneratorA cryptographically random and secure password generator which relies only on the standard python libraryInstallationpython3 -m pip install busie-random-password-generatorUsagefromrandom_password_generatorimportgenerate_random_password# password with default options (at least one upper, lower, special, and number character. 8 ≤ length ≤ 25)password=generate_random_password()# password of specified minimum length. must be between 8 and 25password=generate_random_password(length=15)# password without special characterspassword=generate_random_password(special=False)# password without capital letterspassword=generate_random_password(uppercase=False)#password without lowercase letterspassword=generate_random_password(lowercase=False)# password without numberspassword=generate_random_password(numbers=False)Can also be run usingpython3 -m generate_random_password
Package: business_calendar
business_calendarbusiness_calendaris a Python package that implements simple business days
calculations. You can use a custom work week and a holiday list.DocumentationYou can find the latest documentationhere.Examplefrombusiness_calendarimportCalendar,MO,TU,WE,TH,FRimportdatetimedate1=datetime.datetime(2013,1,10)# normal calendar, no holidayscal=Calendar()date2=cal.addbusdays(date1,25)print('%sdays between%sand%s'%\(cal.busdaycount(date1,date2),date1,date2))# don't work on Fridays? no problem!cal=Calendar(workdays=[MO,TU,WE,TH])date2=cal.addbusdays(date1,25)print('%sdays between%sand%s'%\(cal.busdaycount(date1,date2),date1,date2))# holiday? no problem!cal=Calendar(workdays=[MO,TU,WE,TH],holidays=['2013-01-17'])date2=cal.addbusdays(date1,25)print('%sdays between%sand%s'%\(cal.busdaycount(date1,date2),date1,date2)LicenseMITHistory0.1.0 (2014-06-22)Initial release.0.2.0 (2015-12-27)Fixed bug in work day calculation when end date was not a work day.0.2.1 (2015-12-27)Fixed distribution issues.
Package: businessdate
Python librarybusinessdateA fast, efficient Python library for generatingbusiness datesfor simple and fast date operations.>>>frombusinessdateimportBusinessDate>>>BusinessDate(2017,12,31)+'2 weeks'BusinessDate(20180114)>>>BusinessDate(20171231)+'2w'# same but shorterBusinessDate(20180114)>>>BusinessDate(20180114).to_date()datetime.date(2018,1,14)Typical banking business features are provided likeholiday adjustmentsto move dates away from weekend days orholidays. As well as functionality to getyear fractionsdepending onday count conventionsas the lengths of interest payment periods.Beside datesbusiness periodscan be created for time intervals like10Y,3 Monthsor2b.
Those periods can easily be added to or subtracted from business dates.Moreoverrangestyleschedule generatorare provided to systematic build a list of dates.
Such are used to set up a payment schedule of loan and financial derivatives.Example Usage>>>fromdatetimeimportdate>>>frombusinessdateimportBusinessDate,BusinessPeriod>>>BusinessDate(year=2014,month=1,day=11)BusinessDate(20140111)>>>BusinessDate(date(2014,1,11))BusinessDate(20140111)>>>BusinessDate(20140111)BusinessDate(20140111)>>>BusinessDate('20140111')BusinessDate(20140111)>>>BusinessDate('2015-12-31')BusinessDate(20151231)>>>BusinessDate('31.12.2015')BusinessDate(20151231)>>>BusinessDate('12/31/2015')BusinessDate(20151231)>>>BusinessDate(42369)BusinessDate(20151231)>>>BusinessDate(20140101)+BusinessPeriod('1Y3M')BusinessDate(20150401)>>>BusinessDate(20140101)+'1Y3M'BusinessDate(20150401)>>>BusinessDate(20170101)-'1Y1D'BusinessDate(20151231)>>>BusinessDate()==BusinessDate(date.today())True>>>BusinessDate('1Y3M20140101')BusinessDate(20150401)For more examples see thedocumentation.InstallThe latest stable version can always be installed or updated via pip:$pipinstallbusinessdateDevelopment VersionThe latest development version can be installed directly from GitHub:$pipinstall--upgradegit+https://github.com/sonntagsgesicht/businessdate.gitor downloaded fromhttps://github.com/sonntagsgesicht/businessdate.ToDodecide which base class or inheritance forBusisnessDateis better:BaseDateFloat(floatinheritance)BaseDateDatetimeDate(datetime.dateinheritance)2. store businessdays adjustment convention and holidays as private property ofBusinessDate.
The information should not get lost underBusinessPeriodoperation.
Decide which date determines convention and holidays of aBusinessRange.ContributionsIssuesandPull Requestsare always welcome.LicenseCode and documentation are available according to the Apache Software License (seeLICENSE).
Package: business-duration
Business_DurationCalculates business duration in days, hours, minutes and seconds by
excluding weekends, public holidays and non-business hoursHow to install the packagepip install business-durationExample 1frombusiness_durationimportbusinessDurationimportpandasaspdimportholidaysaspyholidaysfromdatetimeimporttime#Start date must be in standard python datetime formatstart_date=pd.to_datetime('2017-07-01 02:02:00')#Start date must be in standard python datetime formatend_date=pd.to_datetime('2017-07-07 04:48:00')#Business open hour must be in standard python time format-Hour,Min,Secbiz_open_time=time(7,0,0)#Business close hour must be in standard python time format-Hour,Min,Secbiz_close_time=time(17,0,0)#US public holidaysUS_holiday_list=pyholidays.US(state='CA')#Business duration can be 'day', 'hour', 'min', 'sec'unit_hour='hour'#Printing outputprint(businessDuration(startdate=start_date,enddate=end_date,starttime=biz_open_time,endtime=biz_close_time,holidaylist=US_holiday_list,unit=unit_hour))#Result#30.0#Result is 30 hours because July 1st, 2nd are weekends and 4th is US public holiday. So 3 days remains with 10 business hours per day. 3 days*10 hours = 30 HoursExample 2frombusiness_durationimportbusinessDurationfromdatetimeimportdatetimestart_date=datetime.strptime("2018-01-01","%Y-%m-%d").date()end_date=datetime.strptime("2018-03-31","%Y-%m-%d").date()print(businessDuration(startdate=start_date,enddate=end_date,unit='day'))#Result65.0Example 3frombusiness_durationimportbusinessDurationimportpandasaspdimportholidaysaspyholidaysfromdatetimeimporttime,datetime#Reading input fileinputdata=pd.read_excel('Sample.xls')#Converting to standard Python datetime formatinputdata.sys_created_on=pd.to_datetime(inputdata.sys_created_on,format='%Y-%m-%d%H:%M:%S')inputdata.resolved_at=pd.to_datetime(inputdata.resolved_at,format='%Y-%m-%d%H:%M:%S')#Business open hourbiz_open_time=time(8,0,0)#Business close timebiz_close_time=time(17,0,0)#Weekend list. 5-Sat, 6-Sunweekend_list=[5,6]#Custom US holidaysUS_holiday_list={datetime(2018,1,1).date():"New Year's Day",datetime(2018,5,28).date():"Memorial Day",datetime(2018,7,4).date():"Independence Day",datetime(2018,9,3).date():"Labor Day",datetime(2018,11,22).date():"Thanksgiving",datetime(2018,12,25).date():"Christmas Day"}#Business duration 'day','hour','min','sec'unit_hour='hour'#Applying the function to entire dataframefromitertoolsimportrepeatinputdata['Biz_Hour']=list(map(businessDuration,inputdata.sys_created_on,inputdata.resolved_at,repeat(biz_open_time),repeat(biz_close_time),repeat(weekend_list),repeat(US_holiday_list),repeat(unit_hour)))
Package: businesslen
businesslenOverviewThis Python package calculates the business hours/days* between two datetimes.
It is possible to customize the work week schedule and list of holidays.The default work week schedule is 9 AM to 5 PM, Monday to Friday, with a lunch
break from 12 PM to 1 PM. The default holiday schedule is US from the packageholidays.* Business days are eight-hour workday.Installationpip install businesslenUsagefrom datetime import datetime

from businesslen import BusinessLen


start_dt = datetime(2020, 2, 10, 8, 5, 12)
end_dt = datetime(2020, 2, 12, 16, 37, 28)

bl = BusinessLen()
bl.hours(start_dt, end_dt) # 20.62
bl.days()  # 2.58Documentationdef __init__(workweek_schedule, lunch_hour, offdays):
    """"Keyword arguments:
    workweek_schedule --
        a dict that defines weekly work hours; has following format
        {
            0: (9, 17),
            ...
            6: ()
        }
        The key is an int following datetime weekday() function where
        Monday is 0 and Sunday is 6. The value is a tuple with two ints:
        the start hour and the end hour in 24 hour format (0 to 23).
    lunch_hour -- int
    offdays -- either an ISO country code or tuple of datetime dates to be
               considered as holidays
    """

def hours(self, start_dt, end_dt):
    """Return business hours.

    Keyword arguments:
    start_dt -- datetime object of start time
    end_dt -- datetime object of end time
    """

def days(self):
    """Return business days."""Off-hours are not not added. For example, ifend_dtis 30 minutes past work
hours, those 30 minutes will be ignored.Input verification is done upon object initialization and each calculation.ValueErroris raised with corresponding error message if something is wrong.
Package: businessman
Businessman PackageCRUD Business Logic with auto-generator controller for flask-restx.example:import what you needfromflaskimportBlueprintfromflask_mongoengineimportDocumentfrommongoengineimportStringFieldfrombusinessmanimportcrud_controller_factoryMongoEngine model:fromflask_mongoengineimportDocumentfrommongoengineimportStringFieldclassSampleModel(Document):meta={"collection":"SampleModel"}name=StringField()code=StringField()Restx Schema model:fromflask_restximportApi,fieldssample_schema={'name':fields.String(required=True,description=''),'code':fields.String(required=True,description=''),}Blueprint and NameSpace:blueprint=Blueprint('api',__name__)api=Api(blueprint,title='Calendar API Service',version='1.0',description='A description',# All API metadatas)ns1=crud_controller_factory(model=SampleModel,schema_class=sample_schema)api.add_namespace(ns1)all of the above is forapi.py:define a flask blueprintcreate arestx.Namespacefrom defined model withcrud_controller_factoryfunction toolsadd this namespace to the blueprintadd the blueprint to theflask.Appobjectflaskapp.py:fromflaskimportFlaskfromflask_mongoengineimportMongoEnginefromapiimportblueprintapp=Flask(__name__)db=MongoEngine()app.config.from_pyfile("config.py")db.init_app(app)app.register_blueprint(blueprint)if__name__=="__main__":app.run(debug=True)
Package: businesstemplates
An efficient command line tool to create resumes and business cards on the go!Notable FeaturesModern pythonic syntax.Easy to run scripts.Covers all important information.Lightweight module.Installing“Python 3.7” or higher is required to install this module.Installing this module is quite simple,# Linux/macOSpython3-mpipinstall-Ubusinesstemplates# Windowspy-3-mpipinstall-UbusinesstemplatesOther Required Packagespython-docxpathlibHow to run?Resume GeneratorNow you can design your own impressive resumeOpen your favourite terminal and enter thisresume_generatorEnter the information through the inputs and you’re done!Business Card GeneratorDesign your sparkling business card in just under a minute.Open your favourite terminal and enter thisbusiness_card_generatorEnter the information through the inputs and you’re done!
Package: businesstimedelta
BusinessTimeDeltaPython's timedelta for business time. This module helps you calculate the exact working time between two datetimes. It supports common scenarios such as custom schedules, holidays, and time zones.InstallationUse pip to install BusinessTimeDelta.pipinstallbusinesstimedeltaExample UseDefine your business hoursimportdatetimeimportpytzimportbusinesstimedelta# Define a working dayworkday=businesstimedelta.WorkDayRule(start_time=datetime.time(9),end_time=datetime.time(18),working_days=[0,1,2,3,4])# Take out the lunch breaklunchbreak=businesstimedelta.LunchTimeRule(start_time=datetime.time(12),end_time=datetime.time(13),working_days=[0,1,2,3,4])# Combine the twobusinesshrs=businesstimedelta.Rules([workday,lunchbreak])Calculate the business time between two datetimesstart=datetime.datetime(2016,1,18,9,0,0)end=datetime.datetime(2016,1,22,18,0,0)bdiff=businesshrs.difference(start,end)printbdiff# <BusinessTimeDelta 40 hours 0 seconds>print"%shours and%sseconds"%(bdiff.hours,bdiff.seconds)# 40 hours and 0 secondsBusiness time arithmeticprintstart+businesstimedelta.BusinessTimeDelta(businesshrs,hours=40)# 2016-01-22 18:00:00+00:00printend-businesstimedelta.BusinessTimeDelta(businesshrs,hours=40)# 2016-01-18 09:00:00+00:00To define holidays, simply use theHolidayspackageimportholidaysaspyholidaysca_holidays=pyholidays.US(state='CA')holidays=businesstimedelta.HolidayRule(ca_holidays)businesshrs=businesstimedelta.Rules([workday,lunchbreak,holidays])# Christmas is on Friday 2015/12/25start=datetime.datetime(2015,12,21,9,0,0)end=datetime.datetime(2015,12,28,9,0,0)printbusinesshrs.difference(start,end)# <BusinessTimeDelta 32 hours 0 seconds>TimezonesIf your datetimes are not timezone aware, they will be localized to UTC (see example above).Let's say you want to calculate the business time overlap between a working day in San Francisco and in Santiago, Chile:santiago_workday=businesstimedelta.WorkDayRule(start_time=datetime.time(9),end_time=datetime.time(18),working_days=[0,1,2,3,4],tz=pytz.timezone('America/Santiago'))santiago_lunchbreak=businesstimedelta.LunchTimeRule(start_time=datetime.time(12),end_time=datetime.time(13),working_days=[0,1,2,3,4],tz=pytz.timezone('America/Santiago'))santiago_businesshrs=businesstimedelta.Rules([santiago_workday,santiago_lunchbreak])sf_tz=pytz.timezone('America/Los_Angeles')sf_start=sf_tz.localize(datetime.datetime(2016,1,18,9,0,0))sf_end=sf_tz.localize(datetime.datetime(2016,1,18,18,0,0))printsantiago_businesshrs.difference(sf_start,sf_end)# <BusinessTimeDelta 4 hours 0 seconds>Overnight Shifts# Day shiftworkday=WorkDayRule(start_time=datetime.time(9),end_time=datetime.time(17),working_days=[0,1,2,3,4],tz=pytz.utc)# Night shiftnightshift=businesstimedelta.WorkDayRule(start_time=datetime.time(23),end_time=datetime.time(7),working_days=[0,1,2,3,4])businesshrs=businesstimedelta.Rules([workday,nightshift])start=datetime.datetime(2016,1,18,9,0,0)end=datetime.datetime(2016,1,22,18,0,0)bdiff=businesshrs.difference(start,end)printbdiff# <BusinessTimeDelta 80 hours 0 seconds>
Package: business-validator
Business-ValidatorErrorSchemaUse business_validator.ErrorSchema if you don't know which format you're gonna use.Quick StartDTOclassCommentDto(BaseModel):comment:strpost_id:intowner_id:intAdd error source (error context)classSource(BaseModel):local:strDTO Validator@dataclasses.dataclass()classCommentValidator(Validator[ErrorSchema[Source]]):dto:CommentDto@validateasyncdeftest1(self):post_ids=list(range(1,10))ifself.dto.post_idnotinpost_ids:self.context.add_error(ErrorSchema(code=ErrorCodeEnum.not_found.value,message="Id doen't not exists",detail=f"Post with id={self.dto.post_id}not found",source=Source(local="data/post_id",),))@validateasyncdeftest2(self):owner_ids=list(range(1,10))ifself.dto.owner_idnotinowner_ids:self.context.add_error(ErrorSchema(code=ErrorCodeEnum.not_found.value,message="Id doen't not exists",detail=f"User with id={self.dto.post_id}not found",source=Source(local="data/owner_id",),))Useasyncdeffunction():validator=CommentValidator(...)errors=awaitvalidator.errors()# orawaitvalidator.validate()# raise ValidationError
Package: bus-interrogation-tunnel
🚌 Bus Interrogation Tunnel (bitbus)BIT 班车查询接口。Note只有查询功能，故无需登录。🧪 例子（要先克隆仓库，pdm install）🚍 查询车次$ pdm run bitbus /vehicle/get-list date==2023-03-13
{
    'count': 52,
    'code': '0',
    'message': 'ok',
    'data': [
        {
            'pkid': 3338,
            'id': '2217130562077421589',
            'shuttle_type': 3,
            'car_number': '京ADG889',
            'name': '良乡校区-中关村校区',
            'train_number': '',
            'service_time': '1,2,3,4,5',
            'origin_address': '良乡校区',
            'end_address': '中关村校区',
            'intermediate_site': None,
            'origin_time': '06:20',
            'end_time': '07:10',
            'reservation_num_able': 51,
            'type': 0,
            'teacher_ticket_price': '10.0',
            'student_ticket_price': '6.0'
        },
…
}也可以筛选始末站：$pdmrunbitbus/vehicle/get-listdate==2023-03-13address==良乡校区->中关村校区💺 查询座位$ pdm run bitbus /vehicle/get-reserved-seats id==2208639427336042078 date==2023-03-11
{'code': '1',
 'message': 'ok',
 'data': {'reserved_count': 48,
          'reservation_num': 3,
          'reserved_seat_number': ['3', '10', '14', …],
          'is_full': 1}}🛠️ 开发$pdminstall$ pipx install pre-commit  # Alternate: python -m pip install pre-commit
$ pre-commit install
$ pdm run lint
Package: busm
The package busm means bring up Samuel. It's allusion comes from Holy Bible 1 Samuel 28:11.
It help you find abnormal situations in a background process.There are several function decorators and logging handlers inside.
These tools can send message of abnormal situations through Email, Telegram or Line Notify.套件 busm 是 "召喚撒母耳" 的意思，典故出自聖經撒母耳記上 28 章第 11 節，其實就是觀落陰的意思。
這套件可以幫你找出背景作業的異常狀況。裡面有一些 function decorators 和 logging handlers, 用這些工具可以把異常狀況透過
Email, Telegram, Line Notify 這些方式送出去。Quick StartFirst, install the package.pipinstallbusmThen add decorators before functions you'd like to monitor.importbusm@busm.through_smtpdeffoo_email():print('It sucks!')@busm.through_telegramdeffoo_telegram():print('Segmentation fault.')@busm.through_linedeffoo_line():print('Stack overflow.')if__name__=='__main__':foo_email()foo_telegram()foo_line()Run your python code.pythonfoo.pyYou must see the following message,
and a config file will be generated in HOME directory.-----------------------------------------------------------------
  Please change fundog config file (~/.busm.json) to enable.
-----------------------------------------------------------------Edit this config file ~/.busm.json to fit for you.{
  "smtp": {
    "host": "smtp.gmail.com",
    "port": 587,
    "user": "someone",
    "pass": "********",
    "from_name": "Foo",
    "from_email": "someone@gmail.com",
    "to_name": "Master",
    "to_email": "someone@gmail.com"
  },
  "telegram": {
    "token": "123456789:-----------------------------------",
    "master": "123456789"
  },
  "line-notify": {
    "token": ""
  }
}Run your python code again.pythonfoo.pyTada! You can preview screenshotshere.