NeoBase 0.35__tar.gz → 0.36__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.
Files changed (27) hide show
  1. {neobase-0.35/src/NeoBase.egg-info → neobase-0.36}/PKG-INFO +5 -3
  2. {neobase-0.35 → neobase-0.36}/README.rst +2 -1
  3. {neobase-0.35 → neobase-0.36}/pyproject.toml +8 -6
  4. {neobase-0.35 → neobase-0.36/src/NeoBase.egg-info}/PKG-INFO +5 -3
  5. {neobase-0.35 → neobase-0.36}/src/NeoBase.egg-info/SOURCES.txt +1 -0
  6. {neobase-0.35 → neobase-0.36}/src/NeoBase.egg-info/scm_file_list.json +2 -0
  7. neobase-0.36/src/NeoBase.egg-info/scm_version.json +8 -0
  8. {neobase-0.35 → neobase-0.36}/src/neobase/__main__.py +10 -8
  9. {neobase-0.35 → neobase-0.36}/src/neobase/neobase.py +114 -51
  10. neobase-0.36/src/neobase/py.typed +0 -0
  11. neobase-0.36/src/neobase/version.py +3 -0
  12. {neobase-0.35 → neobase-0.36}/tox.ini +2 -2
  13. neobase-0.35/src/NeoBase.egg-info/scm_version.json +0 -8
  14. neobase-0.35/src/neobase/version.py +0 -3
  15. {neobase-0.35 → neobase-0.36}/LICENSE +0 -0
  16. {neobase-0.35 → neobase-0.36}/MANIFEST.in +0 -0
  17. {neobase-0.35 → neobase-0.36}/_config.yml +0 -0
  18. {neobase-0.35 → neobase-0.36}/doc/Makefile +0 -0
  19. {neobase-0.35 → neobase-0.36}/doc/conf.py +0 -0
  20. {neobase-0.35 → neobase-0.36}/doc/index.rst +0 -0
  21. {neobase-0.35 → neobase-0.36}/doc/make.bat +0 -0
  22. {neobase-0.35 → neobase-0.36}/setup.cfg +0 -0
  23. {neobase-0.35 → neobase-0.36}/src/NeoBase.egg-info/dependency_links.txt +0 -0
  24. {neobase-0.35 → neobase-0.36}/src/NeoBase.egg-info/entry_points.txt +0 -0
  25. {neobase-0.35 → neobase-0.36}/src/NeoBase.egg-info/top_level.txt +0 -0
  26. {neobase-0.35 → neobase-0.36}/src/neobase/__init__.py +0 -0
  27. {neobase-0.35 → neobase-0.36}/src/neobase/optd_por_public.csv +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeoBase
3
- Version: 0.35
3
+ Version: 0.36
4
4
  Summary: Python library to manipulate OpenTravelData
5
5
  Author-email: Alex Prengère <alex.prengere@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/alexprengere/neobase
@@ -9,7 +9,8 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Classifier: Programming Language :: Python :: Implementation :: CPython
11
11
  Classifier: Programming Language :: Python :: Implementation :: PyPy
12
- Requires-Python: >=3.9
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.11
13
14
  Description-Content-Type: text/x-rst
14
15
  License-File: LICENSE
15
16
  Dynamic: license-file
@@ -30,12 +31,13 @@ Minimalist `GeoBases <https://github.com/opentraveldata/geobases/>`__
30
31
  implementation:
31
32
 
32
33
  - no dependencies
33
- - compatible with Python 3.9+, CPython and PyPy
34
+ - compatible with Python 3.11+, CPython and PyPy
34
35
  - one data source:
35
36
  `opentraveldata <https://github.com/opentraveldata/opentraveldata>`__
36
37
  - one Python module for easier distribution on clusters (like Hadoop)
37
38
  - faster load time (5x)
38
39
  - tested with pytest and tox
40
+ - passes static typing checks with ty
39
41
 
40
42
  .. code:: python
41
43
 
@@ -14,12 +14,13 @@ Minimalist `GeoBases <https://github.com/opentraveldata/geobases/>`__
14
14
  implementation:
15
15
 
16
16
  - no dependencies
17
- - compatible with Python 3.9+, CPython and PyPy
17
+ - compatible with Python 3.11+, CPython and PyPy
18
18
  - one data source:
19
19
  `opentraveldata <https://github.com/opentraveldata/opentraveldata>`__
20
20
  - one Python module for easier distribution on clusters (like Hadoop)
