@@ -141,7 +141,7 @@ def __init__(
141
141
self ,
142
142
session_config : t .Dict [str , t .Any ],
143
143
server : Server ,
144
- plugins : t .List [t .Any ] = [] ,
144
+ plugins : t .Optional [ t . List [t .Any ]] = None ,
145
145
) -> None :
146
146
"""Initialize workspace loading.
147
147
@@ -162,6 +162,8 @@ def __init__(
162
162
``self.session``.
163
163
"""
164
164
165
+ if plugins is None :
166
+ plugins = []
165
167
if not session_config :
166
168
raise exc .EmptyWorkspaceException ("Session configuration is empty." )
167
169
@@ -276,9 +278,9 @@ def build(self, session: t.Optional[Session] = None, append: bool = False) -> No
276
278
if "start_directory" in self .session_config :
277
279
cwd = self .session_config ["start_directory" ]
278
280
run_before_script (self .session_config ["before_script" ], cwd = cwd )
279
- except Exception as e :
281
+ except Exception :
280
282
self .session .kill_session ()
281
- raise e
283
+ raise
282
284
283
285
if "options" in self .session_config :
284
286
for option , value in self .session_config ["options" ].items ():
@@ -349,10 +351,7 @@ def iter_create_windows(
349
351
for window_iterator , window_config in enumerate (
350
352
self .session_config ["windows" ], start = 1
351
353
):
352
- if "window_name" not in window_config :
353
- window_name = None
354
- else :
355
- window_name = window_config ["window_name" ]
354
+ window_name = window_config .get ("window_name" , None )
356
355
357
356
is_first_window_pass = self .first_window_pass (
358
357
window_iterator , session , append
@@ -363,20 +362,14 @@ def iter_create_windows(
363
362
w1 = session .attached_window
364
363
w1 .move_window ("99" )
365
364
366
- if "start_directory" in window_config :
367
- start_directory = window_config ["start_directory" ]
368
- else :
369
- start_directory = None
365
+ start_directory = window_config .get ("start_directory" , None )
370
366
371
367
# If the first pane specifies a start_directory, use that instead.
372
368
panes = window_config ["panes" ]
373
369
if panes and "start_directory" in panes [0 ]:
374
370
start_directory = panes [0 ]["start_directory" ]
375
371
376
- if "window_shell" in window_config :
377
- window_shell = window_config ["window_shell" ]
378
- else :
379
- window_shell = None
372
+ window_shell = window_config .get ("window_shell" , None )
380
373
381
374
# If the first pane specifies a shell, use that instead.
382
375
try :
0 commit comments