1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

formatting

This commit is contained in:
Kelly Brazil
2024-01-30 20:19:15 -08:00
parent c332c4febf
commit 7659fe470a
2 changed files with 17 additions and 21 deletions

View File

@ -14,12 +14,12 @@ Usage (module):
Schema:
{
"path": string or null,
"parent": string or null,
"filename": string or null,
"stem": string or null,
"extension": string or null,
"path_list": [ array or null
"path": string,
"parent": string,
"filename": string,
"stem": string,
"extension": string,
"path_list": [
string
],
}
@ -27,7 +27,6 @@ Schema:
Examples:
$ echo "/abc/def/gh.txt" | jc --path -p
{
"path": "/abc/def/gh.txt",
"parent": "/abc/def",
@ -41,18 +40,16 @@ Examples:
"gh.txt"
]
}
"""
from pathlib import PurePosixPath, PureWindowsPath
from typing import Dict
import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.0'
description = 'path string parser'
description = 'POSIX path string parser'
author = 'Michael Nietzold'
author_email = 'https://github.com/muescha'
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
@ -74,7 +71,6 @@ def _process(proc_data: Dict) -> Dict:
Dictionary. Structured to conform to the schema.
"""
# no changes
return proc_data

View File

@ -1,6 +1,7 @@
"""jc - JSON Convert POSIX path list string parser
Parse a colon-separated POSIX path list, commonly found in environment variables.
Parse a colon-separated POSIX path list, commonly found in environment
variables.
Usage (cli):
@ -15,12 +16,12 @@ Schema:
[
{
"path": string or null,
"parent": string or null,
"filename": string or null,
"stem": string or null,
"extension": string or null,
"path_list": [ array or null
"path": string,
"parent": string,
"filename": string,
"stem": string,
"extension": string,
"path_list": [
string
],
}
@ -69,7 +70,7 @@ import jc.utils
class info():
"""Provides parser metadata (version, author, etc.)"""
version = '1.0'
description = 'path list string parser'
description = 'POSIX path list string parser'
author = 'Michael Nietzold'
author_email = 'https://github.com/muescha'
compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd']
@ -91,7 +92,6 @@ def _process(proc_data: List[Dict]) -> List[Dict]:
List of Dictionaries. Structured to conform to the schema.
"""
# no changes
return proc_data
@ -113,7 +113,7 @@ def parse(data, raw=False, quiet=False):
jc.utils.compatibility(__name__, info.compatible, quiet)
jc.utils.input_type_check(data)
# This parser is an alias of path.py
# This parser uses path.py
path.info = info # type: ignore
delimiter = ":" if "\\" not in data else ";"