Initial commit

This commit is contained in:
Saturneic 2019-03-11 08:11:44 +08:00
commit cae87b36d3
24 changed files with 990 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

114
.gitignore vendored Normal file
View File

@ -0,0 +1,114 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/

11
.idea/giteasy.iml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

7
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (giteasy)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/giteasy.iml" filepath="$PROJECT_DIR$/.idea/giteasy.iml" />
</modules>
</component>
</project>

318
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="d703f139-38f3-455d-a086-a2da561870b5" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" 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="CoverageDataManager">
<SUITE FILE_PATH="coverage/giteasy$Debug.coverage" NAME="Debug Coverage Results" MODIFIED="1552200896901" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/giteasy$ssh.coverage" NAME="ssh Coverage Results" MODIFIED="1552191792390" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="46200952">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.11" value="2" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="py" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="Python" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="dummy" value="6" />
<entry key="py" value="6153" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="PLAIN_TEXT" value="6" />
<entry key="Python" value="6153" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/server.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="79">
<caret line="122" column="43" selection-start-line="122" selection-start-column="43" selection-end-line="122" selection-end-column="43" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1552200895581" expanded="true" signature="87:92" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ssh.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="25" column="1" selection-start-line="25" selection-start-column="1" selection-end-line="25" selection-end-column="1" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1552191914094" expanded="true" signature="65:70" ph="..." />
<marker date="1552191914094" expanded="true" signature="137:264" ph="..." />
<marker date="1552191914094" expanded="true" signature="389:594" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>self.remotes</find>
</findStrings>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/lib/ssh.py" />
<option value="$PROJECT_DIR$/ssh.py" />
<option value="$PROJECT_DIR$/server.py" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="30" />
<option name="width" value="1440" />
<option name="height" value="804" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="giteasy" type="b2602c69:ProjectViewProjectNode" />
<item name="giteasy" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Python.Debug">
<configuration name="Debug" type="PythonConfigurationType" factoryName="Python">
<module name="giteasy" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="/usr/local/bin/python3.7" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/server.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<module name="giteasy" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="$PROJECT_DIR$/bin/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="ssh" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="giteasy" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="/usr/local/bin/python3.7" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/ssh.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.Debug" />
<item itemvalue="Python.ssh" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.ssh" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="d703f139-38f3-455d-a086-a2da561870b5" name="Default Changelist" comment="" />
<created>1552027430305</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1552027430305</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="30" width="1440" height="804" extended-state="0" />
<layout>
<window_info id="Favorites" order="0" side_tool="true" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.19170243" />
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Database Changes" order="0" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info anchor="bottom" id="Event Log" order="2" sideWeight="0.5007153" side_tool="true" weight="0.26404494" />
<window_info anchor="bottom" id="Version Control" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Python Console" order="4" weight="0.3286517" />
<window_info anchor="bottom" id="Docker" order="5" show_stripe_button="false" />
<window_info anchor="bottom" id="Message" order="6" />
<window_info anchor="bottom" id="Find" order="7" />
<window_info anchor="bottom" id="Run" order="8" sideWeight="0.49928468" weight="0.26404494" />
<window_info anchor="bottom" id="Debug" order="9" weight="0.30758426" />
<window_info anchor="bottom" id="Cvs" order="10" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="11" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="12" />
<window_info anchor="right" id="Database" order="0" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="1" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="SciView" order="2" />
<window_info anchor="right" id="Ant Build" order="3" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="4" weight="0.25" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<default-breakpoints>
<breakpoint type="python-exception">
<properties notifyOnTerminate="true" exception="BaseException">
<option name="notifyOnTerminate" value="true" />
</properties>
</breakpoint>
</default-breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/server.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="79">
<caret line="122" column="43" selection-start-line="122" selection-start-column="43" selection-end-line="122" selection-end-column="43" />
<folding>
<element signature="e#0#15#0" expanded="true" />
<marker date="1552200895581" expanded="true" signature="87:92" ph="..." />
<marker date="1552200895581" expanded="true" signature="1551:7243" ph="..." />
<marker date="1552200895581" expanded="true" signature="1596:1605" ph="..." />
<marker date="1552200895581" expanded="true" signature="4928:5204" ph="..." />
<marker date="1552200895581" expanded="true" signature="5502:5669" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ssh.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="25" column="1" selection-start-line="25" selection-start-column="1" selection-end-line="25" selection-end-column="1" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1552191914094" expanded="true" signature="65:70" ph="..." />
<marker date="1552191914094" expanded="true" signature="137:264" ph="..." />
<marker date="1552191914094" expanded="true" signature="389:594" ph="..." />
</folding>
</state>
</provider>
</entry>
</component>
</project>

