text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="29b90bc5-4ceb-41a1-bd4a-99e7c6145de3" name="Default" comment="">
      <change type="DELETED" beforePath="$PROJECT_DIR$/modules/cmds.py" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/modules/prompts.py" afterPath="" />
      <change type="DELETED" beforePath="$PROJECT_DIR$/modules/send_cmd.py" afterPath="" />
    </list>
    <ignored path="Cisco_SNMPv3_tool.iws" />
    <ignored path=".idea/workspace.xml" />
    <ignored path=".idea/dataSources.local.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="Cisco_SNMPv3_tool" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
  </component>
  <component name="FindManager">
    <FindUsagesManager>
      <setting name="OPEN_NEW_TAB" value="true" />
    </FindUsagesManager>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/modules/cisco_mode.py" />
        <option value="$PROJECT_DIR$/modules/cmds.py" />
        <option value="$PROJECT_DIR$/modules/prompts.py" />
        <option value="$PROJECT_DIR$/modules/send_cmd.py" />
        <option value="$PROJECT_DIR$/README.md" />
        <option value="$PROJECT_DIR$/lib/cisco_mode.py" />
        <option value="$PROJECT_DIR$/lib/send_cmd.py" />
        <option value="$PROJECT_DIR$/snmp_v3_tool.py" />
        <option value="$PROJECT_DIR$/lib/cmds.py" />
        <option value="$PROJECT_DIR$/lib/prompts.py" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsBuildToolPackageJson" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="-1246" />
    <option name="y" value="-1057" />
    <option name="width" value="1920" />
    <option name="height" value="1057" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="true">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectReloadState">
    <option name="STATE" value="0" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="lib" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="Cisco_SNMPv3_tool" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="etc" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scope" />
      <pane id="Scratches" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="options.lastSelected" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
    <property name="options.splitter.main.proportions" value="0.3" />
    <property name="options.splitter.details.proportions" value="0.2" />
    <property name="options.searchVisible" value="true" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
    <property name="FullScreen" value="false" />
    <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
  </component>
  <component name="RunManager">
    <configuration default="true" type="DjangoTestsConfigurationType" factoryName="Django tests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="TARGET" value="" />
      <option name="SETTINGS_FILE" value="" />
      <option name="CUSTOM_SETTINGS" value="false" />
      <option name="USE_OPTIONS" value="false" />
      <option name="OPTIONS" value="" />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="PyBehaveRunConfigurationType" factoryName="Behave">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="ADDITIONAL_ARGS" value="" />
      <method />
    </configuration>
    <configuration default="true" type="PyLettuceRunConfigurationType" factoryName="Lettuce">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="ADDITIONAL_ARGS" value="" />
      <method />
    </configuration>
    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs>
        <env name="PYTHONUNBUFFERED" value="1" />
      </envs>
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="PARAMETERS" value="" />
      <option name="SHOW_COMMAND_LINE" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
      <command value="run-script" />
      <scripts />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Attests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Doctests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Nosetests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="Unittests">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="PUREUNITTEST" value="true" />
      <option name="PARAMS" value="" />
      <option name="USE_PARAM" value="false" />
      <method />
    </configuration>
    <configuration default="true" type="tests" factoryName="py.test">
      <option name="INTERPRETER_OPTIONS" value="" />
      <option name="PARENT_ENVS" value="true" />
      <envs />
      <option name="SDK_HOME" value="" />
      <option name="WORKING_DIRECTORY" value="" />
      <option name="IS_MODULE_SDK" value="false" />
      <option name="ADD_CONTENT_ROOTS" value="true" />
      <option name="ADD_SOURCE_ROOTS" value="true" />
      <module name="Cisco_SNMPv3_tool" />
      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
      <option name="SCRIPT_NAME" value="" />
      <option name="CLASS_NAME" value="" />
      <option name="METHOD_NAME" value="" />
      <option name="FOLDER_NAME" value="" />
      <option name="TEST_TYPE" value="TEST_SCRIPT" />
      <option name="PATTERN" value="" />
      <option name="USE_PATTERN" value="false" />
      <option name="testToRun" value="" />
      <option name="keywords" value="" />
      <option name="params" value="" />
      <option name="USE_PARAM" value="false" />
      <option name="USE_KEYWORD" value="false" />
      <method />
    </configuration>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="29b90bc5-4ceb-41a1-bd4a-99e7c6145de3" name="Default" comment="" />
      <created>1417522558914</created>
      <option name="number" value="Default" />
      <updated>1417522558914</updated>
    </task>
    <task id="LOCAL-00001" summary="upgrade to python 3">
      <created>1417523940633</created>
      <option name="number" value="00001" />
      <option name="project" value="LOCAL" />
      <updated>1417523940633</updated>
    </task>
    <task id="LOCAL-00002" summary="add read me.">
      <created>1417554991639</created>
      <option name="number" value="00002" />
      <option name="project" value="LOCAL" />
      <updated>1417554991639</updated>
    </task>
    <task id="LOCAL-00003" summary="add read me.">
      <created>1417555137593</created>
      <option name="number" value="00003" />
      <option name="project" value="LOCAL" />
      <updated>1417555137593</updated>
    </task>
    <task id="LOCAL-00004" summary="add read me.">
      <created>1417555786740</created>
      <option name="number" value="00004" />
      <option name="project" value="LOCAL" />
      <updated>1417555786740</updated>
    </task>
    <task id="LOCAL-00005" summary="add read me.">
      <created>1417555893524</created>
      <option name="number" value="00005" />
      <option name="project" value="LOCAL" />
      <updated>1417555893524</updated>
    </task>
    <task id="LOCAL-00006" summary="pretty up the readme.">
      <created>1417556040313</created>
      <option name="number" value="00006" />
      <option name="project" value="LOCAL" />
      <updated>1417556040313</updated>
    </task>
    <task id="LOCAL-00007" summary="pretty up the readme.">
      <created>1417556075580</created>
      <option name="number" value="00007" />
      <option name="project" value="LOCAL" />
      <updated>1417556075580</updated>
    </task>
    <task id="LOCAL-00008" summary="pretty up the readme.">
      <created>1417556211154</created>
      <option name="number" value="00008" />
      <option name="project" value="LOCAL" />
      <updated>1417556211155</updated>
    </task>
    <task id="LOCAL-00009" summary="pretty up the readme.">
      <created>1417556240119</created>
      <option name="number" value="00009" />
      <option name="project" value="LOCAL" />
      <updated>1417556240119</updated>
    </task>
    <task id="LOCAL-00010" summary="cleanup output">
      <created>1417601115743</created>
      <option name="number" value="00010" />
      <option name="project" value="LOCAL" />
      <updated>1417601115743</updated>
    </task>
    <task id="LOCAL-00011" summary="rename modules to lib
