mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
add type hints
This commit is contained in:
@ -39,6 +39,7 @@ Examples:
|
|||||||
[]
|
[]
|
||||||
"""
|
"""
|
||||||
import jc.utils
|
import jc.utils
|
||||||
|
from typing import Optional, List, Dict
|
||||||
|
|
||||||
|
|
||||||
class info():
|
class info():
|
||||||
@ -57,7 +58,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def _process(proc_data):
|
def _process(proc_data: List[Dict]) -> List[Dict]:
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -78,7 +79,11 @@ def _process(proc_data):
|
|||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
def parse(data, raw=False, quiet=False):
|
def parse(
|
||||||
|
data: str,
|
||||||
|
raw: Optional[bool] = False,
|
||||||
|
quiet: Optional[bool] = False
|
||||||
|
) -> List[Dict]:
|
||||||
"""
|
"""
|
||||||
Main text parsing function
|
Main text parsing function
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ Examples:
|
|||||||
{example output}
|
{example output}
|
||||||
...
|
...
|
||||||
"""
|
"""
|
||||||
|
from typing import Optional, Dict, Iterable
|
||||||
import jc.utils
|
import jc.utils
|
||||||
from jc.utils import stream_success, stream_error
|
from jc.utils import stream_success, stream_error
|
||||||
from jc.exceptions import ParseError
|
from jc.exceptions import ParseError
|
||||||
@ -69,7 +70,7 @@ class info():
|
|||||||
__version__ = info.version
|
__version__ = info.version
|
||||||
|
|
||||||
|
|
||||||
def _process(proc_data):
|
def _process(proc_data: Dict) -> Dict:
|
||||||
"""
|
"""
|
||||||
Final processing to conform to the schema.
|
Final processing to conform to the schema.
|
||||||
|
|
||||||
@ -90,7 +91,12 @@ def _process(proc_data):
|
|||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
def parse(data, raw=False, quiet=False, ignore_exceptions=False):
|
def parse(
|
||||||
|
data: Iterable[str],
|
||||||
|
raw: Optional[bool] = False,
|
||||||
|
quiet: Optional[bool] = False,
|
||||||
|
ignore_exceptions: Optional[bool] = False
|
||||||
|
) -> Iterable[Dict]:
|
||||||
"""
|
"""
|
||||||
Main text parsing generator function. Returns an iterator object.
|
Main text parsing generator function. Returns an iterator object.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user