@@ -74,7 +74,11 @@ class Country:
7474 _countriesdata = None
7575 _ochaurl_default = "https://docs.google.com/spreadsheets/d/1NjSI2LaS3SqbgYc0HdD8oIb7lofGtiHgoKKATCpwVdY/export?format=csv&gid=1088874596"
7676 _ochaurl = _ochaurl_default
77- _ochapath = None
77+ _ochapath_default = script_dir_plus_file (
78+ "Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv" ,
79+ CountryError ,
80+ )
81+ _ochapath = _ochapath_default
7882 _country_name_overrides = {}
7983 _country_name_mappings = {}
8084
@@ -239,14 +243,8 @@ def countriesdata(
239243 "Download from OCHA feed failed! Falling back to stored file."
240244 )
241245 if countries is None :
242- file_path = script_dir_plus_file (
243- "Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv" ,
244- CountryError ,
245- )
246- if cls ._ochapath :
247- file_path = cls ._ochapath
248246 countries = hxl .data (
249- file_path ,
247+ cls . _ochapath ,
250248 InputOptions (allow_local = True , encoding = "utf-8" ),
251249 )
252250 cls .set_countriesdata (countries )
@@ -269,7 +267,7 @@ def set_use_live_default(cls, use_live: Optional[bool] = None) -> None:
269267 cls ._use_live = use_live
270268
271269 @classmethod
272- def set_ocha_url (cls , url : Optional [ str ] = None ) -> None :
270+ def set_ocha_url (cls , url : str = None ) -> None :
273271 """
274272 Set OCHA url from which to retrieve countries data
275273
@@ -294,8 +292,8 @@ def set_ocha_path(cls, path: Optional[str] = None) -> None:
294292 Returns:
295293 None
296294 """
297- if path and not os .path .exists (path ):
298- path = None
295+ if not path or ( path and not os .path .exists (path ) ):
296+ path = cls . _ochapath_default
299297 cls ._ochapath = path
300298
301299 @classmethod
0 commit comments