Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Colinkang/WeRoBot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: offu/WeRoBot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 14,880 additions and 1,254 deletions.
  1. +19 −0 .codeclimate.yml
  2. +14 −0 .coveragerc
  3. +10 −0 .editorconfig
  4. +34 −0 .github/ISSUE_TEMPLATE/Bug_report.md
  5. +21 −0 .github/ISSUE_TEMPLATE/Feature_request.md
  6. +4 −0 .github/PULL_REQUEST_TEMPLATE.md
  7. +38 −0 .github/dependabot.yml
  8. +12 −0 .github/issue-close-app.yml
  9. +80 −0 .github/workflows/test.yml
  10. +15 −0 .gitignore
  11. +0 −3 .gitmodules
  12. +1 −0 .pipignore
  13. +9 −0 .scrutinizer.yml
  14. +10 −0 .style.yapf
  15. +0 −22 .travis.yml
  16. +8 −0 .vscode/settings.json
  17. +4 −3 MANIFEST.in
  18. +21 −38 README.rst
  19. +2,600 −0 artwork/logo.svg
  20. +8 −0 bors.toml
  21. +5 −19 dev-requirements.txt
  22. +3 −0 docs-requirements.txt
  23. +1 −1 docs/.gitignore
  24. +1 −1 docs/Makefile
  25. BIN docs/_static/logo.png
  26. BIN docs/_static/qq.png
  27. +0 −1 docs/_themes
  28. +37 −0 docs/_themes/LICENSE
  29. +71 −0 docs/_themes/README.rst
  30. +29 −0 docs/_themes/flask/layout.html
  31. +18 −0 docs/_themes/flask/relations.html
  32. +14 −0 docs/_themes/flask/sidebarintro.html
  33. +583 −0 docs/_themes/flask/static/flasky.css_t
  34. +12 −0 docs/_themes/flask/theme.conf
  35. +78 −0 docs/_themes/flask_theme_support.py
  36. +48 −0 docs/api.rst
  37. +198 −0 docs/changelog.rst
  38. +246 −0 docs/client.rst
  39. +76 −74 docs/conf.py
  40. +55 −0 docs/config.rst
  41. +115 −0 docs/contrib.rst
  42. +68 −0 docs/contribution-guide.rst
  43. +82 −9 docs/deploy.rst
  44. +17 −0 docs/encryption.rst
  45. +11 −0 docs/error-page.rst
  46. +471 −0 docs/events.rst
  47. +135 −19 docs/handlers.rst
  48. +11 −5 docs/index.rst
  49. +46 −38 docs/messages.rst
  50. +72 −11 docs/replies.rst
  51. +23 −25 docs/session.rst
  52. +72 −1 docs/start.rst
  53. +21 −0 example/hello_world.py
  54. +3 −0 pytest.ini
  55. +3 −1 requirements.txt
  56. +5 −1 setup.cfg
  57. +42 −10 setup.py
  58. +0 −10 tests.sh
  59. +2 −0 tests/client_config.py
  60. 0 tests/django_test_env/django_test/__init__.py
  61. +117 −0 tests/django_test_env/django_test/settings.py
  62. +44 −0 tests/django_test_env/django_test/urls.py
  63. +16 −0 tests/django_test_env/django_test/wsgi.py
  64. +10 −0 tests/django_test_env/manage.py
  65. +81 −0 tests/messages/test_entries.py
  66. +2,023 −0 tests/test_client.py
  67. +39 −0 tests/test_config.py
  68. +293 −0 tests/test_contrib.py
  69. +39 −0 tests/test_crypto.py
  70. +0 −58 tests/test_events.py
  71. +1,036 −0 tests/test_handler.py
  72. +0 −75 tests/test_handlers.py
  73. +0 −15 tests/test_imagemessage.py
  74. +0 −28 tests/test_link.py
  75. +0 −19 tests/test_locationmessage.py
  76. +21 −0 tests/test_logger.py
  77. +928 −50 tests/test_parser.py
  78. +0 −109 tests/test_render.py
  79. +327 −0 tests/test_replies.py
  80. +259 −0 tests/test_robot.py
  81. +0 −23 tests/test_server.py
  82. +126 −29 tests/test_session.py
  83. +0 −15 tests/test_textmessage.py
  84. +0 −24 tests/test_types.py
  85. +51 −12 tests/test_utils.py
  86. +12 −0 tox-requirements.txt
  87. +10 −2 tox.ini
  88. +6 −4 werobot/__init__.py
  89. +1,302 −0 werobot/client.py
  90. +46 −0 werobot/config.py
  91. 0 werobot/contrib/__init__.py
  92. +57 −0 werobot/contrib/bottle.py
  93. +45 −0 werobot/contrib/django.py
  94. +67 −0 werobot/contrib/error.html
  95. +58 −0 werobot/contrib/flask.py
  96. +70 −0 werobot/contrib/tornado.py
  97. +142 −0 werobot/crypto/__init__.py
  98. +13 −0 werobot/crypto/exceptions.py
  99. +15 −0 werobot/crypto/pkcs7.py
  100. +5 −0 werobot/exceptions.py
  101. +78 −0 werobot/logger.py
  102. +0 −61 werobot/messages.py
  103. +1 −0 werobot/messages/__init__.py
  104. +14 −0 werobot/messages/base.py
  105. +41 −0 werobot/messages/entries.py
  106. +245 −0 werobot/messages/events.py
  107. +64 −0 werobot/messages/messages.py
  108. +26 −45 werobot/parser.py
  109. +203 −0 werobot/pay.py
  110. +271 −0 werobot/replies.py
  111. +0 −159 werobot/reply.py
  112. +605 −89 werobot/robot.py
  113. +1 −1 werobot/session/__init__.py
  114. +30 −5 werobot/session/filestorage.py
  115. +24 −14 werobot/session/mongodbstorage.py
  116. +96 −0 werobot/session/mysqlstorage.py
  117. +79 −0 werobot/session/postgresqlstorage.py
  118. +19 −2 werobot/session/redisstorage.py
  119. +56 −0 werobot/session/saekvstorage.py
  120. +66 −0 werobot/session/sqlitestorage.py
  121. +1 −26 werobot/testing.py
  122. +120 −97 werobot/utils.py
