mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-01 12:56:54 +08:00
use print for nbextension list output
logging is inappropriate here also only show config dir if there's config in it.
This commit is contained in:
parent
f26e0b1015
commit
d0e0ddf400
@ -868,18 +868,24 @@ class ListNBExtensionsApp(BaseNBExtensionApp):
|
||||
"""List all the nbextensions"""
|
||||
config_dirs = [os.path.join(p, 'nbconfig') for p in jupyter_config_path()]
|
||||
|
||||
self.log.info("Known nbextensions:")
|
||||
print("Known nbextensions:")
|
||||
|
||||
for config_dir in config_dirs:
|
||||
self.log.info(u' config dir: {}'.format(config_dir))
|
||||
head = u' config dir: {}'.format(config_dir)
|
||||
head_shown = False
|
||||
|
||||
cm = BaseJSONConfigManager(parent=self, config_dir=config_dir)
|
||||
for section in NBCONFIG_SECTIONS:
|
||||
data = cm.get(section)
|
||||
if 'load_extensions' in data:
|
||||
self.log.info(u' {} section'.format(section))
|
||||
if not head_shown:
|
||||
# only show heading if there is an nbextension here
|
||||
print(head)
|
||||
head_shown = True
|
||||
print(u' {} section'.format(section))
|
||||
|
||||
for require, enabled in data['load_extensions'].items():
|
||||
self.log.info(u' {} {}'.format(
|
||||
print(u' {} {}'.format(
|
||||
require,
|
||||
GREEN_ENABLED if enabled else RED_DISABLED))
|
||||
if enabled:
|
||||
|
@ -241,15 +241,16 @@ class ListServerExtensionsApp(BaseNBExtensionApp):
|
||||
"""
|
||||
config_dirs = jupyter_config_path()
|
||||
for config_dir in config_dirs:
|
||||
self.log.info(u'config dir: {}'.format(config_dir))
|
||||
cm = BaseJSONConfigManager(parent=self, config_dir=config_dir)
|
||||
data = cm.get("jupyter_notebook_config")
|
||||
server_extensions = (
|
||||
data.setdefault("NotebookApp", {})
|
||||
.setdefault("nbserver_extensions", {})
|
||||
)
|
||||
if server_extensions:
|
||||
print(u'config dir: {}'.format(config_dir))
|
||||
for import_name, enabled in server_extensions.items():
|
||||
self.log.info(u' {} {}'.format(
|
||||
print(u' {} {}'.format(
|
||||
import_name,
|
||||
GREEN_ENABLED if enabled else RED_DISABLED))
|
||||
validate_serverextension(import_name, self.log)
|
||||
|
Loading…
Reference in New Issue
Block a user