Install
-------
::
% pip3 install input-helper
Usage
-----
.. code:: python
In [1]: import input_helper as ih
In [2]: real_args = ih.string_to_set('arg1, arg2, arg3')
In [3]: real_val = ih.from_string('true')
In [4]: response = ih.user_input('type some input, human')
In [5]: selected = ih.make_selections(list_of_items)
In [6]: seconds = ih.timestamp_to_seconds('1h22m33s')
In [7]: urls = ih.get_all_urls('some-file-with-urls.txt', 'https://blah.net')
In [8]: from pprint import pprint
In [9]: mm = ih.matcher.MasterMatcher(debug=True)
In [10]: pprint(mm('@handle1 and @handle2 here are the #docs you requested https://github.com/kenjyco/input-helper/blob/master/README.md'))
{'_key_matcher_dict': {'mention_list': 'MentionMatcher',
'non_url_text': 'NonUrlTextMatcher',
'tag_list': 'TagMatcher',
'text': 'IdentityMatcher',
'url_details_list': 'UrlDetailsMatcher',
'url_list': 'UrlMatcher'},
'mention_list': ['handle1', 'handle2'],
'non_url_text': '@handle1 and @handle2 here are the #docs you requested',
'tag_list': ['docs'],
'text': '@handle1 and @handle2 here are the #docs you requested '
'https://github.com/kenjyco/input-helper/blob/master/README.md',
'url_details_list': [{'domain': 'github.com',
'filename_prefix': 'github.com--kenjyco--input-helper--blob--master--README.md',
'full_url': 'https://github.com/kenjyco/input-helper/blob/master/README.md',
'path': {'full_path': '/kenjyco/input-helper/blob/master/README.md',
'uri': '/kenjyco/input-helper/blob/master/README.md'},
'protocol': 'https'}],
'url_list': ['https://github.com/kenjyco/input-helper/blob/master/README.md']}
In [11]: ih.user_input_fancy()
input> go to https://github.com/kenjyco for a good time #learning stuff
Out[11]:
{'line_orig': 'go to https://github.com/kenjyco for a good time #learning stuff',
'non_url_text': 'go to for a good time #learning stuff',
'tag_list': ['learning'],
'url_list': ['https://github.com/kenjyco']}
Raw data
{
"_id": null,
"home_page": "https://github.com/kenjyco/input-helper",
"name": "input-helper",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "input,user input,regex,matching,json,selection,menus,filtering,conversions,transformations,comparisons,cli,command-line,helper,kenjyco",
"author": "Ken",
"author_email": "kenjyco@gmail.com",
"download_url": "https://github.com/kenjyco/input-helper/tarball/v0.1.47",
"platform": null,
"description": "Install\n-------\n\n::\n\n % pip3 install input-helper\n\nUsage\n-----\n\n.. code:: python\n\n In [1]: import input_helper as ih\n\n In [2]: real_args = ih.string_to_set('arg1, arg2, arg3')\n\n In [3]: real_val = ih.from_string('true')\n\n In [4]: response = ih.user_input('type some input, human')\n\n In [5]: selected = ih.make_selections(list_of_items)\n\n In [6]: seconds = ih.timestamp_to_seconds('1h22m33s')\n\n In [7]: urls = ih.get_all_urls('some-file-with-urls.txt', 'https://blah.net')\n\n In [8]: from pprint import pprint\n\n In [9]: mm = ih.matcher.MasterMatcher(debug=True)\n\n In [10]: pprint(mm('@handle1 and @handle2 here are the #docs you requested https://github.com/kenjyco/input-helper/blob/master/README.md'))\n {'_key_matcher_dict': {'mention_list': 'MentionMatcher',\n 'non_url_text': 'NonUrlTextMatcher',\n 'tag_list': 'TagMatcher',\n 'text': 'IdentityMatcher',\n 'url_details_list': 'UrlDetailsMatcher',\n 'url_list': 'UrlMatcher'},\n 'mention_list': ['handle1', 'handle2'],\n 'non_url_text': '@handle1 and @handle2 here are the #docs you requested',\n 'tag_list': ['docs'],\n 'text': '@handle1 and @handle2 here are the #docs you requested '\n 'https://github.com/kenjyco/input-helper/blob/master/README.md',\n 'url_details_list': [{'domain': 'github.com',\n 'filename_prefix': 'github.com--kenjyco--input-helper--blob--master--README.md',\n 'full_url': 'https://github.com/kenjyco/input-helper/blob/master/README.md',\n 'path': {'full_path': '/kenjyco/input-helper/blob/master/README.md',\n 'uri': '/kenjyco/input-helper/blob/master/README.md'},\n 'protocol': 'https'}],\n 'url_list': ['https://github.com/kenjyco/input-helper/blob/master/README.md']}\n\n In [11]: ih.user_input_fancy()\n input> go to https://github.com/kenjyco for a good time #learning stuff\n Out[11]:\n {'line_orig': 'go to https://github.com/kenjyco for a good time #learning stuff',\n 'non_url_text': 'go to for a good time #learning stuff',\n 'tag_list': ['learning'],\n 'url_list': ['https://github.com/kenjyco']}\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Helpers for parsing user input, generating menus, transforming data, making comparisons, flexible argument acceptance (string to list/set), regex matching, and more",
"version": "0.1.47",
"project_urls": {
"Download": "https://github.com/kenjyco/input-helper/tarball/v0.1.47",
"Homepage": "https://github.com/kenjyco/input-helper"
},
"split_keywords": [
"input",
"user input",
"regex",
"matching",
"json",
"selection",
"menus",
"filtering",
"conversions",
"transformations",
"comparisons",
"cli",
"command-line",
"helper",
"kenjyco"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "71f1a0bb12cbf20e201e2385f0efc348361732b63b47fc13b4f7316a0a19c575",
"md5": "324132d97b8acecd9c5050da223ca257",
"sha256": "6260d25985c0124b18a877e1cb308cbe2cac070ed2a0b4fb55417e3601eb54ea"
},
"downloads": -1,
"filename": "input_helper-0.1.47-py3-none-any.whl",
"has_sig": false,
"md5_digest": "324132d97b8acecd9c5050da223ca257",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23796,
"upload_time": "2023-11-21T23:08:55",
"upload_time_iso_8601": "2023-11-21T23:08:55.615843Z",
"url": "https://files.pythonhosted.org/packages/71/f1/a0bb12cbf20e201e2385f0efc348361732b63b47fc13b4f7316a0a19c575/input_helper-0.1.47-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-21 23:08:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kenjyco",
"github_project": "input-helper",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "input-helper"
}