Argument parser
=============== file: ArgParser.py
class: ArgumentParser
Класс для парсинга аргументов из командной строки.
Методы
add_rule( )
ArgumentParse.add_rule(var_name, flag)
ex: ArgumentParse.add_rule('MyKey', '-key'),
ArgumentParse.add_rule('MyKey', ['-key1', '-key2'])
var_name - имя переменной, которая будет содержать значение после флага
flag - флаг для обозначения аргумента (должен начинаться с "-" и стоять перед значением)
add_rules_dict( )
ArgumentParse.add_rules_dict(rules)
ex: ArgumentParse.add_rules_dict({
'key1': '-flag1',
'key2': ['-flag2', '-flag3']
})
rules - словарь с правилами { var_name: flags }
parse( )
ArgumentParse.parse(args_list = None)
ex: ArgumentParse.parse()
args_list - список аргументов. Если None, то парсинг происходит из sys.argv
Argument list
=============== file: ArgParser.py
class: ArgumentList
Класс, содержащий аргументы консоли после ArgumentParser.parse().
Singleton, следовательно каждый созданный экземпляр класса будет содержать, что и другие те же переменные.
Применение
ex: python main.py --host smth.ru
main.py:
from AEngine_console.ArgParser import ArgumentParser, ArgumentList
ArgumentParser.add_rule('host', ['--host', '-h'])
ArgumentParser.parse()
args = ArgumentList()
print(args.host)
output: smth.ru
Metadata
Release files for AEngineConsole 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| AEngineConsole-0.0.1.tar.gz | 2.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AEngineConsole-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 5.0 kB
Release files / AEngineConsole-0.0.1.tar.gz
| Download URL | AEngineConsole-0.0.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0fdc7883bfe272060b22e5edd3411583d2a715a7cddf6f018481bf03d354c8b
|
|
BLAKE2b-256 checksum How to use checksums |
d65b83ad54ae74cde114f49e4622584119e58323c3664f60f089e6aaad749190
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.2
|
Release files / AEngineConsole-0.0.1-py2.py3-none-any.whl
| Download URL | AEngineConsole-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c21da5856da3bf95a74d6905fc970bdad2aa81a4890caed06b272fa5e3c7df1f
|
|
BLAKE2b-256 checksum How to use checksums |
b860adb7ee81f7f7365a7233226f99c546a4a4147866b9346bf0e498d7fb207e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.2
|
Security for AEngineConsole 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.