Metadata-Version: 2.1
Name: infer_parser
Version: 0.0.2
Summary: Library for generating shell parsers from type hints
Home-page: https://github.com/lggruspe/infer-parser
Author: Levi Gruspe
Author-email: mail.levig@gmail.com
License: UNKNOWN
Description: infer-parser
        ============
        
        ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lggruspe/infer-parser/Python%20package)
        [![PyPI](https://img.shields.io/pypi/v/infer_parser)](https://pypi.org/project/infer_parser/)
        [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/infer_parser)](https://pypi.org/project/infer_parser/)
        [![GitHub](https://img.shields.io/github/license/lggruspe/infer-parser)](./LICENSE)
        
        infer-parser is a Python library for inferring shell parsers from type hints.
        
        Example
        -------
        
        ```python
        from typing import Optional
        from infer_parser import infer, CantParse
        
        parse = infer(Optional[int])
        
        assert parse("5") == 5
        assert parse("-11") == -11
        assert parse("") is None
        assert parse("None") is None
        assert isinstance(parse("12.13"), CantParse)
        
        parse_tuple = infer(tuple[float, ...])
        
        assert parse_tuple("1.5") == (1.5,)
        assert parse_tuple("0.0  4.2 -1") == (0.0, 4.2, -1.0)
        assert parse_tuple("") == ()
        assert isinstance(parse_tuple("Hello, world!"), CantParse)
        ```
        
        Limitations
        -----------
        
        infer-parser cannot always infer a parser.
        
        ```python
        from typing import Callable
        from infer_parser import infer, CantInfer
        
        parse = infer(Callable[..., int])  # not supported
        assert isinstance(parse, CantInfer)
        ```
        
        License
        -------
        
        [MIT](./LICENSE).
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
