Saravanan666/pypi-org huggingface dataset:
Package: better-cluster
Better ClusterA high-performance inter-process communication library designed to handle communication between multiple bots/web applicationsThis library is made to handle mulltiple discord clients. If you want something simpler or have only one client, check outbetter-ipcInstallationStable versionFor Linuxpython3-mpipinstall-Ubetter-clusterFor Windowspy-mpipinstall-Ubetter-clusterDevelopment versionFor Linuxpython3-mpipinstall-Ugit+https://github.com/MiroslavRosenov/better-clusterFor Windowspy-mpipinstall-Ugit+https://github.com/MiroslavRosenov/better-clusterSupportYou can join the support serverhereExamplesExample of a clusterimportasynciofromdiscord.ext.clusterimportClusterif__name__=="__main__":cluster=Cluster()asyncio.run(cluster.start())Example of a shardimportasyncioimportdiscordfromdiscord.ext.clusterimportShard,ClientPayloadfromdiscord.extimportcommandsclassMyBot(commands.Bot):def__init__(self)->None:intents=discord.Intents.all()super().__init__(command_prefix="$.",intents=intents)self.shard=Shard(self,shard_id=1)asyncdefsetup_hook(self)->None:awaitself.shard.connect()@Shard.route(shard_id=1)asyncdefget_user_data(self,data:ClientPayload):user=self.get_user(data.user_id)returnuser._to_minimal_user_json()if__name__=='__main__':bot=MyBot()asyncio.run(bot.run(...))Example of web clientfromquartimportQuartfromdiscord.extimportclusterapp=Quart(__name__)ipc=cluster.Client()@app.route('/')asyncdefmain():returnawaitipc.request("get_user_data",1,user_id=383946213629624322)if__name__=='__main__':app.run(port=8000,debug=True)
Package: bettercmd
# bettercmd
A better cmd.py## Purpose
I love writing interactive command line programs and there’s lots of uses for them but often it’s hard to get the stuff you want without writing your own parser.There was a module [CMDLN](https://github.com/trentm/cmdln) which I tried that inspired this module, but it was quite old and only used optparse, not argparse for commands, and I thought I could do better. Hence bettercmd was born.## Usage
For examples see the examples directory.
Package: betterconcurrent
betterconcurrentThis is a fork of Python 3.11.2'sconcurrent.futuresmodule, demonstrating some improvements that could be useful to merge to the standard implementation.
In short, these features are cooperative multitasking (solving thedeadlock footgun) and fire-and-forget execution of task-parallel computations.The changes currently pertain toThreadPoolExecutor. The architecture ofProcessPoolExecutoris not trivially amenable to these changes and is left as-is for now.All exported types are backwards compatible and will behave the same asconcurrent.futures, meaning that this package is a safe drop-in replacement.You can install this package withpip install betterconcurrentFutureFutures are now aware, through a weakref, of the executor that generated them.yield_until_doneCode running inside a function submitted to an executor can now potentially cooperatively wait for the result of a future on the same executor.
This can be done by inserting the yielding expressionyield from future.yield_until_done().
If the executor is capable of cooperative scheduling, the current function will be paused and its continuation will be rescheduled upon completion of the future.
If the executor does not have this capability, the call will block in the same wayfuture.result()orfuture.exception()would.
In any case,future.done()is guaranteed to beTrueafter execution resumes from the yielding expression, allowing the user to access the result without further blocking.This introduces a new pattern for cooperative multitasking.
A top-level functionbetterconcurrent.yield_until_doneaccepts a list of futures and yields execution until all of them are done.ThreadPoolExecutorCooperative MultitaskingThreadPoolExecutornow supports cooperative multitasking and is compatible with theyield_until_donefeature!concurrent.futurescode that exhibits thedeadlock footguncan be adjusted to use this feature and never deadlock withbetterconcurrent. Simply useyield_until_donebefore blocking on the result of any futures and execution will not stall!
It should be noted that the footgun is still present inbetterconcurrentto maintain backward compatibility.Fire-and-ForgetWe enable a powerful pattern wherein functions that submit subtasks without any interest in the result can be executed until convergence.ThreadPoolExecutornow has a complement toshutdowncalledjoin.
Whereshutdownwould stop the computation in its tracks and prevent it from further unfolding,joinwill block until all tasks – and their subtasks – have completed, even if they continue to unfold when it is called.ExampleA search for a particular node in a tree can be parallelized by recursively spawning a subtask for each of the children. We might not care to return the value to the caller, but rather print a message or assign the result to a shared variable.
Seetree_search.pyfor an example of a parallel tree search!To doAchieve full exception-safety. Some unlucky exception firings might cause undefined behavior currently.
Package: betterconf
Minimalistic Python library for your configs.Betterconf (better config) is a Python library for project configuration
managment. It allows you define your config like a regular Python class.Features:Easy to hack.Less boilerplate.Minimal code to do big things.InstallationI recommend you to use poetry:poetryaddbetterconfHowever, you can use pip:pipinstallbetterconfHow to?Try to write a simple config:frombetterconfimportfield,ConfigclassMyConfig(Config):my_var=field("my_var")cfg=MyConfig()print(cfg.my_var)Try to run:my_var=1pythonour_file.pyWith default values:frombetterconfimportfield,ConfigclassMyConfig(Config):my_var=field("my_var",default="hello world")my_second_var=field("my_second_var",default=lambda:"hi")# can be callable!cfg=MyConfig()print(cfg.my_var)print(cfg.my_second_var)# hello world# hiOverride values when it's needed (for an example: test cases)frombetterconfimportfield,ConfigclassMyConfig(Config):my_var=field("my_var",default="hello world")cfg=MyConfig(my_var="WOW!")print(cfg.my_var)# WOW!By defaultbetterconfgets all values fromos.environbut sometimes we need much.
You can create ownfield's value providerin minutes:frombetterconfimportfield,Configfrombetterconf.configimportAbstractProviderclassNameProvider(AbstractProvider):defget(self,name:str):returnnameclassCfg(Config):my_var=field("my_var",provider=NameProvider())cfg=Cfg()print(cfg.my_var)# my_varAlso we can cast our values to python objects (or just manipulate them):frombetterconfimportfield,Config# out of the box we have `to_bool` and `to_int`frombetterconf.casterimportto_bool,to_int,AbstractCasterclassDashToDotCaster(AbstractCaster):defcast(self,val:str):returnval.replace("-",".")to_dot=DashToDotCaster()classCfg(Config):integer=field("integer",caster=to_int)boolean=field("boolean",caster=to_bool)dots=field("dashes",caster=to_dot)cfg=Cfg()print(cfg.integer,cfg.boolean,cfg.dots)# -500, True, hello.worldinteger=-500boolean=truedashes=hello-worldpythonour_file.pyLicenseThis project is licensed under MIT License.SeeLICENSEfor details.Made with :heart: byprostomarkeloffand our contributors.
Package: betterconfig
betterconfig provides a more convenient and extensible configuration language,
and a simpler interface built on python’s builtin ConfigParser format, along
with a drastically simplified interface for loading configs.Type Coercion Boilerplate SucksConfigParser, like many config languages, treats all values as strings,
meaning that when you have configs like this:[config]
foo = 1
bar = a,list,of,strings
baz = just a plain old stringyou end up with boilerplate that looks like this:from ConfigParser import ConfigParser
MAP = {
    'foo': int,
    'bar': lambda x: x.split(','),
    'baz': str,
}
c = ConfigParser()
c.read('./foo.cfg')
config = {k:MAP[k](v) for k,v in c.items('config')}Don’t you really wish you could just do this:[config]
foo = 1
bar = ['a', 'list', 'of', 'strings']
baz = "just a plain old string"and drop the map?import betterconfig
config = betterconfig.load('./foo.cfg')['config']betterconfig supports all literal types supported byast.literal_eval:
strings, numbers, tuples, lists, dicts, booleans, and None.More Flexibility in Config, Less Config by ModuleWe wanted a config language that was as easy to use as a settings module in
django or flask (and nearly as extensible), but less magical to initialize,
and slightly safer than something like this:import importlib
settings = importlib.import_module('settings')So we want a config that can do stuff like this:top_level  = 'variables defined outside of sections'
include    = ['./include.cfg', 'include.d/*.cfg']

[section]
namespaced = TrueAnd we don’t want to have to iterate sections or items, we really just want to
load it into a dict:import betterconfig
settings = betterconfig.load('./fancy.cfg')And if you’re really in love with.notation, you can always do something
silly like make a modulesettings.pythat does something magical like:import betterconfig
globals().update(betterconfig.load('./fancy.cfg'))InstallingThe betterconfig project lives ongithub, and is available viapip.Installing v0.3 From Pipsudo pip install betterconfig==0.3Installing v0.3 From Sourcecurl https://github.com/axialmarket/betterconfig/archive/version_0.3.tar.gz | tar vzxf -
cd betterconfig
sudo python setup.py installRunning TestsThe betterconfig tests require py.test, which can be installed via pip.sudo pip install pytest==2.5.2
py.test test_betterconfig.pyAuthors and ContributorsMatthew Story <matt.story@axial.net>Jon Rosebaugh <jon@inklesspen.com>Inspired By:http://stackoverflow.com/a/6209146Inspired By:http://stackoverflow.com/a/2819788
Package: betterconfigs
BetterConfigsA small package to simplify configuration storing and retrievingUsageUsing BetterConfigs is as simple as importing the package, calling a new configuration object, and saving whatever you need to a file.Example CodeImport the package withimport betterconfigsCreate a configuration file object withobjectname = betterconfigs.config(filename)whereobjectnameis a blank variable andfilenameis the string of the configuration file.You can now set properties usingobjectname[property]=key. Note you cannot use the propertyversionas this is specific to the configuration file and must not be changed.import betterconfigs
t = betterconfigs.config('test.config')
t['hello'] = 'world'
print(t['hello'])Encrypting/DecryptingWith version 0.8 of BetterConfigs, you can now encrypt and decrypt your configuration files on the fly. This is great in the case you need to sync configurations, and don't want them to be available to prying eyes.To get started, use theencryptFile()function after you've created theconfigobject. This will encrypt all existing configurations in the file, as well as provide you with an encryption key stored in the propertyencKey. When the configuration object is destroyed, theencKeyvalue is also unloaded from memory, so make sure you save it!To open an encrypted configuration file, create the object again, and set theencKeyvalue to the same one used to encrypt it previously. Then, just access the configuration as normal, and BetterConfigs handles everything for you.Finally, to decrypt the file, make sure theencKeyvalue is set correctly, and use thedecryptFile()function.
Package: better-configuration
# BetterConfigBetterConfig is config library used to create  config structures for projects## InstallationUse the package manager [pip](https://pip.pypa.io/en/stable/) to install betterconfig.```bashpip install better-configuration```## Usage```pythonfrom betterconfiguration import configtest_config = config.BaseConfig("test", "this is a test value")print(test_config.test)```### Result![](images/result.png)## ContributingPull requests are welcome. For major changes, please open an issue firstto discuss what you would like to change.Please make sure to update tests as appropriate.## License[MIT](https://choosealicense.com/licenses/mit/)
Package: bettercord
bettercordPython wrapper forBetterCord APIFew statsInstallationpip install bettercordWARNING!Wrapper is asynchronous, so any method calls should be performed only is asynchronous functions!UsingStartingImporting moduleimportbettercordInilialing clientclient=bettercord.Client("API token")If your don't usingdiscord.pyorpycordinitialize client like this:client=bettercord.Client("API token",fork_name="module name")BotsGetting info about the bot by IDbot_info=awaitclient.get_bot_info(bot_id)Getting comments on the botbot_comments=awaitclient.get_bot_comments(bot_id)Sending statsstatus=awaitclient.post_stats(server_count,shard_count)Automatic sending statsclient.run(bot)UsersGetting user profile by IDuser_info=awaitclient.get_user_info(user_id)Checking the user's vote for the botstatus=awaitclient.check_bot_vote(user_id)ServersGetting info about the server by IDserver_info=awaitclient.get_server_info(server_id)Checking the user's vore for the serverstatus=awaitclient.check_server_vote(server_id,user_id)LinksExamples for this versionAPI docsMonitoring
Package: better-crayons
Better Crayons: Text UI colors for Python.This module is really simple, it gives you colored strings for terminal
usage. Included colors arered,green,yellow,blue,black,magenta,cyan,white, andnormal( as well ascleananddisable).Better Crayonsis nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself.Arguments includealways=Trueandbold=True.FeaturesIf you calldisable(), all future calls to colors will be ignored.If you callnormal(), color is reset to default foreground colorIf the current process is not in a TTY (e.g. being piped), no colors will be displayed.Length of ColoredStrings can be properly calculated.Powered by colorama.Usage is simple# red is red, white is white.
>>> print('{} white'.format(better_crayons.red('red')))
red whiteThat's it!Installation$ pip install better_crayons
Package: better-cryptography
Contentsbetter-cryptographyprovides a simplified interface for encrypting files, folders, and strings, and a simplified interface for generating ciphering objects across multiple cryptography libraries. The library also provides various functions and methods used in cryptography and information security.FAQHow do I install and import the package?Install through thepip3 install better-cryptographycommand. Import viaimport better_cryptographyorfrom better_cryptography import ....How do I report a bug?Email me atw.garrioch456@gmail.com.
Package: betterdata
betterdata by gmankalibrary for working with data. Features: automatic writing to disk when new data is added to an object, quick export to ymlnavigationinstallationusagereadingautosavesmanual savessome syntax sugarinteractive inputlicenseinstallation^pipinstallbetterdatausage^frombetterdataimportDatadf=Data(data={'key1':'val1','key2':'val2',},file_path='data.yml')after running this code it will automatically create filedata.ymlkey1: val1
key2: val2if file already exists, then it will be overwrittenreading^if you will not specifydataargument, then data will be read from diskfrombetterdataimportDatadf=Data(file_path='data.yml')print(df)# {'key1': 'val1', 'key2': 'val2'}if file does not exists then dict will be emptyfrombetterdataimportDatafrompathlibimportPathPath('data.yml').unlink()data=Data(file_path='data.yml')print(data)# {}autosaves^if you put something in the dictionary then it will also automatically written to diskfrombetterdataimportDatadata=Data(file_path='data.yml')print(data)# {}print(Path('data.yml').exists())# Falsedata['key1']='val1'data['key2']='val2'print(data)# {'key1': 'val1', 'key2': 'val2'}print(open('data.yml','r').read())# key1: val1# key2: val2manual saves^if you editing list in a dict then it will not automatically saved, but you can save it manuallyfrombetterdataimportDatafrompathlibimportPathPath('data.yml').unlink(missing_ok=True)data=Data(file_path='data.yml')print(data)# {}print(Path('data.yml').exists())# Falsedata['list']=[1,2,3]print(data)# {'list': [1, 2, 3]}print(open('data.yml','r').read())# list:# - 1# - 2# - 3data['list'].append('some very important data')print(data)# {'list': [1, 2, 3, 'some very important data']}print(open('data.yml','r').read())# list:# - 1# - 2# - 3# as you can see, appended data was not written on disk, so you can write it manuallydata.to_file()print(open('data.yml','r').read())# list:# - 1# - 2# - 3# - some very important datasome syntax sugar^frombetterdataimportDatadata=Data({'key1':'val1','key2':'val2',})print(data)# {'key1': 'val1', 'key2': 'val2'}print(data['key1'])# val1print(data.key1)# val1print(data.to_str())# key1: val1# key2: val2print('key2'indata)# Trueprint('key3'indata)# Falseprint(data['key3'])# Noneprint(data.key3)# AttributeError: 'Data' object has no attribute 'key3'interactive input^frombetterdataimportDatadata=Data()data.interactive_input('key1')it will interactively ask user to input value forkey1args:item: str# key namedigits_to_int: bool = True# convert digits from str to intkill_app_on_exit: bool = True# kill app if user selectexitbuttonbreak_if_exist: bool = True# skip   interactive input if key already in dictsel: Sel = yes_no# you can specify Sel object fromeasyselect libwhich will be used to confirm the valuetext = None# change text which will be printed on the screenlicense^gnu gpl 3
Package: better-devtools
python devtoolsPython's missing debug print command and other development tools.For more information, seedocumentation.InstallJustpipinstalldevtoolsIf you've got python 3.7+ andpipinstalled, you're good to go.Usagefromdevtoolsimportdebugwhatever=[1,2,3]debug(whatever)Outputs:test.py:4<module>:whatever:[1,2,3](list)That's only the tip of the iceberg, for example:importnumpyasnpdata={'foo':np.array(range(20)),'bar':{'apple','banana','carrot','grapefruit'},'spam':[{'a':i,'b':(iforiinrange(3))}foriinrange(3)],'sentence':'this is just a boring sentence.\n'*4}debug(data)outputs:Usage without Importdevtools can be used withoutfrom devtools import debugif you adddebuginto__builtins__insitecustomize.py.For instructions on addingdebugto__builtins__,
see theinstallation docs.
Package: bettered
BetteREDIntroductionbettered automatically transcodes a given path of flac files to mp3 files based on desired quality (MP3 V0 or MP3 320) and creates a corresponding torrent file with a specified announce url.bettered usesMoeto initialize and read the configuration, and the pluginmoe_transcodeto handle the transcoding logic.Installation:1. Installbetteredfrom PyPII recommend usingpipxto installbettered.$ pipx install betteredIf you don't care about havingbetteredand it's dependencies (mainlyMoe) in an isolated environment, you can just install normally with pip as well.$ pip install bettered2. Installmktorrentmktorrentmust be built from source unless your package manager includes >=v1.1$ git clone https://github.com/Rudde/mktorrent.git
$ cd mktorrent
$ sudo make install3. Installffmpeghttps://ffmpeg.org/download.htmlRunffmpeg -hto ensure it's in your path.4. ConfigureYour configuration file should exist in "~/.config/bettered/config.toml" and should look like the following:enable_plugins=["transcode"][transcode]transcode_path="~/transcode"[bettered]torrent_file_path="~/torrents"announce_url="https://flacsfor.me/213/announce"[move]album_path="{album.artist} - {album.title} ({album.year})"transcode_pathis where the transcoded albums will be placed.torrent_file_pathis where the.torrentfiles will be placesannounce_urlyour announce url for your tracker of choice.album_pathis the format of the album path. This will also have the bitrate automatically appended. See theMoe docsfor more information on customizing this value.5. Runbettered -hContributing:1. Fork the repository and create a feature/bug fix branch2. Install development requirements$ poetry install3. Hack away4. Lint your code$ pre-commit run -a5. Submit a pull request
Package: better-exceptions-fork
Note:This a fork of the originalbetter_exceptionslibrary.
This fork is intended to fix some edge cases I reported (see#47),but for
this it adds two dependencies to the project. The fixed errors are too
small to justify the addition of dependency to the main library, hence
this fork that I publish for personal use.better-exceptionsPretty and more helpful exceptions in Python, automatically.UsageInstallbetter_exceptionsvia pip:$pipinstallbetter_exceptionsAnd set theBETTER_EXCEPTIONSenvironment variable to any value:exportBETTER_EXCEPTIONS=1# Linux / OSXsetxBETTER_EXCEPTIONS1# WindowsThat’s it!Python REPL (Interactive Shell)In order to usebetter_exceptionsin the Python REPL, first install the
package (as instructed above) and run:$python-mbetter_exceptionsType "help", "copyright", "credits" or "license" for more information.(BetterExceptionsConsole)>>>in order to drop into abetter_exceptions-enabled Python interactive shell.Advanced UsageIf you want to allow the entirety of values to be outputted instead of
being truncated to a certain amount of characters:importbetter_exceptionsbetter_exceptions.MAX_LENGTH=NoneWhile usingbetter_exceptionsin production, do not forget to unset
theBETTER_EXCEPTIONSvariable to avoid leaking sensitive data in
your logs.TroubleshootingIf you do not see beautiful exceptions, first make sure that the
environment variable does exist. You can tryecho $BETTER_EXCEPTIONS(Linux / OSX) orecho %BETTER_EXCEPTIONS%(Windows). On Linux and
OSX, theexportcommand does not add the variable permanently, you
will probably need to edit the~/.profilefile to make it
persistent. On Windows, you need to open a new terminal after thesetxcommand.Check that there is no conflict with another library, and that thesys.excepthookfunction has been correctly replaced with thebetter_exceptions’s one. Sometimes other components can set up their
own exception handlers, such as thepython3-apportUbuntu package
that you may need to uninstall.Make sure that you have not inadvertently deleted thebetter_exceptions_hook.pthfile that should be in the same place as
thebetter_exceptionsfolder where all of your Python packages are
installed. Otherwise, try re-installingbetter_exceptions.You can also try to manually activate the hook by addingimport better_exceptions; better_exceptions.hook()at the beginning
of your script.Finally, if you still can not get this module to work,open a new
issueby
describing your problem precisely and detailing your configuration
(Python andbetter_exceptionsversions, OS, code snippet,
interpeter, etc.) so that we can reproduce the bug you are experiencing.LicenseCopyright © 2017, Josh Junon. Licensed under theMIT
license.
Package: better-fasta-grep
Better FASTA GrepBetter FASTA Grep, or BFG for short, is a Grep-like utility for retrieving
matching sequence records from a FASTA file. Given one or more patterns and a
FASTA file, it searches the file for matching headers and or sequences and
outputs any matching headers, sequences, or both.FeaturesSearch headers, sequences, or bothSearch via regular expressions or plain stringsCase-insensitive searchSelect non-matching sequence recordsCount the number of matchesDisplay line numbers in the resultSequence records, not individual lines, are selectedMulti-line sequences are treated as singular unitsFlexible output options: output headers, sequences, or bothA screenshot of running BFG under macOS Mojave.Quick installationThe easiest way to install this program is viapip:pipinstallbetter_fasta_grepYou can then launchbfgusingoneof the following commands:bfg--help
better_fasta_grep--help# equivalentDocumentationIntroductionInstallationInvokingbfgRegular ExpressionsInput DataUsage© Department for Animal Evolution and Biodiversity 2019