File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1919# Imports requiring compatibility between Python 2 and Python 3
2020if sys .version_info .major == 2 :
2121 import urllib2
22+ import urllib as parse
2223elif sys .version_info .major == 3 :
2324 from urllib import request as urllib2
25+ import urllib .parse as parse
2426
2527
2628class GPServer (object ):
@@ -247,6 +249,12 @@ def get_url(self):
247249 """
248250 return self .uri
249251
252+ def get_name (self ):
253+ """
254+ Returns the file name of the output file
255+ """
256+ return parse .unquote (self .get_url ().split ('/' )[- 1 ])
257+
250258
251259class GPJob (GPResource ):
252260 """
@@ -440,6 +448,17 @@ def get_output_files(self):
440448 else :
441449 return []
442450
451+ def get_file (self , name ):
452+ """
453+ Returns the output file with the specified name, if no output files
454+ match, returns None.
455+ """
456+ files = self .get_output_files ()
457+ for f in files :
458+ if f .get_name () == name :
459+ return f
460+ return None
461+
443462 def wait_until_done (self ):
444463 """
445464 This method will not return until the job is either complete or has
You can’t perform that action at this time.
0 commit comments