Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On memory unzipping, Allow missing of optional items, and so on. #76

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions gtfs_go_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import tempfile
import urllib
import uuid
import zipfile

from PyQt5.QtCore import *
from PyQt5.QtGui import *
Expand Down Expand Up @@ -162,12 +161,6 @@ def download_zip(self, url: str) -> str:

return download_path

def extract_zip(self, zip_path: str) -> str:
extracted_dir = os.path.join(TEMP_DIR, "extract", str(uuid.uuid4()))
os.makedirs(extracted_dir, exist_ok=True)
with zipfile.ZipFile(zip_path) as z:
z.extractall(extracted_dir)
return extracted_dir

def get_target_feed_infos(self):
feed_infos = []
Expand Down Expand Up @@ -221,7 +214,6 @@ def execution(self):
if feed_info["path"].startswith("http"):
feed_info["path"] = self.download_zip(feed_info["path"])

extracted_dir = self.extract_zip(feed_info["path"])
output_dir = os.path.join(
self.outputDirFileWidget.filePath(), feed_info["dir"]
)
Expand All @@ -235,8 +227,9 @@ def execution(self):
"aggregated_csv": "",
}

gtfs = gtfs_parser.GTFS(feed_info["path"])

if self.ui.simpleCheckbox.isChecked():
gtfs = gtfs_parser.GTFS(extracted_dir)
routes_geojson = {
"type": "FeatureCollection",
"features": gtfs_parser.parse.read_routes(
Expand Down Expand Up @@ -268,7 +261,6 @@ def execution(self):
json.dump(stops_geojson, f, ensure_ascii=False)

if self.ui.aggregateCheckbox.isChecked():
gtfs = gtfs_parser.GTFS(extracted_dir)
aggregator = gtfs_parser.aggregate.Aggregator(
gtfs,
no_unify_stops=not self.ui.unifyCheckBox.isChecked(),
Expand Down
2 changes: 1 addition & 1 deletion gtfs_parser