@@ -11,18 +11,10 @@ def batch_process_folder_sasfiles(
11
11
) -> None :
12
12
"""Finds all .sas files in folder, tries to extract formats from these.
13
13
14
- Parameters
15
- ----------
16
- sas_files_path: str
17
- The path to the folder containing the .sas files.
18
- output_path: str
19
- The path to the folder where the formats will be stored.
20
- Not including the filename itself, only the base folder.
21
-
22
- Returns:
23
- -------
24
- None
25
- Only writes to disk (side effect).
14
+ Args:
15
+ sas_files_path (str): The path to the folder containing the .sas files.
16
+ output_path (str): The path to the folder where the formats will be stored.
17
+ Not including the filename itself, only the base folder.
26
18
"""
27
19
for file in glob .glob (sas_files_path + "*.sas" ):
28
20
print (f"Processing { file } ." )
@@ -32,23 +24,13 @@ def batch_process_folder_sasfiles(
32
24
def process_single_sasfile (file : str , output_path : str = PROD_FORMATS_PATH ) -> None :
33
25
"""Get a single .sas file from storage, extracts formats and stores to disk as timestamped jsonfiles.
34
26
35
- Parameters
36
- ----------
37
- file: str
38
- The path to the .sas file.
39
- output_path: str
40
- The path to the folder where the formats will be stored.
41
- Not including the filename itself, only the base folder.
42
-
43
- Returns:
44
- -------
45
- None
46
- Only writes to disk (side effect).
27
+ Args:
28
+ file (str): The path to the .sas file.
29
+ output_path (str): The path to the folder where the formats will be stored.
30
+ Not including the filename itself, only the base folder.
47
31
48
32
Raises:
49
- ------
50
- ValueError
51
- If the file is not a .sas file.
33
+ ValueError: If the file is not a .sas file.
52
34
"""
53
35
if not file .endswith (".sas" ):
54
36
raise ValueError ("Dude, you gotta send in a .sas file." )
@@ -65,15 +47,15 @@ def process_single_sasfile(file: str, output_path: str = PROD_FORMATS_PATH) -> N
65
47
def parse_sas_script (sas_script_content : str ) -> dict [str , dict [str , str ]]:
66
48
"""Extract a format as a Python dictionary from a SAS script.
67
49
68
- Parameters
69
- ----------
70
- sas_script_content: str
71
- The content of the SAS script.
50
+ Args:
51
+ sas_script_content (str):The content of the SAS script.
72
52
73
53
Returns:
74
- -------
75
- dict[str, dict[str, str]]
76
- A nested dictionary containing the format-name as key, and the format-content as value.
54
+ dict[str, dict[str, str]]: A nested dictionary containing the format-name as key,
55
+ and the format-content as value.
56
+
57
+ Raises:
58
+ Exception: If we are unable to parse the lines of a format correctly.
77
59
"""
78
60
formats_in_file : dict [str , dict [str , str ]] = {}
79
61
for proc_step in sas_script_content .split ("proc format;" )[1 :]:
0 commit comments