remove license from scripts
remove "import x" and change to "from x import x"">
      <created>1450304472666</created>
      <option name="number" value="00011" />
      <option name="project" value="LOCAL" />
      <updated>1450304472666</updated>
    </task>
    <option name="localTasksCounter" value="12" />
    <servers />
  </component>
  <component name="TodoView" selected-index="0">
    <todo-panel id="selected-file">
      <are-packages-shown value="false" />
      <are-modules-shown value="false" />
      <flatten-packages value="false" />
      <is-autoscroll-to-source value="false" />
    </todo-panel>
    <todo-panel id="all">
      <are-packages-shown value="false" />
      <are-modules-shown value="false" />
      <flatten-packages value="false" />
      <is-autoscroll-to-source value="false" />
    </todo-panel>
    <todo-panel id="default-changelist">
      <are-packages-shown value="false" />
      <are-modules-shown value="false" />
      <flatten-packages value="false" />
      <is-autoscroll-to-source value="false" />
    </todo-panel>
  </component>
  <component name="ToolWindowManager">
    <frame x="-1246" y="-1057" width="1920" height="1057" extended-state="6" />
    <editor active="false" />
    <layout>
      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1625" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32954547" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32954547" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32954547" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32954547" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="UnknownFeatures">
    <option featureType="com.intellij.fileTypeFactory" implementationName="*.conf" />
    <option featureType="com.intellij.fileTypeFactory" implementationName="*.md" />
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <MESSAGE value="upgrade to python 3" />
    <MESSAGE value="add read me." />
    <MESSAGE value="pretty up the readme." />
    <MESSAGE value="cleanup output" />
    <MESSAGE value="rename modules to lib
remove license from scripts
remove "import x" and change to "from x import x"" />
    <option name="LAST_COMMIT_MESSAGE" value="rename modules to lib
remove license from scripts
remove "import x" and change to "from x import x"" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="83" column="31" selection-start-line="83" selection-start-column="31" selection-end-line="83" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="5" selection-start-line="46" selection-start-column="5" selection-end-line="46" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="126" column="12" selection-start-line="126" selection-start-column="12" selection-end-line="126" selection-end-column="62" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="83" column="31" selection-start-line="83" selection-start-column="31" selection-end-line="83" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="5" selection-start-line="46" selection-start-column="5" selection-end-line="46" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="51" column="44" selection-start-line="51" selection-start-column="4" selection-end-line="51" selection-end-column="44" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="0" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="5" selection-start-line="46" selection-start-column="5" selection-end-line="46" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="24" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="0" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="5" selection-start-line="46" selection-start-column="5" selection-end-line="46" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="47" column="0" selection-start-line="47" selection-start-column="0" selection-end-line="47" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="40" column="0" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="46" column="5" selection-start-line="46" selection-start-column="5" selection-end-line="46" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="167" column="0" selection-start-line="167" selection-start-column="0" selection-end-line="167" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="167" column="0" selection-start-line="167" selection-start-column="0" selection-end-line="167" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/__init__.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/LICENSE">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-2.25">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/README.md">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cmds.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.015625">
          <caret line="1" column="23" selection-start-line="1" selection-start-column="23" selection-end-line="1" selection-end-column="23" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/prompts.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/send_cmd.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/lib/cisco_mode.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/etc/hosts.txt">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/etc/snmpv3.conf">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/snmp_v3_tool.py">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.046875">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding>
            <element signature="e#114#142#0" expanded="true" />
          </folding>
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
'use strict';

var express = require('express');

redpajama_set_name: RedPajamaGithub


text:
import threading
import logging
from concurrent import futures

import grpc
from google.protobuf import empty_pb2, timestamp_pb2

from fedlearner.common import common_pb2 as common_pb
from fedlearner.common import data_join_service_pb2 as dj_pb
from fedlearner.common import data_join_service_pb2_grpc as dj_grpc

from fedlearner.common.db_client import DBClient
from fedlearner.proxy.channel import make_insecure_channel, ChannelType

from fedlearner.data_join.routine_worker import RoutineWorker
from fedlearner.data_join.raw_data_manifest_manager import (
    RawDataManifestManager
)
from fedlearner.data_join.common import (retrieve_data_source,
                                         commit_data_source)

