shlexwhichplus


Nameshlexwhichplus JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/shlexwhichplus
SummaryLike shutil.which, but for all file types, and multiple results (if desired)
upload_time2023-05-08 04:37:24
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords shutil which search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Like shutil.which, but for all file types, and multiple results (if desired)

## pip install shlexwhichplus

#### Tested against Windows 10 / Python 3.10 / Anaconda

```python

import shutil

from shlexwhichplus import which_plus

print('_________________shutil.which')
print(shutil.which('python.exe'))
print(shutil.which('Python.exe'))
print(shutil.which('output.avi'))
print(shutil.which('output.avi')),
print(shutil.which(b'teSt.txt'))
print(shutil.which(b'teSt.txt'))

print('_________________which_plus')
print(which_plus('python.exe', mode='one', path=None))
print(which_plus('Python.exe', mode='all', path=None))
print(which_plus('output.avi', mode='all', path=None))
print(which_plus('output.avi', mode='one', path=None))
print(which_plus('api-ms-win-crt-conio-l1-1-0.dll', mode='one', path=None))
print(which_plus('api-ms-win-crt-conio-l1-1-0.dll', mode='all', path=None))
print(which_plus('Python.exe', mode='BLALBLALA', path=None))  # one if mode not in [all,one]
print(which_plus('TeST.txt', mode='all', path=None))
print(which_plus('teSt.txt', mode='one', path=None))
print(which_plus(b'teSt.txt', mode='all', path=None))
print(which_plus(b'teSt.txt', mode='one', path=None))


# output 


_________________shutil.which
C:\ProgramData\anaconda3\envs\dfdir\python.exe
C:\ProgramData\anaconda3\envs\dfdir\Python.exe
None
None
None
None
_________________which_plus
C:\ProgramData\anaconda3\envs\dfdir\python.exe
['C:\\ProgramData\\anaconda3\\envs\\dfdir\\python.exe']
['C:\\cprojekt\\output.avi', 'C:\\ProgramData\\anaconda3\\envs\\dfdir\\output.avi']
C:\ProgramData\anaconda3\envs\dfdir\output.avi
C:\ProgramData\anaconda3\envs\dfdir\api-ms-win-crt-conio-l1-1-0.dll
['C:\\ProgramData\\anaconda3\\envs\\dfdir\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\Program Files\\Microsoft\\jdk-11.0.16.101-hotspot\\bin\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\ProgramData\\anaconda3\\envs\\dfdir\\Library\\bin\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\Program Files\\Eclipse Adoptium\\jdk-11.0.18.10-hotspot\\bin\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\Program Files\\Amazon Corretto\\jdk17.0.6_10\\bin\\api-ms-win-crt-conio-l1-1-0.dll']
C:\ProgramData\anaconda3\envs\dfdir\python.exe
['C:\\ProgramData\\anaconda3\\envs\\dfdir\\Library\\bin\\TeST.txt', 'C:\\ProgramData\\anaconda3\\envs\\dfdir\\TeST.txt', 'C:\\ProgramData\\anaconda3\\envs\\dfdir\\Scripts\\TeST.txt']
C:\ProgramData\anaconda3\envs\dfdir\TeST.txt
[b'C:\\ProgramData\\anaconda3\\envs\\dfdir\\Library\\bin\\TeST.txt', b'C:\\ProgramData\\anaconda3\\envs\\dfdir\\TeST.txt', b'C:\\ProgramData\\anaconda3\\envs\\dfdir\\Scripts\\TeST.txt']
b'C:\\ProgramData\\anaconda3\\envs\\dfdir\\TeST.txt'




    Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH,
    or None if there is no such file.

    :param cmd: A string specifying the command to be searched.
    :type cmd: str
    :param mode: A string indicating whether to return one or all matches on the PATH.
                 If 'one', return the first match found on the PATH.
                 If 'all', return a list of all matches found on the PATH.
                 If any other string, mode defaults to 'one'.
    :type mode: str
    :param path: A string representing the search path. If None, uses the current system PATH variable.
    :type path: str|None
    :return: If mode is 'one', returns the first path found to the given command, or None if not found.
             If mode is 'all', returns a list of all paths found to the given command, or an empty list if not found.
    :rtype: str or list of str





```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/shlexwhichplus",
    "name": "shlexwhichplus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "shutil,which,search",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/42/01/23d5a8f70b56580e31b2a90e16cf9cddab91c0cd244080dc5a3fca53245e/shlexwhichplus-0.10.tar.gz",
    "platform": null,
    "description": "# Like shutil.which, but for all file types, and multiple results (if desired)\r\n\r\n## pip install shlexwhichplus\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n```python\r\n\r\nimport shutil\r\n\r\nfrom shlexwhichplus import which_plus\r\n\r\nprint('_________________shutil.which')\r\nprint(shutil.which('python.exe'))\r\nprint(shutil.which('Python.exe'))\r\nprint(shutil.which('output.avi'))\r\nprint(shutil.which('output.avi')),\r\nprint(shutil.which(b'teSt.txt'))\r\nprint(shutil.which(b'teSt.txt'))\r\n\r\nprint('_________________which_plus')\r\nprint(which_plus('python.exe', mode='one', path=None))\r\nprint(which_plus('Python.exe', mode='all', path=None))\r\nprint(which_plus('output.avi', mode='all', path=None))\r\nprint(which_plus('output.avi', mode='one', path=None))\r\nprint(which_plus('api-ms-win-crt-conio-l1-1-0.dll', mode='one', path=None))\r\nprint(which_plus('api-ms-win-crt-conio-l1-1-0.dll', mode='all', path=None))\r\nprint(which_plus('Python.exe', mode='BLALBLALA', path=None))  # one if mode not in [all,one]\r\nprint(which_plus('TeST.txt', mode='all', path=None))\r\nprint(which_plus('teSt.txt', mode='one', path=None))\r\nprint(which_plus(b'teSt.txt', mode='all', path=None))\r\nprint(which_plus(b'teSt.txt', mode='one', path=None))\r\n\r\n\r\n# output \r\n\r\n\r\n_________________shutil.which\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\python.exe\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\Python.exe\r\nNone\r\nNone\r\nNone\r\nNone\r\n_________________which_plus\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\python.exe\r\n['C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\python.exe']\r\n['C:\\\\cprojekt\\\\output.avi', 'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\output.avi']\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\output.avi\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\api-ms-win-crt-conio-l1-1-0.dll\r\n['C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\\\Program Files\\\\Microsoft\\\\jdk-11.0.16.101-hotspot\\\\bin\\\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\Library\\\\bin\\\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-11.0.18.10-hotspot\\\\bin\\\\api-ms-win-crt-conio-l1-1-0.dll', 'C:\\\\Program Files\\\\Amazon Corretto\\\\jdk17.0.6_10\\\\bin\\\\api-ms-win-crt-conio-l1-1-0.dll']\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\python.exe\r\n['C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\Library\\\\bin\\\\TeST.txt', 'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\TeST.txt', 'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\Scripts\\\\TeST.txt']\r\nC:\\ProgramData\\anaconda3\\envs\\dfdir\\TeST.txt\r\n[b'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\Library\\\\bin\\\\TeST.txt', b'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\TeST.txt', b'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\Scripts\\\\TeST.txt']\r\nb'C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\dfdir\\\\TeST.txt'\r\n\r\n\r\n\r\n\r\n    Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH,\r\n    or None if there is no such file.\r\n\r\n    :param cmd: A string specifying the command to be searched.\r\n    :type cmd: str\r\n    :param mode: A string indicating whether to return one or all matches on the PATH.\r\n                 If 'one', return the first match found on the PATH.\r\n                 If 'all', return a list of all matches found on the PATH.\r\n                 If any other string, mode defaults to 'one'.\r\n    :type mode: str\r\n    :param path: A string representing the search path. If None, uses the current system PATH variable.\r\n    :type path: str|None\r\n    :return: If mode is 'one', returns the first path found to the given command, or None if not found.\r\n             If mode is 'all', returns a list of all paths found to the given command, or an empty list if not found.\r\n    :rtype: str or list of str\r\n\r\n\r\n\r\n\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Like shutil.which, but for all file types, and multiple results (if desired)",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/shlexwhichplus"
    },
    "split_keywords": [
        "shutil",
        "which",
        "search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12515051ca22ef58c44b1032d7405c5b98730eaf80d672ed47cbf249a28898de",
                "md5": "e7519c3a9518e5a268fd721763d6ff27",
                "sha256": "2e08408bce56653eb2ac6524c6dc2f7a53c049343534bfe5d901c49cf74fc197"
            },
            "downloads": -1,
            "filename": "shlexwhichplus-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7519c3a9518e5a268fd721763d6ff27",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6242,
            "upload_time": "2023-05-08T04:37:22",
            "upload_time_iso_8601": "2023-05-08T04:37:22.694133Z",
            "url": "https://files.pythonhosted.org/packages/12/51/5051ca22ef58c44b1032d7405c5b98730eaf80d672ed47cbf249a28898de/shlexwhichplus-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "420123d5a8f70b56580e31b2a90e16cf9cddab91c0cd244080dc5a3fca53245e",
                "md5": "0d41885f368993d34f4ad8bca8db2163",
                "sha256": "120857831d259665abcdda8740e2ff504eb824c4781bd70ab422f63ec202da8e"
            },
            "downloads": -1,
            "filename": "shlexwhichplus-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "0d41885f368993d34f4ad8bca8db2163",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4807,
            "upload_time": "2023-05-08T04:37:24",
            "upload_time_iso_8601": "2023-05-08T04:37:24.923813Z",
            "url": "https://files.pythonhosted.org/packages/42/01/23d5a8f70b56580e31b2a90e16cf9cddab91c0cd244080dc5a3fca53245e/shlexwhichplus-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 04:37:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "shlexwhichplus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "shlexwhichplus"
}
        
Elapsed time: 0.06592s