<commit_before>class VirtualizationController extends KDController

  constructor:->
    super

    @kc = KD.getSingleton("kiteController")
    @dialogIsOpen = no
    @resetVMData()
    (KD.getSingleton 'mainController').once 'AppIsReady', => @fetchVMs()
    @on 'VMListChanged', @bound 'resetVMData'

  run:(vm, command, callback)->
    # KD.requireMembership
    #   callback : =>
    @askForApprove command, (approved)=>
      if approved
        cb = unless command is 'vm.info' then @_cbWrapper vm, callback \
             else callback
        @kc.run
          kiteName : 'os'
          method   : command
          vmName   : vm
        , cb
      else unless command is 'vm.info' then @info vm
      # onFailMsg : "Login required to use VMs"  unless command is 'vm.info'
      # onFail    : =>
      #   unless command is 'vm.info' then callback yes
      #   else callback null, state: 'STOPPED'
      # silence   : yes

    if "string" is typeof options
      command = options
      options =
        withArgs : command

    @fetchDefaultVmName (defaultVmName)=>
      vmName = if options.vmName then options.vmName else defaultVmName
      unless vmName
        return callback message: 'There is no VM for this account.'
      options.correlationName = vmName
      @kc.run options, callback

  _runWraper:(command, vm, callback)->
    [callback, vm] = [vm, callback]  unless 'string' is typeof vm
    @fetchDefaultVmName (defaultVm)=>
      vm or= defaultVm
      return  unless vm
      KD.requireMembership
        callback : =>
          @askForApprove command, (approved)=>
            if approved
              cb = unless command is 'vm.info' then @_cbWrapper vm, callback \
                   else callback
              @run
                kiteName : 'os'
                method   : command
                vmName   : vm
              , cb
            else unless command is 'vm.info' then @info vm
        onFailMsg : "Login required to use VMs"  unless command is 'vm.info'
        onFail    : =>
          unless command is 'vm.info' then callback yes
          else callback null, state: 'STOPPED'
        silence   : yes

  start:(vm, callback)->
    @_runWraper 'vm.start', vm, callback

  stop:(vm, callback)->
    @_runWraper 'vm.shutdown', vm, callback
<commit_msg>virtualization: comment out the bits about requiring membership for now<commit_after>class VirtualizationController extends KDController

  constructor:->
    super

    @kc = KD.getSingleton("kiteController")
    @dialogIsOpen = no
    @resetVMData()
    (KD.getSingleton 'mainController').once 'AppIsReady', => @fetchVMs()
    @on 'VMListChanged', @bound 'resetVMData'

  run:(vm, command, callback)->
    # KD.requireMembership
    #   callback : =>
    @askForApprove command, (approved)=>
      if approved
        cb = unless command is 'vm.info' then @_cbWrapper vm, callback \
             else callback
        @kc.run
          kiteName : 'os'
          method   : command
          vmName   : vm
        , cb
      else unless command is 'vm.info' then @info vm
      # onFailMsg : "Login required to use VMs"  unless command is 'vm.info'
      # onFail    : =>
      #   unless command is 'vm.info' then callback yes
      #   else callback null, state: 'STOPPED'
      # silence   : yes

    if "string" is typeof options
      command = options
      options =
        withArgs : command

    @fetchDefaultVmName (defaultVmName)=>
      vmName = if options.vmName then options.vmName else defaultVmName
      unless vmName
        return callback message: 'There is no VM for this account.'
      options.correlationName = vmName
      @kc.run options, callback

  _runWraper:(command, vm, callback)->
    [callback, vm] = [vm, callback]  unless 'string' is typeof vm
    @fetchDefaultVmName (defaultVm)=>
      vm or= defaultVm
      return  unless vm
      # KD.requireMembership
      #   callback : =>
      @askForApprove command, (approved)=>
        if approved
          cb = unless command is 'vm.info' then @_cbWrapper vm, callback \
               else callback
          @run
            kiteName : 'os'
            method   : command
            vmName   : vm
          , cb
        else unless command is 'vm.info' then @info vm
        # onFailMsg : "Login required to use VMs"  unless command is 'vm.info'
        # onFail    : =>
        #   unless command is 'vm.info' then callback yes
        #   else callback null, state: 'STOPPED'
        # silence   : yes

  start:(vm, callback)->
    @_runWraper 'vm.start', vm, callback

  stop:(vm, callback)->
    @_runWraper 'vm.shutdown', vm, callback

{'fraction_non_alphanumeric': 0.09334485738980121, 'fraction_numerical': 0.0, 'mean_word_length': 2.1087978509066487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '2884722', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1312, 'n_words': 425}