class MasterFSM(object):
    INVALID_PEER_FSM_STATE = {}
    INVALID_PEER_FSM_STATE[common_pb.DataSourceState.Init] = set(
            [common_pb.DataSourceState.Failed,
             common_pb.DataSourceState.Ready,
             common_pb.DataSourceState.Finished]
        )
    INVALID_PEER_FSM_STATE[common_pb.DataSourceState.Processing] = set(
            [common_pb.DataSourceState.Failed,
             common_pb.DataSourceState.Finished]
        )
    INVALID_PEER_FSM_STATE[common_pb.DataSourceState.Ready] = set(
            [common_pb.DataSourceState.Failed,
             common_pb.DataSourceState.Init]
        )
    INVALID_PEER_FSM_STATE[common_pb.DataSourceState.Finished] = set(
            [common_pb.DataSourceState.Failed,
             common_pb.DataSourceState.Init,
             common_pb.DataSourceState.Processing]
        )

    def __init__(self, peer_client, data_source_name, kvstore, batch_mode):
        self._lock = threading.Lock()
        self._peer_client = peer_client
        self._data_source_name = data_source_name
        self._kvstore = kvstore
        self._batch_mode = batch_mode
        self._init_fsm_action()
        self._data_source = None
        self._sync_data_source()
        self._reset_batch_mode()
        self._raw_data_manifest_manager = RawDataManifestManager(
                kvstore, self._data_source, batch_mode
            )
        self._data_source_meta = self._data_source.data_source_meta
        if self._data_source.role == common_pb.FLRole.Leader:
            self._role_repr = "leader"
        else:
            self._role_repr = "follower"
        self._fsm_worker = None
        self._started = False

    def get_mainifest_manager(self):
        return self._raw_data_manifest_manager

    def get_data_source(self):
        with self._lock:
            return self._sync_data_source()

    def set_failed(self):
        return self.set_state(common_pb.DataSourceState.Failed, None)

    def set_state(self, new_state, origin_state=None):
        with self._lock:
            try:
                data_source = self._sync_data_source()
                if data_source.state == new_state:
                    return True
                if origin_state is None or data_source.state == origin_state:
                    data_source.state = new_state
                    self._update_data_source(data_source)
                    return True
                new_data_source = self._sync_data_source()
                logging.warning("DataSource: %s failed to set to state: "
                                "%d, origin state mismatch(%d != %d)",
                                self._data_source_name, new_state,
                                origin_state, new_data_source.state)
                return False
            except Exception as e: # pylint: disable=broad-except
                logging.warning("Faile to set state to %d with exception %s",
                                new_state, e)
                return False
            return True

    def start_fsm_worker(self):
        with self._lock:
            if not self._started:
                assert self._fsm_worker is None, \
                    "fsm_woker must be None if FSM is not started"
                self._started = True
                self._fsm_worker = RoutineWorker(
                        '{}_fsm_worker'.format(self._data_source_name),
                        self._fsm_routine_fn,
                        self._fsm_routine_cond, 5
                    )
                self._fsm_worker.start_routine()

    def stop_fsm_worker(self):
        tmp_worker = None
        with self._lock:
            if self._fsm_worker is not None:
                tmp_worker = self._fsm_worker
                self._fsm_worker = None
        if tmp_worker is not None:
            tmp_worker.stop_routine()

    def _fsm_routine_fn(self):
        peer_info = self._get_peer_data_source_status()
        with self._lock:
            data_source = self._sync_data_source()
            state = data_source.state
            if self._fallback_failed_state(peer_info):
                logging.warning("%s at state %d, Peer at state %d "\
                                "state invalid! abort data source %s",
                                self._role_repr, state,
                                peer_info.state, self._data_source_name)
            elif state not in self._fsm_driven_handle:
                logging.error("%s at error state %d for data_source %s",
                               self._role_repr, state, self._data_source_name)
            else:
                state_changed = self._fsm_driven_handle[state](peer_info)
                if state_changed:
                    new_state = self._sync_data_source().state
                    logging.warning("%s state changed from %d to %d",
                                    self._role_repr, state, new_state)
                    state = new_state
            if state in (common_pb.DataSourceState.Init,
                         common_pb.DataSourceState.Processing) and \
                    not self._batch_mode:
                self._raw_data_manifest_manager.sub_new_raw_data()

    def _fsm_routine_cond(self):
        return True

    def _sync_data_source(self):
        if self._data_source is None:
            self._data_source = \
                retrieve_data_source(self._kvstore, self._data_source_name)
        assert self._data_source is not None, \
            "data source {} is not in kvstore".format(self._data_source_name)
        return self._data_source

    def _reset_batch_mode(self):
        if self._batch_mode:
            data_source = self._sync_data_source()
            if data_source.state == common_pb.DataSourceState.UnKnown:
                raise RuntimeError("Failed to reset batch mode since "\
                                   "DataSource {} at UnKnown state"\
                                   .format(self._data_source_name))
            if data_source.state in (common_pb.DataSourceState.Init,
                                       common_pb.DataSourceState.Processing):
                logging.info("DataSouce %s at Init/Processing State. Don't "\
                             "need reset", self._data_source_name)
            elif data_source.state == common_pb.DataSourceState.Ready:
                logging.info("DataSouce %s at Ready. need reset to Processing "\
                             "state", self._data_source_name)
                data_source.state = common_pb.DataSourceState.Processing
                self._update_data_source(data_source)
            else:
                raise RuntimeError("Failed to reset batch mode since Data"\
                                   "Source {} at Finished/Failed state, Peer"\
                                   "may delete it"\
                                   .format(self._data_source_name))

    def _init_fsm_action(self):
        self._fsm_driven_handle = {
             common_pb.DataSourceState.UnKnown:
                 self._get_fsm_action('unknown'),
             common_pb.DataSourceState.Init:
                 self._get_fsm_action('init'),
             common_pb.DataSourceState.Processing:
                 self._get_fsm_action('processing'),
             common_pb.DataSourceState.Ready:
                 self._get_fsm_action('ready'),
             common_pb.DataSourceState.Finished:
                 self._get_fsm_action('finished'),
             common_pb.DataSourceState.Failed:
                 self._get_fsm_action('failed')
        }

    def _get_fsm_action(self, action):
        def _not_implement(useless):
            raise NotImplementedError('state is not NotImplemented')
        name = '_fsm_{}_action'.format(action)
        return getattr(self, name, _not_implement)

    def _fsm_init_action(self, peer_info):
        state_changed = False
        if self._data_source.role == common_pb.FLRole.Leader:
            if peer_info.state == common_pb.DataSourceState.Init:
                state_changed = True
        elif peer_info.state == common_pb.DataSourceState.Processing:
            state_changed = True
        if state_changed:
            self._data_source.state = common_pb.DataSourceState.Processing
            self._update_data_source(self._data_source)
            return True
        return False

    def _fsm_processing_action(self, peer_info):
        if self._all_partition_finished():
            state_changed = False
            if self._data_source.role == common_pb.FLRole.Leader:
                if peer_info.state == common_pb.DataSourceState.Processing:
                    state_changed = True
            elif peer_info.state == common_pb.DataSourceState.Ready:
                state_changed = True
            if state_changed:
                self._data_source.state = common_pb.DataSourceState.Ready
                self._update_data_source(self._data_source)
                return True
        return False

    def _fsm_ready_action(self, peer_info):
        if self._batch_mode:
            logging.info("stop fsm from Ready to Finish since "\
                         "the data join master run in batch mode")
            return False
        state_changed = False
        if self._data_source.role == common_pb.FLRole.Leader:
            if peer_info.state == common_pb.DataSourceState.Ready:
                state_changed = True
        elif peer_info.state == common_pb.DataSourceState.Finished:
            state_changed = True
        if state_changed:
            self._data_source.state = common_pb.DataSourceState.Finished
            self._update_data_source(self._data_source)
            return True
        return False

    def _fsm_finished_action(self, peer_info):
        return False

    def _fsm_failed_action(self, peer_info):
        if peer_info.state != common_pb.DataSourceState.Failed:
            request = dj_pb.DataSourceRequest(
                    data_source_meta=self._data_source_meta
                )
            self._peer_client.AbortDataSource(request)
        return False

    def _fallback_failed_state(self, peer_info):
        state = self._data_source.state
        if (state in self.INVALID_PEER_FSM_STATE and
                peer_info.state in self.INVALID_PEER_FSM_STATE[state]):
            self._data_source.state = common_pb.DataSourceState.Failed
            self._update_data_source(self._data_source)
            return True
        return False

    def _update_data_source(self, data_source):
        self._data_source = None
        try:
            commit_data_source(self._kvstore, data_source)
        except Exception as e:
            logging.error("Failed to update data source: %s since "\
                          "exception: %s", self._data_source_name, e)
            raise
        self._data_source = data_source
        logging.debug("Success update to update data source: %s.",
                       self._data_source_name)

    def _get_peer_data_source_status(self):
        request = dj_pb.DataSourceRequest(
                data_source_meta=self._data_source_meta
            )
        return self._peer_client.GetDataSourceStatus(request)

    def _all_partition_finished(self):
        all_manifest = self._raw_data_manifest_manager.list_all_manifest()
        assert len(all_manifest) == \
                self._data_source.data_source_meta.partition_num, \
            "manifest number should same with partition number"
        for manifest in all_manifest.values():
            if manifest.sync_example_id_rep.state != \
                    dj_pb.SyncExampleIdState.Synced or \
                    manifest.join_example_rep.state != \
                    dj_pb.JoinExampleState.Joined:
                return False
        return True

