Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Way to check

Project description

vbml

To install use this command:

pip install https://github.com/timoniq/vbml/archive/master.zip --upgrade

or:

pip install vbml

To add this project to your project requirements:

  • add string vbml or -e https://github.com/timoniq/vbml/archive/master.zip to your requirements file

  • add element vbml or vbml @ https://github.com/timoniq/vbml/archive/master.zip to your install_requires list

Simple usage example:

from vbml import Patcher
import typing
from vbml.validators import ValidatorManager, AbstractAsynchronousValidator


class MyValidator(AbstractAsynchronousValidator):
    key = "int"

    async def check(self, text: str, *args) -> typing.Union[typing.Any, None]:
        if text.isdigit():
            return int(text)


# Init your VBML main processor
manager = ValidatorManager([MyValidator()])
patcher = Patcher()
# Create a pattern
pattern = patcher.pattern("i am <name> my age is <age:int> years")
# Mind about text sample
text = "i am vbml my age is 0 years"
text2 = "amm.. some text"


def main():
    # Go
    print(patcher.check(text, pattern))
    # >> {'name': 'vbml', 'age': 0}

    print(patcher.check(text2, pattern))
    # >> None


main()

You can ignore check only pattern, without validator formatting:

print(pattern(text))
# >> {'name': 'vbml', 'age': '0'}

Made with :heart:love by timoniq

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for vbml, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size vbml-0.2.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page