Saravanan666/pypi-org huggingface dataset:
Package: better-singleton
SingletonAbout the projectA clean, transparent and easy to use python singleton wrapper.Installationpip install better-singletonUsageSingleton definition:frombetter_singletonimportsingleton@singletonclassCounter:def__init__(self,initial_counter):self.counter=initial_counterdefinc(self):self.counter+=1Usage:counter1=Counter(1)counter1.inc()counter2=Counter(1)print(counter2.counter)# >>> 2Ensures that at most only one instance of the class exists at any point in time.__init__and__new__of the original class get called only once: the first time
an instance is created. This instance will from then on be the singleton instance.
Every following call to the constructor of the wrapped class returns the singleton instance.The wrapped class cannot have a class variable called_singletonas that stores
the singleton instance. This will throw an error before execution begins.Not thread safe during first initialization.RoadmapContributingPublishBump version inpyproject.tomlpoetry updatepoetry buildpoetry publishLicenseSeeLicense.md.ContributorsStephan SchmiedmayerAcknowledgmentsTeam Incentive Mechanism App Cluster of "Advanced Python Programming Spring 2022"
Nour Bouzid, Yanjie Li, Stephan Schmiedmayer and Leonhard Zirus under supervision of Valentin Zieglmeier
Package: bettersocket
bettersocketPainless socket handing for PythonFree software: MIT licenseDocumentation:https://bettersocket.readthedocs.io.FeaturesImplements a framing mechanism over raw sockets using delimiters.Works with both blocking and nonblocking sockets.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.1 (2020-03-19)Removed the exposed fileio, as it were confusing (see.https://github.com/marcsello/bettersocket/issues/1)Fixed__str__and__repr__functions onBetterSocketIOclass to support other address families than INETExposedresetcall inBetterSocketIOclassVarious cleanups, and bugfixesRemoved support for Python 3.50.1.0 (2020-02-20)First release on PyPI.
Package: betterspread
Better SpreadA wrapper around gspread with cell and row level functionalitiesSheetfrombetterspreadimportSheet,Connectioncon=Connection(credentials_path="./credentials.json")sheet=Sheet(connection=con,sheet_name="Better Sheet")tab=awaitsheet.get_tab('Sheet1')Sheetis a subclass of gsprad'sSpreadsheetget all valuesawaittab.values()# returns a list of rowsRowrow is a subclass of list, with functionalities likeupdateandclearrow=awaittab.get_row(1)# returns a Rowprint(row)update rowawaitrow.update(['new','values'])awaitrow.clear()# clear all value of the rowCellcell is a subclass of string, with additional functionalities likeupdateandclearcell=awaittab.get_cell('A1')# returns a Cellcell=row[0]# same as aboveupdate cellawaitcell.update('New cell value')awaitcell.clear()# clear value of the cell
Package: betterspy
betterspyShow sparsity patterns of sparse matrices or write them to image files.Example:importbetterspyfromscipyimportsparseA=sparse.rand(20,20,density=0.1)# betterspy.plot()# set attributes on gca()# plt.show()# or directlybetterspy.show(A)betterspy.write_png("out.png",A,# border_width=2,# border_color="red",# colormap="viridis")no colormapviridisThere is a command-line tool that can be used to showmatrix-marketorHarwell-Boeingfiles:betterspy msc00726.mtx [out.png]Seebetterspy -hfor all options.Gallerybp_200bp_600Chebyshev2orani678rajat19rdb1250lrdb3200lwest0989west1505Installationbetterspy isavailable from the Python Package
Index, so simply dopip install betterspyto install.LicenseThis software is published under theGPLv3 license.
Package: bettersql
A better SQL engine for DataFrames, Lists and Dictionaries!MotivationPandasql is a great project but it lacked the ability to call Python UDF's or use SQL to update a DataFrame.
Bettersql allows both of these features plus there is no need to define a lambda to passglobals()because
I wrote the function to automatically getglobals()from the caller level.InstallationTo install bettersql, simply:$pipinstallbettersqlUsageA simple example:frompandasimportDataFramefrombettersqlimportsqldfdefreverse(x):# sample function with one parameterifxisnotNone:returnx[::-1]# DataFrame sourcenames=DataFrame({'id':[1,2,3],'name':['Alpha','Beta','Gamma'],'category':[1,2,2]})# Dict of lists sourcecategories={'id':[1,2,3],'name':['One','Two','Three']}sql='''SELECT n.id, n.name, n.category, c.name as categoryname, reverse(n.name) as reverseFROM names AS nLEFT JOIN categories AS c on n.category= c.id'''# The first reverse is the alias for the function in SQL and the second reverse is a reference to the Python UDFr=sqldf(sql,reverse=reverse)print(r)
Package: betterstack-uptime
Python Betterstack-Uptimebetterstack-uptimeis a library written in python that can assist in dealing with the Betterstack Uptime API. This is done by converting API endpoints into python objects, and translating the attributes from the API into variables.Current endpoints implementedMonitorsMonitor SLAMonitor GroupsHeartbeatsHeartbeat GroupsIncidentsIn future, there will be more endpoints added. These however, will need some extra code in order for them to work properly. If you desperately need another endpoint, feel free to extend theBaseAPIObjectclass, and implement it!betterstack-uptimeis free andopen sourcesoftware, you are free to use it, share it, modify it and share the modifications with the world.Getting StartedRequirementsYou will need the following software:python>= 3.7InstallingRun the following command to install the packagepipinstallbetterstack-uptimeUsageJust some quick boilerplate code to get you startedGet all instancesfrombetterstack.uptimeimportUptimeAPIfrombetterstack.uptime.objectsimportMonitorapi=UptimeAPI("yourtokenhere")monitors=Monitor.get_all_instances(api=api)formonitorinmonitors:print(monitor.url)DocumentationFull documentation is available athttps://iwink.github.io/python-betterstack-uptime/ContributingPlease readCONTRIBUTING.mdfor details on our code of conduct, and the process for submitting pull requests to me.VersioningWe useSemVerfor versioning. For the versions available, see thetags on this repository.AuthorsWouter Mellema-Initial work-wmellemaSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for details
Package: betterstatcord.py
BetterStatcord.pyA better Statcord API library for Python + Discord.py (and maybe its forks)AdvantagesIt's blazin fast: The official library is full of inefficient, slow, and unnecessary code which does nothingexcept slow your bot down.Cleaner and smaller codebase: BetterStatcord.py is smaller and cleaner, making it much more reliable and understandable.Easier to use: For its basic functionality, all you need isoneline of code to set it up!More accurate: This library has more accurate statistics than the official one.Supports clustering: This library has a special class for clustered bots, which supports the clustered API stats endpoint.Supports Discord.py forks: The main library does not...Supports Disnake + Pycord slash commands: Supports slash commands for both of these forks.ExamplesCheck out theexamples folder
Package: bettertags
Bettertagsbettertagsis an enhanced version of themkdocs-materialbuilt-in tags pluginwith FREE versions of all Insiders-only tags features, and some minor improvements.This plugin is originally based on the MIT-licensed source frommkdocs-material, but many parts have been heavily refactored/rewritten (and weren't written without any knowledge of the Material Insiders source). If you have suggestions of extra enhancements, please open an issue.Installation and usageRunpip install bettertagsReplace thetagsconfigruation option of yourmkdocs.ymlwithbettertagsIf you use Material-provided functions fortags_compareortags_pages_compare, replacematerial.plugins.tagswithbettertagsYou can now use any insiders-only featuresdescribed in the Material docs. I've also added a few features totags_extra_files, described below.tags_extra_filesUse this option to add additional tag lists to your wiki:plugins:
  - bettertags:
      tags_extra_files:
        extra-1.md: [allowed-tag-1, allowed-tag-2, ...]
        extra-2.md: "*subfolder"
        extra-3.md: "*"
        "folder/extra-4.md":
            - rule: "*subfolder"
            - priority: 3Each tag index can have one of the following types of rules:[allowed-tag-1, ...]: only include tags from the given list*subfolder: only include tags and pages from files contained within the same parent folder (or any descendants) as this index*: include all tags and pagesAn index may also have an associated priority. By default, all extra indexes have priority0, and the primary index (fromtags_fileoption) has priority1. When a tag on a wiki page is linked back to a tag index, it is linked to the index with the highest priority that contains the page. By default, this means a tag will always link back to the primary tags index. In the above example, pages infolder/will have tags linking tofolder/extra-4.md, sincefolder/has a priority3 > 1. If a tag is shown in two indices with the same priority, it will link back to the index with the longest shared prefix between its file path and the path of the file containing the tag. That is, if indices/tags.mdand/folder/tags.mdboth have priority1, a tag in/folder/subfolder/file.mdwill link to/folder/tags.md. It is consideredundefined behaviorto have multiple indexes thattiefor having thehighest priority and longest shared prefixfor a given page/tag pair.tags_extra_filescan also be replaced withindexesin your config for improved clarity.
Package: better-terminal
Better TerminalA simple pip library to make your terminal simplerDocumentationInstallationpipinstallbetter_terminalCreating a templateA template is just a simple string where you can add variables as placeholders.frombetter_terminalimportTerminalterminal=Terminal.New("@RED@Launching Rocket in @BRIGHT_YELLOW@#countdown#.")If you run the script now, the place holder will stay as it is.
To change that we need to create variable for those place holder.[NOTE: Notice the @ colors @, we will talk about that later]Creating variables.create_variable()requires two arguments, the name of the placeholder and a default value for the variable.countdown=terminal.create_variable("countdown",5)As soon as we create the variable the placeholders will automatically update.Using the variableYou can get the current value of the variable with.valuemethodprint(variable.value)To update the variable use.update()which requires one argument, that is the new value of the variableLets see an example with a simple countdownwhileTrue:sleep(2)countdown.update(countdown.value-1)if(countdown.value==0):terminal.update_template("@GREEN@ROCKET LAUNCHED!")sleep(10)breakYay!Changing templateYou don't need to be stuck with a sinple template. You can change your template with.update_template()function which accepts one arguemnt that is the new template.ColorsEver thought that terminals were boring, well lets decorate them with colors.You can use the.COLOR["COLOR_NAME"]property of Terminal class to get or color string.Terminal.New(Terminal.COLOR["GREEN"]+"Hello World")This will change the text after color to green.\[NOTE: There color value ever works with the variable value]\Or you can just use the color name with "@"on both sides.Terminal.New("@GREEN@Hello World")To switch to the default color, use @CLEAR@ orTerminal.COLOR["CLEAR"].Example Codefrombetter_terminalimportTerminalfromtimeimportsleepterminal=Terminal.New("@RED@Launching Rocket in @BRIGHT_YELLOW@#countdown#.")countdown=terminal.create_variable("countdown",5)whileTrue:sleep(2)countdown.update(countdown.value-1)if(countdown.value==0):terminal.update_template("@GREEN@ROCKET LAUNCHED!")sleep(10)breakLicenseWe use theMIT Licensefor this projectFAQWhen will be the next update?Quite SoonWhen will the new update bring?The new update will bring integration of terminal input with the whole system.
Package: better-threads
Better ThreadsA wrapper over threads that provides extended control. The module supports pausing, terminating and putting threads to sleep. The module also provides some additional tools to Pipe data between threads and a thread pool to keep track of threads.Key featuresPipe data between threadsPause, Resume and Stop threadsSimpleInstallingPython 3.7 or higher is requiredpip install better-threadsQuick exampleMore exmpleshttps://github.com/ItsYasiru/Better-Threads/tree/master/examplesimporttimefromBetterThreadsimportThreadPoolthread_pool=ThreadPool()@thread_pool.thread()deftest_loop():print("Loop running!")time.sleep(1)test_loop.start(test_loop)time.sleep(5)test_loop.terminate(test_loop)
Package: bettertime
Better TimeBetter Time- is a Python library, converting string date expressions to seconds [int].InstallitionPyPI:$[py-m]pipinstallbettertimeGitHub:$gitclonehttps://github.com/DarkJoij/bettertimeExamplesConverting from string expressions to seconds:frombettertimeimportto_secondsprint(to_seconds('5hours 30minutes'))19800Converting from seconds to string expressions:frombettertimeimportto_stringprint(to_string(793800,language='en'))9d4h30mFunctionto_secondstake parameterexpression: str.Functionto_stringtake 2 parameters:seconds: int,language: 'ru' | 'en' = 'ru'.To see all dates aliases check filebettertime/parser.py.Sweet using and building your lovely dsbots)
Package: bettertimeit
=============Better Timeit=============.. image:: https://badge.fury.io/py/bettertimeit.png:target: http://badge.fury.io/py/bettertimeit.. image:: https://travis-ci.org/simonpercivall/bettertimeit.png?branch=master:target: https://travis-ci.org/simonpercivall/bettertimeit.. image:: https://pypip.in/d/bettertimeit/badge.png:target: https://crate.io/packages/bettertimeit?version=latestA Better Timeit* Free software: BSD license* Documentation: http://bettertimeit.rtfd.org.Example-------``bettertimeit`` will time any function which is named "timeit\_<something>".The "timeit\_" functions may be contained within a function or in a module.Each "timeit\_" function will be timed separately::from bettertimeit import bettertimeitdef container():a = 5def timeit_calculation():a**10b = 3def timeit_calculation_2():a**bbettertimeit(container)To run timings from setup.py, you could add this to :func:`setup`::setup(...timeit_suite="timings",)And then run::% python setup.py timeitThis would run timeit functions in ``timings.py``.Features--------* Lets you write your timing test code as regular code instead of strings,but without the overhead of a function call.* Put your timing test code in a module or inside a function* Uses the same method as timeit.main to calculate the optimal number ofpasses to run.* Adds a ``timeit_suite`` option to setup() in setup.py, and a distutilscommand ``timeit`` to run timings from setup.py.=========Changelog=========Here's the recent changes to Better Timeit... changelog:::version: 1.1.1:released: 2014-05-02.. change:::tags: generalAdd a target-time option to the distutils command, to tune the target timefor each run... changelog:::version: 1.1:released: 2014-04-29.. change:::tags: generalAdd a distutils command to run timings from setup.py. Also add asetup() flag ``timeit_suite`` to set timeit module in setup.py... changelog:::version: 1.0.1:released: 2014-04-29.. change:::tags: generalA version that actually works: the 1.0 release didn't extract the bodyof the timeit function... changelog:::version: 1.0:released: 2014-04-28.. change:::tags: generalFirst version.
Package: better-timers-gudninatan
BetterTimersBetter timers for pygame with demoFor in-depth explanation (in Icelandic) see:https://gudninathan.blogspot.is/2017/05/pygame-og-events-1-genericevent.htmlQuick startStart by downloading the package!$ pip install pygame
$ pip install better_timers-gudninatanImport timer managerfrom better_timers import timersORCreate a new timer managerfrom better_timers import BetterTimers
timers = BetterTimers()Add new timers that will automatically go to the event queue repeatedly, every N milliseconds using this format.timers.set_timer(event, ms, *delay_ms)You can pass in both the regular USEREVENT types or create your ownpygame.event.Eventwith any custom args and kwargs for unlimited possibilities. Override already established timers easily, or delete them entirely by passing in a rate of 0 or less.genericEvent = USEREVENT + 1
randomEvent = USEREVENT + 2

coolEvent = pygame.event.Event(genericEvent, code="cool")
uncoolEvent = pygame.event.Event(genericEvent, code="uncool")

timers.set_timer(coolEvent, 500) # Sets a timer for 500 milliseconds
timers.set_timer(coolEvent, 2000, 300) # Overrides old 500 rate timer, with delay

timers.set_timer(uncoolEvent, 1000) # New genericEvent timer with a different code

timers.set_timer(randomEvent, 5000) # Traditional timer set with USEREVENT
timers.set_timer(randomEvent, 0) # Timer stoppedYou will recieve these events in the pygame event queue just as you would expect.while True:
    ...
    for event in pygame.event.get():
        ...
        if event == coolEvent:
            print("How cool!")
    ...All timers will be stopped upon callingpygame.quit(). You can also stop all the timers with this neat shortcut:timers.end_all_timers()Compatabilitybetter_timers is compatible with both python 2 & 3.Dependenciesbetter_timers is dependant onpygame.
Package: betterTUI
ExamplesMusic PlayerCodebetterTUI - collection of curses widgets for building TUI'sThe purpose of betterTUI is to make creating TUI's in python with navigation, input
and colors easy and fast. I developped this library over curses because I could not find any others
which accomplished this goal. If you want to contribute to the library, you are welcome to add
Issues/PullRequests and I will look at them ASAP!You can find the documentation here:Documentation
Package: better-twitter
Better-TwitterA simple python tool that makes your twitter timeline much better.Installationpip3installbetter-twitterTwitter APITo be able to use this package, you need toregister a Twitter appand add its credentials when you use this package for the first time. This package will connect to your Twitter account using that app's credentials on behalf of you.Get startedBlock from fileTo block multiple users of a file:better-twitter--block-filetest_file.csvNote: The csv file should have two columns nameduser_idandscreen_name.Mute from fileTo mute multiple users of a file:better-twitter--mute-filetest_file.csvNote: The csv file should have two columns nameduser_idandscreen_name.Update Twitter APITo update twitter API credentials:better-twitter--update-apiTo DoAdd "mute from file" functionalityAdd "block from file" functionalityRewrite the functions in OOP styleSplite functions to be separated in different files and directories (instead of a single main.py file)Add "block/mute retweeters of a tweet" functionalityAdd "block/mute likes of a tweet" functionalityAdd "check a fake user's retweets" functionalityAdd "remove my tweets older than N days" functionalityAdd "remove my likes older than N days" functionalityAdd "search for tweets containing a specific word/hashtag and block/mute them"Add "export an account's tweets/followers/followings/likes"Add "block accounts tweeting about a specific hashtag"Add "export block list"
Package: better-uniform
A better scipy.stats.uniformThestatssub-package of scipy is quite cool.In particular, it provides dozens of probability distributions implemented with
a common interface.Butscipy.stats.uniformalways bugged me.>>>fromscipyimportstats>>>help(stats.uniform)Auniformcontinuousrandomvariable.Thisdistributionisconstantbetween`loc`and``loc+scale``.Whyloc + scale? Why notscale?So I wrotebetter_uniform: eight small lines of code that don't bug me so
much.fromscipyimportstatsclassfrozen(stats._distn_infrastructure.rv_continuous_frozen):def__init__(self,dist,*args,**kwds):super(frozen,self).__init__(dist,*args,**kwds)defbuniform(a,b):# b for betterdist=stats.uniformdist.name='uniform'returnfrozen(dist,loc=a,scale=b-a)Now it works as I expect it to work:d=buniform(0,1)d.rvs()# 0 < rv < 1d.suport()# (0.0, 1.0)d=buniform(1,2)d.rvs()# 1 < rv < 2d.support()# (1.0, 2.0)# note the differencefromscipy.statsimportuniformd=uniform(1,2)d.rvs()# 1 < rv < 3d.support()# (1.0, 3.0)That's it!Cool, I want it!pip install better-uniformorgitclonehttps://github.com/j-faria/better_uniform.gitcdbetter_uniform
pythonsetup.pyinstalland later, from Pythonfrombetter_uniformimportbuniformor better yetfrombetter_uniformimportbuniformasuniform
Package: betteruptime
betteruptime-pythonbetteruptime-pythonis aBetterUptimeAPI client for python.InstallationThe package is published onPyPIand can be installed by running:pip install betteruptimeBasic UseEasily query the BetterUptime API from you Python code.>>>client=betteruptime.Client(bearer_token='My BetterUptime Bearer Token')>>>client.monitors.list()>>>client.monitors.get('123456')
Package: betterwinreg
betterwinregA sane way of working with the Windows registry.Getting a RegistryKey instanceTo get aRegistryKeyinstance, simply do:frombetterwinreg.keyimportRegistryKeykey=RegistryKey('HKEY_MY_HKEY/Path/To/Key/You/Want')You can also use backslashes:key=RegistryKey('HKEY_MY_KEY\\Path\\To\\Key\\You\\Want')Or, if you don't want to escape every backslash, you can use raw strings:key=RegistryKey(r'HKEY_MY_KEY\Path\To\Key\You\Want')Getting valuesYou can get a specific value by using a dict-like syntax:my_value=key['Value']You can also iterate though all the values a key has:forname,valueinkey.values().items():# do some stuffFor example, you would get the wallpaper path by doing:wallpaper_path=RegistryKey(r'HKEY_CURRENT_USER\Control Panel\Desktop')['WallPaper']Note that getting a value returns a special object that represents the registry type. You can use it normally, but doing stuff with it will make it a regular instance of the base type.>>>RegistryKey(r'HKEY_CURRENT_USER\Control Panel\Desktop')['WallPaper']Sz('D:\\Pictures\\wallpaper.png')Setting and deleting valuesSince registry types are different than Python types, you need to specify what type the registry value will be set to.frombetterwinreg.valueimportSzRegistryKey(r'HKEY_CURRENT_USER\Control Panel\Desktop')['WallPaper']=Sz(r'D:\Pictures\wallpaper.png')To delete a value, you can usedel:delRegistryKey(r'HKEY_CLASSES_ROOT\Directory\Shell\git_shell')['WallPaper']Navigating through the registryThe main ways to move through the registry are usingsubkeys()andparent, and concatenating in a Path-like way.>>>RegistryKey(r'HKEY_CURRENT_USER\Control Panel\Desktop').parentRegistryKey('HKEY_CURRENT_USER\\Control Panel')>>>RegistryKey(r'HKEY_CURRENT_USER\Control Panel\Desktop').subkeys()[RegistryKey('HKEY_CURRENT_USER\\Control Panel\\Desktop\\Colors'),RegistryKey('HKEY_CURRENT_USER\\Control Panel\\Desktop\\WindowMetrics'),RegistryKey('HKEY_CURRENT_USER\\Control Panel\\Desktop\\MuiCached')]You can also joinRegistryKeys in aPath-like manner:>>>RegistryKey(r'HKEY_CURRENT_USER\Control Panel')/'Desktop'RegistryKey('HKEY_CURRENT_USER\\Control Panel\\Desktop')NotesOnly tested on Windows 10 64-bit.It won't work on 32-bit, because of some incompatible API calls (e.g.RegDeleteKeyEx).
Package: betterx
# BetterXA better unix utility tool.## AboutBetterX aims to be a set of tools that would make your experience with the command line a lot smoother.## InstallationGet it on your system usingpip-`sh $ pip install betterx `To get the bleeding edge version, install from git -`sh $ pip installgit+https://github.com/mentix02/betterx.git`## DocumentationFind the documentation here - [BetterX Docs](docs/README.md)I almost never write exclusive documentation other than inline comments in my code (and that too only sparsely) but I took the initiative to do it for this project so do go through the docs. They’re not perfect but it’s a start.
Package: better-zipfile
better_zipfile本项目旨在对优化python中自带的zipfile，以处理mnbvc项目解压遇到的问题目前基于原始的zipfile有了以下两种优化：在读取文件名时，使用alan的charset-mnbvc库，支持更多种类型的文件内文件名编码。如果遇到文件尾部多余的数据时，自动处理掉尾部数据并正确读取。