11"""app.location"""
22from ..coordinates import Coordinates
3- from ..utils import countries
3+ from ..utils . countries import CountryCodeUtil
44from ..utils .populations import country_population
55
66
@@ -9,6 +9,7 @@ class Location: # pylint: disable=too-many-instance-attributes
99 """
1010 A location in the world affected by the coronavirus.
1111 """
12+ country_code_util = CountryCodeUtil ()
1213
1314 def __init__ (
1415 self , id , country , province , coordinates , last_updated , confirmed , deaths , recovered ,
@@ -31,17 +32,15 @@ def __init__(
3132 def country_code (self ):
3233 """
3334 Gets the alpha-2 code represention of the country. Returns 'XX' if none is found.
34-
3535 :returns: The country code.
3636 :rtype: str
3737 """
38- return (countries . country_code (self .country ) or countries .DEFAULT_COUNTRY_CODE ).upper ()
38+ return (country_code_util . get_country_code (self .country ) or country_code_util .DEFAULT_COUNTRY_CODE ).upper ()
3939
4040 @property
4141 def country_population (self ):
4242 """
4343 Gets the population of this location.
44-
4544 :returns: The population.
4645 :rtype: int
4746 """
@@ -50,7 +49,6 @@ def country_population(self):
5049 def serialize (self ):
5150 """
5251 Serializes the location into a dict.
53-
5452 :returns: The serialized location.
5553 :rtype: dict
5654 """
@@ -101,7 +99,6 @@ def __init__(self, id, country, province, coordinates, last_updated, timelines):
10199 def serialize (self , timelines = False ):
102100 """
103101 Serializes the location into a dict.
104-
105102 :param timelines: Whether to include the timelines.
106103 :returns: The serialized location.
107104 :rtype: dict
0 commit comments