Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 4, 2024
1 parent 2f198d1 commit a740337
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/jupyter-ai/jupyter_ai/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def initialize_settings(self):

async def _get_dask_client(self):
return DaskClient(processes=False, asynchronous=True)

async def stop_extension(self):
"""
Public method called by Jupyter Server when the server is stopping.
Expand All @@ -274,16 +274,18 @@ async def stop_extension(self):
try:
await self._stop_extension()
except Exception as e:
self.log.error("Jupyter AI raised an exception while stopping, printed below. Please report this to the maintainers on GitHub.")
self.log.error(
"Jupyter AI raised an exception while stopping, printed below. Please report this to the maintainers on GitHub."
)
self.log.exception(e)

async def _stop_extension(self):
"""
Private method that defines the cleanup code to run when the server is
stopping.
"""
if 'dask_client_future' in self.settings:
dask_client: DaskClient = await self.settings['dask_client_future']
if "dask_client_future" in self.settings:
dask_client: DaskClient = await self.settings["dask_client_future"]
self.log.info("Closing Dask client.")
await dask_client.close()
self.log.debug("Closed Dask client.")

0 comments on commit a740337

Please sign in to comment.