Skip to content

Commit

Permalink
add property with sorted extensions (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed May 20, 2021
1 parent 5f76fda commit b063117
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jupyter_server/extension/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ def _config_manager_changed(self, change):
"""
)

@property
def sorted_extensions(self):
"""Returns an extensions dictionary, sorted alphabetically."""
return dict(sorted(self.extensions.items()))

# The `_linked_extensions` attribute tracks when each extension
# has been successfully linked to a ServerApp. This helps prevent
# extensions from being re-linked recursively unintentionally if another
Expand Down Expand Up @@ -350,7 +355,7 @@ def link_all_extensions(self, serverapp):
"""
# Sort the extension names to enforce deterministic linking
# order.
for name in sorted(self.extensions.keys()):
for name in self.sorted_extensions.keys():
self.link_extension(name, serverapp)

def load_all_extensions(self, serverapp):
Expand All @@ -359,5 +364,5 @@ def load_all_extensions(self, serverapp):
"""
# Sort the extension names to enforce deterministic loading
# order.
for name in sorted(self.extensions.keys()):
for name in self.sorted_extensions.keys():
self.load_extension(name, serverapp)

0 comments on commit b063117

Please sign in to comment.