class DataJoinMaster(dj_grpc.DataJoinMasterServiceServicer):
    def __init__(self, peer_client, data_source_name,
                 kvstore_type, options):
        super(DataJoinMaster, self).__init__()
        self._data_source_name = data_source_name
        kvstore = DBClient(kvstore_type, options.use_mock_etcd)
        self._options = options
        self._fsm = MasterFSM(peer_client, data_source_name,
                              kvstore, self._options.batch_mode)
        self._data_source_meta = \
                self._fsm.get_data_source().data_source_meta

    def GetDataSource(self, request, context):
        return self._fsm.get_data_source()

    def GetDataSourceStatus(self, request, context):
        self._check_data_source_meta(request.data_source_meta, True)
        data_source = self._fsm.get_data_source()
        response = dj_pb.DataSourceStatus(
                role=data_source.role,
                state=data_source.state
            )
        return response

    def AbortDataSource(self, request, context):
        response = self._check_data_source_meta(request.data_source_meta)
        if response.code == 0 and not self._fsm.set_failed():
            response.code = -2
            response.error_message = "failed to set failed state to fsm"
        return response

    def RequestJoinPartition(self, request, context):
        response = dj_pb.RawDataResponse()
        meta_status = self._check_data_source_meta(request.data_source_meta)
        if meta_status.code != 0:
            response.status.MergeFrom(meta_status)
            return response
        rank_status = self._check_rank_id(request.rank_id)
        if rank_status.code != 0:
            response.status.MergeFrom(rank_status)
            return response
        data_source = self._fsm.get_data_source()
        if data_source.state != common_pb.DataSourceState.Processing:
            response.status.code = -3
            response.status.error_message = \
                    "data source is not at processing state"
        else:
            manifest_manager = self._fsm.get_mainifest_manager()
            rank_id = request.rank_id
            manifest = None
            partition_id = None if request.partition_id < 0 \
                    else request.partition_id
            if request.HasField('sync_example_id'):
                manifest = manifest_manager.alloc_sync_exampld_id(
                        rank_id, partition_id
                    )
            elif request.HasField('join_example'):
                manifest = manifest_manager.alloc_join_example(
                        rank_id, partition_id
                    )
            else:
                response.status.code = -4
                response.status.error_message = "request not support"
            if response.status.code == 0:
                if manifest is not None:
                    response.manifest.MergeFrom(manifest)
                else:
                    assert partition_id is None, \
                        "only the request without appoint partition "\
                        "support response no manifest"
                    response.finished.MergeFrom(empty_pb2.Empty())
        return response

    def FinishJoinPartition(self, request, context):
        response = self._check_data_source_meta(request.data_source_meta)
        if response.code != 0:
            return response
        response = self._check_rank_id(request.rank_id)
        if response.code != 0:
            return response
        data_source = self._fsm.get_data_source()
        if data_source.state != common_pb.DataSourceState.Processing:
            response.code = -2
            response.error_message = "data source is not at processing state"
        else:
            rank_id = request.rank_id
            partition_id = request.partition_id
            manifest_manager = self._fsm.get_mainifest_manager()
            if request.HasField('sync_example_id'):
                manifest_manager.finish_sync_example_id(rank_id, partition_id)
            elif request.HasField('join_example'):
                manifest_manager.finish_join_example(rank_id, partition_id)
            else:
                response.code = -3
                response.error_message = "request not support"
        return response

    def QueryRawDataManifest(self, request, context):
        self._check_data_source_meta(request.data_source_meta, True)
        manifest_manager = self._fsm.get_mainifest_manager()
        manifest = manifest_manager.get_manifest(request.partition_id)
        return manifest

    def FinishRawData(self, request, context):
        response = self._check_data_source_meta(request.data_source_meta)
        if response.code == 0:
            if self._options.batch_mode:
                response.code = -2
                response.error_message = "Forbid to finish raw data since "\
                                         "master run in batch mode"
            elif request.HasField('finish_raw_data'):
                manifest_manager = self._fsm.get_mainifest_manager()
                manifest_manager.finish_raw_data(request.partition_id)
            else:
                response.code = -3
                response.error_message = \
                    "FinishRawData should has finish_raw_data"
        return response

    def AddRawData(self, request, context):
        response = self._check_data_source_meta(request.data_source_meta)
        if response.code == 0:
            sub_dir = self._fsm.get_data_source().raw_data_sub_dir
            if self._options.batch_mode:
                response.code = -2
                response.error_message = "Forbid to add raw data since "\
                                         "master run in batch mode"
            elif request.HasField('added_raw_data_metas'):
                manifest_manager = self._fsm.get_mainifest_manager()
                manifest_manager.add_raw_data(
                        request.partition_id,
                        request.added_raw_data_metas.raw_data_metas,
                        request.added_raw_data_metas.dedup
                    )
            else:
                response.code = -3
                response.error_message = \
                        "AddRawData should has field next_process_index"
        return response

    def ForwardPeerDumpedIndex(self, request, context):
        response = self._check_data_source_meta(request.data_source_meta)
        if response.code == 0:
            manifest_manager = self._fsm.get_mainifest_manager()
            if request.HasField('peer_dumped_index'):
                manifest_manager.forward_peer_dumped_index(
                        request.partition_id,
                        request.peer_dumped_index.peer_dumped_index
                    )
            else:
                response.code = -2
                response.error_message = "ForwardPeerDumpedIndex should "\
                                         "has field peer_dumped_index"
        return response

    def GetRawDataLatestTimeStamp(self, request, context):
        response = dj_pb.RawDataResponse(
                timestamp=timestamp_pb2.Timestamp(seconds=0)
            )
        meta_status = self._check_data_source_meta(request.data_source_meta)
        if meta_status.code != 0:
            response.status.MergeFrom(meta_status)
            return response
        manifest_manager = self._fsm.get_mainifest_manager()
        ts = manifest_manager.get_raw_date_latest_timestamp(
                request.partition_id
            )
        if ts is not None:
            response.timestamp.MergeFrom(ts)
        return response

    def _check_data_source_meta(self, remote_meta, raise_exp=False):
        if self._data_source_meta != remote_meta:
            local_meta = self._data_source_meta
            if local_meta.name != remote_meta.name:
                logging.error("data_source_meta mismtach since name "\
                              "%s != %s", local_meta.name, remote_meta.name)
            if local_meta.partition_num != remote_meta.partition_num:
                logging.error("data_source_meta mismatch since partition "\
                              "num %d != %d", local_meta.partition_num,
                              remote_meta.partition_num)
            if local_meta.start_time != remote_meta.start_time:
                logging.error("data_source_meta mismatch since start_time "\
                              "%d != %d",
                              local_meta.start_time, remote_meta.start_time)
            if local_meta.end_time != remote_meta.end_time:
                logging.error("data_source_meta mismatch since end_time "\
                              "%d != %d",
                              local_meta.end_time, remote_meta.end_time)
            if local_meta.negative_sampling_rate != \
                    remote_meta.negative_sampling_rate:
                logging.error("data_source_meta mismatch since negative_"\
                              "sampling_rate %f != %f",
                              local_meta.negative_sampling_rate,
                              remote_meta.negative_sampling_rate)
            if raise_exp:
                raise RuntimeError("data source meta mismatch")
            return common_pb.Status(
                    code=-1, error_message="data source meta mismatch"
                )
        return common_pb.Status(code=0)

    def _check_rank_id(self, rank_id):
        if rank_id < 0:
            return common_pb.Status(
                    code=-2, error_message="invalid rank id"
                )
        return common_pb.Status(code=0)

    def start_fsm(self):
        self._fsm.start_fsm_worker()

    def stop_fsm(self):
        self._fsm.stop_fsm_worker()

class DataJoinMasterService(object):
    def __init__(self, listen_port, peer_addr, data_source_name,
                 kvstore_type, options):
        channel = make_insecure_channel(
                peer_addr, ChannelType.REMOTE,
                options=[('grpc.max_send_message_length', 2**31-1),
                         ('grpc.max_receive_message_length', 2**31-1)]
            )
        peer_client = dj_grpc.DataJoinMasterServiceStub(channel)
        self._data_source_name = data_source_name
        self._listen_port = listen_port
        self._server = grpc.server(
            futures.ThreadPoolExecutor(max_workers=10),
            options=[('grpc.max_send_message_length', 2**31-1),
                     ('grpc.max_receive_message_length', 2**31-1)])
        self._data_join_master = DataJoinMaster(
                peer_client, data_source_name, kvstore_type, options
            )
        dj_grpc.add_DataJoinMasterServiceServicer_to_server(
                self._data_join_master, self._server
            )
        self._server.add_insecure_port('[::]:%d'%listen_port)
        self._server_started = False

    def start(self):
        if not self._server_started:
            self._server.start()
            self._data_join_master.start_fsm()
            self._server_started = True
            logging.info("DataJoinMasterService for data_source: " \
                         "%s start on port[%d]", self._data_source_name,
                         self._listen_port)

    def stop(self):
        if self._server_started:
            self._data_join_master.stop_fsm()
            self._server.stop(None)
            self._server_started = False
            logging.info("DataJoinMasterService for data_source: %s "\
                         "stopped ", self._data_source_name)

    def run(self):
        self.start()
        self._server.wait_for_termination()
        self.stop()


