<commit_before>goog.provide 'acorn.shells.Registry'

goog.require 'acorn'

class acorn.shells.Registry

  @modules: {}

  @registerModule: (shellModule) =>

    # validate that shellModule contains required String properties
    required_properties = [ 'id', 'title', 'description' ]
    _.each required_properties, (property) ->
      unless shellModule[property]?
        MissingParameterError "shell registration", property

      unless _.isString shellModule[property]
        TypeError property, 'str'

    # validate that shellModule contains a Model object
    unless shellModule.Model?
      MissingParameterError "shell registration", "Model"

    # populate shellModule with default properties from Shell
    _.each acorn.shells.Shell, (value, key) ->
      unless shellModule[key]?
        class shellModule[key] extends value

    # validate shellModule's Model and View properties
    class_properties = [ 'Model', 'ContentView', 'SummaryView', 'RemixView']
    _.each class_properties, (property) ->
      unless _.isFunction shellModule[property]
        TypeError property, 'class'

    # set the `shell` property of each class within shellModule to point
    # back to the shellModule namespace
    _.each class_properties, (property) ->
      shellModule[property].shell = shellModule

    # ensure this module isn't already registered
    if @modules[shellModule.id]?
      ShellRegistryError shellModule.id, 'Shell.id already registered.'
<commit_msg>registry: shells no longer provide a SummaryView<commit_after>goog.provide 'acorn.shells.Registry'

goog.require 'acorn'

class acorn.shells.Registry

  @modules: {}

  @registerModule: (shellModule) =>

    # validate that shellModule contains required String properties
    required_properties = [ 'id', 'title', 'description' ]
    _.each required_properties, (property) ->
      unless shellModule[property]?
        MissingParameterError "shell registration", property

      unless _.isString shellModule[property]
        TypeError property, 'str'

    # validate that shellModule contains a Model object
    unless shellModule.Model?
      MissingParameterError "shell registration", "Model"

    # populate shellModule with default properties from Shell
    _.each acorn.shells.Shell, (value, key) ->
      unless shellModule[key]?
        class shellModule[key] extends value

    # validate shellModule's Model and View properties
    class_properties = [ 'Model', 'ContentView', 'RemixView']
    _.each class_properties, (property) ->
      unless _.isFunction shellModule[property]
        TypeError property, 'class'

    # set the `shell` property of each class within shellModule to point
    # back to the shellModule namespace
    _.each class_properties, (property) ->
      shellModule[property].shell = shellModule

    # ensure this module isn't already registered
    if @modules[shellModule.id]?
      ShellRegistryError shellModule.id, 'Shell.id already registered.'

{'fraction_non_alphanumeric': 0.08771929824561403, 'fraction_numerical': 0.0, 'mean_word_length': 3.7213375796178343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3289801', 'n_tokens_mistral': 778, 'n_tokens_neox': 742, 'n_words': 243}