Skip to content

Commit

Permalink
Merge pull request #33 from Bennyelg/importlib-files-issue
Browse files Browse the repository at this point in the history
Fix importib files is only support 3.9 so revert
  • Loading branch information
yaph authored Aug 2, 2022
2 parents 471e2d4 + 40c5e57 commit 0ad39e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.9', '3.10'] # '3.11-dev'
python-version: ['3.8', '3.9', '3.10'] # '3.11-dev'

steps:
- uses: actions/checkout@v1
Expand Down
11 changes: 6 additions & 5 deletions geonamescache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@


import json

from importlib import resources
import os

from . import geonamesdata

Expand Down Expand Up @@ -95,7 +94,9 @@ def search_cities(self, query, attribute='alternatenames', case_sensitive=True):
results.append(record)
return results

def _load_data(self, datadict, datafile):
@staticmethod
def _load_data(datadict, datafile):
if datadict is None:
datadict = json.loads(resources.files(__name__).joinpath('data', datafile).read_text())
return datadict
with open(os.path.join(os.path.dirname(__file__), 'data', datafile)) as f:
datadict = json.load(f)
return datadict
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Python Modules'
],
test_suite='tests',
tests_require=['pytest'],
)
)

0 comments on commit 0ad39e7

Please sign in to comment.