Saravanan666/pypi-org huggingface dataset:
Package: argresolver
ArgResolver v0.3.3Resolver is a simple decorator for resolving (missing) arguments at runtime.
It performs various tasks from looking up arguments from the environment variable scope to simple service dependency injection.1.Resolver1.1.Environment1.2.Map1.3.Chain1. Resolver1.1. Environment# We inject arguments from the environment variables scope to a simple function# We use a `prefix` to minimize clashes with other components# username will have a correponding DB_USERNAME, same for password and databasefromargresolverimportEnvironmentfromargresolver.utilsimportmodified_environ# We use it to alter the environment variables@Environment()defconnect(host,user,password):print("Connecting:{user}:{password}@{host}".format(**locals()))withmodified_environ(PASSWORD='my_pass'):connect('localhost','admin')# Prints: Connecting: admin:my_pass@localhost# We inject arguments from the environment variables scope# to an instance __init__.# We use a `prefix` to minimize clashes with other components that have a username / password.# Argument username will have a correponding DB_USERNAME, same for password and databasefromargresolverimportEnvironmentfromargresolver.utilsimportmodified_environ# We use it to alter the environment variablesclassConnection:@Environment(prefix='DB')def__init__(self,username,password,database='default'):self.username=usernameself.password=passwordself.database=databasedef__str__(self):# Hint: In a real world example you won't put your password in here ;-)return"Connection(username='{self.username}', password='{self.password}'"\", database='{self.database}')".format(self=self)withmodified_environ(DB_USERNAME='admin',DB_PASSWORD='secret'):conn=Connection()print(str(conn))# Connection(username='admin', password='secret', database='default')1.2. Map# We use the Map resolver to override an argument's default value# that is better suited for our needs.fromargresolverimportMap# Let's assume we cannot touch this code...classFoo:def__init__(self,arg1,arg2='I_dont_like_this_default'):self.arg1=arg1self.arg2=arg2def__str__(self):return"Foo(arg1='{self.arg1}', arg2='{self.arg2}')".format(self=self)# But we can alter the class and wrap a resolver around the class __init__Foo.__init__=Map(dict(arg2="better_default"),default_override=True)(Foo.__init__)foo=Foo("this is arg1")print(str(foo))# Foo(arg1='this is arg1', arg2='better_default')1.3. Chain# We do some automatic dependency injection with fallbackfromargresolverimportChain,Const,Mapinject=Chain(Map(dict(service1="Service1",service2="Service2")),Const("Fallback Service"))classOrchestration:@injectdefbusiness_process1(self,service1,service2):print("Calling service:",service1)print("Calling service:",service2)@injectdefbusiness_process2(self,service1,service3):print("Calling service:",service1)print("Calling service:",service3)orchester=Orchestration()orchester.business_process1()# Prints:# Calling service: Service1# Calling service: Service2orchester.business_process2()# Prints:# Calling service: Service1# Calling service: Fallback Service
Package: arg-robotics-tools
arg_robotics_toolsA toolset for navigation (no ros) created by arg lab.This file will become your README and also the index of your documentation.
Website :https://arg-nctu.github.io/arg_robotics_tools/Installpip install arg_robotics_toolsWe can install it locally :(or use this if above command failed)git clone git@github.com:ARG-NCTU/arg_robotics_tools.gitcd ~/arg_robotics_toolspip install -e .How to useFill me in please! Don't forget code examples:cd ~/arg_robotics_toolssource docker_run.shsource colab_jupyter.shclick ctrl and the url to open browser, then you should see local jupyter notebook!inside jupyter notebook, click .ipynp and run cellsHow to pushclear all notebook outputin docker : $makein your laptop, do your git push
Package: arg-ros-tools
arg_ros_toolsA toolset for navigation(ex:rosbag) created by arg lab.This file will become your README and also the index of your documentation.
Website :https://arg-nctu.github.io/arg_ros_tools/Installpip install arg_ros_toolsWe can install it locally :(or use this if above command failed)git clone git@github.com:ARG-NCTU/arg_ros_tools.gitcd ~/arg_ros_toolspip install -e .How to useFill me in please! Don't forget code examples:cd ~/arg_ros_toolssource docker_run.shsource colab_jupyter.shclick ctrl and the url to open browser, then you should see local jupyter notebook!inside jupyter notebook, click .ipynp and run all cell
Package: argscall
argscallargscall is python library that can be used to call functions while mapping and validating dynamic input arguments «*args or **kwargs» using the function arguments signature.UsagefromargscallimportargsCaller# A simple function that requires one argumentdefdo_something(name):print(name.upper())# Call the function passing a list with argumentsargscall(do_something,"a").call()It becomes more usefull when used with dynamic input arguments, e.g command line arguments:# test.pyimportsysfromargscallimportargsCaller# A sample function that requires an argumentdefdo_something(name):print(name.upper())# Call the function passing the command line argumentsargsCaller(do_something,*sys.argv[1:]).call()Testing different use cases$ python test.py Joe
JOE

$ python test.py
Traceback (most recent call last)
...
argscall.exceptions.MissingArgument: Missing required argument: name


$ python test.py Joe Black
Traceback (most recent call last)
...
argscall.exceptions.TooManyArgument: Got more arguments than expected (value: 'Black')
Package: argscript
Argscript is a port of werkzeug.script to argparse. Argscript generates
a an argparse command line parser from the function definitions of a script.An action is a function in the same module starting withaction_which
takes a number of arguments where every argument has a default. The type
of the default value specifies the type of the argument. Arguments can
then be passed by using–name=valuefrom the shell. [werkzeug.script]Installationdevelopment version::git clone git@github.com:hoffmann/argscript.git
cd argscript
sudo python setup.py installfrom pypi.python.org::pip install argscript
Package: arg-services
Argumentation MicroservicesThis project contains Protobuf definitions for building complex argumentation machines.
The idea is to facilitate a microservice-oriented architecture where individual parts can be swapped out easily.
Along with the Protobuf files, the project also contains code for generating libraries for multiple programming languages that are released as packages in their respective registries:PythonTypeScriptDocumentation can be found at theBuf Schema Registry.Build Locally./generate.sh
Package: argset
GitHub|PyPI|Issuesargsetprovides a simple interface for determining whether a callable takes
an argument with a given name, filtering adictof potential arguments down
to just those that a callable accepts, and determining any required arguments
that are missing from adictof potential arguments.Installationargsetrequires Python 3.6 or higher.  Just usepipfor Python 3 (You have pip, right?) to installargsetand its dependencies:python3 -m pip install argsetExamplesInspecting a function’s arguments:>>> from argset import argset
>>> def my_func(foo, bar):
...     print(f"foo={foo!r}")
...     print(f"bar={bar!r}")
...
>>> a = argset(my_func)
>>> "foo" in a
True
>>> "quux" in a
FalseFiltering a set of arguments to just those accepted by the function:>>> a.select({"foo": 42, "bar": 23, "quux": 17})
{'foo': 42, 'bar': 23}
>>> my_func(**a.select({"foo": 42, "bar": 23, "quux": 17}))
foo=42
bar=23Same as above, but now the function takes**kwargs:>>> from argset import argset
>>> def my_func2(foo, **kwargs):
...     print(f"foo={foo!r}")
...     for k, v in kwargs.items():
...          print(f"{k}={v!r}")
...
>>> a2 = argset(my_func2)
>>> "foo" in a2
True
>>> "quux" in a2
True
>>> a2.select({"foo": 42, "bar": 23, "quux": 17})
{'foo': 42, 'bar': 23, 'quux': 17}
>>> my_func2(**a2.select({"foo": 42, "bar": 23, "quux": 17}))
foo=42
bar=23
quux=17APIargset(func:Callable)->ArgSetInspects a callable and returns a summary of its arguments as anArgSetclassArgSetA representation of the arguments taken by a callable.  It has the following
attributes & properties:required_positional_only: intThe number of arguments that are positional-only and do not have default
valuesoptional_positional_only: intThe number of arguments that are positional-only and have a default valuepositional_only: intThe total number of positional-only argumentsrequired_args: frozenset[str]The names of all positional-or-keyword or keyword-only arguments that do
not have default valuesoptional_args: frozenset[str]The names of all positional-or-keyword or keyword-only arguments that have
default valuesargnames: frozenset[str]The names of all positional-or-keyword or keyword-only argumentstakes_args: boolWhether the callable has an argument of the form*argstakes_kwargs: boolWhether the callable has an argument of the form**kwargsArgSetobjects support theinoperator; an expression of the formargname in areturnsTrueiffargnameis ina.argnamesora.takes_kwargsisTrue.ArgSetobjects have the following methods:ArgSet.select(kwargs:Dict[str,Any])->Dict[str,Any]Returns all items inkwargswhere the key is the name of a
positional-or-keyword or keyword-only argument accepted by the callable.  Iftakes_kwargsisTrue, the return value is a copy ofkwargs.ArgSet.missing(kwargs:Dict[str,Any])->FrozenSet[str]Returns all keys inrequired_argsthat do not appear inkwargs
Package: argshell
argshellIntegrates the argparse and cmd modules to create custom shells with argparse functionality.InstallationInstall with:pip install argshellUsageCustom shells are created by subclassing the ArgShell class and adding functions of the formdo_*(), just like the cmd.Cmd class.TheArgShellclass contains arich.console.Consoleobject that can be used to print renderables.In terminal:Rather than being limited to input strings, you can useargparsestyle parsers for shell commands.Create a function that instantiates anArgShellParserinstance, adds arguments, and then returns theArgShellParserobject.Then you can can decoratedo_*functions usingwith_parser()to pass aNamespaceobject instead of a string.In terminal:Thewith_parserfunction also accepts an optional list of functions that accept and return anargshell.Namespaceobject.These functions will be executed in order after the parser function parses the arguments.In terminal:When using your shell, enteringhelp commandwill, in addition to the command's doc string,
print the help message of the parser that decorates it, if it is decorated.Thecapturecommand can be used to save an svg of another command's output by prepending to a command.(NOTE: This only works for output printed withArgShell'sconsolemember mentioned earlier.)The font size is proportional to your terminal width when using the command and any text your terminal wraps will be truncated in the svg.The following would create a file calledadd.svgin your current directory:The saved svg:There's also a "hidden" command for generating documentation calledshell_docs.Executing that command forMyShell:
Package: argskwargsmodifier
A decorator that modifies the arguments and keyword arguments of a function before calling it.Tested against Windows / Python 3.11 / Anacondapip install argskwargsmodifierAdecoratorthatmodifiestheargumentsandkeywordargumentsofafunctionbeforecallingit.Args:f_py(function,optional):Reservedforthefunction;donotusethisargumentexplicitly.args_and_function(tupleoftuples):Atupleoftupleswhereeachtuplecontainsanargumentnameandafunctiontotransformtheargument.Thedecoratorwillapplythespecifiedfunctiontoeachargumentwithamatchingname.Eachtransformationfunctiontakestwoarguments:theargumentvalueandadictionarycontainingallkeywordargumentsandarguments(transformedintokwargs)passedtothedecoratedfunction.Returns:function:Thedecoratedfunction.Example:fromargskwargsmodifierimportchange_args_kwargs@change_args_kwargs(args_and_function=(("arg1",lambdaarg,allkwargs:arg*2),("arg2",lambdaarg,allkwargs:arg*3ifargelseNone),("arg3",lambdaarg,allkwargs:arg*5ifallkwargs.get('arg2')elsearg*50),))defexample_function(arg1,arg2=None,arg3=None):print(arg1,arg2,arg3)pass# Test the decorated functionexample_function(1,arg3=3)# Output: 2 None 150example_function(1,54,arg3=3)# Output: 2 162 15The`change_args_kwargs`decoratorallowsyoutomodifyargumentsandkeywordargumentsbasedontheprovided`args_and_function`listbeforeinvokingthedecoratedfunction.Eachtransformationfunctionin`args_and_function`receivestheargument's value and a dictionary of all keywordargumentspassedtothedecoratedfunction,givingyouflexibilityinargumentmodification.
Package: argskwargsmodifierclass
A decorator that modifies the arguments and keyword arguments of a function based on the calling instance's attributes.Tested against Windows / Python 3.11 / Anacondapip install argskwargsmodifierclassAdecoratorthatmodifiestheargumentsandkeywordargumentsofafunctionbasedonthecallinginstance's attributes.Args:f_py(function,optional):Reservedforthefunction;donotusethisargumentexplicitly.args_and_function(tupleoftuples):Atupleoftupleswhereeachtuplecontainsanargumentnameandafunctiontotransformtheargument.Thedecoratorwillapplythespecifiedfunctiontoeachargumentwithamatchingname.Eachtransformationfunctiontakesthreearguments:theargumentvalue,adictionaryofkeywordarguments,andtheinstancethatcalledthedecoratedmethod.Returns:function:Thedecoratedfunction.Example:fromargskwargsmodifierclassimportchange_args_kwargsclassADBTEST:def__init__(self,stripit=True):self.stripit=stripit@change_args_kwargs(args_and_function=(("text",lambdaarg,argdict,instance:arg.strip("x")ifinstance.stripitelsearg,),))defonefunction(self,text,number=10):print(f"{text=}")print(f"{number=}")t=ADBTEST(stripit=True)t.onefunction("bibib    xxxx",number=20)t.onefunction("bibibx    xxxx",15)t2=ADBTEST(stripit=False)t2.onefunction(text="aaabibib",number=0x5)t2.onefunction("aaaabibibx    xx")t.stripit=Falset.onefunction("bibib    xxxx")t.onefunction("bibibx    xxxx")t2.stripit=Truet2.onefunction("aaabibib   xxx")t2.onefunction("aaaabibibx    xx")# text='bibib    '# number=20# text='bibibx    '# number=15# text='aaabibib'# number=5# text='aaaabibibx    xx'# number=10# text='bibib    xxxx'# number=10# text='bibibx    xxxx'# number=10# text='aaabibib   '# number=10# text='aaaabibibx    '# number=10The`change_args_kwargs`decoratorallowsyoutomodifyfunctionargumentsandkeywordargumentsbasedontheattributesofthecallinginstance.Ittakesatupleofargumenttransformations,eachofwhichisdefinedasatuplecontaininganargumentname,atransformationfunction,andtheinstancethatcalledthedecoratedmethod.Thedecoratordynamicallyadjuststheargumentsaccordingtotheinstance's attributes,providingfine-grainedcontroloverargumentmodification.
Package: argspander
argspander====Python package that provides argument expansion of objects.Why:----It was created to enable a sane way of entering arguments gathered fromargparse into your program, without the need to pass round an arguments object.Usage:---->>> import argspander>>> @argspander.expand... def f(a, b, c):...     print "a: %s, b: %s, c: %s" % (a, b, c)>>> f(3, 2, 1)a: 3, b: 2, c: 1>>> class Args():  # similar to the object return by argparse...     a = 3...     b = 2...     c = 1>>>  f(Args(), expand=True)a: 3, b: 2, c: 1
Package: argsrun
Simple tool for creating pluggable commands and sub-commands.Usage example:# in setup.py of your project specify argsrun entry point in console scripts# and provided commands as follows:setup(name="MyProj",# ...entry_points={'console_scripts':['myproj = argsrun:main',# argsrun will handle main command],'myproj':[# ...and lookup for this subcommands'main = myproj:main','run = myproj.module:run',],})In case you have several packages/projects and you want them to share same
entry point, you can easily do it like follows:# my-frontend-app/setup.pysetup(name="MySite Frontend",entry_points={'console_scripts':['mysite = argsrun:main',],'mysite':['serve-frontend = frontend:serve',]})# my-backend-app/setup.pysetup(name="MySite Admin backend",entry_points={'console_scripts':['mysite = argsrun:main',],'mysite':['serve-admin = backend:serve',]})# In my-frontend-app/frontend/__init__.pyimportargsrundefhandler(options):# Run frontend apppassdefparser_setup(ap):ap.add_argument('--port',help="Port to bind to")main=argsrun.Entry(handler,parser_setup)
Package: argstart
argstartLets you define a "main" function to be run automatically. If that function has arguments, they'll be turned into command-line arguments.So you can do:fromargstartimportstart@startdefmain(in_path:str,out_path:str,timeout:int=500):...Instead of:fromargparseimportArgumentParserdefmain(in_path:str,out_path:str,timeout:int=500):......if__name__=="__main__":parser=ArgumentParser()parser.add_argument("in_path",type=str)parser.add_argument("out_path",type=str)parser.add_argument("-t","--timeout",type=int,default=500)args=parser.parse_args()main(args.in_path,args.out_path,args.timeout)More detailsMostly:just write the function as you normally would, and it should work as you expect.Usepython your_file.py --helpfor full generated usage, like with argparse.If specified, type annotations will be used to determine the command-line argument type.Parses common docstring formats usingdocstring-parserto add command and argument descriptions.So that all your functions get defined first, the main function is called at the end of your script - not immediately when it's defined/decorated. This is the same as if you hadif __name__ == "__main__"at the bottom.Command-line--flagsalso get a short acronym you can use instead, like-f.It's command-line convention that flags are optional and positional arguments are required, so this is how arguments are translated by default:defmain(one,two,foo=1,bar=2)# command-line: example.py [-f FOO] [-b BAR] one twoBut you could force required arguments to becomerequired flagsby making them keyword-only:defmain(one,*,two,foo=1,bar=2)# command-line: example.py -t TWO [-f FOO] [-b BAR] oneOr force optional arguments to becomeoptional positional argumentsby making them positional-only:defmain(one,two,foo=1,/,bar=2)# command-line: example.py [-b BAR] one two [foo]Supports*argsand**kwargs:defmain(foo,*bar)# command-line: example.py foo [bar ...]defmain(foo,**bar)# command-line: example.py [-b [BAR ...]] fooFinally, booleans will by default create a--toggle-flagwhich don't require any value after:defmain(foo=False)# command-line: example.py [-f]# (meaning foo defaults to False when -f flag is not given)
Package: argstat
# argstat
Beautiful printer for arguments (argparse) inspired by youngnam## Install` $ pip install argstat `## Example 1` >>> from argstat import Argstat # ① >>> import argparse >>> >>> parser = argparse.ArgumentParser() >>> input_args =parser.add_argument_group('Inputargs') >>>input_args.add_argument('--train_target',type=str, >>>default='C',choices=['C','C+E'])>>>input_args.add_argument('--test_target',type=str, >>>default='C',choices=['C','C+E'])>>>input_args.add_argument('--rec_size',type=int, default=111) >>>input_args.add_argument('--input_size',type=int, default=222) >>>input_args.add_argument('--num_vital',type=int, default=333) >>>input_args.add_argument('--cut_window',type=int, default=444) >>>input_args.add_argument('--skip_prob',type=float, default=555) >>>input_args.add_argument('--skip_mask',type=int, default=666) >>>input_args.add_argument('--target_vital',type=int, default=777) >>> >>> train_args =parser.add_argument_group('Trainargs') >>>train_args.add_argument('--num_epochs',type=int, default=888) >>>train_args.add_argument('--batch_size',type=int, default=999) >>>train_args.add_argument('--lr',type=float, default=0.1234) >>> >>> base_args =parser.add_argument_group('Baseargs') >>>base_args.add_argument('--save_path',type=str,default='testlong path') >>>base_args.add_argument('--weight_path',type=str) >>>base_args.add_argument('--gpu',type=str,default='1234')>>>base_args.add_argument('--device',type=str) >>>base_args.add_argument('--mode',type=str,default='base',>>>choices=['base','single'])# ② >>> >>> argstat = Argstat(parser) >>> print (argstat) `<img width=”250” alt=”screenshot” src=”https://user-images.githubusercontent.com/3329885/45678036-8eb8b100-bb70-11e8-8205-94c7dcd604a1.png”>## Example 2` >>> ① ~ ② >>> argstat = Argstat(parser, False) >>> print (argstat) `## Example 3` >>> ① ~ ② >>> from six.moves import cStringIO as StringIO >>> argstat = Argstat(parser) >>> print(argstat.print_to(StringIO(),False).getvalue())`## Example 4` >>> ① ~ ② >>> argstat = Argstat(parser) >>> print(argstat.jsonify())`## Example 5` >>> ① ~ ② >>> argstat = Argstat(parser) >>> withopen("path","w")as fp: >>>     argstat.print_to(fp, False) `
Package: args-to-db
pipinstallargs_to_dbData Generation Tool for Argument Optimisationargs_to_dbis an attempt to generalize and simplify the process of running a programm in different modes or configurations and combining the resulting datasets to allow for further analysis.The functionality is separated into three different (independently usable) parts:Command ConstructionGiven a programm/script which is highly dependent on parameters and arguments, which we want to run for swarm of different settings, yielding datasets for further analysis.Argument construction is made easy with the interfacescmd, option, flagwhich are the intended way of constructingCommandandCommandListobjects.fromargs_to_dbimportcmd,flag,optionpy=cmd('python')# > py=[['python']]script=cmd('script.py')# > py=[['script.py']]data=option('--input',['file1.csv','file2.csv'])# > data=[['--input', 'file1.csv'],#         ['--input', 'file2.csv']]opt_flags=flag('-O')+flag('-r')# > opt_flags=[[],#              ['-r'],#              ['-O'],#              ['-O', '-r']]log_flag=flag('--log',vary=False)# > log_flag=[['--log']]cmds=py+script+data+opt_flags+log_flag# > cmds=[['python', 'script.py', '--input', 'file1.csv', '--log'],#         ['python', 'script.py', '--input', 'file1.csv', '-r', '--log'],#         ['python', 'script.py', '--input', 'file1.csv', '-O', '--log'],#         ['python', 'script.py', '--input', 'file1.csv', '-O', '-r', '--log'],#         ['python', 'script.py', '--input', 'file2.csv', '--log'],#         ['python', 'script.py', '--input', 'file2.csv', '-r', '--log'],#         ['python', 'script.py', '--input', 'file2.csv', '-O', '--log'],#         ['python', 'script.py', '--input', 'file2.csv', '-O', '-r', '--log']]TheCommandListobjects are arrays of commands (which themselves are arrays again), they behave like normal python arrays except for the differnt usage of the+and+=operators.Command ExecutionA givenCommandListobject may then be executed withrun, providing the user with a live interface in the terminal of execution states and parallelisation control of the execution.run(cmds,threads=4)# runs all specified commands with up to 4 concurrent threads.Data CollectionData may be produced by the programm/script independently of being called withargs_to_db, which is therefore completely optional.
But functionality is provided to make data collection and combination straight forward and as easy as possible for fast results.args=argparse.ArgumentParser().parse_args()config=config_from_args(args,__file__)write_results(config,{'solver_solve_time':solve_time})This produces an output which is then later on combined with the others by theruntask - note the native support ofargparseobjects which are often used for argument/parameter parsing.
Package: argsupport
argsupportSupporting argparse best practicesargsupport isunder active development. Would you like to see a particular feature? Ask and thou shall recieve.Installationpip install argsupportDevelopment installation# install lib, but use system links from the repo into sitepackages.pythonsetup.pydevelop# install test dependenices.pythonsetup.pytest# run the testspytesttestsExamplesFuture extensionsRelease notes0.0.1First versionContributorsDonal Mee