Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
description = "Enable labextension(s) by name"
def run_task(self):
[enable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class DisableLabExtensionsApp(BaseExtensionApp):
description = "Disable labextension(s) by name"
def run_task(self):
[disable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class CheckLabExtensionsApp(BaseExtensionApp):
description = "Check labextension(s) by name"
flags = check_flags
should_check_installed_only = Bool(False, config=True,
help="Whether it should check only if the extensions is installed")
def run_task(self):
all_enabled = all(
check_extension(
arg, self.app_dir,
self.should_check_installed_only,
logger=self.log)
for arg in self.extra_args)
if not all_enabled:
exit(1)
msg = traceback.format_exception(ex.__class__, ex, exc_traceback)
for line in msg:
self.log.debug(line)
self.log.error('\nErrored, use --debug for full output:')
self.log.error(msg[-1].strip())
sys.exit(1)
def run_task(self):
pass
def _log_format_default(self):
"""A default format for messages"""
return "%(message)s"
class InstallLabExtensionApp(BaseExtensionApp):
description = "Install labextension(s)"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
install_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class UpdateLabExtensionApp(BaseExtensionApp):
description = "Update labextension(s)"
flags = update_flags
all = Bool(False, config=True,
help="Whether to update all extensions")
for arg in self.extra_args
])
class UninstallLabExtensionApp(BaseExtensionApp):
description = "Uninstall labextension(s) by name"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
uninstall_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class ListLabExtensionsApp(BaseExtensionApp):
description = "List the installed labextensions"
def run_task(self):
list_extensions(self.app_dir, logger=self.log)
class EnableLabExtensionsApp(BaseExtensionApp):
description = "Enable labextension(s) by name"
def run_task(self):
[enable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class DisableLabExtensionsApp(BaseExtensionApp):
description = "Disable labextension(s) by name"
all = Bool(False, config=True,
help="Whether to update all extensions")
def run_task(self):
if not self.all and not self.extra_args:
self.log.warn('Specify an extension to update, or use --all to update all extensions')
return False
if self.all:
return update_extension(all_=True, app_dir=self.app_dir, logger=self.log)
return any([
update_extension(name=arg, app_dir=self.app_dir, logger=self.log)
for arg in self.extra_args
])
class LinkLabExtensionApp(BaseExtensionApp):
description = """
Link local npm packages that are not lab extensions.
Links a package to the JupyterLab build process. A linked
package is manually re-installed from its source location when
`jupyter lab build` is run.
"""
should_build = Bool(True, config=True,
help="Whether to build the app after the action")
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
link_package(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
for arg in self.extra_args
])
class UnlinkLabExtensionApp(BaseExtensionApp):
description = "Unlink packages by name or path"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
unlink_package(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class UninstallLabExtensionApp(BaseExtensionApp):
description = "Uninstall labextension(s) by name"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
uninstall_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class ListLabExtensionsApp(BaseExtensionApp):
description = "List the installed labextensions"
def run_task(self):
list_extensions(self.app_dir, logger=self.log)
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
uninstall_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class ListLabExtensionsApp(BaseExtensionApp):
description = "List the installed labextensions"
def run_task(self):
list_extensions(self.app_dir, logger=self.log)
class EnableLabExtensionsApp(BaseExtensionApp):
description = "Enable labextension(s) by name"
def run_task(self):
[enable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class DisableLabExtensionsApp(BaseExtensionApp):
description = "Disable labextension(s) by name"
def run_task(self):
[disable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class CheckLabExtensionsApp(BaseExtensionApp):
Links a package to the JupyterLab build process. A linked
package is manually re-installed from its source location when
`jupyter lab build` is run.
"""
should_build = Bool(True, config=True,
help="Whether to build the app after the action")
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
link_package(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class UnlinkLabExtensionApp(BaseExtensionApp):
description = "Unlink packages by name or path"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
unlink_package(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class UninstallLabExtensionApp(BaseExtensionApp):
description = "Uninstall labextension(s) by name"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
"""A default format for messages"""
return "%(message)s"
class InstallLabExtensionApp(BaseExtensionApp):
description = "Install labextension(s)"
def run_task(self):
self.extra_args = self.extra_args or [os.getcwd()]
return any([
install_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args
])
class UpdateLabExtensionApp(BaseExtensionApp):
description = "Update labextension(s)"
flags = update_flags
all = Bool(False, config=True,
help="Whether to update all extensions")
def run_task(self):
if not self.all and not self.extra_args:
self.log.warn('Specify an extension to update, or use --all to update all extensions')
return False
if self.all:
return update_extension(all_=True, app_dir=self.app_dir, logger=self.log)
return any([
update_extension(name=arg, app_dir=self.app_dir, logger=self.log)
for arg in self.extra_args
])
class ListLabExtensionsApp(BaseExtensionApp):
description = "List the installed labextensions"
def run_task(self):
list_extensions(self.app_dir, logger=self.log)
class EnableLabExtensionsApp(BaseExtensionApp):
description = "Enable labextension(s) by name"
def run_task(self):
[enable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class DisableLabExtensionsApp(BaseExtensionApp):
description = "Disable labextension(s) by name"
def run_task(self):
[disable_extension(arg, self.app_dir, logger=self.log)
for arg in self.extra_args]
class CheckLabExtensionsApp(BaseExtensionApp):
description = "Check labextension(s) by name"
flags = check_flags
should_check_installed_only = Bool(False, config=True,
help="Whether it should check only if the extensions is installed")
def run_task(self):
all_enabled = all(