21
21
  - faster load time (5x)
22
22
  - tested with pytest and tox
23
+ - passes static typing checks with ty
23
24
 
24
25
  .. code:: python
25
26
 
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=71", "setuptools-scm[simple]>=8.1"]
2
+ requires = ["setuptools>=71", "setuptools-scm[simple]>=10.1"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -10,7 +10,7 @@ readme = "README.rst"
10
10
  authors = [
11
11
  {name = "Alex Prengère", email = "alex.prengere@gmail.com"},
12
12
  ]
13
- requires-python = ">=3.9"
13
+ requires-python = ">=3.11"
14
14
  license-files = ["LICENSE"]
15
15
  classifiers = [
16
16
  "Development Status :: 5 - Production/Stable",
@@ -18,6 +18,7 @@ classifiers = [
18
18
  "Programming Language :: Python :: 3 :: Only",
19
19
  "Programming Language :: Python :: Implementation :: CPython",
20
20
  "Programming Language :: Python :: Implementation :: PyPy",
21
+ "Typing :: Typed",
21
22
  ]
22
23
 
23
24
  [project.scripts]
@@ -36,7 +37,7 @@ include = ["neobase*",]
36
37
  [dependency-groups]
37
38
  test = [
38
39
  "pytz>=2024",
39
- "pytest>=8.0",
40
+ "pytest>=9.0",
40
41
  "pytest-cov>=5.0",
41
42
  "pytest-benchmark>=5.1",
42
43
  ]
@@ -89,7 +90,7 @@ show_contexts = true
89
90
 
90
91
  [tool.ruff]
91
92
  line-length = 100
92
- target-version = "py39"
93
+ target-version = "py311"
93
94
  extend-exclude = ["doc"]
94
95
 
95
96
  [tool.ruff.lint]
@@ -122,11 +123,12 @@ ignore = [
122
123
  "module-import-not-at-top-of-file",
123
124
  "ambiguous-unicode-character-string",
124
125
  "collection-literal-concatenation",
125
- "collections-named-tuple",
126
+ "mutable-class-default",
127
+ "blanket-type-ignore",
126
128
  ]
127
129
  preview = true
128
130
 
129
131
  [tool.black]
130
132
  line-length = 88
131
- target-version = ["py39"]
133
+ target-version = ["py311"]
132
134
  force_exclude = "doc/*"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NeoBase
3
- Version: 0.35
3
+ Version: 0.36
4
4
  Summary: Python library to manipulate OpenTravelData
5
5
  Author-email: Alex Prengère <alex.prengere@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/alexprengere/neobase
@@ -9,7 +9,8 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Classifier: Programming Language :: Python :: Implementation :: CPython
11
11
  Classifier: Programming Language :: Python :: Implementation :: PyPy
12
- Requires-Python: >=3.9
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.11
13
14
  Description-Content-Type: text/x-rst
14
15
  License-File: LICENSE
15
16
  Dynamic: license-file
@@ -30,12 +31,13 @@ Minimalist `GeoBases <https://github.com/opentraveldata/geobases/>`__
30
31
  implementation:
31
32
 
32
33
  - no dependencies
33
- - compatible with Python 3.9+, CPython and PyPy
34
+ - compatible with Python 3.11+, CPython and PyPy
34
35
  - one data source:
35
36
  `opentraveldata <https://github.com/opentraveldata/opentraveldata>`__
36
37
  - one Python module for easier distribution on clusters (like Hadoop)
37
38
  - faster load time (5x)
38
39
  - tested with pytest and tox
40
+ - passes static typing checks with ty
39
41
 
40
42
  .. code:: python
41
43
 
@@ -19,4 +19,5 @@ src/neobase/__init__.py
19
19
  src/neobase/__main__.py
20
20
  src/neobase/neobase.py
21
21
  src/neobase/optd_por_public.csv
22
+ src/neobase/py.typed
22
23
  src/neobase/version.py
@@ -9,6 +9,7 @@
9
9
  "pyproject.toml",
10
10
  "LICENSE",
11
11
  ".gitignore",
12
+ ".github/workflows/pre-commit.yml",
12
13
  ".github/workflows/python-package.yml",
13
14
  "tests/test_neobase.py",
14
15
  "tests/conftest.py",
@@ -18,6 +19,7 @@
18
19
  "doc/make.bat",
19
20
  "src/neobase/optd_por_public.csv",
20
21
  "src/neobase/neobase.py",
22
+ "src/neobase/py.typed",
21
23
  "src/neobase/__init__.py",
22
24
  "src/neobase/version.py",
23
25
  "src/neobase/__main__.py"
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.36",
3
+ "distance": 0,
4
+ "node": "g27ab87bd8e14d871d38f7ce7c1883a384d9b648d",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-08-04"
8
+ }
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/python
2
2
 
3
3
  import sys
4
+ from collections.abc import Sequence
5
+
4
6
  from neobase import NeoBase, __version__
5
7
 
6
8
 
7
- def main():
9
+ def main(argv: Sequence[str] | None = None) -> None:
8
10
  import argparse
9
11
 
10
12
  parser = argparse.ArgumentParser(prog="NeoBase")
@@ -16,11 +18,11 @@ def main():
16
18
  parser.add_argument(
17
19
  "keys",
18
20
  nargs="+",
19
- help="List of IATA codes",
21
+ help="list of IATA codes",
20
22
  )
21
23
  parser.add_argument(
22
24
  "--date",
23
- help="Reference date to compute active airports",
25
+ help="reference date to compute active airports, format is YYYY-MM-DD",
24
26
  )
25
27
  parser.add_argument(
26
28
  "-f",
@@ -44,7 +46,7 @@ def main():
44
46
  "-c",
45
47
  "--case-sensitive",
46
48
  action="store_true",
47
- help="opposite of 'grep -i', make the matching case-sensitive with --field",
49
+ help="make the matching case-sensitive with --field",
48
50
  )
49
51
  parser.add_argument(
50
52
  "-r",
@@ -60,7 +62,7 @@ def main():
60
62
  help="when used, the output will look like a CSV containing those fields",
61
63
  )
62
64
 
63
- args = parser.parse_args()
65
+ args = parser.parse_args(argv)
64
66
  G = NeoBase(date=args.date)
65
67
 
66
68
  if args.show:
@@ -84,9 +86,9 @@ def main():
84
86
  if not args.case_sensitive:
85
87
  needle = needle.lower()
86
88
  haystack = haystack.lower()
87
- if args.word: # --word means will look in words list, not substrings
88
- haystack = haystack.split()
89
- if (needle in haystack) is args.invert_match:
89
+ # --word means will look in words list, not substrings
90
+ haystack_ = haystack.split() if args.word else haystack
91
+ if (needle in haystack_) is args.invert_match:
90
92
  continue
91
93
  if args.show:
92
94
  w.writerow(G.get(p, f) for f in args.show)
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/python
2
-
3
2
  """
4
3
  GeoBase. Rebooted.
5
4
 
@@ -20,28 +19,17 @@ from importlib.resources import files
20
19
  from os import getenv
21
20
  import operator
22
21
  from datetime import datetime
23
- from collections import namedtuple
24
22
  from math import pi, cos, sin, asin, sqrt, fsum
25
- from itertools import starmap
23
+ from itertools import starmap, pairwise
24
+ from typing import NamedTuple, TypeAlias, Any, cast
26
25
  import csv
27
26
  import heapq
27
+ from collections.abc import Callable, Iterable, Iterator, Sequence
28
28
 
29
29
  from functools import partial
30
30
 
31
31
  open_ = partial(open, encoding="utf-8")
32
32
 
33
- try:
34
- # This is only available for Python3.10+
35
- from itertools import pairwise
36
- except ImportError:
37
- from itertools import tee
38
-
39
- def pairwise(iterable):
40
- # pairwise('ABCDEFG') --> AB BC CD DE EF FG
41
- a, b = tee(iterable)
42
- next(b, None)
43
- return zip(a, b)
44
-
45
33
 
46
34
  __all__ = ["OPTD_POR_URL", "LatLng", "NeoBase", "UnknownKeyError"]
47
35
 
@@ -52,7 +40,16 @@ OPTD_POR_URL = (
52
40
 
53
41
  _DEF_OPTD_POR_FILE = "optd_por_public.csv"
54
42
  _DEFAULT_RADIUS = 50
55
- LatLng = namedtuple("LatLng", ["lat", "lng"])
43
+
44
+ FieldValue: TypeAlias = Any
45
+ PointData: TypeAlias = dict[str, FieldValue]
46
+ Splitter: TypeAlias = Callable[[str], FieldValue]
47
+ DistanceResult: TypeAlias = tuple[float, str]
48
+
49
+
50
+ class LatLng(NamedTuple):
51
+ lat: float
52
+ lng: float
56
53
 
57
54
 
58
55
  class UnknownKeyError(KeyError):
@@ -67,7 +64,7 @@ class NeoBase:
67
64
  """Main structure, a wrapper around a dict, with dict-like behavior."""
68
65
 
69
66
  KEY = 0 # iata_code
70
- FIELDS = (
67
+ FIELDS: Sequence[tuple[str, int, Splitter | None]] = (
71
68
  ("iata_code", 0, None),
72
69
  ("name", 6, None),
73
70
  ("lat", 8, None),
@@ -87,7 +84,7 @@ class NeoBase:
87
84
  DUPLICATES = getenv("OPTD_POR_DUPLICATES", "1") == "1"
88
85
 
89
86
  @staticmethod
90
- def skip(row, date):
87
+ def skip(row: Sequence[str], date: str) -> bool:
91
88
  date_from, date_until = row[13], row[14]
92
89
  if date_from and date < date_from:
93
90
  return True
@@ -95,7 +92,12 @@ class NeoBase:
95
92
  return True
96
93
  return False
97
94
 
98
- def __init__(self, rows=None, date=None, duplicates=None):
95
+ def __init__(
96
+ self,
97
+ rows: Iterable[str] | None = None,
98
+ date: str | None = None,
99
+ duplicates: bool | None = None,
100
+ ) -> None:
99
101
  if date is None:
100
102
  date = getenv("OPTD_POR_DATE", datetime.today().strftime("%Y-%m-%d"))
101
103
 
@@ -114,11 +116,16 @@ class NeoBase:
114
116
  self._data = self.load(rows, date, duplicates)
115
117
 
116
118
  @staticmethod
117
- def _empty_value():
119
+ def _empty_value() -> PointData:
118
120
  return {"__dup__": set()}
119
121
 
120
122
  @classmethod
121
- def load(cls, f, date, duplicates):
123
+ def load(
124
+ cls,
125
+ f: Iterable[str],
126
+ date: str,
127
+ duplicates: bool,
128
+ ) -> dict[str, PointData]:
122
129
  """Building a dictionary of geographical data from optd_por.
123
130
 
124
131
  >>> import os.path as op
@@ -133,7 +140,7 @@ class NeoBase:
133
140
  fields, key_c, skip = cls.FIELDS, cls.KEY, cls.skip
134
141
  empty_value = cls._empty_value
135
142
 
136
- data = {}
143
+ data: dict[str, PointData] = {}
137
144
  try:
138
145
  next(f) # skipping first line
139
146
  except StopIteration:
@@ -170,15 +177,16 @@ class NeoBase:
170
177
  data[key] = d
171
178
  else:
172
179
  prev_d = data[key]
173
- new_key = f"{key}@{1 + len(prev_d['__dup__'])}"
180
+ prev_d_dup = cast("set[str]", prev_d["__dup__"])
181
+ new_key = f"{key}@{1 + len(prev_d_dup)}"
174
182
  data[new_key] = d
175
183
  # Exchanging duplicata information
176
- d["__dup__"] = prev_d["__dup__"] | {key}
177
- prev_d["__dup__"].add(new_key)
184
+ d["__dup__"] = prev_d_dup | {key}
185
+ prev_d_dup.add(new_key)
178
186
 
179
187
  return data
180
188
 
181
- def __iter__(self):
189
+ def __iter__(self) -> Iterator[str]:
182
190
  """Returns iterator of all keys in the base.
183
191
 
184
192
  :returns: the iterator of all keys
@@ -189,7 +197,7 @@ class NeoBase:
189
197
  """
190
198
  return iter(self._data)
191
199
 
192
- def __contains__(self, key):
200
+ def __contains__(self, key: str | None) -> bool:
193
201
  """Test if a key is in the base.
194
202
 
195
203
  :param key: the key of to be tested
@@ -209,7 +217,7 @@ class NeoBase:
209
217
  key = key.upper()
210
218
  return key in self._data
211
219
 
212
- def __bool__(self):
220
+ def __bool__(self) -> bool:
213
221
  """Testing structure emptiness.
214
222
 
215
223
  :returns: a boolean
@@ -221,7 +229,7 @@ class NeoBase:
221
229
  """
222
230
  return bool(self._data)
223
231
 
224
- def __len__(self):
232
+ def __len__(self) -> int:
225
233
  """Testing structure size.
226
234
 
227
235
  :returns: a integer
@@ -232,7 +240,7 @@ class NeoBase:
232
240
  """
233
241
  return len(self._data)
234
242
 
235
- def keys(self):
243
+ def keys(self) -> Iterator[str]:
236
244
  """Returns iterator of all keys in the base.
237
245
 
238
246
  :returns: the iterator of all keys
@@ -243,7 +251,7 @@ class NeoBase:
243
251
  """
244
252
  return iter(self)
245
253
 
246
- def set(self, key, **data):
254
+ def set(self, key: str | None, **data: FieldValue) -> None:
247
255
  """Set information.
248
256
 
249
257
  >>> b = NeoBase()
@@ -256,13 +264,19 @@ class NeoBase:
256
264
  >>> b.get('Wow!', 'name')
257
265
  'test'
258
266
  """
259
- if key is not None:
260
- key = key.upper()
267
+ if key is None:
268
+ return
269
+ key = key.upper()
261
270
  if key not in self:
262
271
  self._data[key] = self._empty_value()
263
272
  self._data[key].update(data)
264
273
 
265
- def get(self, key, field=None, default=_sentinel):
274
+ def get(
275
+ self,
276
+ key: str | None,
277
+ field: str | None = None,
278
+ default: object = _sentinel,
279
+ ) -> Any:
266
280
  """Get data from structure.
267
281
 
268
282
  >>> b = NeoBase()
@@ -292,7 +306,13 @@ class NeoBase:
292
306
  else:
293
307
  return res
294
308
 
295
- def get_location(self, key, lat_field="lat", lng_field="lng", default=_sentinel):
309
+ def get_location(
310
+ self,
311
+ key: str | None,
312
+ lat_field: str = "lat",
313
+ lng_field: str = "lng",
314
+ default: object = _sentinel,
315
+ ) -> LatLng | None:
296
316
  """Get None or the geocode.
297
317
 
298
318
  >>> b = NeoBase()
@@ -307,12 +327,12 @@ class NeoBase:
307
327
  # Unless default is set, we raise an Exception
308
328
  if default is _sentinel:
309
329
  raise UnknownKeyError(f"Key not found: {key}")
310
- return default
330
+ return cast("LatLng | None", default)
311
331
 
312
332
  try:
313
333
  loc = LatLng(
314
- float(d[lat_field]),
315
- float(d[lng_field]),
334
+ float(cast("str", d[lat_field])),
335
+ float(cast("str", d[lng_field])),
316
336
  )
317
337
 
318
338
  except (ValueError, TypeError, KeyError):
@@ -325,7 +345,10 @@ class NeoBase:
325
345
  return loc
326
346
 
327
347
  @staticmethod
328
- def distance_between_locations(l0, l1):
348
+ def distance_between_locations(
349
+ l0: LatLng | None,
350
+ l1: LatLng | None,
351
+ ) -> float | None:
329
352
  """Great circle distance
330
353
 
331
354
  :param l0: the LatLng tuple of the first location
@@ -359,7 +382,11 @@ class NeoBase:
359
382
  )
