Saravanan666/pypi-org huggingface dataset:
Package: enumify
EnumifyA quick way to write documented Enums, or Enums with member valuesInstallpip install enumifyWhat is Enumify?Enumify was built on an idea of how could I be the absolute laziest at declaring Enums, honestly!I didn't enjoy the idea of how I would need to re-type out member names if I just wanted them to be a 1:1, such as the following:importenumclassDaysOfWeek(enum.Enum):MONDAY="monday"TUESDAY="tuesday"WEDNESDAY="wednesday"There is of course, an alternative that lives infastcore, specifically themk_class, which annotates like the following:fromfastcore.basicsimportmk_classmk_class("DaysOfWeek",{o:o.lower()foroin["MONDAY","TUESDAY","WEDNESDAY"]})But I didn't like that theDaysOfWeekclass was permeable as it was not a trueEnum, and I had a side goal of also making the enum members bedocumented.As a result, this is our finished conversion of that previous enum:fromenumifyimportenumify,Member@enumifyclassDaysOfWeek:MONDAY:MemberTUESDAY:MemberWEDNESDAY:MemberAnd we can see its set value below:print(DaysOfWeek.MONDAY)mondayThus we come to the two use-cases ofenumify:Make Enum's whose member's values are the names of the membersMake Enum's whose members can bedocumentedHow do I use it?There are two supported "modes" forenumify, an interactive mode and a static mode. The static mode should be used when you're in environments such as VSCode or PyLint, where they can make use of documentation underneath a particular variable or member.Interactive mode should be if you are developing or working out of Jupyter Notebook for your enums.What do I mean by this? Let's compare two examples.Interactive ModeWith interactive mode, we can not only use theMemberorMemnotation to specify our self-named member, but we can also document that member with an assign:@enumify(interactive=True)classDaysOfWeek:MONDAY:Member="The first day of the week"TUESDAY:Member="The second day of the week"WEDNESDAY:Member="The third day of the week"And now these members will have affiliated documentation:DaysOfWeek.MONDAY.__doc__'The first day of the week'We can even document values that aren'tMembertype by specifying it's documentation last in the assign@enumify(interactive=True)classDaysOfWeek:MONDAY:Member="The first day of the week"TUESDAY:int=0,"Some number"DaysOfWeek.TUESDAY.__doc__'Some number'BUT, they willnothave this documentation show when using IDE's such as VSCode. This is where static mode comes in.Static ModeWith static mode, we can still use theMemberannotation, but we assume that the user will be working out of an IDE and instead rely on how IDE's can annotate variables.
{% include note.html content='If so, it will be impossible for Jupyter/Notebook users to pick up your documentation for the member' %}
Below is our completeDaysOfWeekexample with this:@enumify(interactive=False)classDaysOfWeek:MONDAY:Member"The first day of the week"TUESDAY:Member"The second day of the week"WEDNESDAY:Member"The third day of the week"DaysOfWeek.MONDAY<DaysOfWeek.MONDAY: 'monday'>assertDaysOfWeek.MONDAY.__doc__isNone
Package: enumit
Enumeration library for python.Basic Usagefrom enumit import Enum


class Status(Enum):
    APPROVED = Enum.Field('approved')
    DENIED = Enum.Field('denied', 'Denied')

>> Status.APPROVED
>> approved

>> Status['approved']
>> Approved

>> Status.choices()
>> [('approved', 'Approved'), ('denied', 'Denied')]

>> Status.values()
>> ['approved', 'denied']

>> Status.names()
>> ['Approved', 'Denied']

