pythonfinder.utils module¶
-
pythonfinder.utils.
dedup
(iterable)[source]¶ Deduplicate an iterable object like iter(set(iterable)) but order-reserved.
-
pythonfinder.utils.
ensure_path
(path)[source]¶ Given a path (either a string or a Path object), expand variables and return a Path object.
-
pythonfinder.utils.
expand_paths
(path, only_python=True)[source]¶ Recursively expand a list or
PathEntry
instance
-
pythonfinder.utils.
get_python_version
(path)[source]¶ Get python version string using subprocess from a given path.
-
pythonfinder.utils.
guess_company
(path)[source]¶ Given a path to python, guess the company who created it
-
pythonfinder.utils.
looks_like_python
(name)[source]¶ Determine whether the supplied filename looks like a possible name of python.
-
pythonfinder.utils.
optional_instance_of
(cls)[source]¶ Return an validator to determine whether an input is an optional instance of a class.
- Returns
A validator to determine optional instance membership.
- Return type
_OptionalValidator
-
pythonfinder.utils.
path_is_executable
(path)[source]¶ Determine whether the supplied path is executable.
- Returns
Whether the provided path is executable.
- Return type
-
pythonfinder.utils.
path_is_known_executable
(path)[source]¶ Returns whether a given path is a known executable from known executable extensions or has the executable bit toggled.
- Parameters
path (
Path
) – The path to the target executable.- Returns
True if the path has chmod +x, or is a readable, known executable extension.
- Return type
-
pythonfinder.utils.
path_is_python
(path)[source]¶ Determine whether the supplied path is executable and looks like a possible path to python.
- Parameters
path (
Path
) – The path to an executable.- Returns
Whether the provided path is an executable path to python.
- Return type
-
pythonfinder.utils.
path_is_pythoncore
(path)[source]¶ Given a path, determine whether it appears to be pythoncore.
Does not verify whether the path is in fact a path to python, but simply does an exclusionary check on the possible known python implementations to see if their names are present in the path (fairly dumb check).