File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
import argparse
2
+ import glob
2
3
import os .path
4
+ import sys
3
5
4
6
5
7
def main ():
@@ -87,6 +89,10 @@ def main():
87
89
if os .path .isdir (args .path ):
88
90
args .path = os .path .join (args .path , "*" )
89
91
92
+ filenames = glob .glob (args .path )
93
+ if not filenames :
94
+ sys .exit (f"No files found matching { args .path } " )
95
+
90
96
if args .bbox :
91
97
# Convert comma-separated string into floats
92
98
args .lon_min , args .lat_min , args .lon_max , args .lat_max = (
@@ -108,7 +114,7 @@ def main():
108
114
from .process_data import process_data
109
115
110
116
print ("Processing data..." )
111
- df = process_data (args . path )
117
+ df = process_data (filenames )
112
118
113
119
activities = None
114
120
if args .activities_path :
Original file line number Diff line number Diff line change 1
- import glob
1
+ from __future__ import annotations
2
+
2
3
import math
3
4
from multiprocessing import Pool
4
5
@@ -101,10 +102,8 @@ def process_fit(fitfile):
101
102
102
103
103
104
# Function for processing (unzipped) GPX and FIT files in a directory (path)
104
- def process_data (path ) :
105
+ def process_data (filenames : list [ str ]) -> pd . DataFrame :
105
106
# Process all files (GPX or FIT)
106
- filenames = glob .glob (path )
107
-
108
107
with Pool () as pool :
109
108
try :
110
109
it = pool .imap_unordered (process_file , filenames )
You can’t perform that action at this time.
0 commit comments