@@ -97,14 +97,14 @@ def download_file(url):
97
97
def read_sig_yaml (sig_file ):
98
98
import yaml
99
99
100
- stream = open (sig_file , 'r' )
101
- sigs_wgs = yaml .safe_load (stream )
100
+ # stream = open(sig_file, 'r')
101
+ sigs_wgs = yaml .safe_load (sig_file )
102
102
103
103
return sigs_wgs
104
104
105
105
def process_sig_yaml ():
106
106
107
- sig_file = download_file ('https://raw.githubusercontent.com/kubernetes/community/master/sigs.yaml' , '/tmp/sigs.yaml' )
107
+ sig_file = download_file ('https://raw.githubusercontent.com/kubernetes/community/master/sigs.yaml' )
108
108
109
109
sigs_wgs = read_sig_yaml (sig_file )
110
110
@@ -307,4 +307,33 @@ def expand_name(nested_name):
307
307
return object_name
308
308
309
309
df [new_col ] = df [old_col ].apply (expand_name )
310
- return df
310
+ return df
311
+
312
+ def create_file (pre_string ):
313
+ """Creates an output file in an "output" directory with today's date
314
+ as part of the filename and prints the file_path to the terminal to
315
+ make it easier to open the output file.
316
+
317
+ Parameters
318
+ ----------
319
+ pre_string : str
320
+ This is the string that will preface today's date in the filename
321
+ Returns
322
+ -------
323
+ file : file object
324
+ file_path : str
325
+ This is the full path to the file name for the output.
326
+
327
+ """
328
+ from datetime import datetime
329
+ from os .path import dirname , join
330
+
331
+ today = datetime .today ().strftime ('%Y-%m-%d' )
332
+ output_filename = "./output/" + pre_string + "_" + today + ".csv"
333
+ current_dir = dirname (__file__ )
334
+ file_path = join (current_dir , output_filename )
335
+ file = open (file_path , 'w' , newline = '' )
336
+
337
+ print ("Output file:\n " , file_path , sep = "" )
338
+
339
+ return file , file_path
0 commit comments