diff options
Diffstat (limited to 'dodai/tools/__init__.py')
-rw-r--r-- | dodai/tools/__init__.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/dodai/tools/__init__.py b/dodai/tools/__init__.py index ab90cfe..b6d93a1 100644 --- a/dodai/tools/__init__.py +++ b/dodai/tools/__init__.py | |||
@@ -65,7 +65,6 @@ def config_directory_project(): | |||
65 | path = os.path.dirname(os.path.abspath(sys.argv[0])) | 65 | path = os.path.dirname(os.path.abspath(sys.argv[0])) |
66 | return os.path.join(path, 'config') | 66 | return os.path.join(path, 'config') |
67 | 67 | ||
68 | |||
69 | def config_directories(project_name): | 68 | def config_directories(project_name): |
70 | """Returns a list of possible project directories | 69 | """Returns a list of possible project directories |
71 | 70 | ||
@@ -82,4 +81,19 @@ def config_directories(project_name): | |||
82 | dirs.append(dir) | 81 | dirs.append(dir) |
83 | return dirs | 82 | return dirs |
84 | 83 | ||
84 | def list_to_english(data): | ||
85 | """Takes the input list and creates a string with each option | ||
86 | encased in single quotes and seperated by a comma with exception | ||
87 | of the last option which is prefixed with the word 'and' | ||
85 | 88 | ||
89 | """ | ||
90 | if data: | ||
91 | if len(data) > 1: | ||
92 | out = [] | ||
93 | last = "{0}".format(data.pop()) | ||
94 | for row in data: | ||
95 | out.append("{0}".format(row)) | ||
96 | out = ', '.join(out) | ||
97 | return "{0} and {1}".format(out, last) | ||
98 | else: | ||
99 | return "{0}".format(data.pop()) | ||