360
383
  )
361
384
 
362
- def distance(self, *keys, default=_sentinel):
385
+ def distance(
386
+ self,
387
+ *keys: str | None,
388
+ default: object = _sentinel,
389
+ ) -> float | None:
363
390
  """Compute distance between two elements.
364
391
 
365
392
  This is just a wrapper between the original haversine
@@ -379,11 +406,15 @@ class NeoBase:
379
406
  except KeyError:
380
407
  if default is _sentinel:
381
408
  raise
382
- return default
409
+ return cast("float | None", default)
383
410
  else:
384
- return fsum(starmap(self.distance_between_locations, pairwise(locations)))
411
+ return fsum(starmap(self.distance_between_locations, pairwise(locations))) # type: ignore
385
412
 
386
- def _build_distances(self, lat_lng_ref, keys):
413
+ def _build_distances(
414
+ self,
415
+ lat_lng_ref: LatLng | None,
416
+ keys: Iterable[str | None],
417
+ ) -> Iterator[DistanceResult]:
387
418
  """
388
419
  Compute the iterable of (dist, keys) of a reference
389
420
  lat_lng and a list of keys. Keys which have not valid
@@ -399,18 +430,30 @@ class NeoBase:
399
430
  data_get = self._data.get
400
431
  distance_between_locations = self.distance_between_locations
