gtfs_kit 4.0.0__tar.gz → 4.0.2__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.
@@ -1,23 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gtfs-kit
3
- Version: 4.0.0
4
- Summary: A Python 3.6+ library for analyzing GTFS feeds.
3
+ Version: 4.0.2
4
+ Summary: A Python 3.6.1+ library for analyzing GTFS feeds.
5
5
  Home-page: https://github.com/mrcagney/gtfs_kit
6
6
  License: MIT
7
7
  Author: Alex Raichev
8
8
  Author-email: araichev@mrcagney.com
9
- Requires-Python: >=3.6,<4.0
9
+ Requires-Python: >=3.6.1,<4.0
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.6
13
12
  Classifier: Programming Language :: Python :: 3.7
14
13
  Classifier: Programming Language :: Python :: 3.8
15
14
  Requires-Dist: folium (<1)
16
15
  Requires-Dist: geopandas (<1)
17
- Requires-Dist: json2table (>=1.1,<2.0)
18
- Requires-Dist: pandas (<1)
19
- Requires-Dist: pycountry (>=18.5,<19.0)
20
- Requires-Dist: requests (>=2.23.0,<3.0.0)
16
+ Requires-Dist: json2html (<2)
17
+ Requires-Dist: pandas (<2)
18
+ Requires-Dist: pycountry (<20)
19
+ Requires-Dist: requests (>=2.23,<3.0)
21
20
  Requires-Dist: rtree (<1)
22
21
  Requires-Dist: shapely (<2)
23
22
  Requires-Dist: utm (<1)
@@ -43,7 +42,7 @@ Installation
43
42
 
44
43
  Examples
45
44
  ========
46
- You can play with ``ipynb/examples.ipynb`` in a Jupyter notebook.
45
+ Examples are in the Jupyter notebook ``notebooks/examples.ipynb``.
47
46
 
48
47
 
49
48
  Authors
@@ -16,7 +16,7 @@ Installation
16
16
 
17
17
  Examples
18
18
  ========
19
- You can play with ``ipynb/examples.ipynb`` in a Jupyter notebook.
19
+ Examples are in the Jupyter notebook ``notebooks/examples.ipynb``.
20
20
 
21
21
 
22
22
  Authors
@@ -12,4 +12,4 @@ from .validators import *
12
12
  from .feed import *
13
13
 
14
14
 
15
- __version__ = "4.0.0"
15
+ __version__ = "4.0.2"
@@ -139,7 +139,7 @@ FEED_ATTRS_2 = ["_trips_i", "_calendar_i", "_calendar_dates_g"]
139
139
  FEED_ATTRS = FEED_ATTRS_1 + FEED_ATTRS_2
140
140
 
141
141
  #: WGS84 coordinate reference system for Geopandas
142
- WGS84 = {"init": "epsg:4326"}
142
+ WGS84 = "EPSG:4326"
143
143
 
144
144
  #: Colorbrewer 8-class Set2 colors