>> 'approved' in Status
>> True
Package: enum_meta
This Python module provides a metclass-based approach to providing enumerated
types in Python. Enumerated types are defined by define a subclass of the Enum
class, with the class attributes defined the enumerated values. Dictionary style
methods are also provided for things such as accessing and iterating over the
enumeration values. Enumerated type classes can be further subclassed and/or
merged. Once enumerated type classes have been defined, they cannot easily be
modified.Example of use:>>> class Season(Enum):
...    summer = 'Summer'
...    autumn = 'Autumn'
...    winter = 'Winter'
...    spring = 'Spring'>>> this_season = Season.spring
>>> Season.values()
['Summer', 'Autumn', 'Winter', 'Spring']This requires Python 2.2 or greater.
Package: enummi
I love enumerate(), but I hate using it with zip() - this function takes care of itpip install enummiTested against Windows 10 / Python 3.10 / AnacondaCombining multiple iterables:It allows you to merge multiple iterables into a single sequence of tuples. This can be useful when you have several related iterables and want to process them together.Indexing the tuples:The function assigns an index value to each tuple, representing the position of the elements in the original iterables. This indexing provides a convenient way to access and reference elements based on their relative positions.Generates results on the fly:As a generator function, enummi generates and yields results one at a time, as they are needed. This lazy evaluation strategy can save memory and computational resources, especially when dealing with large or infinite sequences.Flexibility with input:The function accepts a variable number of iterables as arguments (*args), allowing you to provide any number of iterables to be combined. It can handle different lengths of input iterables and adapt accordingly.Compatible with different iterable types:The function can work with various types of iterables, such as lists, tuples, strings, or any other iterable object. It is not limited to a specific data structure, providing flexibility in terms of input.Simple and concise implementation:The implementation of enummi is relatively straightforward and concise, utilizing built-in Python functions (zip and enumerate) to achieve the desired functionality. This simplicity makes the function easy to understand and maintain.fromenummiimportenummifori,a,b,cinenummi([1,2,3],[4,5,6],[7,8,9]):print(i,a,b,c)Output:014712582369fori,ainenummi([1,2,3]):print(i,a)Output:011223fori,ainenummi([]):print(i,a)Output:(nooutput)
Package: enum-mixins
Enum Mixins (WIP)TODOs: Configuring this templateCreate a Netlify site for your repository, then turn off automatic builds in Netlify settings.Add these CI secrets:PYPI_API_TOKEN,NETLIFY_AUTH_TOKEN(Netlify user settings - personal access tokens),DEV_NETLIFY_SITE_ID,PROD_NETLIFY_SITE_ID(API ID from Netlify site settings)Set up Codecov at TODOOverviewInstallationpipinstallenum_mixinsUsageDevelopmentSubmit PRs againstdevelopbranch, then make a release pull request tomaster.# Optional: set up a pyenv virtualenvpyenvvirtualenv3.9enum_mixins-3.9echo"enum_mixins-3.9">.python-version
pyenvversion# Install requirementspipinstall--upgradepipwheel
pipinstall-rrequirements_dev.txt# Install local packagepipinstall-e.# Install pre-commitpre-commitinstall# Run testsmaketest# Run lintmakelint# bump version before submitting a PR against master (all master commits are deployed)bump2versionpatch# possible: major / minor / patch# also ensure CHANGELOG.md updatedChangelog0.0.1First release on PyPI.
Package: enumpaths
enumpathsSimple standalone Python tool that takes a host argument and file of URL paths, iterates through the URLs sending a proxied GET request (for Burp Suite).Why?Speed up your pentesting workflowbut mostly because I kept running into this issue where I would have a list of paths & a target but wanted to see the requests/responses in Burp Suite.Repohttps://github.com/0xBruno/enumpaths/Usage:Use pipx to use as standalone tool. Otherwise you will have to dopython3 -m enumpaths.$ enumpaths https://your.target paths.txtor$ cat paths | enumpaths https://your.target -With gobuster output, -n is necessary so you do not include status codes.--helpif you get confusedDefault settings:Proxy -> localhost:8080User-Agent -> Tesla carbrowserExample:Link:https://github.com/0xBruno/enumpaths/blob/main/example.PNGI want to know more:Its like 10 lines of code. Just read it.There's probably a better tool somewhere out there or a flag for an existing tool. Cool. Let me know.
Package: enum-prop
enum-propEnum definitions can't, for good reasons, reference instances of themselves within their
own definitions. This module allows definitions to come around that by mapping the names
of enums for lookups, hidden behind a special dict subclass. This allows enum
definitions to remain tidy, and avoids having to define instance-specific configuration
as property functions.Installation$python3-mpipinstallenum-propUsageimportenumfromenum_propimportenum_property,enum_getterclassVehicle(enum.Enum):car="car"bike="bike"unicycle="unicycle"wheels=enum_property({car:4,bike:2,unicycle:1})__int__=enum_getter({car:4,bike:2,unicycle:1})print(Vehicle.unicycle.wheels)# 1print(Vehicle.car.wheels)# 4print(int(Vehicle.unicycle))# 1print(int(Vehicle.bike))# 2
Package: enum-properties
Enum PropertiesAdd properties to Python enumeration values with a simple declarative syntax.Enum Propertiesis a
lightweight extension toPython’s Enum class. Example:fromenum_propertiesimportEnumProperties,pfromenumimportautoclassColor(EnumProperties,p('rgb'),p('hex')):# name   value      rgb       hexRED=auto(),(1,0,0),'ff0000'GREEN=auto(),(0,1,0),'00ff00'BLUE=auto(),(0,0,1),'0000ff'# the named p() values in the Enum's inheritance become properties on# each value, matching the order in which they are specifiedColor.RED.rgb==(1,0,0)Color.GREEN.rgb==(0,1,0)Color.BLUE.rgb==(0,0,1)Color.RED.hex=='ff0000'Color.GREEN.hex=='00ff00'Color.BLUE.hex=='0000ff'Properties may also be symmetrically mapped to enumeration values, using
s() values:fromenum_propertiesimportEnumProperties,sfromenumimportautoclassColor(EnumProperties,s('rgb'),s('hex',case_fold=True)):RED=auto(),(1,0,0),'ff0000'GREEN=auto(),(0,1,0),'00ff00'BLUE=auto(),(0,0,1),'0000ff'# any named s() values in the Enum's inheritance become properties on# each value, and the enumeration value may be instantiated from the# property's valueColor((1,0,0))==Color.REDColor((0,1,0))==Color.GREENColor((0,0,1))==Color.BLUEColor('ff0000')==Color.REDColor('FF0000')==Color.RED# case_fold makes mapping case insensitiveColor('00ff00')==Color.GREENColor('00FF00')==Color.GREENColor('0000ff')==Color.BLUEColor('0000FF')==Color.BLUEColor.RED.hex=='ff0000'Member functions may also be specialized to each enumeration value, using the
@specialize decorator.fromenum_propertiesimportEnumProperties,specializeclassSpecializedEnum(EnumProperties):ONE=1TWO=2THREE=3@specialize(ONE)defmethod(self):return'method_one()'@specialize(TWO)defmethod(self):return'method_two()'@specialize(THREE)defmethod(self):return'method_three()'SpecializedEnum.ONE.method()=='method_one()'SpecializedEnum.TWO.method()=='method_two()'SpecializedEnum.THREE.method()=='method_three()'Please report bugs and discuss features on theissues page.Contributionsare
encouraged!Full documentation at read the docs.InstallationClone enum-properties fromGitHubor install a release offPyPI:pipinstallenum-properties
Package: enumset
enumsetcollection of Enum classes.Installpip install enumsetEnumsetEnumset stores multiple Enum-class value, each value in Enum-class should be unique.fromenumimportEnum,FlagfromenumsetimportEnumsetA=Enum("A","A1 A2 A3")B=Enum("B","B1 B2")C=Flag("C","C1 C2 C3 C4")es=Enumset([A,B,C])es.setval(A.A1)es.setval(B.B2)es.setval(C.C3)assertlist(es.values())==[A.A1,B.B2,C.C3]assertes.getval(A)==A.A1es.setval(A.A2)# replace A1 -> A2es.setval(C.C4)# replace C3 -> C4assertlist(es.values())==[A.A2,B.B2,C.C4]assertes.getval(A)==A.A2FlagsetFlagset stores multiple Enum-class value, likeset[Enum].fromenumimportEnum,FlagfromenumsetimportFlagsetA=Enum("A","A1 A2 A3")B=Enum("B","B1 B2")C=Flag("C","C1 C2 C3 C4")fs=Flagset([A,B,C])fs.setval(A.A1)fs.setval(B.B2)fs.setval(C.C3)assertlist(fs.values())==[A.A1,B.B2,C.C3]assertlist(fs.getval(A))==[A.A1]fs.setval(A.A2)# A1+A2fs.setval(C.C4)# C3+C4assertlist(fs.values())==[A.A1,A.A2,B.B2,C.C3,C.C4]assertlist(fs.getval(A))==[A.A1,A.A2]assertlist(fs.getval(C))==[C.C3,C.C4]fs.setval(A.A2)# A2 already existsassertlist(fs.values())==[A.A1,A.A2,B.B2,C.C3,C.C4]
Package: enum-switch
Enum-based Switch for PythonThis is an attempt at creating a way to do a reliable, not-bug-prone
implementation, for Python, of aswitchthing like other languages
have.How it worksSuppose you have an enum, like this:class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3And you want to implement logic which branches based on a value which is of typeColor.
You can do it by subclassing theSwitchclass. The syntax should be obvious, but:Inherit from SwitchImplement a method for each value of the EnumIf you are not implementing them all: add adefaultmethod.If you leave any Enum value unaccounted for: it will raise an exception when you
instantiate your class.Then:Instantiate your classCall it as a function passing it a value from the EnumThe respective method will be executed and its return value returnedfrom enum_switch import Switch