401
432
  for key in keys:
402
- d = data_get(key.upper() if key is not None else key)
433
+ if key is None:
434
+ continue
435
+ d = data_get(key.upper())
403
436
 
404
437
  if d is None:
405
438
  continue
406
439
  try:
407
- lat_lng = float(d["lat"]), float(d["lng"])
440
+ lat_lng = LatLng(
441
+ float(cast("str", d["lat"])),
442
+ float(cast("str", d["lng"])),
443
+ )
408
444
  except (ValueError, TypeError, KeyError):
409
445
  continue
410
446
 
411
- yield distance_between_locations(lat_lng_ref, lat_lng), key
447
+ dist = distance_between_locations(lat_lng_ref, lat_lng)
448
+ if dist is not None:
449
+ yield dist, key
412
450
 
413
- def find_near_location(self, lat_lng, radius=_DEFAULT_RADIUS, from_keys=None):
451
+ def find_near_location(
452
+ self,
453
+ lat_lng: LatLng | None,
454
+ radius: float = _DEFAULT_RADIUS,
455
+ from_keys: Iterable[str | None] | None = None,
456
+ ) -> Iterator[DistanceResult]:
414
457
  """
415
458
  Returns a list of nearby keys from a location (given
416
459
  latidude and longitude), and a radius for the search.
@@ -436,7 +479,12 @@ class NeoBase:
436
479
  if dist <= radius:
437
480
  yield dist, key
438
481
 
439
- def find_near(self, key, radius=_DEFAULT_RADIUS, from_keys=None):
482
+ def find_near(
483
+ self,
484
+ key: str | None,
485
+ radius: float = _DEFAULT_RADIUS,
486
+ from_keys: Iterable[str | None] | None = None,
487
+ ) -> Iterator[DistanceResult]:
440
488
  """