76
bin/activate Normal file
View File

@ -0,0 +1,76 @@
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r
fi
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${_OLD_VIRTUAL_PS1:-}"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="/Users/huyibing/PycharmProjects/giteasy"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "${PYTHONHOME:-}" ] ; then
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
unset PYTHONHOME
fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
if [ "x(giteasy) " != x ] ; then
PS1="(giteasy) ${PS1:-}"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r
fi

37
bin/activate.csh Normal file
View File

@ -0,0 +1,37 @@
# This file must be used with "source bin/activate.csh" *from csh*.
# You cannot run it directly.
# Created by Davide Di Blasi <davidedb@gmail.com>.
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
# Unset irrelevant variables.
deactivate nondestructive
setenv VIRTUAL_ENV "/Users/huyibing/PycharmProjects/giteasy"
set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
set _OLD_VIRTUAL_PROMPT="$prompt"
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
if ("giteasy" != "") then
set env_name = "giteasy"
else
if (`basename "VIRTUAL_ENV"` == "__") then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
else
set env_name = `basename "$VIRTUAL_ENV"`
endif
endif
set prompt = "[$env_name] $prompt"
unset env_name
endif
alias pydoc python -m pydoc
rehash

75
bin/activate.fish Normal file
View File

@ -0,0 +1,75 @@
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
# you cannot run it directly
function deactivate -d "Exit virtualenv and return to normal shell environment"
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
set -gx PATH $_OLD_VIRTUAL_PATH
set -e _OLD_VIRTUAL_PATH
end
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
set -e _OLD_VIRTUAL_PYTHONHOME
end
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
functions -e fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
functions -c _old_fish_prompt fish_prompt
functions -e _old_fish_prompt
end
set -e VIRTUAL_ENV
if test "$argv[1]" != "nondestructive"
# Self destruct!
functions -e deactivate
end
end
# unset irrelevant variables
deactivate nondestructive
set -gx VIRTUAL_ENV "/Users/huyibing/PycharmProjects/giteasy"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
# unset PYTHONHOME if set
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# fish uses a function instead of an env var to generate the prompt.
# save the current fish_prompt function as the function _old_fish_prompt
functions -c fish_prompt _old_fish_prompt
# with the original prompt function renamed, we can override with our own.
function fish_prompt
# Save the return status of the last command
set -l old_status $status
# Prompt override?
if test -n "(giteasy) "
printf "%s%s" "(giteasy) " (set_color normal)
else
# ...Otherwise, prepend env
set -l _checkbase (basename "$VIRTUAL_ENV")
if test $_checkbase = "__"
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
else
printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
end
end
# Restore the return status of the previous command.
echo "exit $old_status" | .
_old_fish_prompt
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end

12
bin/easy_install Executable file
View File

@ -0,0 +1,12 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install'
__requires__ = 'setuptools==39.1.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==39.1.0', 'console_scripts', 'easy_install')()
)

12
bin/easy_install-3.7 Executable file
View File

@ -0,0 +1,12 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install-3.7'
__requires__ = 'setuptools==39.1.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==39.1.0', 'console_scripts', 'easy_install-3.7')()
)

12
bin/pip Executable file
View File

@ -0,0 +1,12 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==10.0.1', 'console_scripts', 'pip')()
)

12
bin/pip3 Executable file
View File

@ -0,0 +1,12 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
)

12
bin/pip3.7 Executable file
View File

@ -0,0 +1,12 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.7'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==10.0.1', 'console_scripts', 'pip3.7')()
)

11
bin/pylupdate5 Executable file
View File

@ -0,0 +1,11 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from PyQt5.pylupdate_main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())