class MySwitch(Switch):
    def RED(self):
        return "Apple"

    def GREEN(self):
        return "Kiwi"

    def BLUE(self):
        return "Sky"

switch = MySwitch()

print(switch(Color.RED))

AppleAnd that's it.Some additional notes:Passing it something that is not a value of the correct Enum type will raise ValueErrordefaultis optionalHope someone finds it useful!
Package: enum-tools
Tools to expand Python’s enum module.DocsTestsPyPIAnacondaActivityQAOtherThis library provides the following:enum_tools.autoenum– ASphinxextension to document Enums better thanautoclasscan currently.@enum_tools.documentation.document_enum– A decorator to add docstrings toEnummembers
from a comment at the end of the line.enum_tools.custom_enums– AdditionalEnumclasses with different functionality.Installationenum_toolscan be installed from PyPI or Anaconda.To install withpip:$python-mpipinstallenum_toolsTo install withconda:$condainstall-cconda-forgeenum_toolsFurther Readinghttps://docs.python.org/3/library/enum.htmlIs it possible to define a class constant inside an Enum?Enums with AttributesWhen should I subclass EnumMeta instead of Enum?
Package: enumy
EnumyThe problem with Python's "Enum" module is that it is not a reasonable way to restrict variables to a predefined set of values.Latest version:v1.0.2Installationpipinstall--userenumySpecial methodscheck_typeCheck if a variable matches a certain data type.var.check_type(str)check_valueCheck if a value is present in the allowed values.text="ByteSentinel"var.check_value(text)ExamplefromenumyimportEnumytest=Enumy(("Value 1","Value 2"),str)test="Value 2"# Workingtest=123# Exception
Package: env
Mapping environment variables can be a bit of a pain.Now you can replace this boilerplate:ZENDESK_URL = os.environ['ZENDESK_URL']
ZENDESK_USER = os.environ['ZENDESK_USER']
ZENDESK_PASS = os.environ['ZENDESK_PASS']
ZENDESK_VIEW = os.environ['ZENDESK_VIEW']With a simple call:import env>>> zendesk = env.prefix('zendesk_')
>>> zendesk
{'user': ..., 'pass': ..., 'url': ..., 'view': ...}Or have a bit more control:>>> env.map(user='zendesk_user')
{'user': ...}
Package: env2
# Env2os.environ on stereoidsenv2 allows raising errors on missing environment variables without too much bolierplate code. This is very useful when developing microservices that depends on environment variables.## How it worksWith env2 you can replace this:```pythonimport osvar = os.environ.get('key', None)if not var:raise Exception(f'{key} not found in environment variables')return var```With this:```pythonfrom env2 import env2var = env2('key')```env2 will automatically raise on a missing key, to avoid that:```pythonfrom env2 import env2var = env2('key', raise_error=False)```env2 allows to set default values as well:```pythonfrom env2 import env2var = env2('key', default='key2')```## LicenseThis software is under [WTFPL](http://www.wtfpl.net) license
Package: env2cli
DesriptionInstead of maintain ugly and long entrypoint scripts to call your module with environment variables as arguments from your dockerfile, just add this elegant converting framework from environment variables to cli command line arguments.Installationpipinstallenv2cliUsageAssume your old dockerfile looked like this...ENVPOSITIONAL_ARGvalENVSOME_PARAMvalueENVOTHER_PARAMvaly...ENTRYPOINTpythonmain.py${POSITIONAL_ARG}-p${SOME_PARAM}--other${OTHER_PARAM}...Add new file, for example,entrypoint.pylike this:frommainimportmainfromenv2cliimport*argv=bulk_apply([Argument('POSITIONAL_ARG'),Argument('SOME_PARAM','-p'),Argument('OTHER_PARAM','--other')])main(argv)And the new dockerfile should be looking like this:ENVPOSITIONAL_ARGvalENVSOME_PARAMvalueENVOTHER_PARAMvaly...ENTRYPOINTpythonentrypoint.pyOr even if your program isn’t python!ENVPOSITIONAL_ARGvalENVSOME_PARAMvalueENVOTHER_PARAMvaly...ENTRYPOINT./myprog$(env2cli.py)# instead ENTRYPOINT ./myprogram ${POSITIONAL_ARG} -p ${SOME_PARAM} --other ${OTHER_PARAM}
Package: env2dict
Environment to python dictionary parser utilAboutSyntaxExamplesHow to useMore infoEnvironment to python dictionary parser utilpipinstallenv2dictAboutThis small package provides an ability of easy setting/overriding Python variables from environment. It is expected that u will use to override your configuration data without changing configuration files itself, what is especially useful for containers-oriented applications.SyntaxTo use it, u need to define environment variables matches the pattern:PrefixBodyOperationSuffixwhere:Prefixis any word to determine target variables; for instance,DDprefix means to use only variables starts withDD; can be empty, what means to select all available variables (not recommended)Bodyis the name of the target configuration parameterOperationSuffixis the one of next available suffixes (by default, but u can change your defaults):_NUMBERto convert variable value to integer (environment variables are always strings)_FLOATto convert variable value to float_FLAGto convert variable value tooptional[boolean]at that values:1/yes/Yes/True/trueequaltrue0/no/No/False/falseequalfalseNone/null/NULLequalnull_LISTmeans to parse variable value to string list_LIST_APPENDmeans to parse variable value to string list and append to existing list instead of override_JSONmeans to parse variable value as json stringno suffix means that no conversion will be performed, so variable value will stay a stringMoreover, u can put nested dicts values using__separator in the environment variable name.Note also that u can combine these suffixes to perform more complicated transformations.Examplesenv variableDD_S_COUNT_NUMBER=10will be converted toS_COUNT=10Python objectDD_S_COUNT=10🠚S_COUNT="10"DD_USE_THIS_FLAG=yes🠚USE_THIS=TrueDD_USE_THIS_FLAG=true🠚USE_THIS=TrueDD_USE_THIS_FLAG=no🠚USE_THIS=FalseDD_ALLOWED_HOSTS_LIST_APPEND=127.0.0.1;dev.ocr.com;dev.web.comwill append a list['127.0.0.1', 'dev.ocr.com', 'dev.web.com']toALLOWED_HOSTSvariableDD_READ_ME_JSON={\"a\": 1, \"b\": [1, 2]}will be translated toREAD_ME={'a': 1, 'b': [1, 2]}DD_SOME_DICT__KEY1__KEY2=postgreswill create a dictionarySOME_DICT={'KEY1': {'KEY2': 'postgres'}}if it doesn't exist and will add a field in existing dictionary by aforementioned routeDD_A__B_LIST_APPEND_JSON=[1, 2, 3, [1, 2, \"3\"]]will append[1, 2, 3, [1, 2, "3"]]to the end of valueVfromA={"B": V}How to usefromenv2dictimportparse_varsnew_vars=parse_vars(prefix='DD_',initial_vars=None,source=None)More infoPlease take a look at:parse_varsfunction docstringtestsdirectory of this package repo.
Package: env2fs
Write a file with an env var content or a set of env vars.Usage example:env2fs ~/.ssh/id_rsa SSH_KEY fmod=600 dmod=700Note that the missing dollar sign is intendent to prevent evaluation from
the parent shell itself.The above example writes the contents of the$SSH_KEYenvironment variable
into~/.ssh/id_rsa, with a mode of 600 and 700 for any parent directory
that will be automatically created if necessary.To write an env file, pass a variable name that ends with underscore, ie:export staging_pgpass=foo
env2fs staging.env staging_Will write staging.env with contents:pgpass=fooExtra CLI options:--dryrun       Do not actually touch the fs
--verbose,-v      Verbose output
Package: env2installer
Bundles everything in an Anaconda environment and creates an installer.Tested with Anaconda3, Python 3.9.16, Windows 10All your py-files and any other file you want to add to your app need to be in the ROOT of your env.pip install env2installerPlease install:pyinstallerpip install -U pyinstallerImageMagick (for the icon)https://imagemagick.org/script/download.phpInno Setup (to create the installer)https://jrsoftware.org/isdl.phpfromenv2installerimportcreate_installer_exe# the file for the icon, size doesn't matter, but it must be a png file and can't have spacesimage_for_icon=r"C:\Users\Gamer\Videos\bilder2\2021-02-0603_49_36-Window.png"# there will be 2 output folders: c:\proxytyri_temp and c:\proxytyri# the setup-up file will be: "C:\proxytyri\proxyfilesdownl_setup.exe"outputfolder="c:\\proxytyri"# your py file, make sure that it is in the root of your env!pyfile=r"C:\Users\Gamer\anaconda3\envs\royalehigh\downloadproxies.py"# name of you appappname="proxyfilesdownl"# your nameautor="arni"# path of ImageMagickmagickpath=r"C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick.exe"create_installer_exe(image_for_icon,outputfolder,pyfile,appname,autor,version="1",# version as stringLicenseFile=None,# If None, an empty file will be added. The license file will be shown to the user during the installation.InfoBeforeFile=None,# If None, an empty file will be added. The file will be shown to the user during the installation.InfoAfterFile=None,# If None, an empty file will be added. The file will be shown to the user during the installation.url="https://127.0.0.1",# your urlinnosetupfilepath=r"C:\Program Files (x86)\Inno Setup 6\Compil32.exe",# the Inno Setup executablemagickpath=magickpath,# path of ImageMagickexcludepackages=("pip",),# packages you want to excludeadd_to_pyinstaller_cmd=''# commands to add to pyinstaller, like "--noconsole")# For multiple py to exe (the first file will be the entry)pyfiles=[r"C:\Users\Gamer\anaconda3\envs\subproctest\f1.py",r"C:\Users\Gamer\anaconda3\envs\subproctest\fatye\f2.py",r"C:\Users\Gamer\anaconda3\envs\subproctest\fatye\f3.py",]spefi=create_installer_exe_multi(pyfiles,appname="f1xxx",image_for_icon=r"C:\Users\Gamer\Documents\Downloads\xxxxx.png",autor="arni",magickpath=r"C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick.exe",outputfolder="c:\\proxytyrixxx982111xxxdewddaxxxx",version="982",# version as stringLicenseFile=None,# If None, an empty file will be added. The license file will be shown to the user during the installation.InfoBeforeFile=None,# If None, an empty file will be added. The file will be shown to the user during the installation.InfoAfterFile=None,# If None, an empty file will be added. The file will be shown to the user during the installation.url="https://127.0.0.1",# your urlinnosetupfilepath=r"C:\Program Files (x86)\Inno Setup 6\Compil32.exe",# the Inno Setup executableexcludepackages=("pip",),# packages you want to excludeadd_to_pyinstaller_cmd="--noconsole",# commands to add to pyinstaller, like "--noconsole")
Package: env2json
Installation$[sudo]pipinstallenv2jsonExamples.env.devDB_NAME=nameDB_USER=usernameDB_HOST=127.0.0.1DB_PORT=5432$python-menv2json.env.dev>.env.dev.json.env.dev.json{"DB_HOST":"127.0.0.1","DB_NAME":"name","DB_PORT":"5432","DB_USER":"username"}readme42.com