@@ -29,29 +29,23 @@ def rename_files(root_folder: str, rename: str, ioc: str) -> None:
2929 os .path .join (root_folder , rename ),
3030 os .path .join (
3131 root_folder ,
32- rename .replace (
33- f"IOC_{ padded_start_copy } " , f"IOC_{ padded_current_copy } "
34- ),
32+ rename .replace (f"IOC_{ padded_start_copy } " , f"IOC_{ padded_current_copy } " ),
3533 ),
3634 )
3735 if f"IOC-{ padded_start_copy } " in rename :
3836 os .rename (
3937 os .path .join (root_folder , rename ),
4038 os .path .join (
4139 root_folder ,
42- rename .replace (
43- f"IOC-{ padded_start_copy } " , f"IOC-{ padded_current_copy } "
44- ),
40+ rename .replace (f"IOC-{ padded_start_copy } " , f"IOC-{ padded_current_copy } " ),
4541 ),
4642 )
4743 if f"{ ioc } _{ padded_start_copy } " in rename :
4844 os .rename (
4945 os .path .join (root_folder , rename ),
5046 os .path .join (
5147 root_folder ,
52- rename .replace (
53- f"{ ioc } _{ padded_start_copy } " , f"{ ioc } _{ padded_current_copy } "
54- ),
48+ rename .replace (f"{ ioc } _{ padded_start_copy } " , f"{ ioc } _{ padded_current_copy } " ),
5549 ),
5650 )
5751
@@ -102,9 +96,7 @@ def replace_line(ioc: str, line: str) -> str:
10296 line = temp_text
10397 temp_text = re .sub (f"{ ioc } _0{ START_COPY } " , f"{ ioc } _{ padded_current_copy } " , line )
10498 line = temp_text
105- temp_text = re .sub (
106- f"RAMPFILELIST0{ START_COPY } " , f"RAMPFILELIST{ padded_current_copy } " , line
107- )
99+ temp_text = re .sub (f"RAMPFILELIST0{ START_COPY } " , f"RAMPFILELIST{ padded_current_copy } " , line )
108100 line = temp_text
109101 return line
110102
@@ -133,9 +125,7 @@ def help_check() -> None:
133125 )
134126 print ("Fourth Argument: <max-number-ioc>" )
135127 print ("This should be the maximum number copied to.\n " )
136- print (
137- "Make sure to run this file from an epics terminal so that make clean can run.\n "
138- )
128+ print ("Make sure to run this file from an epics terminal so that make clean can run.\n " )
139129 sys .exit ()
140130
141131
@@ -186,16 +176,12 @@ def copy_folder(file_format: str, ioc_name: str) -> str:
186176 The path of the new folder.
187177 """
188178 start_path = file_format .format (f"{ ioc_name } -{ padded_start_copy } " )
189- path = os .path .join (
190- os .getcwd (), file_format .format (f"{ ioc_name } -{ padded_current_copy } " )
191- )
179+ path = os .path .join (os .getcwd (), file_format .format (f"{ ioc_name } -{ padded_current_copy } " ))
192180 try :
193181 copytree (
194182 os .path .join (os .getcwd (), start_path ),
195183 os .path .join (path ),
196- ignore = ignore_patterns (
197- "st-*.cmd" , "build.mak" , "*.db" , "*.substitutions" , "*.req"
198- ),
184+ ignore = ignore_patterns ("st-*.cmd" , "build.mak" , "*.db" , "*.substitutions" , "*.req" ),
199185 )
200186 except FileExistsError :
201187 raise FileExistsError (
@@ -248,9 +234,7 @@ def get_file_text(file: str, ioc: str, root: str) -> List[str]:
248234 if START_COPY == 1 :
249235 if file == "st.cmd" :
250236 skip = [
251- x
252- for x , val in enumerate (text )
253- if f"< iocBoot/ioc{ ioc } -IOC-01/st-common.cmd" in val
237+ x for x , val in enumerate (text ) if f"< iocBoot/ioc{ ioc } -IOC-01/st-common.cmd" in val
254238 ]
255239 elif file == "config.xml" :
256240 return generate_config (ioc )
@@ -259,11 +243,7 @@ def get_file_text(file: str, ioc: str, root: str) -> List[str]:
259243
260244 # Last one handled on starts other than 1 to avoid breaking commenting.
261245 if path .endswith (r"App\src\Makefile" ):
262- skip = [
263- x
264- for x , val in enumerate (text )
265- if "build.mak " in val or "/src/build.mak" in val
266- ]
246+ skip = [x for x , val in enumerate (text ) if "build.mak " in val or "/src/build.mak" in val ]
267247 text = replace_text (text , ioc , skip )
268248 return text
269249
@@ -328,9 +308,7 @@ def copy_loop(initial_copy: int, max_copy: int, file_format: str, ioc: str) -> N
328308 for current_copy in range (initial_copy , max_copy + 1 ):
329309 padded_start_copy = add_zero_padding (START_COPY )
330310 padded_current_copy = add_zero_padding (current_copy )
331- padded_current_copy = (
332- f"0{ current_copy } " if len (f"{ current_copy } " ) < 2 else current_copy
333- )
311+ padded_current_copy = f"0{ current_copy } " if len (f"{ current_copy } " ) < 2 else current_copy
334312 path = copy_folder (file_format , ioc_name )
335313 for root , sub_folder , files in os .walk (path ):
336314 file_walk (files , ioc , root )
@@ -359,9 +337,7 @@ def check_valid_ioc_to_copy(ioc: str) -> None:
359337 )
360338 sys .exit ()
361339 else :
362- with open (
363- os .path .join ("iocBoot" , f"ioc{ ioc } -IOC-01" , "st-common.cmd" )
364- ) as file_pointer :
340+ with open (os .path .join ("iocBoot" , f"ioc{ ioc } -IOC-01" , "st-common.cmd" )) as file_pointer :
365341 text = file_pointer .read ()
366342 if "\n seq " in text :
367343 print (
0 commit comments