From 5326e6e4fc3a66913ee629d129c855284e5c3888 Mon Sep 17 00:00:00 2001 From: nanoric Date: Sun, 6 Jan 2019 00:58:37 -0400 Subject: [PATCH 1/8] =?UTF-8?q?[Mod]=20=E7=B1=BB=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E4=BD=BF=E7=94=A8snake=5Fcase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 31be539b..dfa488fb 100644 --- a/.pylintrc +++ b/.pylintrc @@ -139,7 +139,7 @@ bad-names=foo, tata # Naming style matching correct class attribute names. -class-attribute-naming-style=camelCase +class-attribute-naming-style=snake_case # Regular expression matching correct class attribute names. Overrides class- # attribute-naming-style. From 70fbb06cbf88a346f38797eb1d90866c51910a05 Mon Sep 17 00:00:00 2001 From: nanoric Date: Sun, 6 Jan 2019 00:58:48 -0400 Subject: [PATCH 2/8] =?UTF-8?q?[Add]=20=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E7=9A=84=E7=BA=A6?= =?UTF-8?q?=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .style.yapf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.style.yapf b/.style.yapf index ab82e5ad..66c974c4 100644 --- a/.style.yapf +++ b/.style.yapf @@ -1,4 +1,15 @@ [style] based_on_style = google -split_before_logical_operator = true spaces_before_comment=2, 4 +SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED = true +SPLIT_ALL_COMMA_SEPARATED_VALUES = true +SPLIT_BEFORE_BITWISE_OPERATOR = true +SPLIT_BEFORE_CLOSING_BRACKET = true +SPLIT_BEFORE_DICT_SET_GENERATOR = true +SPLIT_BEFORE_DOT = true +SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true +SPLIT_BEFORE_FIRST_ARGUMENT = true +SPLIT_BEFORE_LOGICAL_OPERATOR = true +SPLIT_BEFORE_NAMED_ASSIGNS = true +SPLIT_COMPLEX_COMPREHENSION = true +DEDENT_CLOSING_BRACKETS=true From 8f1029ee37c53b5d23e518551b162e303f4e548e Mon Sep 17 00:00:00 2001 From: nanoric Date: Sun, 6 Jan 2019 00:59:21 -0400 Subject: [PATCH 3/8] =?UTF-8?q?[Mod]=20=E4=BF=AE=E6=AD=A3import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/event/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnpy/event/__init__.py b/vnpy/event/__init__.py index d1f08b68..db211d01 100644 --- a/vnpy/event/__init__.py +++ b/vnpy/event/__init__.py @@ -1 +1 @@ -from engine import Event, EventEngine, EVENT_TIMER \ No newline at end of file +from .engine import Event, EventEngine, EVENT_TIMER \ No newline at end of file From 88002bc315f5e554bd68ba15f21524a87a0d7ce8 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 7 Jan 2019 02:20:39 -0400 Subject: [PATCH 4/8] [Add] added travis script --- .travis.yml | 12 ++++++++++++ requirements-dev.txt | 2 ++ requirements-travis.txt | 0 requirements.txt | 0 tests/test_all.py | 4 ++++ 5 files changed, 18 insertions(+) create mode 100644 .travis.yml create mode 100644 requirements-dev.txt create mode 100644 requirements-travis.txt create mode 100644 requirements.txt create mode 100644 tests/test_all.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..41e4f902 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: python +python: + - "3.7" +install: + - pip install -r requirements.txt + - pip install -r requirements-travis.txt + - pip install -r requirements-dev.txt +# command to run tests +script: + - yapf --style .style.yapf + - pylint --rcfile=.pylintrc vnpy + - python tests/test_all.py diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..6325b67f --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +pylint +https://github.com/google/yapf/archive/master.zip diff --git a/requirements-travis.txt b/requirements-travis.txt new file mode 100644 index 00000000..e69de29b diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_all.py b/tests/test_all.py new file mode 100644 index 00000000..f636d3fd --- /dev/null +++ b/tests/test_all.py @@ -0,0 +1,4 @@ +import unittest + +if __name__ == '__main__': + unittest.main() From 121cdccdb0db0dcb71d9aa70d38068ed4d5bee37 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 7 Jan 2019 02:36:46 -0400 Subject: [PATCH 5/8] [Mod] move requirements-travis.txt to /travis/folder [Add] added format check --- .travis.yml | 6 +++--- requirements-travis.txt => travis/requirements-travis.txt | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename requirements-travis.txt => travis/requirements-travis.txt (100%) diff --git a/.travis.yml b/.travis.yml index 41e4f902..fa0ffea0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: python python: - - "3.7" + - "3.7-dev" install: - pip install -r requirements.txt - - pip install -r requirements-travis.txt + - pip install -r travis/requirements.txt - pip install -r requirements-dev.txt # command to run tests script: - - yapf --style .style.yapf + - python travis/format_check.py - pylint --rcfile=.pylintrc vnpy - python tests/test_all.py diff --git a/requirements-travis.txt b/travis/requirements-travis.txt similarity index 100% rename from requirements-travis.txt rename to travis/requirements-travis.txt From 665f515d86639586def702d5a802d5d2f317816d Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 7 Jan 2019 02:40:02 -0400 Subject: [PATCH 6/8] [Mod] rename travis/requirements-travis.txt to travis/requirements.txt --- travis/{requirements-travis.txt => requirements.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename travis/{requirements-travis.txt => requirements.txt} (100%) diff --git a/travis/requirements-travis.txt b/travis/requirements.txt similarity index 100% rename from travis/requirements-travis.txt rename to travis/requirements.txt From bf2565920fddc8181bb6397b05a3727cd08f1d56 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 7 Jan 2019 02:42:55 -0400 Subject: [PATCH 7/8] [Add] added format_check.py --- travis/format_check.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 travis/format_check.py diff --git a/travis/format_check.py b/travis/format_check.py new file mode 100644 index 00000000..c1455f19 --- /dev/null +++ b/travis/format_check.py @@ -0,0 +1,27 @@ +import logging +import os + +from yapf.yapflib.yapf_api import FormatFile + +logger = logging.Logger(__file__) + +if __name__ == '__main__': + has_changed = False + for root, dir, filenames in os.walk("vnpy"): + for filename in filenames: + basename, ext = os.path.splitext(filename) + if ext == '.py': + path = os.path.join(root, filename) + reformatted_code, encoding, changed = FormatFile(filename=path, + style_config='.style.yapf', + print_diff=True, + verify=False, + in_place=False, + logger=None + ) + if changed: + has_changed = True + logger.warning("File {} not formatted!".format(path)) + else: + logger.info("File {} is formatted!".format(path)) + exit(has_changed) From 65eac4612cd858cb981cbc8cee83596e6ec1b1c5 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 7 Jan 2019 02:49:02 -0400 Subject: [PATCH 8/8] =?UTF-8?q?[Add]=20=E5=A2=9E=E5=8A=A0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 00000000..2b8dd00e --- /dev/null +++ b/Readme.md @@ -0,0 +1,21 @@ +vnpy 2.0 + +## 贡献代码 +--- + +如果你遇到了任何BUG,欢迎[创建 Issue]。 + +我们热烈欢迎任何人为我们的项目贡献代码。无论是多么细小的改工,都可以[提交PR],我们会认真对待每一个PR。 + +在提交代码的时候,请遵守以下规则,以提高代码质量: + + * 使用[yapf](目前必须使用github上的最新代码:```pip install https://github.com/google/yapf/archive/master.zip```)格式化你的代码。对你的每一个文件运行```yapf --style .style.yapf ```即可。 + * 使用[pylint]检查你的代码,确保没有error和warning。我们使用的pylint规则在项目根目录下。运行```pylint --rcfile=pylintrc vnpy```即可。 + + [yapf]:https://github.com/google/yapf + [pylint]:https://github.com/PyCQA/pylint + [提交PR]:https://help.github.com/articles/creating-a-pull-request/ + [创建 Issue]:http://pylint.pycqa.org/en/latest/tutorial.html + + +