19 changes: 19 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
engines:
duplication:
enabled: true
config:
languages:
- python
fixme:
enabled: true
markdownlint:
enabled: true
pep8:
enabled: true
ratings:
paths:
- "**.py"
exclude_paths:
- docs/
- travis/
- tests/
14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[run]
source = werobot

[report]
exclude_lines =
pragma: no cover

def __repr__

raise AssertionError
raise NotImplementedError

if 0:
if __name__ == .__main__.:
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true

[*.{yml,ini}]
indent_size = 2
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug Report / Bug 反馈
about: 反馈 WeRoBot 的 bug

---

<!--
请注意:不规范的问题会被部署的 issue bot 自动关闭。
Issue tracker 只用于反馈 bug 和 feature request。
与 WeRoBot 用法相关的问题请加入主页上的 QQ 群讨论或在 SegmentFault 社区提问。
在提问前请仔细阅读我们的文档,并推荐阅读《提问的智慧》:
https://github.com/ruby-china/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md
-->
* **对 Bug 的描述**
* 当前行为:
* 正确的行为:

* **环境**
* 平台:
* WeRoBot 版本号:
* Python 版本:

* **复现代码或 repo 链接**

```python
from werobot import WeRoBot

# 请在这里给出 bug 的复现代码。如有必要,可以创建一个复现 repo 并将链接粘贴到这里。
```

* **复现步骤**

* **其他信息**
<!-- 如对 bug 修复的建议、相关 issue 或 PR 的引用等信息 -->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature request
about: 为 WeRoBot 的功能提出建议

---

<!--
Issue tracker 只用于反馈 bug 和 feature request 。
与 WeRoBot 用法相关的问题请加入主页上的 QQ 群讨论或在 SegmentFault 社区提问。
在提问前请仔细阅读我们的文档,并推荐阅读《提问的智慧》:
https://github.com/ruby-china/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md
-->

* **遇到的问题**
<!-- feature 总是要解决问题,来讲讲遇到的问题吧 -->

