Skip to content

Commit 4a6e1b7

Browse files
authored
Merge pull request #31 from ckc-org/improve-lat-long-code-style
Improve code style and documentation
2 parents e57961d + a2462a0 commit 4a6e1b7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [3.8, 3.9, 3.10.5]
13+
python-version: [3.8, 3.9, 3.10.x]
1414
django-version: ['<4', '>=4']
1515

1616
steps:

ckc/providers.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ class DjangoGeoPointProvider(BaseProvider):
1717
"""
1818

1919
def geo_point(self, **kwargs):
20-
kwargs['coords_only'] = True
2120
faker = factory.faker.faker.Faker()
2221

23-
# local_latlng returns something like:
22+
# local_latlng normally returns something like:
2423
# ('40.72371', '-73.95097', 'Greenpoint', 'US', 'America/New_York')
25-
coords = faker.local_latlng(**kwargs)
26-
return Point(x=float(coords[1]), y=float(coords[0]), srid=4326)
24+
# with coords_only kwarg, it returns something like:
25+
# ('40.72371', '-73.95097')
26+
kwargs.setdefault('coords_only', True)
27+
lat, lon, *_ = faker.local_latlng(**kwargs)
28+
# Point calls for longitude as x and latitude as y
29+
return Point(x=float(lon), y=float(lat), srid=4326)
2730
except (ImportError, ImproperlyConfigured):
2831
pass

0 commit comments

Comments
 (0)