Created
March 17, 2015 21:55
-
-
Save ivanguy/52fb2227a50d2b60b969 to your computer and use it in GitHub Desktop.
Revisions
-
ivanguy created this gist
Mar 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ 3 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <module type="PYTHON_MODULE" version="4"> <component name="NewModuleRootManager"> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> </component> </module> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ <component name="ProjectDictionaryState"> <dictionary name="ivan"> <words> <w>vivod</w> <w>vvod</w> </words> </dictionary> </component> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> </project> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.4.2 (/usr/bin/python3.4)" project-jdk-type="Python SDK" /> </project> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/.idea/3.iml" filepath="$PROJECT_DIR$/.idea/3.iml" /> </modules> </component> </project> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ <component name="DependencyValidationManager"> <state> <option name="SKIP_IMPORT_STATEMENTS" value="false" /> </state> </component> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="" vcs="" /> </component> </project> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,586 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> <list default="true" id="5497e39c-5b14-4cef-bca9-2142c41640d2" name="Default" comment="" /> <ignored path="3.iws" /> <ignored path=".idea/workspace.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="DaemonCodeAnalyzer"> <disable_hints /> </component> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> <component name="FavoritesManager"> <favorites_list name="3" /> </component> <component name="FileEditorManager"> <leaf> <file leaf-file-name="Agent1.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="148" max-vertical-offset="1080"> <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" /> <folding> <element signature="e#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> </file> <file leaf-file-name="starter.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/starter.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="36" max-vertical-offset="216"> <caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" /> <folding /> </state> </provider> </entry> </file> <file leaf-file-name="posix.py" pinned="false" current-in-tab="true"> <entry file="file://$USER_HOME$/.PyCharm40/system/python_stubs/-1247971765/posix.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.33261803" vertical-offset="6386" max-vertical-offset="41544"> <caret line="372" column="4" selection-start-line="372" selection-start-column="4" selection-end-line="372" selection-end-column="4" /> <folding /> </state> </provider> </entry> </file> <file leaf-file-name="os.py" pinned="false" current-in-tab="false"> <entry file="file:///usr/lib/python3.4/os.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="17730"> <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> </file> <file leaf-file-name="Agent2.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="1368"> <caret line="1" column="11" selection-start-line="1" selection-start-column="11" selection-end-line="1" selection-end-column="11" /> <folding /> </state> </provider> </entry> </file> </leaf> </component> <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> <option value="$PROJECT_DIR$/kod.py" /> <option value="$PROJECT_DIR$/src/classified menus.py" /> <option value="$PROJECT_DIR$/classified_menus.py" /> <option value="$PROJECT_DIR$/Agent2.py" /> <option value="$PROJECT_DIR$/Agent1.py" /> <option value="$PROJECT_DIR$/starter.py" /> </list> </option> </component> <component name="ProjectFrameBounds"> <option name="y" value="24" /> <option name="width" value="1920" /> <option name="height" value="1056" /> </component> <component name="ProjectLevelVcsManager" settingsEditedManually="false"> <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="ProjectView"> <navigator currentView="ProjectPane" proportions="" version="1"> <flattenPackages /> <showMembers /> <showModules /> <showLibraryContents /> <hideEmptyPackages /> <abbreviatePackageNames /> <autoscrollToSource /> <autoscrollFromSource /> <sortByType /> </navigator> <panes> <pane id="Scope" /> <pane id="ProjectPane"> <subPane> <PATH> <PATH_ELEMENT> <option name="myItemId" value="3" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> </PATH_ELEMENT> <PATH_ELEMENT> <option name="myItemId" value="External Libraries" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" /> </PATH_ELEMENT> </PATH> <PATH> <PATH_ELEMENT> <option name="myItemId" value="3" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> </PATH_ELEMENT> <PATH_ELEMENT> <option name="myItemId" value="3" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> </PATH_ELEMENT> </PATH> </subPane> </pane> </panes> </component> <component name="PropertiesComponent"> <property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="recentsLimit" value="5" /> </component> <component name="RecentsManager"> <key name="CopyFile.RECENT_KEYS"> <recent name="$PROJECT_DIR$/src" /> <recent name="$PROJECT_DIR$" /> </key> <key name="MoveFile.RECENT_KEYS"> <recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$/src" /> </key> </component> <component name="RunManager" selected="Python.Agent1"> <configuration default="false" name="Agent1" type="PythonConfigurationType" factoryName="Python" temporary="true"> <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="$PROJECT_DIR$" /> <option name="IS_MODULE_SDK" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <module name="3" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/Agent1.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <RunnerSettings RunnerId="PythonRunner" /> <ConfigurationWrapper RunnerId="PythonRunner" /> <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="3" /> <option name="SCRIPT_NAME" value="" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" 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="3" /> <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="3" /> <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> <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="3" /> <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="3" /> <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="3" /> <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> <list size="1"> <item index="0" class="java.lang.String" itemvalue="Python.Agent1" /> </list> <recent_temporary> <list size="1"> <item index="0" class="java.lang.String" itemvalue="Python.Agent1" /> </list> </recent_temporary> </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="5497e39c-5b14-4cef-bca9-2142c41640d2" name="Default" comment="" /> <created>1426133493653</created> <option name="number" value="Default" /> <updated>1426133493653</updated> </task> <servers /> </component> <component name="ToolWindowManager"> <frame x="0" y="24" width="1920" height="1056" extended-state="6" /> <editor active="false" /> <layout> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24986821" 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" weight="0.33" sideWeight="0.5" order="6" 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" weight="0.33" sideWeight="0.5" order="12" side_tool="true" content_ui="tabs" /> <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" 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" weight="0.33" sideWeight="0.5" order="9" 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" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" 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" weight="0.33" 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" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" 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" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3290461" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" 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" weight="0.3290461" sideWeight="0.5" order="1" 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" 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" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> </layout> </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"> <option name="myTodoPanelSettings"> <TodoPanelSettings /> </option> </component> <component name="XDebuggerManager"> <breakpoint-manager> <option name="time" value="1" /> </breakpoint-manager> <watches-manager /> </component> <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="148" max-vertical-offset="1080"> <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" /> <folding> <element signature="e#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/starter.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="36" max-vertical-offset="216"> <caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" /> <folding /> </state> </provider> </entry> <entry file="file://$USER_HOME$/.PyCharm40/system/python_stubs/-1247971765/posix.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="41544"> <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:///usr/lib/python3.4/os.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="17730"> <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$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="1368"> <caret line="1" column="11" selection-start-line="1" selection-start-column="11" selection-end-line="1" selection-end-column="11" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="148" max-vertical-offset="1080"> <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" /> <folding> <element signature="e#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/starter.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="100"> <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://$USER_HOME$/.PyCharm40/system/python_stubs/-1247971765/posix.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="6386" max-vertical-offset="41544"> <caret line="372" column="4" selection-start-line="372" selection-start-column="4" selection-end-line="372" selection-end-column="4" /> <folding /> </state> </provider> </entry> <entry file="file:///usr/lib/python3.4/os.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="17730"> <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$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="1368"> <caret line="1" column="11" selection-start-line="1" selection-start-column="11" selection-end-line="1" selection-end-column="11" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="100"> <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#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="126"> <caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/classified_menus.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="2304"> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/kod.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="7578"> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="100"> <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#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="126"> <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$/../2/kod.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="7578"> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="415" selection-end-column="15" /> </state> </provider> </entry> <entry file="file://$APPLICATION_HOME_DIR$/helpers/python-skeletons/io.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="9392" max-vertical-offset="11250"> <caret line="541" column="8" selection-start-line="541" selection-start-column="8" selection-end-line="541" selection-end-column="8" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/kod.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="7578"> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$USER_HOME$/.PyCharm40/system/python_stubs/-1247971765/builtins.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="62470" max-vertical-offset="102474"> <caret line="3487" column="6" selection-start-line="3487" selection-start-column="6" selection-end-line="3487" selection-end-column="6" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/classified_menus.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.41860464" vertical-offset="540" max-vertical-offset="2304"> <caret line="51" column="18" selection-start-line="51" selection-start-column="18" selection-end-line="51" selection-end-column="18" /> </state> </provider> </entry> <entry file="file:///usr/lib/python3.4/os.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="17730"> <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$/Agent2.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1368"> <caret line="1" column="11" selection-start-line="1" selection-start-column="11" selection-end-line="1" selection-end-column="11" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/Agent1.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1080"> <caret line="50" column="0" selection-start-line="50" selection-start-column="0" selection-end-line="50" selection-end-column="0" /> <folding> <element signature="e#21#54#0" expanded="true" /> </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/starter.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="216"> <caret line="2" column="6" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="6" /> <folding /> </state> </provider> </entry> <entry file="file://$USER_HOME$/.PyCharm40/system/python_stubs/-1247971765/posix.py"> <provider selected="true" editor-type-id="text-editor"> <state vertical-scroll-proportion="0.33261803" vertical-offset="6386" max-vertical-offset="41544"> <caret line="372" column="4" selection-start-line="372" selection-start-column="4" selection-end-line="372" selection-end-column="4" /> <folding /> </state> </provider> </entry> </component> </project> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 1;���������;������ �����������;14.07.1996 2;���������;�������� �������������;12.04.1996 3;������;������ �������;18.02.1996 4;���������;���� ��������;28.02.1996 5;������;������ ����������;20.12.1996 6;������;������ �������������;13.07.1996 7;������;���� ��������;30.11.1996 8;��������;����� ����������;30.01.1996 9;������;������ �������������;25.11.1995 10;������;������ ��������;16.11.1996 11;�������;������ ������������;18.12.1995 12;������;������� �������������;04.04.1995 13;�������;������� �������������;21.07.1996 14;�����������;��������� ���������;13.11.1996 15;�������;����� ��������; 12.12.1995 16;������;������� ���������;08.10.1996 17;�������;������ �����������;06.06.1995 18;������;����� �������������;17.01.1996 19;��������;������ ����������;06.07.1996 20;����������;����� ����������;05.08.1996 21;������������;���� ���������;11.02.1995 22;������;������� ����������;06.04.1995 23;�������;������ ������������� 09.05.1996 24;���������;������� ��������;26.04.1997 25;��������;����� �������;08.03.1997 26;������;��������� ����������;23.01.1997 27;������;������� ����������;05.05.1995 28;�������;���� ���������;31.01.1996 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ __author__ = 'elena' from kod import trpAddStr, trpGet import time names = ['FAM', 'NAME', 'OT'] def type_value(value): try: int(value) return 0 except ValueError: return 1 def vvod(): temp_string = '' global pref, names pref = 'BUFFER' name = input('Имя триплета(name, fam, ot):') name = name.capitalize() value = input('Значение:') code, temp_string = trpAddStr(temp_string, pref, name, value, type_value(value)) for name in names: if trpGet(temp_string, pref, name)[0] == -1: code, temp_string = trpAddStr(temp_string, pref, name, ':', type_value(value), 'запрос') with open('buffer.txt', 'w') as file: file.write(temp_string) def check(): """check if calls answered""" waiting = True while waiting: waiting = False time.sleep(2) with open('buffer.txt', 'r') as file: line = file.readline() for name in names: if trpGet(line, pref, name)[1] == ':': waiting = True def vivod(): with open('buffer.txt', 'r') as file: line = file.readline() for name in names: print('{}={} '.format(name, trpGet(line, pref, name)),) while True: vvod() check() vivod() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ __author__ = 'ivan' import time from kod import trpGet, trpGetPrefix, trpSplit, trpAddStr from Agent1 import names def line_to_list(line): temp_list = [] for chunk in line.split(';'): for item in chunk.split(): temp_list.append(item) return temp_list def get_prefix(): with open('buffer.txt', 'r') as file: temp_string = file.readline() global pref pref = trpGetPrefix(trpSplit(temp_string)[0]) return trpGetPrefix(trpSplit(temp_string)[0]) def wait_for_calls(): """ check if calls need to be answered :return: known value of a call """ waiting = True while waiting: time.sleep(1) with open('buffer.txt', 'r') as file: line = file.readline() global name for name in names: try: if trpGet(line, pref, name)[1] == ':': waiting = False value = trpGet(line, pref, name)[1] return value except IndexError: continue def find_line_in_baze(_value): """ :param _value: str to look for :return: list of items in line with this value """ with open('1652.txt', 'r') as baze: for line in baze.readlines(): if _value in line_to_list(line): return line_to_list(line) def update_buffer(_list): """overwrite buffer.txt with triplets""" with open('buffer.txt', 'w') as buffer: temp_string = '' for x in range(len(names)): temp_string = trpAddStr(temp_string, pref, names[x-1], _list[x]) buffer.write(temp_string) while True: pref = get_prefix() value = wait_for_calls() time.sleep(1) params = find_line_in_baze(value) update_buffer(params) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ $BUFFER.OT=':'"запрос";$BUFFER.NAME=':'"запрос";$BUFFER.FAM=':'"запрос";$BUFFER.Иван=''; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,123 @@ __author__ = 'ivan' # todo Вывести строки-триплеты в строке+значение триплета from kod import * strings = [''] class Menu(): def __init__(self, name, nadmenu=None, function=None): """ :param name: printable name :param nadmenu: в какое меню добавить себя :param function: action of this item : print trpStrings or add trp """ self.items = [] self.name = name if nadmenu is not None: nadmenu.items.append(self) if function is not None: self.foo = function else: self.foo = None def print_items(self): """Отрисовка пунктов меню""" for item in self.items: print(self.items.index(item), '-', item.name) def add_item(self, menu): """сохраняет подпункт при его добавлении""" self.items.append(menu) def act(self): """Осовной способ вызова объекта как функции""" print(self.name.center(45, '-')) if self.foo is not None: self.foo() self.print_items() if len(self.items) > 0: self.items[int(input())].act() def print_strings(): """Вывести все триплексные строки""" for string in strings: print(strings.index(string), string, sep='-') def type_value(value): try: int(value) return 0 except ValueError: return 1 def adding(): """Добавление триплета в существующую/новую триплексную строку""" print_strings() number = int(input('Номер строки в которую добавить триплет:')) if number > len(strings) - 1: strings.append('') number = len(strings) - 1 prefix = input('Префикс:') name = input('Имя триплета:') value = input('Значение триплета:') rem = input('Комментарий к добавляемому триплету:') code, temp_string = trpAddStr(strings[number], prefix, name, value, type_value(value), rem) # code 0 - good, 1 - wrong strings[number] = temp_string # todo print('Триплет %s добавлен в строку %s') % prefix+trpPoint+name+trpEqual+value, str(number) def del_string(): """Удаление триплексой строки""" print_strings() number = int(input('Номер строки для удаления:')) if len(strings) > 1: del strings[number] def del_trp_pref(): """Удаление триплета по префиксу""" print_strings() trpDelPref(int(input('Номер строки содержащей триплет:')), input('Префикс:')) def del_trp_name(): """Удаление триплета по префиксу и имени""" print_strings() trpDel(int(input('Номер строки содержащей триплет:')), input('Префикс:'), input('Имя:')) def merge_strings(): """Объединение двух строк + удаление добавленной строки""" print_strings() string_main = strings[int(input('Номер основной триплексной строки:'))] string_adding = strings[int(input('Номер добавляемой триплексной строки:'))] code, strings[strings.index(string_main)] = trpMergeStr(string_main, string_adding) del strings[strings.index(string_adding)] if __name__ == '__main__': menu_glavnoe = Menu('Главное меню') glavnoe_printing = Menu('Показать триплексые строки', menu_glavnoe, print_strings) glavnoe_adding = Menu('Добавить триплет', menu_glavnoe, adding) glavnoe_delete = Menu('Удалить строку/триплет', menu_glavnoe) glavnoe_merge = Menu('Объединить две триплексые строки', menu_glavnoe, merge_strings) glavnoe_exit = Menu('Выход', menu_glavnoe, exit) delete_triplet = Menu('Удалить триплет', glavnoe_delete) delete_string = Menu('Удалить строку', glavnoe_delete, del_string) triplet_pr = Menu('Удалить триплет по префиксу', delete_triplet, del_trp_pref) triplet_pr_name = Menu('Удалить триплет по префиксу и имени', delete_triplet, del_trp_name) while True: menu_glavnoe.act() # todo все объекты - __main__.Menu, с этим надо чтото сделать This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,416 @@ # Зарезервированные символы ВСПТД: trpBeg = '$' # Начало триплета. trpEnd = ';' # Конец триплета. trpAps = '\'' # Начало и конец текстового значения. trpKv = '\"' # Начало и конец комментария. trpPoint = '.' # Точка, разделяющая префикс и имя триплета. trpEqual = '=' # Знак присваивания. trpRequest = ':' # Запрос. systemSymbols = [trpBeg, trpEnd, trpAps, trpKv, trpPoint, trpEqual, trpRequest] def trpAddStr(trpStr, prefix, name, value, typeValue=1, rem=""): ''' Добавляет триплет в триплетную строку по лексикографическому возрастанию префиксов триплетов. Параметры: trpStr - триплексная строка, в которую производится добавление; prefix - префикс добавляемого триплета; name - имя добавляемого триплета; value - значение добавляемого триплета; typeValue - тип значения триплета: 0 - числовое значение; 1 - текстовое значение (заключается в апострофы); rem - комментарий к добавляемому триплету. ''' try: if (int(typeValue) not in [0, 1]): return (-1,); except ValueError: return (-1,); if (typeValue == 0): try: value = int(value); except ValueError: return (-1,); else: value = str(value); # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); prefix = str(prefix); name = str(name); rem = str(rem); currentIndex = 0; # Текущий индекс при проходе по триплексной строке. lenStr = len(trpStr); # Длина триплексной строки. # Формирование добавляемого триплета. triplet = trpBeg + prefix + trpPoint + name + trpEqual; if (typeValue == 0): triplet += str(value); else: triplet += trpAps + value + trpAps; if (rem != ""): triplet += trpKv + rem + trpKv; triplet += trpEnd; while (currentIndex < lenStr): tmp = trpStr[currentIndex:]; # Часть строки, начинающаяся с текущего индекса. # Получение префикса и имени текущего триплета. currentPrefix = trpGetPrefix(tmp)[1]; currentName = trpGetName(tmp)[1]; # Вставка триплета. if (currentPrefix >= prefix): # 1. Вставка с заменой (если триплет с такими же префиксом и именем уже есть в исходной строке). if (currentPrefix == prefix and currentName == name): lenOld = trpStr[currentIndex:].index(trpEnd) + 1; # Длина заменяемого триплета. res = trpStr[:currentIndex] + triplet + trpStr[currentIndex + lenOld:]; return (0, res); # 2. Вставка с добавлением (если такого же трилета в исходной строке нет). res = trpStr[:currentIndex] + triplet + trpStr[currentIndex:]; return (0, res); currentIndex = trpGoNext(trpStr, currentIndex + 1)[1]; # Переход к следующему триплету. res = trpStr + triplet; # Добавление триплета в конец строки. return (0, res); def trpCheck(trpStr): ''' Проверка корректности триплексной строки. Коды ошибок: 1 - между триплетами есть посторонние символы; 2 - попытка начать новый триплет при незакрытом предыдущем или отсутствие конца последнего триплета; 3 - отсутствие префикса триплета; 4 - некорректный префикс; 5 - не задано имя триплета; 6 - наличие недопустимых символов в имени триплета (или отсутствие знака присваивания); 7 - отсутствие закрывающего апострофа в значении триплета; 8 - строковое значение триплета не обрамлено в апострофы; 9 - наличие посторонних символов после значения триплета, не оформленных в комментарий; 10 - отсутствие закрывающей кавычки в комментарии (или есть посторонние символы после комментария). Параметры: trpStr - проверяемая строка. ''' # ПЕРВЫЙ ЭТАП ПРОВЕРКИ: можно ли строку корректно разбить на триплеты? inTrp = 0; # Увеличивается на 1 при входе в триплет и уменьшается на 1 при выходе из него. trpStr = str(trpStr); lenStr = len(trpStr); # Количество символов в строке. i = 0; while (i < lenStr): if (trpStr[i] == trpBeg): inTrp += 1; if (trpStr[i] == trpEnd): inTrp -= 1; if (inTrp == 0): if (trpStr[i] not in [trpEnd, " ", "\n", "\0"]): return 1; # Ошибка: посторонние символы между триплетами. else: if (trpStr[i] != trpEnd): trpStr = trpStr[:i] + trpStr[i + 1:]; lenStr -= 1; i -= 1; if (abs(inTrp) > 1 or (inTrp != 0 and i == lenStr - 1)): return 2; # Ошибка: несоответствие начала и конца триплета (начало нового триплета при незакрытом предыдущем). i += 1; triplets = trpSplit(trpStr); # Разбиение строки на отдельные триплеты. kolTrp = len(triplets); for i in range(kolTrp): # ВТОРОЙ ЭТАП ПРОВЕРКИ: проверка синтаксиса каждого триплета. isTrpRegular = tripletCheck(triplets[i]); if (isTrpRegular != 0): return isTrpRegular; return 0; def tripletCheck(trpStr): ''' Проверка триплета. Параметры: trpStr - проверяемый триплет. ''' trpStr = str(trpStr); # Проверка префикса. i = 1; while ((trpStr[i] not in systemSymbols) and (trpStr[i] != " ")): i += 1; if (i == 1): if (trpStr[i] == trpPoint): return 3; # Ошибка: отсутствие префикса триплета. if (trpStr[i] == trpEqual): return 5; # Ошибка: не задано имя триплета. if (trpStr[i] != trpPoint): return 4; # Ошибка: некорректный префикс. # Проверка имени. i += 1; while ((trpStr[i] not in systemSymbols) and (trpStr[i] != " ")): i += 1; if (trpStr[i - 1] == trpPoint): return 5; # Ошибка: не задано имя триплета. if (trpStr[i] == " "): while (trpStr[i] == " "): i += 1; if (trpStr[i] != trpEqual): return 6; # Ошибка: наличие недопустимых символов в имени триплета (или отсутствие знака присваивания). while (trpStr[i] not in systemSymbols): i += 1; if (trpStr[i] != trpEqual): return 6; # Ошибка: наличие недопустимых символов в имени триплета (или отсутствие знака присваивания). # Проверка значения. i += 1; while (trpStr[i] == " "): i += 1; value = ""; if (trpStr[i] == trpAps): # Если триплет имеет строковое значение. i += 1; while ((trpStr[i] != trpAps) and (i != len(trpStr) - 1)): i += 1; if (i == len(trpStr) - 1): return 7; # Ошибка: отсутствие закрывающего апострофа в значении триплета. i += 1; else: if (trpStr[i] == trpRequest): # Если значение триплета представляет собой запрос. i += 1; else: # Если триплет имеет численное значение. while ((trpStr[i] != trpKv) and (i != len(trpStr) - 1)): value += trpStr[i]; i += 1; try: value = float(value); except ValueError: return 8; # Ошибка: строковое значение триплета не обрамлено в апострофы. # Проверка комментария. if (i >= len(trpStr) - 2): return 0; while (trpStr[i] == " "): i += 1; if (trpStr[i] != trpKv and trpStr[ i] != trpEnd): return 9; # Ошибка: наличие посторонних символов после значения триплета, не оформленных в комментарий. if (trpStr[ -2] != trpKv): return 10; # Ошибка: отсутствие закрывающей кавычки в комментарии (или есть посторонние символы после комментария). if (trpStr[i + 1:-2].count( trpKv) != 0): return 9; # Ошибка: наличие посторонних символов после значения триплета, не оформленных в комментарий. return 0; def trpDel(trpStr, prefix, name): ''' Удаляет все триплеты с заданными префиксом и именем из триплексной строки. Параметры: trpStr - триплексная строка; prefix - префикс, по которому производится удаление; name - имя, по которому при соответствующем префиксе производится удаление. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); triplets = trpSplit(trpStr); kolTrp = len(triplets); result = ""; for i in range(kolTrp): if ((trpGetPrefix(triplets[i])[1] != prefix) or (trpGetName(triplets[i])[1] != name)): result += triplets[i]; return (0, result); def trpDelPref(trpStr, prefix): ''' Удаляет все триплеты с заданным префиксом из триплексной строки. Параметры: trpStr - триплексная строка; prefix - префикс, по которому производится удаление. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); triplets = trpSplit(trpStr); kolTrp = len(triplets); result = ""; for i in range(kolTrp): if (trpGetPrefix(triplets[i])[1] != prefix): result += triplets[i]; return (0, result); def trpGet(trpStr, prefix, name): ''' Возвращает значение триплета с заданными префиксом и именем. Параметры: trpStr - строка, в которой производится поиск; prefix - префикс искомого триплета; name - имя искомого триплета. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); triplets = trpSplit(trpStr); kolTrp = len(triplets); for i in range(kolTrp): if ((trpGetPrefix(triplets[i])[1] == prefix) and (trpGetName(triplets[i])[1] == name)): return (0, trpGetValue(triplets[i])[1]); return (-1,); def trpGetName(trpStr): ''' Возвращает имя триплета в соответствии с синтаксисом: $<префикс>.<имя>=<значение>["Комментарий"]; Параметры: trpStr - триплексная строка. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); result = trpStr[trpStr.index(trpPoint) + 1: trpStr.index(trpEqual)]; result = result.strip(); return (0, result); def trpGetPrefix(trpStr): ''' Возвращает префикс триплета в соответствии с синтаксисом: $<префикс>.<имя>=<значение>["Комментарий"]; Параметры: trpStr - триплексная строка. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); result = trpStr[trpStr.find(trpBeg) + 1: trpStr.index(trpPoint)]; return (0, result); def trpGetValue(trpStr): ''' Возвращает значение триплета в соответствии с синтаксисом: $<префикс>.<имя>=<значение>["Комментарий"]; Параметры: trpStr - триплексная строка. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); result = trpStr[trpStr.index(trpEqual) + 1: trpStr.find(trpKv)]; result = result.strip(); if (result[0] == trpAps): result = result[1: -1]; return (0, result); def trpGoNext(trpStr, beginIndex): ''' Возвращает индекс начала следующего триплета, осуществляя поиск с заданного индекса. Параметры: trpStr - триплексная строка; currentIndex - индекс, с которого нужно начинать поиск. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); index = beginIndex; lenStr = len(trpStr); while (index < lenStr and trpStr[index] != trpBeg): index += 1; return (0, index); def trpMergeStr(trpStr, trpStrAdd): ''' Сливает две триплексных строки. Возвращает результат слияния. Параметры: trpStr - основная триплексная строка; trpStrAdd - добавляемая триплексная строка. ''' # Если исходные строки содержат ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0 or trpCheck(trpStrAdd) != 0): return (-1,); return (0, trpStr.strip() + trpStrAdd.strip()); def trpSort(trpStr): ''' Cортирует триплексную строку в лексикографическом порядке имен. Возвращает отсортированную триплексную строку. Параметры: trpStr - триплексная строка. ''' # Если исходная строка содержит ошибки, то функция прекращает свою работу. if (trpCheck(trpStr) != 0): return (-1,); triplets = trpSplit(trpStr); kolTrp = len(triplets); for i in range(kolTrp): triplets[i] = triplets[i][1:]; # Удаление символа $ в триплетах. triplets.sort(); # Сортировка строки. result = ""; for i in range(kolTrp): # Генерация результирующей строки. result += trpBeg + str(triplets[i]); return (0, result); def trpSplit(trpStr): ''' Разбивает триплексную строку на триплеты. Возвращает список триплетов. Параметры: trpStr - триплексная строка. ''' arr = trpStr.split(trpEnd); kolTrp = len(arr); # Количество триплетов в исходной строке. for i in range(kolTrp): try: arr[i] = arr[i].strip(); arr[i] = arr[i][1:]; except IndexError: break; if (len(arr[i]) == 0): del arr[i]; else: arr[i] = trpBeg + arr[i] + trpEnd; return arr; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ __author__ = 'ivan' from os import fork if fork() == 0: import Agent1 else: import Agent2