This commit is a continuation from commit [3746b773f4] which is a separation of library modules into its own package from a larger project. Version control jump is significant in feature implementations due simply to under-using commit control after minor feature implementations. Project will receive better commit messages going forward on changes to the package.
21 lines
591 B
Python
21 lines
591 B
Python
import os
|
|
import re
|
|
|
|
class LogLevel:
|
|
NORMAL = 0
|
|
PASS = 1
|
|
DEBUG = 2
|
|
WARN = 3
|
|
ERROR = 4
|
|
|
|
def isPathspec(path_spec: str) -> bool:
|
|
__OS: str = os.name
|
|
# define the path spec pattern depending on OS
|
|
__REGEX_PAT = re.compile(r'^(.+)[\\]([^\\]+)\\*$') \
|
|
if __OS == "nt" else re.compile(r'^(.+)[\/]([^\/]+)$')
|
|
## perform a regex match to ensure that the given path is a
|
|
## valid pathspec for the system.
|
|
return bool(re.match(
|
|
__REGEX_PAT, path_spec.strip(r"\"'")) or \
|
|
re.match(r'^[\w\d\-_]+$', path_spec.strip(r"\"'"))
|
|
) |