text:
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'

describe "Array#pop" do
  it "removes and returns the last element of the array" do
    a = ["a", 1, nil, true]

    a.pop.should == true
    a.should == ["a", 1, nil]

    a.pop.should == nil
    a.should == ["a", 1]

    a.pop.should == 1
    a.should == ["a"]

    a.pop.should == "a"
    a.should == []
  end

  it "returns nil if there are no more elements" do
    [].pop.should == nil
  end

  it "properly handles recursive arrays" do
    empty = ArraySpecs.empty_recursive_array
    empty.pop.should == []

    array = ArraySpecs.recursive_array
    array.pop.should == [1, 'two', 3.0, array, array, array, array]
  end

  compliant_on :ruby, :jruby do
    it "raises a TypeError on a frozen array" do
      lambda { ArraySpecs.frozen_array.pop }.should raise_error(TypeError)
    end
  end
end


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Stapelia conformis N.E.Br.

### Remarks
null


text:
import { sayHello } from "./greet";
import Vue from 'vue'
import './sass/main.scss'

function showHello(divName: string, name: string) {
    const elt = document.getElementById(divName);
    elt.innerText = sayHello(name);
}

showHello("greeting", "UglifyDelayTypeScript2");

const worker = new Worker('dist/backend.js');
worker.postMessage("hello, worker 2");
worker.onmessage = function(e) {
    console.log('onmessage:', e.data);
};

interface MyComponent extends Vue {
    message: string
    onClick(): void
}

const myComponent = {
    //template: '<button @click="onClick">Click!</button>',
    data: function() {
        return {
            message: 'Hello!'
        }
    },
    methods: {
        onClick: function() {
            worker.postMessage("clicked!");
        }
    },

    render(createElement: Vue.CreateElement): Vue.VNode {
        return createElement(
            'button',
            {
                on: {
                    click: this.onClick
                }
            },
            'Click!');
    }
} as Vue.ComponentOptions<MyComponent>;

Vue.component('my-component', myComponent);

const app = new Vue({
    el: '#app'
});


text:
namespace memory {

        template< typename T >
        T* constructInPlace( T* const place ) {
            return new (place) T;
        }

        template< typename T >
        T* constructCopyInPlace( T* const place, const T& objectToCopy ) {
            return new (place) T( objectToCopy );
        }

        template< typename T >
        void destructInPlace( T* const place ) {
            place->~T();
        }

};


text:
'use strict';
require('../common');
const assert = require('assert');

const Timer = process.binding('timer_wrap').Timer;
const N = 30;

let last_i = 0;
let last_ts = 0;

function f(i) {
  if (i <= N) {
    // check order
    assert.strictEqual(i, last_i + 1, `order is broken: ${i} != ${last_i} + 1`);
    last_i = i;

    // check that this iteration is fired at least 1ms later than the previous
    const now = Timer.now();
    console.log(i, now);
    assert(now >= last_ts + 1,
           `current ts ${now} < prev ts ${last_ts} + 1`);
    last_ts = now;

    // schedule next iteration
    setTimeout(f, 1, i + 1);
  }
}
f(1);


text: """Tests for the blueprint init."""


text:
package io.fabric8.forge.rest;

import io.fabric8.forge.rest.dto.CommandInfoDTO;
import io.fabric8.forge.rest.dto.CommandInputDTO;
import io.fabric8.forge.rest.dto.ExecutionRequest;
import io.fabric8.forge.rest.dto.ExecutionResult;
import io.fabric8.forge.rest.dto.UICommands;
import io.fabric8.forge.rest.dto.ValidationResult;
import io.fabric8.forge.rest.dto.WizardResultsDTO;
import io.fabric8.forge.rest.hooks.CommandCompletePostProcessor;
import io.fabric8.forge.rest.main.GitUserHelper;
import io.fabric8.forge.rest.main.ProjectFileSystem;
import io.fabric8.forge.rest.main.UserDetails;
import io.fabric8.forge.rest.ui.RestUIContext;
import io.fabric8.forge.rest.ui.RestUIRuntime;
import io.fabric8.utils.Strings;
import org.jboss.forge.addon.convert.ConverterFactory;
import org.jboss.forge.addon.resource.Resource;
import org.jboss.forge.addon.resource.ResourceFactory;
import org.jboss.forge.addon.ui.command.CommandFactory;
import org.jboss.forge.addon.ui.command.UICommand;
import org.jboss.forge.addon.ui.controller.CommandController;
import org.jboss.forge.addon.ui.controller.CommandControllerFactory;
import org.jboss.forge.addon.ui.controller.WizardCommandController;
import org.jboss.forge.addon.ui.output.UIMessage;
import org.jboss.forge.addon.ui.result.Result;
import org.jboss.forge.furnace.Furnace;
import org.jboss.forge.furnace.addons.AddonRegistry;
import org.jboss.forge.furnace.services.Imported;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Path("/api/forge")
@Stateless
public class CommandsResource {
    private static final transient Logger LOG = LoggerFactory.getLogger(CommandsResource.class);

    @Inject
    private Furnace furnace;

    @Inject
    private CommandControllerFactory commandControllerFactory;

    @Inject
    private CommandFactory commandFactory;

    @Inject
    private CommandCompletePostProcessor commandCompletePostProcessor;

    @Inject
    private ProjectFileSystem projectFileSystem;

    @Inject
    private GitUserHelper gitUserHelper;

    @Context
    private HttpServletRequest request;

    private ConverterFactory converterFactory;

    @GET
    public String getInfo() {
        return furnace.getVersion().toString();
    }

    @GET
    @Path("/commandNames")
    @Produces(MediaType.APPLICATION_JSON)
    public List<String> getCommandNames() {
        List<String> answer = new ArrayList<>();
        try (RestUIContext context = new RestUIContext()) {
            for (String commandName : commandFactory.getCommandNames(context)) {
                answer.add(commandName);
            }
        }
        return answer;
    }

    @GET
    @Path("/commands")
    @Produces(MediaType.APPLICATION_JSON)
    public List<CommandInfoDTO> getCommands() {
        return getCommands(null);
    }

    @GET
    @Path("/commands/{path: .*}")
    @Produces(MediaType.APPLICATION_JSON)
    public List<CommandInfoDTO> getCommands(@PathParam("path") String resourcePath) {
        List<CommandInfoDTO> answer = new ArrayList<>();
        try (RestUIContext context = createUIContext(resourcePath)) {
            for (String name : commandFactory.getCommandNames(context)) {
                try {
                    CommandInfoDTO dto = createCommandInfoDTO(context, name);
                    if (dto != null && dto.isEnabled()) {
                        answer.add(dto);
                    }
                } catch (Exception e) {
                    LOG.warn("Ignored exception on command " + name + " probably due to missing project?: " + e, e);
                }
            }
        }
        return answer;
    }

    @GET
    @Path("/command/{name}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getCommandInfo(@PathParam("name") String name) {
        return getCommandInfo(name, null);
    }