441
489
  Same as find_near_location, except the location is given
442
490
  not by a lat/lng, but with its key, like ORY or SFO.
@@ -465,7 +513,12 @@ class NeoBase:
465
513
  from_keys=from_keys,
466
514
  )
467
515
 
468
- def find_closest_from_location(self, lat_lng, N=1, from_keys=None):
516
+ def find_closest_from_location(
517
+ self,
518
+ lat_lng: LatLng | None,
519
+ N: int = 1,
520
+ from_keys: Iterable[str | None] | None = None,
521
+ ) -> Iterator[DistanceResult]:
469
522
  """
470
523
  Concept close to find_near_location, but here we do not
471
524
  look for the keys radius-close to a location,
@@ -492,7 +545,12 @@ class NeoBase:
492
545
 
493
546
  yield from heapq.nsmallest(N, iterable)
494
547
 
495
- def find_closest_from(self, key, N=1, from_keys=None):
548
+ def find_closest_from(
549
+ self,
550
+ key: str | None,
551
+ N: int = 1,
552
+ from_keys: Iterable[str | None] | None = None,
553
+ ) -> Iterator[DistanceResult]:
496
554
  """
497
555
  Same as find_closest_from_location, except the location is given
498
556
  not by a lat/lng, but with its key, like ORY or SFO.
