@@ -164,7 +164,7 @@ def is_false(v, chk_none: bool = True) -> bool:
164164 chk += [None , 'none' , 'null' , '' ] if chk_none else []
165165 return v in chk
166166
167- def keyval_parse (line : str ) -> List [Tuple [str , str ]]:
167+ def parse_keyval (line : str ) -> List [Tuple [str , str ]]:
168168 """
169169 Parses a csv with key:value pairs such as:
170170
@@ -183,47 +183,47 @@ def keyval_parse(line: str) -> List[Tuple[str, str]]:
183183 line = [tuple (a .split (':' )) for a in line .split (',' )] if line != '' else []
184184 return [(a .strip (), b .strip ()) for a , b in line ]
185185
186- def keyval_env (env_key : str , env_default = None ) -> List [Tuple [str , str ]]:
186+ def env_keyval (env_key : str , env_default = None ) -> List [Tuple [str , str ]]:
187187 """
188188 Parses "key:val,key:val" into a list of tuples [(key,val), (key,val)]
189189
190- See :py:meth:`keyval_parse `
190+ See :py:meth:`parse_keyval `
191191 """
192192 d = env (env_key )
193- return env_default if empty (d ) else keyval_parse (d )
193+ return env_default if empty (d ) else parse_keyval (d )
194194
195- def csv_parse (line : str ) -> List [str ]:
195+ def parse_csv (line : str ) -> List [str ]:
196196 """
197197 Quick n' dirty parsing of a simple comma separated line, with automatic whitespace stripping
198198 of both the ``line`` itself, and the values within the commas.
199199
200200 Example:
201201
202- >>> csv_parse (' hello , world, test')
202+ >>> parse_csv (' hello , world, test')
203203 ['hello', 'world', 'test']
204204
205205 """
206206 return [x .strip () for x in line .strip ().split (',' )]
207207
208- def csv_env (env_key : str , env_default = None ) -> List [str ]:
208+ def env_csv (env_key : str , env_default = None ) -> List [str ]:
209209 """
210210 Quick n' dirty parsing of simple CSV formatted environment variables, with fallback
211211 to user specified ``env_default`` (defaults to None)
212212
213213 Example:
214214
215215 >>> os.setenv('EXAMPLE', ' hello , world, test')
216- >>> csv_env ('EXAMPLE', [])
216+ >>> env_csv ('EXAMPLE', [])
217217 ['hello', 'world', 'test']
218- >>> csv_env ('NONEXISTANT', [])
218+ >>> env_csv ('NONEXISTANT', [])
219219 []
220220
221221 :param str env_key: Environment var to attempt to load
222222 :param any env_default: Fallback value if the env var is empty / not set
223223 :return List[str] parsed_data: A list of str values parsed from the env var
224224 """
225225 d = env (env_key )
226- return env_default if empty (d ) else csv_parse (d )
226+ return env_default if empty (d ) else parse_csv (d )
227227
228228
229229class ErrHelpParser (argparse .ArgumentParser ):
0 commit comments