11
bin/pyrcc5 Executable file
View File

@ -0,0 +1,11 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from PyQt5.pyrcc_main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())

BIN
bin/python Executable file

Binary file not shown.

BIN
bin/python3 Executable file

Binary file not shown.

11
bin/pyuic5 Executable file
View File

@ -0,0 +1,11 @@
#!/Users/huyibing/PycharmProjects/giteasy/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from PyQt5.uic.pyuic import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())

1
pip-selfcheck.json Normal file
View File

@ -0,0 +1 @@
{"last_check":"2019-03-08T06:46:12Z","pypi_version":"19.0.3"}

3
pyvenv.cfg Normal file
View File

@ -0,0 +1,3 @@
home = /usr/local/bin
include-system-site-packages = false
version = 3.7.0

219
server.py Normal file
View File

@ -0,0 +1,219 @@
import paramiko
import re
import os
class ssh(object):
ssh = paramiko.SSHClient();
def __init__(self, hostname, path, user, passwd=None, sshkey=False):
self.hostname = hostname;
self.path = path;
self.user = user;
self.sshkey = sshkey;
if sshkey == True:
self.passwd = None;
self.key = paramiko.RSAKey.from_private_key_file('/Users/huyibing/.ssh/id_rsa')
else:
self.passwd = passwd;
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
def close(self):
self.ssh.close();
def run(self, cmd):
print("CMD:", cmd)
stdin, stdout, stderr = self.ssh.exec_command(cmd)
stdout = list(stdout);
stderr = list(stderr);
return stdout, stderr;
def check_error(self, stderr):
if len(stderr) == 0:
return True
else:
return False
def connect(self,timeout):
if self.sshkey:
self.ssh.connect(hostname=self.hostname, port=22, username=self.user, pkey=self.key, timeout=timeout);
else:
self.ssh.connect(hostname=self.hostname, port=22, username=self.user, password=self.passwd, timeout=timeout);
def __del__(self):
self.close();
class git(ssh):
projects = {}
projects_list = []
remotes = {}
fix_name = None;
def __init__(self, hostname, path, user, passwd):
super().__init__(hostname, path, user, passwd);
self.base_path = [False];
self.connect(5);
def globalinit(self,git_user,git_email):
cmd = "git config --global user.email \"{0}\";".format(git_email);
cmd += "git config --global user.name \"{0}\";".format(git_user);
stdout, stderr = self.run(cmd)
if self.check_error(stderr):
print("Global setting successful.")
else:
print(stderr)
raise ValueError("Args Abnormal")
def baseinit(self):
stdout, stderr = self.run("ls {}".format(self.path))
if self.check_error(stderr):
if "giteasy\n" in stdout:
print("Directory already found.")
else:
stdout, stderr = self.run("mkdir {0}/{1}".format(self.path, "giteasy"))
print("Create directory.")
self.base_path = [True,"{0}/{1}".format(self.path, "giteasy")]
else:
raise ValueError("Home Path Abnormal")
def create_project(self,name):
if self.base_path[0]:
stdout, stderr = self.run("mkdir {0}/{1}".format(self.base_path[1],name))
if self.check_error(stderr):
print("Succeed In Making Directory.")
self.projects[name] = {"path" : "{0}/{1}".format(self.base_path[1],name), "branch" : []}
cmd = "cd {0};".format(self.projects[name]["path"]);
cmd += "git init;";
cmd += "touch ReadME.md;";
cmd += "git add *;"
cmd += "git commit --message=init;";
stdout, stderr = self.run(cmd)
if self.check_error(stderr):
print("Succeed In Getting Repository.")
else:
print(stderr)
raise ValueError("Target Path Abnormal")
else:
raise ValueError("Base Path Abnormal")
else:
raise UnboundLocalError("Init Base First")
def update_projects(self):
if self.base_path[0]:
stdout, stderr = self.run("ls {0}".format(self.base_path[1]))
if self.check_error(stderr):
reform = re.compile("\w+")
for project in stdout:
print("PROJECT",project)
project_name = reform.match(project).string.strip('\n')
self.projects[project_name] = {"path" : "{0}/{1}".format(self.base_path[1],project_name), "branch" : []}
else:
raise ValueError("Base Path Abnormal")
self.list_projects();
else:
raise UnboundLocalError("Init Base First")
def list_projects(self):
for project in self.projects.keys():
self.projects_list.append(project)
print(project)
def set_local(self,path):
self.remotes = {};
self.local_path = path;
os.chdir(self.local_path);
def add_remote(self,name="origin"):
os.popen("git remote add {3} ssh://{0}@{1}:{2}/{4}/.git".format(self.user,self.hostname,self.base_path[1],name,self.fix_name))
self.remotes[name] = {"name" : name, "url" : "ssh://{0}@{1}:{2}/{3}/.git".format(self.user,self.hostname,self.base_path[1],self.fix_name)}
def fetch_remote(self,name):
if name in self.remotes.keys():
os.popen("git fetch {0}".format(name))
def get_remote(self):
retcode = re.compile(r"[\t, ]")
for remote in os.popen("git remote -v").readlines():
results = retcode.split(remote)
for item in results:
if item[0] not in self.remotes.keys():
self.remotes[item[0]] = {"name":item[0],"url":item[1]}
def push_remote(self,name,branch):
if branch in self.projects[self.fix_name]["branch"] and name in self.remotes.keys():
os.popen("git push {0} {1}".format(name,branch))
else:
raise ValueError("Branch or Name Abnormal")
def pull_remote(self,name,branch):
if name in self.remotes.keys():
os.popen("git pull {0} {1}".format(name,branch))
else:
raise ValueError("Remote Error")
def fix(self,name):
if name in self.projects_list:
self.fix_name = name;
stdout, stderr = self.run("cd {0}".format(self.projects[name]["path"]))
if self.check_error(stderr):
print("Fixed.")
self.fix_cmd = "cd {0}".format(self.projects[name]["path"]) + ";";
else:
raise ValueError("Project Path Abnormal")
def commit(self,message):
if self.base_path[0]:
stdout, stderr = self.run(self.fix_cmd+"git commit --message={0}".format(message))
else:
raise UnboundLocalError("Init Base First")
def get_branch(self):
if self.base_path[0] and self.fix_name != None:
stdout, stderr = self.run(self.fix_cmd+"git branch")
if self.check_error(stderr):
reform = re.compile("\w+",)
for branch in stdout:
branch_name = reform.search("*master").group().strip('\n')
self.projects[self.fix_name]["branch"].append(branch_name)
if '*' in str(branch):
self.projects[self.fix_name]["active_branch"] = branch_name
else:
print(stderr)
raise ValueError("Command Error")
def list_branch(self):
for project in self.projects.items():
for branch in project[1]["branch"]:
if branch == project[1]["active_branch"]:
print("(*)",branch)
else:
print(" ",branch)
if __name__ == "__main__":
compute = git("compute.bktus.com", "/home/git", "git", "123456")
compute.globalinit(git_user = "saturneric", git_email = "eric.bktu@gmail.com")
compute.baseinit();
#compute.create_project("lcs")
compute.update_projects();
compute.list_projects();
compute.fix("lcs");
#compute.get_branch("lcs")
compute.set_local("/Users/huyibing/Documents/code/test")
#compute.add_remote();
#compute.get_remote()
compute.get_branch();
compute.list_branch();
print(compute.projects)

26
ssh.py Normal file
View File

@ -0,0 +1,26 @@
import server
import subprocess
import os
class key(server.ssh):
def __init__(self,hostname, path, user, passwd=None, sshkey=False):
super().__init__(hostname=hostname, path=path, user=user, passwd=passwd, sshkey=sshkey)
self.connect(5);
def add_key(self):
self.run("echo \"{0}\" >> ~/.ssh/authorized_keys".format(self.pub_key))
def create_key(self):
retcode = subprocess.Popen(["ssh-keygen", "-b 4096", "-t rsa"], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = retcode.communicate(input=b"\ny \n \n \n")
def get_key(self):
self.pub_key = os.popen("cat ~/.ssh/id_rsa.pub").read()
newkey = key("compute.bktus.com", "/home/git", "git", "123456",sshkey=False);
#newkey.create_key();
#newkey.get_key();
#newkey.add_key();