@@ -524,7 +582,12 @@ class NeoBase:
524
582
  from_keys=from_keys,
525
583
  )
526
584
 
527
- def find_with(self, conditions, from_keys=None, reverse=False):
585
+ def find_with(
586
+ self,
587
+ conditions: Iterable[tuple[str, FieldValue]],
588
+ from_keys: Iterable[str | None] | None = None,
589
+ reverse: bool = False,
590
+ ) -> Iterator[str | None]:
528
591
  """Get iterator of all keys with particular field.
529
592
 
530
593
  For example, if you want to know all airports in Paris.
File without changes
@@ -0,0 +1,3 @@
1
+ from importlib import metadata
2
+
3
+ __version__: str = metadata.version("neobase")
@@ -2,8 +2,8 @@
2
2
  isolated_build = true
3
3
  skip_missing_interpreters = true
4
4
  envlist =
5
- py{39,310,311,312,313,314}
6
- pypy{39,310,311}
5
+ py{311,312,313,314}
6
+ pypy311
7
7
 
8
8
  [testenv]
9
9
  package = wheel
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.35",
3
- "distance": 0,
4
- "node": "ga2c01f4a375b69ab3c2195d56cf5afdce68c1ad8",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-08-01"
8
- }
@@ -1,3 +0,0 @@
1
- from importlib import metadata
2
-
3
- __version__ = metadata.version("neobase")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes