Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def unlink_package(package, app_dir=None, logger=None):
"""Unlink a package from JupyterLab by path or name.
"""
handler = _AppHandler(app_dir, logger)
return handler.unlink_package(package)
def _ensure_compat_errors(info, app_dir, logger):
"""Ensure that the app info has compat_errors field"""
handler = _AppHandler(app_dir, logger)
info['compat_errors'] = handler._get_extension_compat()
def link_package(path, app_dir=None, logger=None):
"""Link a package against the JupyterLab build."""
handler = _AppHandler(app_dir, logger)
return handler.link_package(path)
def enable_extension(extension, app_dir=None, logger=None):
"""Enable a JupyterLab extension.
"""
handler = _AppHandler(app_dir, logger)
return handler.toggle_extension(extension, False)
def list_extensions(app_dir=None, logger=None):
"""List the extensions.
"""
handler = _AppHandler(app_dir, logger)
return handler.list_extensions()
def build_check(app_dir=None, logger=None):
"""Determine whether JupyterLab should be built.
Returns a list of messages.
"""
handler = _AppHandler(app_dir, logger)
return handler.build_check()
def disable_extension(extension, app_dir=None, logger=None):
"""Disable a JupyterLab package.
"""
handler = _AppHandler(app_dir, logger)
return handler.toggle_extension(extension, True)
def _build_check_info(app_dir, logger):
"""Get info about packages scheduled for (un)install/update"""
handler = _AppHandler(app_dir, logger)
messages = handler.build_check(fast=True)
# Decode the messages into a dict:
status = {'install': [], 'uninstall': [], 'update': []}
for msg in messages:
for key, pattern in _message_map.items():
match = pattern.match(msg)
if match:
status[key].append(match.group('name'))
return status
def get_app_info(app_dir=None, logger=None):
"""Get a dictionary of information about the app.
"""
handler = _AppHandler(app_dir, logger)
return handler.info