    @GET
    @Path("/command/{name}/{path: .*}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getCommandInfo(@PathParam("name") String name, @PathParam("path") String resourcePath) {
        CommandInfoDTO answer = null;
        try (RestUIContext context = createUIContext(resourcePath)) {
            answer = createCommandInfoDTO(context, name);
        }
        if (answer != null) {
            return Response.ok(answer).build();
        } else {
            return Response.status(Status.NOT_FOUND).build();
        }
    }

    @GET
    @Path("/commandInput/{name}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getCommandInput(@PathParam("name") String name) throws Exception {
        return getCommandInput(name, null);
    }

    @GET
    @Path("/commandInput/{name}/{path: .*}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getCommandInput(@PathParam("name") String name, @PathParam("path") String resourcePath) throws Exception {
        try {
            CommandInputDTO answer = null;
            try (RestUIContext context = createUIContext(resourcePath)) {
                UICommand command = getCommandByName(context, name);
                if (command != null) {
                    CommandController controller = createController(context, command);
                    answer = UICommands.createCommandInputDTO(context, command, controller);
                }
                if (answer != null) {
                    return Response.ok(answer).build();
                } else {
                    return Response.status(Status.NOT_FOUND).build();
                }
            }
        } catch (Throwable e) {
            LOG.warn("Failed to find input for command " + name + ". " + e, e);
            throw e;
        }
    }

    @POST
    @Path("/command/execute/{name}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response executeCommand(@PathParam("name") String name, ExecutionRequest executionRequest) throws Exception {
        try {
            UserDetails userDetails = null;
            if (commandCompletePostProcessor != null) {
                userDetails = commandCompletePostProcessor.preprocessRequest(name, executionRequest, request);
            }
            String resourcePath = executionRequest.getResource();
            try (RestUIContext context = createUIContext(resourcePath)) {
                UICommand command = getCommandByName(context, name);
                if (command == null) {
                    return Response.status(Status.NOT_FOUND).build();
                }
                List<Map<String, String>> inputList = executionRequest.getInputList();
                CommandController controller = createController(context, command);
                configureAttributeMaps(userDetails, controller);
                ExecutionResult answer = null;
                if (controller instanceof WizardCommandController) {
                    WizardCommandController wizardCommandController = (WizardCommandController) controller;
                    List<WizardCommandController> controllers = new ArrayList<>();
                    List<CommandInputDTO> stepPropertiesList = new ArrayList<>();
                    List<ExecutionResult> stepResultList = new ArrayList<>();
                    List<ValidationResult> stepValidationList = new ArrayList<>();
                    controllers.add(wizardCommandController);
                    WizardCommandController lastController = wizardCommandController;
                    Result lastResult = null;
                    int page = executionRequest.wizardStep();
                    int nextPage = page + 1;
                    boolean canMoveToNextStep = false;
                    for (Map<String, String> inputs : inputList) {
                        UICommands.populateController(inputs, lastController, getConverterFactory());
                        List<UIMessage> messages = lastController.validate();
                        ValidationResult stepValidation = UICommands.createValidationResult(context, lastController, messages);
                        stepValidationList.add(stepValidation);
                        if (!stepValidation.isValid()) {
                            break;
                        }
                        canMoveToNextStep = lastController.canMoveToNextStep();
                        boolean valid = lastController.isValid();
                        if (!canMoveToNextStep) {
                            // lets assume we can execute now
                            lastResult = lastController.execute();
                            LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                            ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
                            stepResultList.add(stepResults);
                            break;
                        } else if (!valid) {
                            LOG.warn("Cannot move to next step as invalid despite the validation saying otherwise");
                            break;
                        }
                        WizardCommandController nextController = lastController.next();
                        if (nextController != null) {
                            if (nextController == lastController) {
                                LOG.warn("No idea whats going on ;)");
                                break;
                            }
                            lastController = nextController;
                            lastController.initialize();
                            controllers.add(lastController);
                            CommandInputDTO stepDto = UICommands.createCommandInputDTO(context, command, lastController);
                            stepPropertiesList.add(stepDto);
                        } else {
                            int i = 0;
                            for (WizardCommandController stepController : controllers) {
                                Map<String, String> stepControllerInputs = inputList.get(i++);
                                UICommands.populateController(stepControllerInputs, stepController, getConverterFactory());
                                lastResult = stepController.execute();
                                LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                                ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
                                stepResultList.add(stepResults);
                            }
                            break;
                        }
                    }
                    answer = UICommands.createExecutionResult(context, lastResult, canMoveToNextStep);
                    WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepValidationList, stepResultList);
                    answer.setWizardResults(wizardResultsDTO);
                } else {
                    Map<String, String> inputs = inputList.get(0);
                    UICommands.populateController(inputs, controller, getConverterFactory());
                    Result result = controller.execute();
                    LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + result);
                    answer = UICommands.createExecutionResult(context, result, false);
                }
                if (answer.isCommandCompleted() && commandCompletePostProcessor != null) {
                    commandCompletePostProcessor.firePostCompleteActions(name, executionRequest, context, controller, answer, request);
                }
                return Response.ok(answer).build();
            }
        } catch (Throwable e) {
            LOG.warn("Failed to invoke command " + name + " on " + executionRequest + ". " + e, e);
            throw e;
        }
    }

    protected void configureAttributeMaps(UserDetails userDetails, CommandController controller) {
        Map<Object, Object> attributeMap = controller.getContext().getAttributeMap();
        if (userDetails != null) {
            attributeMap.put("gitUser", userDetails.getUser());
            attributeMap.put("gitPassword", userDetails.getPassword());
            attributeMap.put("gitAuthorEmail", userDetails.getEmail());
            attributeMap.put("gitAddress", userDetails.getAddress());
            attributeMap.put("gitBranch", userDetails.getBranch());
            attributeMap.put("jenkinsWorkflowFolder", projectFileSystem.getJenkinsWorkflowFolder());
            projectFileSystem.asyncCloneOrPullJenkinsWorkflows(userDetails);
        }
    }

    @POST
    @Path("/command/validate/{name}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response validateCommand(@PathParam("name") String name, ExecutionRequest executionRequest) throws Exception {
        try {
            UserDetails userDetails = null;
            if (commandCompletePostProcessor != null) {
                userDetails = commandCompletePostProcessor.preprocessRequest(name, executionRequest, request);
            }
            String resourcePath = executionRequest.getResource();
            try (RestUIContext context = createUIContext(resourcePath)) {
                UICommand command = getCommandByName(context, name);
                if (command == null) {
                    return Response.status(Status.NOT_FOUND).build();
                }
                List<Map<String, String>> inputList = executionRequest.getInputList();
                CommandController controller = createController(context, command);
                configureAttributeMaps(userDetails, controller);
                ValidationResult answer = null;
                if (controller instanceof WizardCommandController) {
                    WizardCommandController wizardCommandController = (WizardCommandController) controller;
                    List<WizardCommandController> controllers = new ArrayList<>();
                    List<CommandInputDTO> stepPropertiesList = new ArrayList<>();
                    List<ValidationResult> stepResultList = new ArrayList<>();
                    List<ValidationResult> stepValidationList = new ArrayList<>();
                    controllers.add(wizardCommandController);
                    WizardCommandController lastController = wizardCommandController;
                    List<UIMessage> lastResult = null;
                    int page = executionRequest.wizardStep();
                    int nextPage = page + 1;
                    boolean canMoveToNextStep = false;
                    for (Map<String, String> inputs : inputList) {
                        UICommands.populateController(inputs, lastController, getConverterFactory());
                        CommandInputDTO stepDto = UICommands.createCommandInputDTO(context, command, lastController);
                        stepPropertiesList.add(stepDto);
                        canMoveToNextStep = lastController.canMoveToNextStep();
                        boolean valid = lastController.isValid();
                        if (!canMoveToNextStep) {
                            // lets assume we can execute now
                            lastResult = lastController.validate();
                            LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                            ValidationResult stepResults = UICommands.createValidationResult(context, controller, lastResult);
                            stepResultList.add(stepResults);
                            break;
                        } else if (!valid) {
                            LOG.warn("Cannot move to next step as invalid despite the validation saying otherwise");
                            break;
                        }
                        WizardCommandController nextController = lastController.next();
                        if (nextController != null) {
                            if (nextController == lastController) {
                                LOG.warn("No idea whats going on ;)");
                                break;
                            }
                            lastController = nextController;
                            lastController.initialize();
                            controllers.add(lastController);
                        } else {
                            int i = 0;
                            for (WizardCommandController stepController : controllers) {
                                Map<String, String> stepControllerInputs = inputList.get(i++);
                                UICommands.populateController(stepControllerInputs, stepController, getConverterFactory());
                                lastResult = stepController.validate();
                                LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
                                ValidationResult stepResults = UICommands.createValidationResult(context, controller, lastResult);
                                stepResultList.add(stepResults);
                            }
                            break;
                        }
                    }
                    answer = UICommands.createValidationResult(context, controller, lastResult);
                    // TODO do we need stepValidationList?
                    //WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepValidationList, stepResultList);
                    WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepResultList, new ArrayList<ExecutionResult>());
                    answer.setWizardResults(wizardResultsDTO);
                } else {
                    Map<String, String> inputs = inputList.get(0);
                    UICommands.populateController(inputs, controller, getConverterFactory());
                    List<UIMessage> result = controller.validate();
                    LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + result);
                    answer = UICommands.createValidationResult(context, controller, result);
                }
                return Response.ok(answer).build();
            }
        } catch (Throwable e) {
            LOG.warn("Failed to invoke command " + name + " on " + executionRequest + ". " + e, e);
            throw e;
        }
    }

    protected CommandInfoDTO createCommandInfoDTO(RestUIContext context, String name) {
        UICommand command = getCommandByName(context, name);
        CommandInfoDTO answer = null;
        if (command != null) {
            answer = UICommands.createCommandInfoDTO(context, command);
        }
        return answer;
    }

    protected UICommand getCommandByName(RestUIContext context, String name) {
        return commandFactory.getCommandByName(context, name);
    }

    protected CommandController createController(RestUIContext context, UICommand command) throws Exception {
        RestUIRuntime runtime = new RestUIRuntime();
        CommandController controller = commandControllerFactory.createController(context, runtime,
                command);
        controller.initialize();
        return controller;
    }

    protected RestUIContext createUIContext(String resourcePath) {
        AddonRegistry addonRegistry = furnace.getAddonRegistry();
        Imported<ResourceFactory> resourceFactoryImport = addonRegistry.getServices(ResourceFactory.class);
        ResourceFactory resourceFactory = null;
        try {
            resourceFactory = resourceFactoryImport.get();
        } catch (Exception e) {
            LOG.warn("Failed to get ResourceFactory injected: " + e, e);
        }
        if (resourceFactory == null) {
            // lets try one more time - might work this time?
            resourceFactory = resourceFactoryImport.get();
        }
        Resource<?> selection = null;
        if (Strings.isNotBlank(resourcePath) && resourceFactory != null) {
            // lets split out user repositories
            String path = Strings.stripPrefix(resourcePath, "/");
            String userFolder = "user/";
            if (path.startsWith(userFolder)) {
                path = Strings.stripPrefix(path, userFolder);
                String[] userAndPath = path.split("/", 2);
                if (userAndPath.length < 2) {
                    LOG.warn("Could not extract user name and path from resource: " + resourcePath);
                } else {
                    String userId = userAndPath[0];
                    String repositoryName = userAndPath[1];

                    UserDetails userDetails = gitUserHelper.createUserDetails(request);

                    File file = projectFileSystem.cloneOrPullProjectFolder(userId, repositoryName, userDetails);
                    selection = resourceFactory.create(file);
                    LOG.info("Completed pulling source code");
                }
            } else {
                LOG.warn("Unknown path of the form user/{userId}/{repositoryName}");
                throw new RuntimeException("Expected path of the form user/{userId}/{repositoryName} but got: " + path);
            }
        }
        return new RestUIContext(selection);
    }

    public ConverterFactory getConverterFactory() {
        if (converterFactory == null) {
            AddonRegistry addonRegistry = furnace.getAddonRegistry();
            Imported<ConverterFactory> converterFactoryImport = addonRegistry.getServices(ConverterFactory.class);
            converterFactory = converterFactoryImport.get();
        }
        return converterFactory;
    }

    public void setConverterFactory(ConverterFactory converterFactory) {
        this.converterFactory = converterFactory;
    }
}


