Skip to content

Commit eddf96a

Browse files
Jorge Fernandez HernandezJorge Fernandez Hernandez
authored andcommitted
GAIAMNGT-1700 New function build_general_output_filename
1 parent 71ad0ae commit eddf96a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

astroquery/gaia/core.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,12 @@ def load_data(self, ids, *, data_release=None, data_structure='INDIVIDUAL', retr
229229
-------
230230
A dictionary where the keys are the file names and its value is a list of astropy.table.table.Table objects
231231
"""
232-
now = datetime.now(timezone.utc)
233-
now_formatted = now.strftime("%Y%m%d_%H%M%S")
234-
temp_dirname = "temp_" + now_formatted
235-
downloadname_formated = "download_" + now_formatted
236232

237233
overwrite_output_file = True
238234
output_file_specified = False
239235

240236
if not dump_to_file:
241-
output_file = os.path.join(os.getcwd(), temp_dirname, downloadname_formated)
237+
output_file = self.build_general_output_filename()
242238
else:
243239
output_file = 'datalink_output.zip'
244240
output_file_specified = True
@@ -327,6 +323,13 @@ def load_data(self, ids, *, data_release=None, data_structure='INDIVIDUAL', retr
327323

328324
return files
329325

326+
def build_general_output_filename(self):
327+
now = datetime.now(timezone.utc)
328+
now_formatted = now.strftime("%Y%m%d_%H%M%S")
329+
temp_dirname = "temp_" + now_formatted
330+
downloadname_formated = "download_" + now_formatted
331+
return os.path.join(os.getcwd(), temp_dirname, downloadname_formated)
332+
330333
@staticmethod
331334
def __get_data_files(output_file, path):
332335
files = {}

0 commit comments

Comments
 (0)