[mypy] Enforcing typing for superset.examples (#9469)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2020-04-06 09:11:49 -07:00
committed by GitHub
parent c0807c1af7
commit dcb7b8350e
22 changed files with 75 additions and 49 deletions

View File

@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
"""This module contains data related to countries and is used for geo mapping"""
from typing import Any, Dict, List
from typing import Any, Dict, List, Optional
countries: List[Dict[str, Any]] = [
{
@@ -2498,13 +2498,8 @@ for lookup in lookups:
all_lookups[lookup][country[lookup].lower()] = country
def get(field, symbol):
def get(field: str, symbol: str) -> Optional[Dict[str, Any]]:
"""
Get country data based on a standard code and a symbol
>>> get('cioc', 'CUB')['name']
"Cuba"
>>> get('cca2', 'CA')['name']
"Canada"
"""
return all_lookups[field].get(symbol.lower())