text:
parent_course: PMT
lesson_id: PMT-100
permalink: /courses/practical-music-theory/the-twelve-musical-notes
title: The 12 Musical Notes, Explained
description: An overview of the 12 notes in Western music. These are the building blocks of everything!
duration: "8:32"
video_id:
patreon_url:
---


text:
<?xml version="1.0"?>
<QuestsDefinitions
     level="slums"
     pxsl_line="3">
    <!-- IT'S AN OMEN -->
    <!-- quest ItsAnOmen -parent=Q_Explosives05 -difficulty=medium -quest_giver=Ahd -reward_set=ItsAnOmen_reward -->
        <!-- ,show _ QuestStartTrigger sq_itsanomen_StartObject -->
        <!-- ,show _ HumanAI Abed -->
        <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_001 -->
        <!--  -->
        <!-- ,take <<It's An Omen - START>> QuestStartTrigger sq_itsanomen_StartObject -show=false -->
            <!-- ,debugpos SpawnPoint ItsAnOmen_SP_001 -->
            <!--  -->
        <!-- -= enabling chatter once zone Abed     -->
        <!-- ,enable _ ChatterOnceZone ItsAnOmen_ONC_zone_Abed_talk -->
        <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_001 -->
        <!--  -->
    <!-- quest ItsAnOmen02 -parent=ItsAnOmen -glued=true -->
        <!-- ,BLOCK _ -obj=&ItsAnOmen_OBJ_FindWitch& -->
            <!-- ,OR <<It's An Omen - Fisherman's Village>> -->
                <!-- ,debugpos SpawnPoint ItsAnOmen_SP_001 -->
                <!--  -->
                <!-- path -->
                    <!-- -= Conversation with Ahd (Fisherman's village) -->
                    <!-- ,set-lp << forbiden converation life places turend off >>   NPCLifePlace Ahd_LP_Raking  -state=off -->
                    <!-- ,goto _ HumanAI Ahd -distance=4 -show=false -->
                    <!-- ,talk _ Ahd Ahd_Omen_01DLG01 -auto=true -show=false -questgiver_indicator=true -->
                    <!-- ,set-lp << forbiden converation life places turend off >>   NPCLifePlace Ahd_LP_Raking  -state=on -->
                    <!-- ,semaphore _ -->
                <!-- path -->
                    <!-- -= Marker Bazzar -->
                    <!-- ,goto _ HumanAI Abed -distance=6 -show=false -->
                        <!-- ,area ZoneBox Slums_Zone_TheBazaar_A -->
            <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_Bazzar_001 -->
            <!--  -->
            <!-- ,talk <<It's An Omen - Bazzar>> Abed Abed_Omen_USE -questgiver_indicator=true -->
                <!-- ,debugpos SpawnPoint ItsAnOmen_SP_Bazzar_001 -->
            <!-- ,disable _ ChatterOnceZone ItsAnOmen_ONC_zone_Abed_talk -->
            <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_Bazzar_001 -->
            <!--  -->
        <!-- ,BLOCK _ -obj=&ItAnOmen_OBJ_TalkDahlia& -->
            <!-- ,cnd-quest-started _ -quest_name=Witchqueen01 -finished=true -show=false -->
        <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_Bazzar_001 -->
    <!--  -->
        <!-- ,BLOCK _ -obj=&ItsAnOmen_OBJ_GetTalisman& -->
            <!-- ,talk <<It's An Omen - Get the Talisman>> Abed Abed_Omen_02DLG01 -->
                <!-- ,debugpos SpawnPoint ItsAnOmen_SP_Bazzar_001  -->
            <!-- ,take _ QuestInventoryItemDI ItsAnOmen_QII_Amulet -->
            <!-- ,hide _ ModelObject ItsAnOmen_Chain -->
        <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_Bazzar_001 -->
            <!--  -->
    <!-- quest ItsAnOmen03 -parent=ItsAnOmen02 -glued=true    -->
        <!-- ,BLOCK _ -obj=&ItsAnOmen_OBJ_BackToElderAhd& -->
            <!-- ,set-lp <<forbiden converation life places turend off>>   NPCLifePlace Ahd_LP_Raking  -state=off -->
            <!-- ,talk <<It's An Omen - END>> Ahd Ahd_Omen_END -->
                <!-- ,debugpos SpawnPoint ItsAnOmen_SP_001 -->
            <!-- ,set-lp <<forbiden converation life places turend on>>   NPCLifePlace Ahd_LP_Raking  -state=on     -->
            <!-- ,reward _ Ahd -->
            <!--  -->
            <!-- -= Enabling Life Graph -->
            <!-- ,enable _ NPCLifeGraph ItsAnOmen_LifeGraph_Abed_01 -->
        <!-- ,checkpoint _ SpawnPoint ItsAnOmen_SP_001 -->
</QuestsDefinitions>


text:
package com.stuffwithstuff.magpie.ast.pattern;

public interface PatternVisitor<R, C> {
  R visit(RecordPattern pattern, C context);
  R visit(TypePattern pattern, C context);
  R visit(ValuePattern pattern, C context);
  R visit(VariablePattern pattern, C context);
  R visit(WildcardPattern pattern, C context);
}


text:
"""The two-step game from QMIX: https://arxiv.org/pdf/1803.11485.pdf

Configurations you can try:
    - normal policy gradients (PG)
    - contrib/MADDPG
    - QMIX

See also: centralized_critic.py for centralized critic PPO on this game.
"""

import argparse
from gym.spaces import Tuple, MultiDiscrete, Dict, Discrete
import os

import ray
from ray import tune
from ray.tune import register_env, grid_search
from ray.rllib.env.multi_agent_env import ENV_STATE
from ray.rllib.examples.env.two_step_game import TwoStepGame
from ray.rllib.utils.test_utils import check_learning_achieved

parser = argparse.ArgumentParser()
parser.add_argument(
    "--run",
    type=str,
    default="PG",
    help="The RLlib-registered algorithm to use.")
parser.add_argument(
    "--framework",
    choices=["tf", "tf2", "tfe", "torch"],
    default="tf",
    help="The DL framework specifier.")
parser.add_argument("--num-cpus", type=int, default=0)
parser.add_argument(
    "--as-test",
    action="store_true",
    help="Whether this script should be run as a test: --stop-reward must "
    "be achieved within --stop-timesteps AND --stop-iters.")
parser.add_argument(
    "--stop-iters",
    type=int,
    default=200,
    help="Number of iterations to train.")
parser.add_argument(
    "--stop-timesteps",
    type=int,
    default=50000,
    help="Number of timesteps to train.")
parser.add_argument(
    "--stop-reward",
    type=float,
    default=7.0,
    help="Reward at which we stop training.")

if __name__ == "__main__":
    args = parser.parse_args()

    ray.init(num_cpus=args.num_cpus or None)

    grouping = {
        "group_1": [0, 1],
    }
    obs_space = Tuple([
        Dict({
            "obs": MultiDiscrete([2, 2, 2, 3]),
            ENV_STATE: MultiDiscrete([2, 2, 2])
        }),
        Dict({
            "obs": MultiDiscrete([2, 2, 2, 3]),
            ENV_STATE: MultiDiscrete([2, 2, 2])
        }),
    ])
    act_space = Tuple([
        TwoStepGame.action_space,
        TwoStepGame.action_space,
    ])
    register_env(
        "grouped_twostep",
        lambda config: TwoStepGame(config).with_agent_groups(
            grouping, obs_space=obs_space, act_space=act_space))

    if args.run == "contrib/MADDPG":
        obs_space_dict = {
            "agent_1": Discrete(6),
            "agent_2": Discrete(6),
        }
        act_space_dict = {
            "agent_1": TwoStepGame.action_space,
            "agent_2": TwoStepGame.action_space,
        }
        config = {
            "learning_starts": 100,
            "env_config": {
                "actions_are_logits": True,
            },
            "multiagent": {
                "policies": {
                    "pol1": (None, Discrete(6), TwoStepGame.action_space, {
                        "agent_id": 0,
                    }),
                    "pol2": (None, Discrete(6), TwoStepGame.action_space, {
                        "agent_id": 1,
                    }),
                },
                "policy_mapping_fn": (
                    lambda aid, **kwargs: "pol2" if aid else "pol1"),
            },
            "framework": args.framework,
            # Use GPUs iff `RLLIB_NUM_GPUS` env var set to > 0.
            "num_gpus": int(os.environ.get("RLLIB_NUM_GPUS", "0")),
        }
        group = False
    elif args.run == "QMIX":
        config = {
            "rollout_fragment_length": 4,
            "train_batch_size": 32,
            "exploration_config": {
                "epsilon_timesteps": 5000,
                "final_epsilon": 0.05,
            },
            "num_workers": 0,
            "mixer": grid_search([None, "qmix"]),
            "env_config": {
                "separate_state_space": True,
                "one_hot_state_encoding": True
            },
            # Use GPUs iff `RLLIB_NUM_GPUS` env var set to > 0.
            "num_gpus": int(os.environ.get("RLLIB_NUM_GPUS", "0")),
        }
        group = True
    else:
        config = {
            # Use GPUs iff `RLLIB_NUM_GPUS` env var set to > 0.
            "num_gpus": int(os.environ.get("RLLIB_NUM_GPUS", "0")),
            "framework": args.framework,
        }
        group = False

    stop = {
        "episode_reward_mean": args.stop_reward,
        "timesteps_total": args.stop_timesteps,
        "training_iteration": args.stop_iters,
    }

    config = dict(config, **{
        "env": "grouped_twostep" if group else TwoStepGame,
    })

    if args.as_test:
        config["seed"] = 1234

    results = tune.run(args.run, stop=stop, config=config, verbose=2)

    if args.as_test:
        check_learning_achieved(results, args.stop_reward)

    ray.shutdown()