sovabids.misc¶
Module with misc utilities for sovabids.
Attributes¶
Functions¶
Replace Unicode dash characters in sys.argv with regular hyphens. |
|
|
Count the number of non-nested balanced parentheses in the string. If parenthesis is not balanced then return -1. |
Return the number of digits of the given number N. |
Module Contents¶
- sovabids.misc._UNICODE_DASHES¶
- sovabids.misc.handle_unicode_dashes()[source]¶
Replace Unicode dash characters in sys.argv with regular hyphens.
Word processors and some terminals substitute hyphens with typographic dashes (em dash, en dash, etc.). This causes cryptic argparse errors. Call this before parse_args() in every CLI entry point.
- sovabids.misc.flat_paren_counter(string)[source]¶
Count the number of non-nested balanced parentheses in the string. If parenthesis is not balanced then return -1.
- Parameters:
string (str) – The string we will inspect for balanced parentheses.
- Returns:
The number of non-nested balanced parentheses or -1 if the string has unbalanced parentheses.
- Return type:
int