with
statements can be merged PTC-W0062With
statements` 73 c2000 = date.replace(year=2000)
74 coffset = iemre.daily_offset(c2000)
75
76 with ncopen(fn) as nc: 77 with ncopen(iemre.get_dailyc_ncname()) as cnc:
78 res.append(
79 {
Nested with
statements can be merged into a single compound with
statement.
This issue is raised only when there are no other statements between the nested with
statements.
Merging collapsible with
statements can decrease cognitive complexity, improving code readability.
with open("file1", "w") as file1:
with open("file2", "w") as file2:
doSomething()
with open("file1", "w") as file1, open("file2", "w") as file2:
doSomething()