mypy: Enable strict optional in zerver/lib/bugdown.

Explicitly check for none in optional value and set it to a dict.
This commit is contained in:
jkiely 2018-05-17 11:32:40 -04:00 committed by Tim Abbott
parent b3d43df498
commit 04c50cffa7
2 changed files with 4 additions and 2 deletions

View File

@ -318,7 +318,7 @@ strict_optional = True
[mypy-zerver.lib.exceptions] #21: error: Return type of "__reduce_ex__" incompatible with supertype "object"
strict_optional = True
[mypy-zerver.lib.bugdown.api_arguments_table_generator] #18: error: Item "None" of "Optional[Dict[str, Any]]" has no attribute "items"
strict_optional = False
strict_optional = True
[mypy-zerver.lib.message] #868: error: Unsupported operand types for - ("Optional[int]" and "int")
strict_optional = False

View File

@ -11,7 +11,9 @@ REGEXP = re.compile(r'\{generate_api_arguments_table\|\s*(.+?)\s*\|\s*(.+?)\s*\}
class MarkdownArgumentsTableGenerator(Extension):
def __init__(self, configs: Optional[Dict[str, Any]]={}) -> None:
def __init__(self, configs: Optional[Dict[str, Any]]=None) -> None:
if configs is None:
configs = {}
self.config = {
'base_path': ['.', 'Default location from which to evaluate relative paths for the JSON files.'],
}