diff --git a/oslex.py b/oslex.py index 0e3789f..5e53b67 100644 --- a/oslex.py +++ b/oslex.py @@ -4,7 +4,7 @@ def is_posix() -> bool: """ Returns whether the system running Python is POSIX compatible. - This is the condition for oslex.underyling being shlex. + This is the condition for oslex.underlying being shlex. This is also the condition for os.path being posixpath. """ return 'posix' in sys.builtin_module_names @@ -13,7 +13,7 @@ def is_posix() -> bool: def is_windows() -> bool: """ Returns whether the system running Python is Windows based. - This is the condition for oslex.underyling being mslex. + This is the condition for oslex.underlying being mslex. This is also the condition for os.path being ntpath. """ @@ -31,7 +31,7 @@ def is_windows() -> bool: import shlex as underlying elif is_windows(): # mslex has no type annotations -> we have to ignore the "import" error - # also, mypy does not understand conditioanl importing, so it thinks we are redefining the name -> we have to ignore the "no-redef" error + # also, mypy does not understand conditional importing, so it thinks we are redefining the name "underlying" -> we have to ignore the "no-redef" error import mslex as underlying # type: ignore[import, no-redef] else: raise ImportError('no os specific module found') @@ -61,7 +61,8 @@ def join(split_command: list[str]) -> str: The returned value is shell-escaped to protect against injection vulnerabilities (see quote()). This function is safe to use both for POSIX-compatible shells and for Windows's cmd. """ - # shlex only has join() since python 3.8 + # shlex only has join() since Python 3.8 # mslex doesn't have it at all - # it's easier to just implement it without trying to import the functionality + # It's easier to just implement it without trying to import the functionality + # Implementation is the same as shlex.join(), see https://github.com/python/cpython/blob/3.8/Lib/shlex.py return ' '.join(quote(arg) for arg in split_command)