mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 00:02:19 +03:00
Add util function to get raw user input
This commit is contained in:
parent
a6c0361803
commit
5aea327a5b
|
@ -168,6 +168,17 @@ def parse_package_meta(package_path, package, require=True):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_raw_input(description, default=False):
|
||||||
|
"""Get user input via raw_input / input and return input value. Takes a
|
||||||
|
description for the prompt, and an optional default value that's displayed
|
||||||
|
with the prompt."""
|
||||||
|
|
||||||
|
additional = ' (default: {d})'.format(d=default) if default else ''
|
||||||
|
prompt = ' {d}{a}: '.format(d=description, a=additional)
|
||||||
|
user_input = raw_input(prompt)
|
||||||
|
return user_input
|
||||||
|
|
||||||
|
|
||||||
def print_table(data, **kwargs):
|
def print_table(data, **kwargs):
|
||||||
"""Print data in table format. Can either take a list of tuples or a
|
"""Print data in table format. Can either take a list of tuples or a
|
||||||
dictionary, which will be converted to a list of tuples."""
|
dictionary, which will be converted to a list of tuples."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user