MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / _CountryNameDict

Class _CountryNameDict

tests/test_code/py/pytz/__init__.py:372–390  ·  view source on GitHub ↗

Dictionary proving ISO3166 code -> English name. >>> print(country_names['au']) Australia

Source from the content-addressed store, hash-verified

370
371
372class _CountryNameDict(LazyDict):
373 '''Dictionary proving ISO3166 code -> English name.
374
375 >>> print(country_names['au'])
376 Australia
377 '''
378 def _fill(self):
379 data = {}
380 zone_tab = open_resource('iso3166.tab')
381 try:
382 for line in zone_tab.readlines():
383 line = line.decode('UTF-8')
384 if line.startswith('#'):
385 continue
386 code, name = line.split(None, 1)
387 data[code] = name.strip()
388 self.data = data
389 finally:
390 zone_tab.close()
391
392
393country_names = _CountryNameDict()

Callers 1

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected