Skip to content

Commit 3c11427

Browse files
committedDec 2, 2021
update
1 parent 3e1b819 commit 3c11427

File tree

8 files changed

+67
-6
lines changed

8 files changed

+67
-6
lines changed
 

‎cache/diskcache.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# DiskCache库
2+
3+
## 用户文档
4+
5+
- http://www.grantjenks.com/docs/diskcache/tutorial.html#tutorial-cache
6+
7+
## API文档
8+
9+
- http://www.grantjenks.com/docs/diskcache/api.html

‎markdown/gitbook.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# GitBook项目解析
2+
3+
## GitBook项目结构
4+
5+
详见:https://tonydeng.github.io/gitbook-zh/gitbook-howtouse/book/README.html
6+
7+
## 参考资料
8+
9+
### 官方实现
10+
11+
[GitBook官方源码](https://github.com/GitbookIO/gitbook/tree/master/lib):
12+
13+
- Models、Parsers等的建模可直接follow。
14+
15+
### Python实现
16+
17+
[`pybook`](https://github.com/bijanebrahimi/pybook):
18+
19+
- 可以借鉴一些可以临时使用的Python实现方法。
20+
- 原本想fork,然后发现年久失修且架构不好,没有fork价值,不如重写。
21+
22+
其他供参考的实现:
23+
24+
- https://github.com/samuel-walker/gitbook-python-scripts

‎markdown/metadata.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# MetaData解析
2+
3+
`markdown_meta_extension`:
4+
5+
- PyPI:
6+
- GitLab源码:https://gitlab.com/markdown-meta-extension/markdown-meta-extension/-/tree/master

‎markdown/parser.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Markdown解析器
2+
3+
可参考代码:
4+
5+
- https://github.com/yhfyhf/Markdown-Parser-Python
6+
- https://github.com/phpusr/markdown-tree-parser

‎markdown/regex.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 正则表达式实现
2+
3+
一个[Markdown语法的正则教程](http://chubakbidpaa.com/interesting/2021/09/28/regex-for-md.html)
4+
5+
一个[Markdown正则匹配的测试工具](https://www.regextester.com/105361)

‎string/examples.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 字符串处理案例
2+
3+
重复字符计数:https://pretagteam.com/question/counting-repeated-characters-in-a-string-in-python

‎unittest/env.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 模拟环境变量
2+
3+
使用`unittest`的装饰器`mock.patch.dict(os.environ, {'<key>': 'value'})`
4+
5+
方案来自:
6+
7+
- https://adamj.eu/tech/2020/10/13/how-to-mock-environment-variables-with-pythons-unittest/
8+
9+
在此基础上注意:
10+
11+
类级别的装饰器,会在`setUp`方法之后运行。如果`setUp`方法内运行的代码先使用了环境变量,则类装饰器这样写实际上无效。这种情况下需要把装饰器加在`setUp`方法上。例如[`qtclass-admin-cli`的测试`test_tutorial_parsers_course.py`](https://quanttide.coding.net/p/qtclass-app/d/qtclass-admin-cli/git/tree/master/tests/test_tutorial_parsers_course.py)的15行。(PS: 尚未阅读源码或者API文档确认是否如此,请读者谨慎验证,如有问题欢迎PR。)

‎unittest/http.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Mock HTTP API
22

3-
使用最易用的`responses`
3+
使用最易用的[`responses`](https://pypi.org/project/responses/0.4.0/)
44

5-
目前有几种方案可以选择
5+
其他备选方案包括
66

77
- https://github.com/patrys/httmock
88
- https://requests-mock.readthedocs.io/en/latest/matching.html#simple
9-
- https://github.com/getsentry/responses
10-
11-
其他方法:
12-
139
- https://stackoverflow.com/questions/15753390/how-can-i-mock-requests-and-the-response
10+
- https://pythonrepo.com/repo/getsentry-responses-python-wsgi-compatible-web-servers

0 commit comments

Comments
 (0)
Please sign in to comment.