Skip to main content

Common CLI input helper functions and string/arg conversions

Project description


% pip3 install input-helper


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', '')

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'))
{'_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 '
 'url_details_list': [{'domain': '',
                       'filename_prefix': '',
                       'full_url': '',
                       'path': {'full_path': '/kenjyco/input-helper/blob/master/',
                                'uri': '/kenjyco/input-helper/blob/master/'},
                       'protocol': 'https'}],
 'url_list': ['']}

In [11]: ih.user_input_fancy()
input> go to for a good time #learning stuff
{'line_orig': 'go to for a good time #learning stuff',
 'non_url_text': 'go to for a good time #learning stuff',
 'tag_list': ['learning'],
 'url_list': ['']}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for input-helper, version 0.1.40
Filename, size File type Python version Upload date Hashes
Filename, size input_helper-0.1.40-py3-none-any.whl (21.3 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page