@@ -82,8 +82,8 @@ jupyterhub:
8282 - Duplicate the code here and in binderhub/binderspawner_mixin.py
8383 """
8484 from tornado import web
85- from traitlets.config import Configurable
8685 from traitlets import Bool, Unicode
86+ from traitlets.config import Configurable
8787
8888
8989 class BinderSpawnerMixin(Configurable):
@@ -101,7 +101,7 @@ jupyterhub:
101101 # classes using traitlets?
102102 # https://stackoverflow.com/questions/9575409/calling-parent-class-init-with-multiple-inheritance-whats-the-right-way
103103 # https://github.com/ipython/traitlets/pull/175
104- super(BinderSpawnerMixin, self ).__init__(*args, **kwargs)
104+ super().__init__(*args, **kwargs)
105105
106106 auth_enabled = Bool(
107107 False,
@@ -111,7 +111,7 @@ jupyterhub:
111111 Requires `jupyterhub-singleuser` to be available inside the repositories
112112 being built.
113113 """,
114- config=True
114+ config=True,
115115 )
116116
117117 cors_allow_origin = Unicode(
@@ -126,51 +126,52 @@ jupyterhub:
126126 See also BinderHub.cors_allow_origin in binderhub config
127127 for controlling CORS policy for the BinderHub API endpoint.
128128 """,
129- config=True
129+ config=True,
130130 )
131131
132132 def get_args(self):
133133 if self.auth_enabled:
134134 args = super().get_args()
135135 else:
136136 args = [
137- ' --ip=0.0.0.0' ,
138- f' --port={self.port}' ,
139- f' --NotebookApp.base_url={self.server.base_url}' ,
137+ " --ip=0.0.0.0" ,
138+ f" --port={self.port}" ,
139+ f" --NotebookApp.base_url={self.server.base_url}" ,
140140 f"--NotebookApp.token={self.user_options['token']}",
141- ' --NotebookApp.trust_xheaders=True' ,
141+ " --NotebookApp.trust_xheaders=True" ,
142142 ]
143143 if self.default_url:
144- args.append(f' --NotebookApp.default_url={self.default_url}' )
144+ args.append(f" --NotebookApp.default_url={self.default_url}" )
145145
146146 if self.cors_allow_origin:
147- args.append(' --NotebookApp.allow_origin=' + self.cors_allow_origin)
147+ args.append(" --NotebookApp.allow_origin=" + self.cors_allow_origin)
148148 # allow_origin=* doesn't properly allow cross-origin requests to single files
149149 # see https://github.com/jupyter/notebook/pull/5898
150- if self.cors_allow_origin == '*' :
151- args.append(' --NotebookApp.allow_origin_pat=.*' )
150+ if self.cors_allow_origin == "*" :
151+ args.append(" --NotebookApp.allow_origin_pat=.*" )
152152 args += self.args
153153 return args
154154
155155 def start(self):
156156 if not self.auth_enabled:
157- if ' token' not in self.user_options:
157+ if " token" not in self.user_options:
158158 raise web.HTTPError(400, "token required")
159- if ' image' not in self.user_options:
159+ if " image" not in self.user_options:
160160 raise web.HTTPError(400, "image required")
161- if ' image' in self.user_options:
162- self.image = self.user_options[' image' ]
161+ if " image" in self.user_options:
162+ self.image = self.user_options[" image" ]
163163 return super().start()
164164
165165 def get_env(self):
166166 env = super().get_env()
167- if ' repo_url' in self.user_options:
168- env[' BINDER_REPO_URL' ] = self.user_options[' repo_url' ]
167+ if " repo_url" in self.user_options:
168+ env[" BINDER_REPO_URL" ] = self.user_options[" repo_url" ]
169169 for key in (
170- 'binder_ref_url',
171- 'binder_launch_host',
172- 'binder_persistent_request',
173- 'binder_request'):
170+ "binder_ref_url",
171+ "binder_launch_host",
172+ "binder_persistent_request",
173+ "binder_request",
174+ ):
174175 if key in self.user_options:
175176 env[key.upper()] = self.user_options[key]
176177 return env
0 commit comments