* **解决方案**
<!-- 描述为了解决这个问题需要 WeRoBot 添加的 feature -->

* **其他内容**
<!-- 如相关 issue 或 PR 的引用等信息 -->
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!--
在发布 Pull Request 之前,请花一点时间读一下我们的贡献指南:
https://werobot.readthedocs.io/zh_CN/master/contribution-guide.html
-->
38 changes: 38 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "07:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: multipart
versions:
- "> 0.1"
- dependency-name: redis
versions:
- "< 2.10.7, >= 2.10.6.a"
- dependency-name: yapf
versions:
- ">= 0.26.a, < 0.27"
- dependency-name: responses
versions:
- 0.13.1
- dependency-name: sphinx
versions:
- 3.5.0
- 3.5.1
- 3.5.2
- 3.5.3
- dependency-name: tox
versions:
- 3.21.3
- 3.21.4
- 3.22.0
- dependency-name: cryptography
versions:
- 3.4.1
- dependency-name: coverage
versions:
- "5.4"
12 changes: 12 additions & 0 deletions .github/issue-close-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
comment: "> Issue tracker 只用于反馈 bug 和 feature request。在提问前请仔细阅读我们的文档,并推荐阅读《提问的智慧》:https://github.com/ruby-china/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md"
issueConfigs:
- content:
- 对 Bug 的描述
- 环境
- 复现代码或 repo 链接
- 复现步骤
- 其他信息
- content:
- 遇到的问题
- 解决方案
- 其他内容
80 changes: 80 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ matrix.os }}-pip-
- uses: actions/cache@v1
with:
path: .tox
key: ${{ matrix.os }}-tox-${{ matrix.python-version }}-${{ hashFiles('**/tox.ini') }}
restore-keys: |
${{ matrix.os }}-tox-${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r dev-requirements.txt
- name: Test with tox
run: |
tox -s
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/*requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
cat dev-requirements.txt | grep yapf== | xargs pip install
- name: Run yapf
run: |
yapf -p -r -d docs/ werobot/ tests/ *.py
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('**/*requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r docs-requirements.txt
- name: Build docs
run: |
sphinx-build -W docs docs/_build/html
- uses: actions/upload-artifact@v1
with:
name: docs
path: docs/_build/html
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.py[cod]
.python-version

# C extensions
*.so
@@ -9,6 +10,7 @@
dist
build
eggs
.eggs/
parts
bin
var
@@ -25,12 +27,16 @@ pip-log.txt
.coverage
.tox
nosetests.xml
.cache/
cover/
htmlcov/

# Translations
*.mo

# Emacs
.#*

# Mr Developer
.mr.developer.cfg
.project
@@ -45,7 +51,16 @@ docs/_
#VirtualEnv
.Python
include/
Scripts/
pyvenv.cfg

werobot_session.db

.coveralls.yml

werobot_session*
pip-selfcheck.json
venv

*.sqlite3
.pytest_cache
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "docs/_themes"]
path = docs/_themes
url = https://github.com/lepture/flask-sphinx-themes.git
1 change: 1 addition & 0 deletions .pipignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
WeRoBot
distribute
9 changes: 9 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
checks:
python:
code_rating: true
duplicate_code: true
filter:
excluded_paths:
- tests/*
- travis/*
- example/*
10 changes: 10 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[style]
based_on_style = pep8
align_closing_bracket_with_visual_indent = true
allow_multiline_dictionary_keys = false
allow_split_before_dict_value = false
dedent_closing_brackets = true
each_dict_entry_on_separate_line = true
coalesce_brackets = false
spaces_before_comment = 2
split_before_logical_operator = true
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.linting.flake8Enabled": false,
"python.formatting.provider": "yapf",
"python.linting.pylintEnabled": false,
"python.testing.pytestEnabled": true,
"python.pythonPath": "venv/bin/python3",
"restructuredtext.confPath": "${workspaceFolder}/docs"
}
7 changes: 4 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include requirements.txt
include README.rst
include LICENSE
include docs/*.rst
include docs/*.py
include docs/Makefile
include werobot/contrib/error.html
recursive-include tests *
recursive-exclude tests *.pyc
recursive-exclude tests *.pyo
Loading