145
145
  COLORS_SET2 = [
@@ -486,11 +486,13 @@ def _read_feed_from_url(url: str, dist_units: str) -> "Feed":
486
486
 
487
487
 
488
488
  """
489
- r = requests.get(url)
490
- with tempfile.NamedTemporaryFile() as f:
489
+ f = tempfile.NamedTemporaryFile(delete=False)
490
+ with requests.get(url) as r:
491
491
  f.write(r._content)
492
- f.seek(0)
493
- return _read_feed_from_path(f.name, dist_units=dist_units)
492
+ f.close()
493
+ feed = _read_feed_from_path(f.name, dist_units=dist_units)
494
+ Path(f.name).unlink()
495
+ return feed
494
496
 
495
497
 
496
498
  def read_feed(path_or_url: Union[Path, str], dist_units: str) -> "Feed":
@@ -507,7 +509,11 @@ def read_feed(path_or_url: Union[Path, str], dist_units: str) -> "Feed":
507
509
  - Automatically strip whitespace from the column names in GTFS files
508
510
 
509
511
  """
510
- if Path(path_or_url).exists():
512
+ try:
513
+ path_exists = Path(path_or_url).exists()
514
+ except OSError:
515
+ path_exists = False
516
+ if path_exists:
511
517
  return _read_feed_from_path(path_or_url, dist_units=dist_units)
512
518
  elif requests.head(path_or_url).ok:
513
519
  return _read_feed_from_url(path_or_url, dist_units=dist_units)
@@ -13,7 +13,7 @@ import numpy as np
13
13
  import shapely.geometry as sg
14
14
  from shapely.ops import transform
15
15
  import utm
16
- import json2table as j2t
16
+ import json2html as j2h
17
17
 
18
18
  from . import constants as cs
19
19
 
@@ -239,16 +239,7 @@ def get_utm_crs(lat: float, lon: float) -> Dict:
239
239
  latitude and longitude.
240
240
  """
241
241
  zone = utm.from_latlon(lat, lon)[2]
242
- south = lat < 0
243
- return {
244
- "proj": "utm",
245
- "zone": zone,
246
- "south": south,
247
- "ellps": "WGS84",
248
- "datum": "WGS84",
249
- "units": "m",
250
- "no_defs": True,
251
- }
242
+ return f"EPSG:326{zone:02d}"
252
243
 
253
244
 
254
245
  def linestring_to_utm(linestring: sg.LineString) -> sg.LineString:
@@ -495,8 +486,8 @@ def make_html(d: Dict) -> str:
495
486
  Convert the given dictionary into an HTML table (string) with
496
487
  two columns: keys of dictionary, values of dictionary.
497
488
  """
498
- return j2t.convert(
499
- d, table_attributes={"class": "table table-condensed table-hover"}
489
+ return j2h.json2html.convert(
490
+ json=d, table_attributes="class='table table-condensed table-hover'"
500
491
  )
501
492
 
502
493
 
@@ -906,13 +906,12 @@ def compute_screen_line_counts(
906
906
  # Get intersection points of shapes and screen lines
907
907
  g0 = (
908
908
  # Only keep shapes that intersect screen lines to reduce computations
909
- gpd.sjoin(shapes_g, screen_lines.filter(["screen_line_id", "geometry"]))
910
- .merge(screen_lines, on="screen_line_id")
911
- .assign(geometry_x=lambda x: gpd.GeoSeries(x.geometry_x, crs=crs))
912
- .set_geometry("geometry_x")
909
+ gpd.sjoin(shapes_g, screen_lines.filter(["screen_line_id", "geometry"])).merge(
910
+ screen_lines, on="screen_line_id"
911
+ )
913
912
  # Compute intersection points
914
913
  .assign(
915
- int_point=lambda x: x.geometry_x.intersection(
914
+ int_point=lambda x: gpd.GeoSeries(x.geometry_x, crs=crs).intersection(
916
915
  gpd.GeoSeries(x.geometry_y, crs=crs)
917
916
  )
918
917
  )
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "gtfs_kit"
3
- version = "4.0.0"
4
- description = "A Python 3.6+ library for analyzing GTFS feeds."
3
+ version = "4.0.2"
4
+ description = "A Python 3.6.1+ library for analyzing GTFS feeds."
5
5
  authors = ["Alex Raichev <araichev@mrcagney.com>"]
6
6
  readme = "README.rst"
7
7
  license = "MIT"
@@ -10,26 +10,26 @@ documentation = "https://mrcagney.github.io/gtfs_kit_docs"
10
10
  exclude = ["tests", "docs"]
11
11
 
12
12
  [tool.poetry.dependencies]
13
- python = "^3.6 || ^3.7"
14
- pandas = "<1"
13
+ python = "^3.6.1 || ^3.7 || ^3.8"
14
+ pandas = "<2"
15
15
  shapely = "<2"
16
- pycountry = "^18.5"
16
+ pycountry = "<20"
17
17
  utm = "<1"
18
- json2table = "^1.1"
18
+ json2html = "<2"
19
19
  geopandas = "<1"
20
20
  rtree = "<1"
21
21
  folium = "<1"
22
- requests = "^2.23.0"
22
+ requests = "^2.23"
23
23
 
24
24
  [tool.poetry.dev-dependencies]
25
- jupyter = "<2"
26
- pytest = "^4.0"
27
- sphinx = "<2"
28
- pre-commit = "<2"
25
+ jupyter = "*"
26
+ pytest = "<6"
27
+ sphinx = "<4"
28
+ pre-commit = "*"
29
29
  black = "=19.3b0"
30
30
  publish_sphinx_docs = "^1.0"
31
- matplotlib = "^3.0"
32
- pytest-socket = "^0.3.3"
31
+ matplotlib = "*"
32
+ pytest-socket = "*"
33
33
 
34
34
  [build-system]
35
35
  requires = ["poetry>=0.12"]
@@ -10,19 +10,19 @@ package_data = \
10
10
  install_requires = \
11
11
  ['folium<1',
12
12
  'geopandas<1',
13
- 'json2table>=1.1,<2.0',
14
- 'pandas<1',
15
- 'pycountry>=18.5,<19.0',
16
- 'requests>=2.23.0,<3.0.0',
13
+ 'json2html<2',
14
+ 'pandas<2',
15
+ 'pycountry<20',
16
+ 'requests>=2.23,<3.0',
17
17
  'rtree<1',
18
18
  'shapely<2',
19
19
  'utm<1']
20
20
 
21
21
  setup_kwargs = {
22
22
  'name': 'gtfs-kit',
23
- 'version': '4.0.0',
24
- 'description': 'A Python 3.6+ library for analyzing GTFS feeds.',
25
- 'long_description': 'GTFS Kit\n********\n.. image:: https://travis-ci.org/mrcagney/gtfs_kit.svg?branch=master\n :target: https://travis-ci.org/mrcagney/gtfs_kit\n\nGTFS Kit is a Python 3.6+ kit for analyzing `General Transit Feed Specification (GTFS) <https://en.wikipedia.org/wiki/GTFS>`_ data in memory without a database.\nIt uses Pandas and Shapely to do the heavy lifting.\n\nThis project supersedes `GTFSTK <https://github.com/mrcagney/gtfstk>`_.\n\n\nInstallation\n=============\n``pip install gtfs_kit``.\n\n\nExamples\n========\nYou can play with ``ipynb/examples.ipynb`` in a Jupyter notebook.\n\n\nAuthors\n=========\n- Alex Raichev, 2019-09\n\n\nDocumentation\n=============\nOn Github Pages `here <https://mrcagney.github.io/gtfs_kit_docs>`_.\n\n\nNotes\n=====\n- Development status is Alpha\n- This project uses semantic versioning\n- Thanks to `MRCagney <http://www.mrcagney.com/>`_ for donating to this project\n- Constructive feedback and code contributions welcome. Please issue pull requests into the ``develop`` branch and include tests.\n',
23
+ 'version': '4.0.2',
24
+ 'description': 'A Python 3.6.1+ library for analyzing GTFS feeds.',
25
+ 'long_description': 'GTFS Kit\n********\n.. image:: https://travis-ci.org/mrcagney/gtfs_kit.svg?branch=master\n :target: https://travis-ci.org/mrcagney/gtfs_kit\n\nGTFS Kit is a Python 3.6+ kit for analyzing `General Transit Feed Specification (GTFS) <https://en.wikipedia.org/wiki/GTFS>`_ data in memory without a database.\nIt uses Pandas and Shapely to do the heavy lifting.\n\nThis project supersedes `GTFSTK <https://github.com/mrcagney/gtfstk>`_.\n\n\nInstallation\n=============\n``pip install gtfs_kit``.\n\n\nExamples\n========\nExamples are in the Jupyter notebook ``notebooks/examples.ipynb``.\n\n\nAuthors\n=========\n- Alex Raichev, 2019-09\n\n\nDocumentation\n=============\nOn Github Pages `here <https://mrcagney.github.io/gtfs_kit_docs>`_.\n\n\nNotes\n=====\n- Development status is Alpha\n- This project uses semantic versioning\n- Thanks to `MRCagney <http://www.mrcagney.com/>`_ for donating to this project\n- Constructive feedback and code contributions welcome. Please issue pull requests into the ``develop`` branch and include tests.\n',
26
26
  'author': 'Alex Raichev',
27
27
  'author_email': 'araichev@mrcagney.com',
28
28
  'maintainer': None,
@@ -31,7 +31,7 @@ setup_kwargs = {
31
31
  'packages': packages,
32
32
  'package_data': package_data,
33
33
  'install_requires': install_requires,
34
- 'python_requires': '>=3.6,<4.0',
34
+ 'python_requires': '>=3.6.1,<4.0',
35
35
  }
36
36
 
37
37
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes