NeoBase 0.34.27__tar.gz → 0.35__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {neobase-0.34.27/src/NeoBase.egg-info → neobase-0.35}/PKG-INFO +1 -1
- {neobase-0.34.27 → neobase-0.35}/pyproject.toml +4 -4
- {neobase-0.34.27 → neobase-0.35/src/NeoBase.egg-info}/PKG-INFO +1 -1
- {neobase-0.34.27 → neobase-0.35}/src/NeoBase.egg-info/scm_file_list.json +14 -14
- neobase-0.35/src/NeoBase.egg-info/scm_version.json +8 -0
- neobase-0.35/src/neobase/__init__.py +4 -0
- {neobase-0.34.27 → neobase-0.35}/src/neobase/neobase.py +32 -15
- {neobase-0.34.27 → neobase-0.35}/src/neobase/optd_por_public.csv +320 -319
- neobase-0.34.27/src/NeoBase.egg-info/scm_version.json +0 -8
- neobase-0.34.27/src/neobase/__init__.py +0 -4
- {neobase-0.34.27 → neobase-0.35}/LICENSE +0 -0
- {neobase-0.34.27 → neobase-0.35}/MANIFEST.in +0 -0
- {neobase-0.34.27 → neobase-0.35}/README.rst +0 -0
- {neobase-0.34.27 → neobase-0.35}/_config.yml +0 -0
- {neobase-0.34.27 → neobase-0.35}/doc/Makefile +0 -0
- {neobase-0.34.27 → neobase-0.35}/doc/conf.py +0 -0
- {neobase-0.34.27 → neobase-0.35}/doc/index.rst +0 -0
- {neobase-0.34.27 → neobase-0.35}/doc/make.bat +0 -0
- {neobase-0.34.27 → neobase-0.35}/setup.cfg +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/NeoBase.egg-info/SOURCES.txt +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/NeoBase.egg-info/dependency_links.txt +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/NeoBase.egg-info/entry_points.txt +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/NeoBase.egg-info/top_level.txt +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/neobase/__main__.py +0 -0
- {neobase-0.34.27 → neobase-0.35}/src/neobase/version.py +0 -0
- {neobase-0.34.27 → neobase-0.35}/tox.ini +0 -0
|
@@ -119,10 +119,10 @@ select = [
|
|
|
119
119
|
"RUF", # Ruff-specific rules
|
|
120
120
|
]
|
|
121
121
|
ignore = [
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
122
|
+
"module-import-not-at-top-of-file",
|
|
123
|
+
"ambiguous-unicode-character-string",
|
|
124
|
+
"collection-literal-concatenation",
|
|
125
|
+
"collections-named-tuple",
|
|
126
126
|
]
|
|
127
127
|
preview = true
|
|
128
128
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [
|
|
3
|
-
".pre-commit-config.yaml",
|
|
4
3
|
"tox.ini",
|
|
5
|
-
"
|
|
6
|
-
"pyproject.toml",
|
|
7
|
-
"README.rst",
|
|
4
|
+
".pre-commit-config.yaml",
|
|
8
5
|
"MANIFEST.in",
|
|
6
|
+
"README.rst",
|
|
7
|
+
"update_data.sh",
|
|
9
8
|
"_config.yml",
|
|
9
|
+
"pyproject.toml",
|
|
10
|
+
"LICENSE",
|
|
10
11
|
".gitignore",
|
|
11
|
-
"
|
|
12
|
+
".github/workflows/python-package.yml",
|
|
13
|
+
"tests/test_neobase.py",
|
|
14
|
+
"tests/conftest.py",
|
|
15
|
+
"doc/index.rst",
|
|
16
|
+
"doc/conf.py",
|
|
17
|
+
"doc/Makefile",
|
|
18
|
+
"doc/make.bat",
|
|
19
|
+
"src/neobase/optd_por_public.csv",
|
|
12
20
|
"src/neobase/neobase.py",
|
|
13
21
|
"src/neobase/__init__.py",
|
|
14
22
|
"src/neobase/version.py",
|
|
15
|
-
"src/neobase/
|
|
16
|
-
"src/neobase/__main__.py",
|
|
17
|
-
"doc/Makefile",
|
|
18
|
-
"doc/index.rst",
|
|
19
|
-
"doc/make.bat",
|
|
20
|
-
"doc/conf.py",
|
|
21
|
-
"tests/test_neobase.py",
|
|
22
|
-
"tests/conftest.py",
|
|
23
|
-
".github/workflows/python-package.yml"
|
|
23
|
+
"src/neobase/__main__.py"
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -130,7 +130,7 @@ class NeoBase:
|
|
|
130
130
|
"""
|
|
131
131
|
f = iter(f) # convert lists to iterators
|
|
132
132
|
|
|
133
|
-
fields, key_c = cls.FIELDS, cls.KEY
|
|
133
|
+
fields, key_c, skip = cls.FIELDS, cls.KEY, cls.skip
|
|
134
134
|
empty_value = cls._empty_value
|
|
135
135
|
|
|
136
136
|
data = {}
|
|
@@ -139,12 +139,17 @@ class NeoBase:
|
|
|
139
139
|
except StopIteration:
|
|
140
140
|
pass
|
|
141
141
|
|
|
142
|
-
for
|
|
142
|
+
for line in f:
|
|
143
143
|
# Comments and empty lines
|
|
144
|
-
if not
|
|
144
|
+
if not line or line.startswith("#"):
|
|
145
145
|
continue
|
|
146
146
|
|
|
147
|
-
if
|
|
147
|
+
if '"' in line:
|
|
148
|
+
row = next(csv.reader([line], delimiter="^", quotechar='"'))
|
|
149
|
+
else:
|
|
150
|
+
row = line.rstrip("\r\n").split("^")
|
|
151
|
+
|
|
152
|
+
if skip(row, date):
|
|
148
153
|
continue
|
|
149
154
|
|
|
150
155
|
key = row[key_c]
|
|
@@ -269,12 +274,12 @@ class NeoBase:
|
|
|
269
274
|
"""
|
|
270
275
|
if key is not None:
|
|
271
276
|
key = key.upper()
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
277
|
+
|
|
278
|
+
d = self._data.get(key)
|
|
279
|
+
if d is None:
|
|
275
280
|
# Unless default is set, we raise an Exception
|
|
276
281
|
if default is _sentinel:
|
|
277
|
-
raise UnknownKeyError(f"Key not found: {key}")
|
|
282
|
+
raise UnknownKeyError(f"Key not found: {key}")
|
|
278
283
|
return default
|
|
279
284
|
|
|
280
285
|
if field is None:
|
|
@@ -294,7 +299,11 @@ class NeoBase:
|
|
|
294
299
|
>>> b.get_location('ORY')
|
|
295
300
|
LatLng(lat=48.72..., lng=2.35...)
|
|
296
301
|
"""
|
|
297
|
-
if key not
|
|
302
|
+
if key is not None:
|
|
303
|
+
key = key.upper()
|
|
304
|
+
|
|
305
|
+
d = self._data.get(key)
|
|
306
|
+
if d is None:
|
|
298
307
|
# Unless default is set, we raise an Exception
|
|
299
308
|
if default is _sentinel:
|
|
300
309
|
raise UnknownKeyError(f"Key not found: {key}")
|
|
@@ -302,8 +311,8 @@ class NeoBase:
|
|
|
302
311
|
|
|
303
312
|
try:
|
|
304
313
|
loc = LatLng(
|
|
305
|
-
float(
|
|
306
|
-
float(
|
|
314
|
+
float(d[lat_field]),
|
|
315
|
+
float(d[lng_field]),
|
|
307
316
|
)
|
|
308
317
|
|
|
309
318
|
except (ValueError, TypeError, KeyError):
|
|
@@ -387,11 +396,19 @@ class NeoBase:
|
|
|
387
396
|
if lat_lng_ref is None:
|
|
388
397
|
return
|
|
389
398
|
|
|
399
|
+
data_get = self._data.get
|
|
400
|
+
distance_between_locations = self.distance_between_locations
|
|
390
401
|
for key in keys:
|
|
391
|
-
if key
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
402
|
+
d = data_get(key.upper() if key is not None else key)
|
|
403
|
+
|
|
404
|
+
if d is None:
|
|
405
|
+
continue
|
|
406
|
+
try:
|
|
407
|
+
lat_lng = float(d["lat"]), float(d["lng"])
|
|
408
|
+
except (ValueError, TypeError, KeyError):
|
|
409
|
+
continue
|
|
410
|
+
|
|
411
|
+
yield distance_between_locations(lat_lng_ref, lat_lng), key
|
|
395
412
|
|
|
396
413
|
def find_near_location(self, lat_lng, radius=_DEFAULT_RADIUS, from_keys=None):
|
|
397
414
|
"""
|