mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
[mypy] Enforcing typing for superset.examples (#9469)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user