├── .idea
├── .gitignore
├── inspectionProfiles
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
└── wiki.iml
├── .nojekyll
├── LICENSE
├── README.md
├── _media
└── favicon.ico
├── _navbar.md
├── _sidebar.md
├── en-us
├── README.md
├── _navbar.md
├── _sidebar.md
├── api
│ ├── QuecPythonClasslib.md
│ ├── QuecPythonThirdlib.md
│ ├── README.md
│ ├── _navbar.md
│ ├── _sidebar.md
│ ├── pythonBasic.md
│ └── pythonStdlib.md
├── faq
│ ├── README.md
│ ├── _navbar.md
│ └── _sidebar.md
└── python
│ ├── README.md
│ ├── _navbar.md
│ └── _sidebar.md
├── index.html
├── static
├── css
│ ├── buble.css
│ ├── dark.css
│ ├── main.css
│ ├── pure.css
│ ├── sidebar.min.css
│ └── vue.css
└── js
│ ├── countable.min.js
│ ├── docsify-copy-code.min.js
│ ├── docsify-pagination.min.js
│ ├── docsify-scroll-to-top.min.js
│ ├── docsify-sidebar-collapse.min.js
│ ├── docsify.min.js
│ ├── jquery.sidebar.min.js
│ ├── prism-bash.min.js
│ ├── prism-markdown.min.js
│ ├── prism-nginx.min.js
│ ├── prism-python.js
│ ├── prism-python.min.js
│ ├── prism.js
│ ├── prism.min.js
│ ├── search.min.js
│ └── zoom-image.min.js
└── zh-cn
├── README.md
├── _navbar.md
├── _sidebar.md
├── api
├── QuecPythonClasslib.md
├── QuecPythonThirdlib.md
├── README.md
├── _navbar.md
├── _sidebar.md
├── pythonBasic.md
└── pythonStdlib.md
├── faq
├── README.md
├── _navbar.md
└── _sidebar.md
└── python
├── README.md
├── _navbar.md
├── _sidebar.md
└── images
├── 1240.jpg
├── 1241.jpg
├── 1242.jpg
├── 1243.jpg
├── 1244.jpg
├── 1245.jpg
├── 1246.jpg
├── 1247.jpg
└── 1248.jpg
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /../../../../../../../:\Users\rivern.yuan\Desktop\GitHub开源\wiki\.idea/dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/wiki.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/.nojekyll
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Quectel Wireless Solution, Co., Ltd.All Rights Reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # QuecPython
2 | > 一种全新的物联网开发方式
3 |
4 | ## 概述 Overview
5 | 使用QuecPython,你可以使用Python快速实现各种物联网应用,简单、高效、可靠。
6 |
7 |
8 |
9 | ## 特性 Feature
10 | * 无需编译,随写随测
11 | * 轻松入门,易于上手
12 | * 完整API
13 | * 丰富用例
14 | * 垂直行业方案
15 | * 代码加密,安全可靠
16 |
17 | ## 立即开始 Getting started
18 |
19 | + 如果您是python新手,对python语法尚不熟悉,可以先从[python基础](/zh-cn/python/)开始阅读
20 | + 为了便于开发者更快上手QuecPython,我们提供了[文档中心](https://python.quectel.com/doc),文档中心有着有丰富的代码和案例等,您可以按照文档中心的文档顺序来进行学习和实践
21 | + 开发过程中遇到的问题可以从[QuecPython FAQ&DEBUG](https://python.quectel.com/doc/doc/FAQ/zh/index.html)中获取解决办法
22 | + 如果您还有其他问题,可以在我们的[工单系统](https://workorder.quectel.com/)提交您的问题以获取帮助
23 |
24 | ## 了解更多 More
25 | 请访问我们的 [官网](//qpy.quectel.com)
26 |
--------------------------------------------------------------------------------
/_media/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/_media/favicon.ico
--------------------------------------------------------------------------------
/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | * [**视频教程**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
7 | * [**python基础**](/zh-cn/python/)
8 |
9 | * [**python 基本属性**](/zh-cn/api/pythonBasic.md)
10 | * [**QuecPython 标准库**](/zh-cn/api/pythonStdlib.md)
11 | * [**QuecPython 类库**](/zh-cn/api/QuecPythonClasslib.md)
12 | * [**QuecPython 第三方库**](/zh-cn/api/QuecPythonThirdlib.md)
13 | * [**QuecPython 异常处理**](/zh-cn/faq/)
14 |
15 |
16 | * [**官方网站**](//python.quectel.com)
17 | * [**文档中心**](//python.quectel.com/doc/)
18 | * [**资料下载**](//python.quectel.com/download)
--------------------------------------------------------------------------------
/en-us/README.md:
--------------------------------------------------------------------------------
1 | # QuecPython
2 | Little code, Big Future
3 | Easy, Fast, Efficient, Reliable, Safe
4 |
5 |
6 |
7 |
8 | # Start
9 | * **Video Lesson** Comming Soon...
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
22 | # Others
23 | [Download](//qpy.quectel.com/down.html)
24 |
--------------------------------------------------------------------------------
/en-us/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/en-us/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**Video Tutorial**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**Python Basis**](/en-us/python/)
5 | * [**Python Attributes**](/en-us/api/pythonBasic.md)
6 | * [**QuecPython Standardlib**](/en-us/api/pythonStdlib.md)
7 | * [**QuecPython Classlib**](/en-us/api/QuecPythonClasslib.md)
8 | * [**QuecPython Third-partylib**](/en-us/api/QuecPythonThirdlib.md)
9 | * [**QuecPython FAQ**](/en-us/faq/)
10 | * [**Official Website**](//python.quectel.com)
11 | * [**Official Doc**](https://python.quectel.com/docsite/en-us/docs/Quecpython_intro/QPY_history.html)
12 | * [**Download**](//python.quectel.com/down.html)
13 |
14 |
--------------------------------------------------------------------------------
/en-us/api/README.md:
--------------------------------------------------------------------------------
1 | # Quectel QuecPython Class library API Descriptions
2 |
3 | [python Basic Attribute](/en-us/api/pythonBasic.md)
4 |
5 | [python Standard Library](/en-us/api/pythonStdlib.md)
6 |
7 | [QuecPython Class Library](/en-us/api/QuecPythonClasslib.md)
8 |
9 | [QuecPython Third-party Library](/en-us/api/QuecPythonThirdlib.md)
10 |
11 |
--------------------------------------------------------------------------------
/en-us/api/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/en-us/api/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**Video Tutorial**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**Python Basis**](/en-us/python/)
5 | * [**Python Attributes**](/en-us/api/pythonBasic.md)
6 | * [**QuecPython Standardlib**](/en-us/api/pythonStdlib.md)
7 | * [**QuecPython Classlib**](/en-us/api/QuecPythonClasslib.md)
8 | * [**QuecPython Third-partylib**](/en-us/api/QuecPythonThirdlib.md)
9 | * [**QuecPython FAQ**](/en-us/faq/)
10 | * [**Official Website**](//python.quectel.com)
11 | * [**Official Doc**](//python.quectel.com/doc/en/)
12 | * [**Download**](//python.quectel.com/down.html)
13 |
14 |
--------------------------------------------------------------------------------
/en-us/api/pythonBasic.md:
--------------------------------------------------------------------------------
1 | # Built-in Functions
2 |
3 | The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order. For more details, please refer to [Built-in Functions](https://docs.python.org/3.5/library/functions.html) .
4 |
5 | | | | Built-in Functions | | |
6 | | --------- | ------------- | ------------------ | -------------- | ---------- |
7 | | abs() | all() | any() | bin() | callable() |
8 | | chr() | classmethod() | compile() | delattr() | dir() |
9 | | divmod() | enumerate() | eval() | exec() | filter() |
10 | | getattr() | globals() | hasattr() | hash() | hex() |
11 | | id() | input() | isinstance() | issubclass() | iter() |
12 | | len() | locals() | map() | max() | min() |
13 | | next() | oct() | open() | ord() | pow() |
14 | | print() | property() | range() | repr() | reversed() |
15 | | round() | setattr() | sorted() | staticmothed() | sum() |
16 | | super() | type() | zip() | | |
17 |
18 |
19 |
20 | # Built-in Constants
21 |
22 | A small number of constants live in the built-in namespace. They are listed in the following table. For more details, please refer to [Built-in Constants](https://docs.python.org/3.5/library/constants.html) .
23 |
24 | | Built-in Constants | |
25 | | ------------------ | ------------------------------------------------------------ |
26 | | False | The false value of the bool type |
27 | | True | The true value of the bool type |
28 | | None | The sole value of the type NoneType |
29 | | \_\_debug\_\_ | This constant is true if Python was not started with an -O option |
30 | | Ellipsis | Special value used mostly in conjunction with extended slicing syntax for user-defined container data types. |
31 | | NotImplemented | Special value which should be returned by the binary special methods (e.g. __eq__**()**,__lt__**()** ,etc.) to indicate that the operation is not implemented with respect to the other type. |
32 |
33 |
34 |
35 | # Built-in Types
36 |
37 | The following sections describe the standard types that are built into the interpreter. For more details, please refer to [Built-in Types](https://docs.python.org/3.5/library/stdtypes.html) .
38 |
39 | | Built-in Types | |
40 | | -------------- | ------------------------------------------------------ |
41 | | int | integer, numeric type |
42 | | float | floating-point number, numeric type |
43 | | complex | complex numbers, numeric type |
44 | | bool | bool, numeric type |
45 | | list | list, sequence type |
46 | | tuple | tuple, sequence type |
47 | | range | range object, sequence type |
48 | | str | string, sequence type |
49 | | bytes | An immutable sequence of single bytes, sequence type |
50 | | bytearray | Mutable counterpart of the bytes object, sequence type |
51 | | memoryview | binary sequence type |
52 | | dict | dictionary, mapping type |
53 | | set | set |
54 | | frozenset | set, unmodifiable, hash value |
55 | | object | object, default base class for python3.x class |
--------------------------------------------------------------------------------
/en-us/faq/README.md:
--------------------------------------------------------------------------------
1 | # QuecPython Exception Handling Manual
2 |
3 | ## QuecPython Error Codes
4 |
5 | Various error code constants defined in QuecPython (Continuously Updated)
6 |
7 | | Error Code Constant | Error Code | Description |
8 | | ----------------------- | ---------- | ----------------------------------------------- |
9 | | QUEC_PY_FAIL | -1 | Generic failure codes |
10 | | QUEC_PY_OK | 0 | Quec_py value indicating success (no error) |
11 | | QUEC_PY_EPERM | 1 | Operation not permitted |
12 | | QUEC_PY_ENOENT | 2 | No such file or directory |
13 | | QUEC_PY_ESRCH | 3 | No such process |
14 | | QUEC_PY_EINTR | 4 | Interrupted system call |
15 | | QUEC_PY_EIO | 5 | I/O error |
16 | | QUEC_PY_ENXIO | 6 | No such device or address |
17 | | QUEC_PY_E2BIG | 7 | Argument list too long |
18 | | QUEC_PY_ENOEXEC | 8 | Exec format error |
19 | | QUEC_PY_EBADF | 9 | Bad file number |
20 | | QUEC_PY_ECHILD | 10 | No child processes |
21 | | QUEC_PY_EAGAIN | 11 | Try again |
22 | | QUEC_PY_ENOMEM | 12 | Out of memory |
23 | | QUEC_PY_EACCES | 13 | Permission denied |
24 | | QUEC_PY_EFAULT | 14 | Bad address |
25 | | QUEC_PY_ENOTBLK | 15 | Block device required |
26 | | QUEC_PY_EBUSY | 16 | Device or resource busy |
27 | | QUEC_PY_EEXIST | 17 | File exists |
28 | | QUEC_PY_EXDEV | 18 | Cross-device link |
29 | | QUEC_PY_ENODEV | 19 | No such device |
30 | | QUEC_PY_ENOTDIR | 20 | Not a directory |
31 | | QUEC_PY_EISDIR | 21 | Is a directory |
32 | | QUEC_PY_EINVAL | 22 | Invalid argument |
33 | | QUEC_PY_ENFILE | 23 | File table overflow |
34 | | QUEC_PY_EMFILE | 24 | Too many open files |
35 | | QUEC_PY_ENOTTY | 25 | Not a typewriter |
36 | | QUEC_PY_ETXTBSY | 26 | Text file busy |
37 | | QUEC_PY_EFBIG | 27 | File too large |
38 | | QUEC_PY_ENOSPC | 28 | No space left on device |
39 | | QUEC_PY_ESPIPE | 29 | Illegal seek |
40 | | QUEC_PY_EROFS | 30 | Read-only file system |
41 | | QUEC_PY_EMLINK | 31 | Too many links |
42 | | QUEC_PY_EPIPE | 32 | Broken pipe |
43 | | QUEC_PY_EDOM | 33 | Math argument out of domain of func |
44 | | QUEC_PY_ERANGE | 34 | Math result not representable |
45 | | QUEC_PY_EDEADLK | 35 | Resource deadlock would occur |
46 | | QUEC_PY_ENAMETOOLONG | 36 | File name too long |
47 | | QUEC_PY_ENOLCK | 37 | No record locks available |
48 | | QUEC_PY_ENOSYS | 38 | Function not implemented |
49 | | QUEC_PY_ENOTEMPTY | 39 | Directory not empty |
50 | | QUEC_PY_ELOOP | 40 | Too many symbolic links encountered |
51 | | QUEC_PY_EWOULDBLOCK | 41 | Operation would block |
52 | | QUEC_PY_ENOMSG | 42 | No message of desired type |
53 | | QUEC_PY_EIDRM | 43 | Identifier removed |
54 | | QUEC_PY_ECHRNG | 44 | Channel number out of range |
55 | | QUEC_PY_EL2NSYNC | 45 | Level 2 not synchronized |
56 | | QUEC_PY_EL3HLT | 46 | Level 3 halted |
57 | | QUEC_PY_EL3RST | 47 | Level 3 reset |
58 | | QUEC_PY_ELNRNG | 48 | Link number out of range |
59 | | QUEC_PY_EUNATCH | 49 | Protocol driver not attached |
60 | | QUEC_PY_ENOCSI | 50 | No CSI structure available |
61 | | QUEC_PY_EL2HLT | 51 | Level 2 halted |
62 | | QUEC_PY_EBADE | 52 | Invalid exchange |
63 | | QUEC_PY_EBADR | 53 | Invalid request descriptor |
64 | | QUEC_PY_EXFULL | 54 | Exchange full |
65 | | QUEC_PY_ENOANO | 55 | No anode |
66 | | QUEC_PY_EBADRQC | 56 | Invalid request code |
67 | | QUEC_PY_EBADSLT | 57 | Invalid slot |
68 | | QUEC_PY_EDEADLOCK | 58 | Deadlock |
69 | | QUEC_PY_EBFONT | 59 | Bad font file format |
70 | | QUEC_PY_ENOSTR | 60 | Device not a stream |
71 | | QUEC_PY_ENODATA | 61 | No data available |
72 | | QUEC_PY_ETIME | 62 | Timer expired |
73 | | QUEC_PY_ENOSR | 63 | Out of streams resources |
74 | | QUEC_PY_ENONET | 64 | Machine is not on the network |
75 | | QUEC_PY_ENOPKG | 65 | Package not installed |
76 | | QUEC_PY_EREMOTE | 66 | Object is remote |
77 | | QUEC_PY_ENOLINK | 67 | Link has been severed |
78 | | QUEC_PY_EADV | 68 | Advertise error |
79 | | QUEC_PY_ESRMNT | 69 | Srmount error |
80 | | QUEC_PY_ECOMM | 70 | Communication error on send |
81 | | QUEC_PY_EPROTO | 71 | Protocol error |
82 | | QUEC_PY_EMULTIHOP | 72 | Multihop attempted |
83 | | QUEC_PY_EDOTDOT | 73 | RFS specific error |
84 | | QUEC_PY_EBADMSG | 74 | Not a data message |
85 | | QUEC_PY_EOVERFLOW | 75 | Value too large for defined data type |
86 | | QUEC_PY_ENOTUNIQ | 76 | Name not unique on network |
87 | | QUEC_PY_EBADFD | 77 | File descriptor in bad state |
88 | | QUEC_PY_EREMCHG | 78 | Remote address changed |
89 | | QUEC_PY_ELIBACC | 79 | Can not access a needed shared library |
90 | | QUEC_PY_ELIBBAD | 80 | Accessing a corrupted shared library |
91 | | QUEC_PY_ELIBSCN | 81 | .lib section in a.out corrupted |
92 | | QUEC_PY_ELIBMAX | 82 | Attempting to link in too many shared libraries |
93 | | QUEC_PY_ELIBEXEC | 83 | Cannot exec a shared library directly |
94 | | QUEC_PY_EILSEQ | 84 | Illegal byte sequence |
95 | | QUEC_PY_ERESTART | 85 | Interrupted system call should be restarted |
96 | | QUEC_PY_ESTRPIPE | 86 | Streams pipe error |
97 | | QUEC_PY_EUSERS | 87 | Too many users |
98 | | QUEC_PY_ENOTSOCK | 88 | Socket operation on non-socket |
99 | | QUEC_PY_EDESTADDRREQ | 89 | Destination address required |
100 | | QUEC_PY_EMSGSIZE | 90 | Message too long |
101 | | QUEC_PY_EPROTOTYPE | 91 | Protocol wrong type for socket |
102 | | QUEC_PY_ENOPROTOOPT | 92 | Protocol not available |
103 | | QUEC_PY_EPROTONOSUPPORT | 93 | Protocol not supported |
104 | | QUEC_PY_ESOCKTNOSUPPORT | 94 | Socket type not supported |
105 | | QUEC_PY_EOPNOTSUPP | 95 | Operation not supported on transport endpoint |
106 | | QUEC_PY_EAFNOSUPPORT | 97 | Address family not supported by protocol |
107 | | QUEC_PY_EADDRINUSE | 98 | Address already in use |
108 | | QUEC_PY_ECONNABORTED | 103 | Software caused connection abort |
109 | | QUEC_PY_ECONNRESET | 104 | Connection reset by peer |
110 | | QUEC_PY_ENOBUFS | 105 | No buffer space available |
111 | | QUEC_PY_EISCONN | 106 | Transport endpoint is already connected |
112 | | QUEC_PY_ENOTCONN | 107 | Transport endpoint is not connected |
113 | | QUEC_PY_ETIMEDOUT | 110 | Connection timed out |
114 | | QUEC_PY_ECONNREFUSED | 111 | Connection refused |
115 | | QUEC_PY_EHOSTUNREACH | 113 | No route to host |
116 | | QUEC_PY_EALREADY | 114 | Operation already in progress |
117 | | QUEC_PY_EINPROGRESS | 115 | Operation now in progress |
118 |
119 | ### Error Code to Error Message
120 |
121 | ```python
122 | import uerrno.errno_to_str()
123 |
124 | # Not yet realized
125 | errInfo = uerrno.errno_to_str()
126 | print(errInfo)
127 | ```
128 |
129 | ## QuecPython Exception Checking Process
130 |
131 | ### Abnormal Reboot Handling
132 |
133 | The firmware version is the business mode by default, that is, it will automatically reboot when the underlying abnormal error occurs, so as to prevent the module program from stopping and being unusable. In the debugging period, we need to expose and locate the cause of the problem. At this time, we need to set three AT commands (AT port execution):
134 |
135 | - at+qdumpcfg=0,0
136 | - at+qdumpcfg=1,0
137 | - at+log=19,1
138 |
139 | Execute the above three AT commands in turn to enter debug mode. If there is an underlying exception error, it will enter DUMP mode and DUMP port will appear. At this time, you have two choices:
140 |
141 | * Method 1 : Provide firmware version, test steps and test code, and go to **QuecPython** official website to submit problem work orders
142 | * Method 2 : Use Tera term window debugging tool (search for how to use this tool by Google) to crawl Dumpllog, provide firmware version, test steps and test code, and go to **QuecPython** official website to submit problem work orders, saving time for reappearing problems.
143 |
144 | **Note: These commands still take effect after rebooting. If you need to exit debug mode, you can burn the firmware version again.**
145 |
146 | ## Meaning and Use of QuecPython Power up/down Reason
147 |
148 | ### Register Meaning
149 |
150 | #### power_up_reason
151 |
152 | Corresponding register: NINGBO_PWRUP_LOG_REG
153 | Meaning of each bit:
154 |
155 | | 0x01: bit0 | onkey hardware to power up |
156 | | ---------- | :-------------------------- |
157 | | 0x02: bit1 | exton1 hardware to power up |
158 | | 0x04: bit2 | exton2 hardware to power up |
159 | | 0x08: bit3 | bat hardware to power up |
160 | | 0x10: bit4 | rtc_alarm to power up |
161 | | 0x20: bit5 | fault to power up |
162 | | 0x40: bit6 | vbus_detect to power up |
163 |
164 | >
165 | > Currently in use:exton1 hardware to power up (Powerkey hardware is connected to exton1), fault to power up, vbus_detect to power up.
166 |
167 | #### power_down_reason
168 |
169 | Corresponding: NINGBO_POWERDOWN_LOG_REG
170 | Meaning of each bit:
171 |
172 | | 0x01: bit0 | over temperature to power down |
173 | | ---------- | :--------------------------------------------------------- |
174 | | 0x02: bit1 | PMIC VINLDO Voltage below 2.9 V to power down |
175 | | 0x04: bit2 | SW_PDOWN software calls power_down interface to power down |
176 | | 0x08: bit3 | None |
177 | | 0x10: bit4 | PMIC watch dog to power down |
178 | | 0x20: bit5 | long press of ONKEY to power down |
179 | | 0x40: bit6 | VINLDO overtension to power down |
180 | | 0x80: bit7 | VRTC LOW to power down |
181 |
182 | >
183 | > The long press of ONKEY power down is not currently in use.
184 |
185 | #### power_down_reason2
186 |
187 | Only the power_down_reason register is focused on currently , which does not need to be used.
188 |
189 | ### Reasons for Power-up
190 |
191 | #### Up/Down Process
192 |
193 | **1. Long press powerkey to power down**
194 | * A long press action is detected and finally PMIC_SW_PDOWN is called.
195 |
196 | **2. Hardware RESET**
197 | * The CPU RESET pin is called, the PMIC is not powered down, and the PWRUP_LOG_REG and POWERDOWN_LOG_REG registers are not updated.
198 |
199 | **3. Software RESET**
200 | * A. If PMIC_SW_RESET is called, FAULT_WAKEUP is enabled first, then SW_PDOWN is called, and then FAULT wakes up and reboots.
201 | * B. If abnormal reboot similar hardware RESET, only CPU RESET, PMIC does not power down.
202 |
203 | **4. Press powerkey to power up**
204 | * exton1 hardware to power up.
205 |
206 | **5. Plug in USB to power up**
207 | * vbus_detect to power up.
208 |
209 | #### Acquisition of Reasons for Power-up
210 |
211 | After reading power_down_reason every time you boot, its flag will be cleared, and power_up_reason will not be cleared.
212 |
213 | **1. powerkey**
214 | * Power_up_reason==0x02,power_down_reason!=0.
215 |
216 | **2. Hardware, abnormal RESET**
217 | * Since the PMIC does not power down, the PWRUP_LOG_REG register will not be updated, and the POWERDOWN_LOG_REG register will be cleared, so power_up_reason==0x02 and power_down_reason==0 are required. Or power_up_reason==0x40, and power_down_reason==0.
218 |
219 | **3. Software RESET**
220 | * If USB is plugged in, power_up_reason==0x60 and power_down_reason==0x04 are required.
221 |
222 | **4. Vbus**
223 | * Power_up_reason==0x40,且power_down_reason!=0x00.
224 |
225 | **5. Other reasons for power-up are obtained by bit meaning after the foregoing reasons.**
226 |
227 | ### Reasons for Power-down
228 |
229 | It can be obtained according to the meaning of bit as in the code.
230 |
231 | ### Use of Power-on/down Reason Interface
232 |
233 | At present, both boot side and kernel side provide power-on/down reason interface. Because the power-on/down reason flag in POWERDOWN_LOG_REG register needs to be cleared after obtaining power-on/down reason, if this interface is called on boot side, it cannot be called on kernel side, otherwise the obtained value will be abnormal. Now the boot-side interface is not called by default.
234 |
235 |
--------------------------------------------------------------------------------
/en-us/faq/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/en-us/faq/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**Video Tutorial**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**Python Basis**](/en-us/python/)
5 | * [**Python Attributes**](/en-us/api/pythonBasic.md)
6 | * [**QuecPython Standardlib**](/en-us/api/pythonStdlib.md)
7 | * [**QuecPython Classlib**](/en-us/api/QuecPythonClasslib.md)
8 | * [**QuecPython Third-partylib**](/en-us/api/QuecPythonThirdlib.md)
9 | * [**QuecPython FAQ**](/en-us/faq/)
10 | * [**Official Website**](//python.quectel.com)
11 | * [**Official Doc**](//python.quectel.com/doc/en/)
12 | * [**Download**](//python.quectel.com/down.html)
13 |
14 |
--------------------------------------------------------------------------------
/en-us/python/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/en-us/python/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**Video Tutorial**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**Python Basis**](/en-us/python/)
5 | * [**Python Attributes**](/en-us/api/pythonBasic.md)
6 | * [**QuecPython Standardlib**](/en-us/api/pythonStdlib.md)
7 | * [**QuecPython Classlib**](/en-us/api/QuecPythonClasslib.md)
8 | * [**QuecPython Third-partylib**](/en-us/api/QuecPythonThirdlib.md)
9 | * [**QuecPython FAQ**](/en-us/faq/)
10 | * [**Official Website**](//python.quectel.com)
11 | * [**Official Doc**](//python.quectel.com/doc/en/)
12 | * [**Download**](//python.quectel.com/down.html)
13 |
14 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Quectel QuecPython 类库API说明
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
33 |
34 |
35 |
36 | QuecPython Loading ...
37 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/static/css/buble.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Inconsolata|Inconsolata-Bold");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#0074d9);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#0074d9)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#34495e;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#0074d9)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#0074d9)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#fff;fill:var(--theme-color,#0074d9);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#34495e}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:16rem;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:hsla(0,0%,100%,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:0;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#0074d9);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:16rem;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#fff;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#34495e}.markdown-section p.warn{background:rgba(0,116,217,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-16rem)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-16rem;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(16rem)}body.close .sidebar-toggle{background-color:hsla(0,0%,100%,.8);transition:background-color 1s;width:0;padding:10px}body.close .content{transform:translateX(16rem)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#fff;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#0074d9);box-sizing:border-box;color:var(--theme-color,#0074d9);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#0074d9);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#0074d9);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#0074d9)}.sidebar{color:#364149;background-color:#fff}.sidebar a{color:#666;text-decoration:none}.sidebar li{list-style:none;margin:0;padding:.2em 0}.sidebar ul li ul{padding:0}.sidebar li.active{background-color:#eee}.sidebar li.active a{color:#333}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#333;font-weight:400}.markdown-section strong{color:#333;font-weight:600}.markdown-section a{color:var(--theme-color,#0074d9)}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:1.6rem;margin:0 0 1em;word-spacing:.05rem}.markdown-section h1{font-size:2rem;font-weight:500;margin:0 0 1rem}.markdown-section h2{font-size:1.8rem;font-weight:400;margin:0 0 1rem;padding:1rem 0 0}.markdown-section h3{font-size:1.5rem;margin:52px 0 1.2rem}.markdown-section h4{font-size:1.25rem}.markdown-section h5{font-size:1rem}.markdown-section h6{color:#777;font-size:1rem}.markdown-section figure,.markdown-section ol,.markdown-section p,.markdown-section ul{margin:1.2em 0}.markdown-section ol,.markdown-section ul{padding-left:1.5rem}.markdown-section li{line-height:1.5;margin:0}.markdown-section blockquote{border-left:4px solid var(--theme-color,#0074d9);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code{border-radius:3px;padding:.2em .4rem;white-space:nowrap}.markdown-section code,.markdown-section pre{background-color:#f9f9f9;font-family:Inconsolata}.markdown-section pre{border-left:2px solid #eee;font-size:16px;margin:0 0 1em;padding:0 10px 12px 0;overflow:auto;word-wrap:normal;position:relative}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#93a1a1}.token.punctuation{color:#586e75}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#268bd2}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string,.token.url{color:#2aa198}.token.entity{color:#657b83;background:#eee8d5}.token.atrule,.token.attr-value,.token.keyword{color:#a11}.token.function{color:#b58900}.token.important,.token.regex,.token.variable{color:#cb4b16}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.markdown-section pre>code{background-color:#f8f8f8;border-radius:2px;display:block;font-family:Inconsolata;line-height:1.1rem;max-width:inherit;overflow:inherit;padding:20px .8em;position:relative;white-space:inherit}.markdown-section code:after,.markdown-section code:before{letter-spacing:.05rem}code .token{-webkit-font-smoothing:initial;-moz-osx-font-smoothing:initial;min-height:1.5rem;position:relative;left:auto}
--------------------------------------------------------------------------------
/static/css/dark.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#ea6f5a);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#ea6f5a)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#c8c8c8;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#ea6f5a)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#ea6f5a)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#3f3f3f;fill:var(--theme-color,#ea6f5a);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#c8c8c8}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:300px;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:rgba(63,63,63,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:284px;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#ea6f5a);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:300px;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#3f3f3f;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#c8c8c8}.markdown-section p.warn{background:rgba(234,111,90,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(300px)}body.close .sidebar-toggle{background-color:rgba(63,63,63,.8);transition:background-color 1s;width:284px;padding:10px}body.close .content{transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#3f3f3f;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#ea6f5a);box-sizing:border-box;color:var(--theme-color,#ea6f5a);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#ea6f5a);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#ea6f5a);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#ea6f5a)}.sidebar,body{background-color:#3f3f3f}.sidebar{color:#c8c8c8}.sidebar li{margin:6px 15px 6px 0}.sidebar ul li a{color:#c8c8c8;font-size:14px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li ul{padding:0}.sidebar ul li.active>a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#657b83;font-weight:600}.markdown-section a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1{font-size:2rem;margin:0 0 1rem}.markdown-section h2{font-size:1.75rem;margin:45px 0 .8rem}.markdown-section h3{font-size:1.5rem;margin:40px 0 .6rem}.markdown-section h4{font-size:1.25rem}.markdown-section h5{font-size:1rem}.markdown-section h6{color:#777;font-size:1rem}.markdown-section figure,.markdown-section ol,.markdown-section p,.markdown-section ul{margin:1.2em 0}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:1.6rem;word-spacing:.05rem}.markdown-section ol,.markdown-section ul{padding-left:1.5rem}.markdown-section blockquote{border-left:4px solid var(--theme-color,#ea6f5a);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code{background-color:#282828;border-radius:2px;color:#657b83;font-family:Roboto Mono,Monaco,courier,monospace;margin:0 2px;padding:3px 5px;white-space:pre-wrap}.markdown-section>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) code{font-size:.8rem}.markdown-section pre{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;font-family:Roboto Mono,Monaco,courier,monospace;line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 1.4rem;position:relative;word-wrap:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8e908c}.token.namespace{opacity:.7}.token.boolean,.token.number{color:#c76b29}.token.punctuation{color:#525252}.token.property{color:#c08b30}.token.tag{color:#2973b7}.token.string{color:var(--theme-color,#ea6f5a)}.token.selector{color:#6679cc}.token.attr-name{color:#2973b7}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#22a2c9}.token.attr-value,.token.control,.token.directive,.token.unit{color:var(--theme-color,#ea6f5a)}.token.keyword{color:#e96900}.token.atrule,.token.regex,.token.statement{color:#22a2c9}.token.placeholder,.token.variable{color:#3d8fd1}.token.deleted{text-decoration:line-through}.token.inserted{border-bottom:1px dotted #202746;text-decoration:none}.token.italic{font-style:italic}.token.bold,.token.important{font-weight:700}.token.important{color:#c94922}.token.entity{cursor:help}.markdown-section pre>code{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;border-radius:2px;color:#657b83;display:block;font-family:Roboto Mono,Monaco,courier,monospace;font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:2.2em 5px;white-space:inherit}.markdown-section code:after,.markdown-section code:before{letter-spacing:.05rem}code .token{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;min-height:1.5rem;position:relative;left:auto}pre:after{color:#ccc;content:attr(data-lang);font-size:.6rem;font-weight:600;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0}.markdown-section p.tip{background-color:#282828;color:#657b83}input[type=search]{background:#4f4f4f;border-color:#4f4f4f;color:#c8c8c8}
--------------------------------------------------------------------------------
/static/css/main.css:
--------------------------------------------------------------------------------
1 | .sidebar {
2 | background-color: #f8f8f8;
3 | }
4 | .sidebar-toggle{
5 | background-color: rgba(245, 247, 250, 0);
6 | }
7 | input{
8 | border-radius: 9px;
9 | }
10 | *{
11 | transition: 0.5s all;
12 | -webkit-transition: 0.5s all;
13 | -moz-transition: 0.5s all;
14 | -o-transition: 0.5s all;
15 | -ms-transition: 0.5s all;
16 | /* font-weight:bold; */
17 | -webkit-animation: neon2 1.5s ease-in-out infinite alternate;
18 | -moz-animation: neon2 1.5s ease-in-out infinite alternate;
19 | animation: neon2 1.5s ease-in-out infinite alternate;
20 | }
21 |
22 | /* .sidebar ul li > ul li > a{ */
23 | /* padding-left: 5px; */
24 | /* border-left: 2px solid rgba(164, 166, 168, 0.3); */
25 | /* } */
26 |
27 |
28 | .sidebar ul li.active > a{
29 | border-left: 4px solid;
30 | color: var(--theme-color,#42b983) !important;
31 | border-right: 0px solid !important;
32 | background-color: rgba(255, 163, 163, 0.1);
33 | text-indent: 5px;
34 | }
35 |
36 | .markdown-section h1 {
37 | padding-top: 70px;
38 | }
39 |
40 | .markdown-section h2 {
41 | padding-top: 60px;
42 | }
43 |
44 | .markdown-section h3 {
45 | padding-top: 50px;
46 | }
47 |
48 | .markdown-section h4 {
49 | padding-top: 40px;
50 | }
51 |
52 | .markdown-section h5 {
53 | padding-top: 30px;
54 | margin-bottom: 0rem !important;
55 | }
56 |
57 | .markdown-section blockquote{
58 | margin-top: 0rem !important;
59 | margin-bottom: 0rem !important;
60 | margin-left: 2rem !important;
61 | background-color: #f8f8f8;
62 | }
63 |
64 | .markdown-section code.lang-python, .markdown-section pre{
65 | background-color: #333 !important;
66 | border-radius: 9px;
67 |
68 | }
69 |
70 | .markdown-section code.lang-c, .markdown-section pre{
71 | background-color: #333 !important;
72 | border-radius: 9px;
73 |
74 | }
75 |
76 | .markdown-section code.lang-json, .markdown-section pre{
77 | background-color: #333 !important;
78 | border-radius: 9px;
79 |
80 | }
81 |
82 | .markdown-section code.lang-, .markdown-section pre{
83 | background-color: #333 !important;
84 | border-radius: 9px;
85 |
86 | }
87 |
88 | .docsify-copy-code-button:focus, pre:hover .docsify-copy-code-button{
89 | border-radius: 9px;
90 | opacity: 0.8 !important;
91 | margin-top: 0.2rem;
92 | margin-right: 0.2rem;
93 | }
94 |
95 | .token.punctuation{
96 | color:#B0E0E6;
97 | }
98 | .lang-python{
99 | color:white !important;
100 | }
101 | .lang-c{
102 | color:white !important;
103 | }
104 | .lang-json{
105 | color:white !important;
106 | }
107 | .lang-{
108 | color:white !important;
109 | }
110 |
111 | body.close .sidebar-toggle {
112 | background-color: rgba(0, 0, 0, 0);
113 | transition: background-color 1s;
114 | width: 284px;
115 | padding: 10px;
116 | }
117 |
118 | thead > tr{
119 | background-color: #dc143c;
120 | border: 2px solid #dc143c;
121 | color: white;
122 | line-height: 1.8rem;
123 | }
124 |
125 | .github-corner{
126 | opacity: 0.5 !important;
127 | }
128 |
129 | .github-corner:hover{
130 | opacity: 1 !important;
131 | }
132 |
--------------------------------------------------------------------------------
/static/css/pure.css:
--------------------------------------------------------------------------------
1 | *{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#000);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#000)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#000;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#000)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#000)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#fff;fill:var(--theme-color,#000);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#000}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:300px;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:hsla(0,0%,100%,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:284px;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#000);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:300px;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#fff;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#000}.markdown-section p.warn{background:rgba(0,0,0,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(300px)}body.close .sidebar-toggle{background-color:hsla(0,0%,100%,.8);transition:background-color 1s;width:284px;padding:10px}body.close .content{transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#fff;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#000);box-sizing:border-box;color:var(--theme-color,#000);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#000);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#000);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#000)}
--------------------------------------------------------------------------------
/static/css/sidebar.min.css:
--------------------------------------------------------------------------------
1 | @import"../js/jquery.sidebar.min.js";
2 | /*或者@importurl(style2.css);*/
3 | .app-sub-sidebar li:before {
4 | content: "";
5 | padding-right: 4px;
6 | float: left;
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/static/css/vue.css:
--------------------------------------------------------------------------------
1 | @import url("https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#42b983);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#42b983)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#34495e;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#42b983)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#42b983)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#fff;fill:var(--theme-color,#42b983);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#34495e}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:300px;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:hsla(0,0%,100%,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:284px;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#42b983);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:300px;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#fff;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#34495e}.markdown-section p.warn{background:rgba(66,185,131,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(300px)}body.close .sidebar-toggle{background-color:hsla(0,0%,100%,.8);transition:background-color 1s;width:284px;padding:10px}body.close .content{transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#fff;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#42b983);box-sizing:border-box;color:var(--theme-color,#42b983);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#42b983);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#42b983);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#42b983)}.sidebar,body{background-color:#fff}.sidebar{color:#364149}.sidebar li{margin:6px 0}.sidebar ul li a{color:#505d6b;font-size:14px;font-weight:400;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li ul{padding:0}.sidebar ul li.active>a{border-right:2px solid;color:var(--theme-color,#42b983);font-weight:600}.app-sub-sidebar li:before{content:"-";padding-right:4px;float:left}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#2c3e50;font-weight:600}.markdown-section a{color:var(--theme-color,#42b983);font-weight:600}.markdown-section h1{font-size:2rem;margin:0 0 1rem}.markdown-section h2{font-size:1.75rem;margin:45px 0 .8rem}.markdown-section h3{font-size:1.5rem;margin:40px 0 .6rem}.markdown-section h4{font-size:1.25rem}.markdown-section h5{font-size:1rem}.markdown-section h6{color:#777;font-size:1rem}.markdown-section figure,.markdown-section p{margin:1.2em 0}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:1.6rem;word-spacing:.05rem}.markdown-section ol,.markdown-section ul{padding-left:1.5rem}.markdown-section blockquote{border-left:4px solid var(--theme-color,#42b983);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code,.markdown-section output:after,.markdown-section pre{font-family:Roboto Mono,Monaco,courier,monospace}.markdown-section code,.markdown-section pre{background-color:#f8f8f8}.markdown-section output,.markdown-section pre{margin:1.2em 0;position:relative}.markdown-section output,.markdown-section pre>code{border-radius:2px;display:block}.markdown-section output:after,.markdown-section pre>code{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial}.markdown-section code{border-radius:2px;color:#e96900;margin:0 2px;padding:3px 5px;white-space:pre-wrap}.markdown-section>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) code{font-size:.8rem}.markdown-section pre{padding:0 1.4rem;line-height:1.5rem;overflow:auto;word-wrap:normal}.markdown-section pre>code{color:#525252;font-size:.8rem;padding:2.2em 5px;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;white-space:inherit}.markdown-section output{padding:1.7rem 1.4rem;border:1px dotted #ccc}.markdown-section output>:first-child{margin-top:0}.markdown-section output>:last-child{margin-bottom:0}.markdown-section code:after,.markdown-section code:before,.markdown-section output:after,.markdown-section output:before{letter-spacing:.05rem}.markdown-section output:after,.markdown-section pre:after{color:#ccc;font-size:.6rem;font-weight:600;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0;content:attr(data-lang)}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8e908c}.token.namespace{opacity:.7}.token.boolean,.token.number{color:#c76b29}.token.punctuation{color:#525252}.token.property{color:#c08b30}.token.tag{color:#2973b7}.token.string{color:var(--theme-color,#42b983)}.token.selector{color:#6679cc}.token.attr-name{color:#2973b7}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#22a2c9}.token.attr-value,.token.control,.token.directive,.token.unit{color:var(--theme-color,#42b983)}.token.function,.token.keyword{color:#e96900}.token.atrule,.token.regex,.token.statement{color:#22a2c9}.token.placeholder,.token.variable{color:#3d8fd1}.token.deleted{text-decoration:line-through}.token.inserted{border-bottom:1px dotted #202746;text-decoration:none}.token.italic{font-style:italic}.token.bold,.token.important{font-weight:700}.token.important{color:#c94922}.token.entity{cursor:help}code .token{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;min-height:1.5rem;position:relative;left:auto}
--------------------------------------------------------------------------------
/static/js/countable.min.js:
--------------------------------------------------------------------------------
1 | var defaultOptions={countable:!0,position:"top",margin:"10px",float:"right",fontsize:"0.9em",color:"rgb(90,90,90)",language:"english",isExpected:!0};function plugin(t,n){if(!defaultOptions.countable)return;let o;t.beforeEach(function(t){return o=t.match(/([\u4e00-\u9fa5]+?|[a-zA-Z0-9]+)/g).length,t}),t.afterEach(function(t,n){let i=o+" words",e=Math.ceil(o/400)+" min";"chinese"===defaultOptions.language&&(i=o+" 字",e=Math.ceil(o/400)+" 分钟"),n(`\n ${"bottom"===defaultOptions.position?t:""}\n \n
\n ${i}\n ${defaultOptions.isExpected?` | ${e}`:""}\n \n
\n
\n ${"bottom"!==defaultOptions.position?t:""}\n `)})}window.$docsify.count=Object.assign(defaultOptions,window.$docsify.count),window.$docsify.plugins=[].concat(plugin,window.$docsify.plugins);
--------------------------------------------------------------------------------
/static/js/docsify-copy-code.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * docsify-copy-code
3 | * v2.1.1
4 | * https://github.com/jperasmus/docsify-copy-code
5 | * (c) 2017-2020 JP Erasmus
6 | * MIT license
7 | */
8 | !function(){"use strict";function s(o){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}!function(o,e){void 0===e&&(e={});var t=e.insertAt;if(o&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css","top"===t&&n.firstChild?n.insertBefore(c,n.firstChild):n.appendChild(c),c.styleSheet?c.styleSheet.cssText=o:c.appendChild(document.createTextNode(o))}}(".docsify-copy-code-button,.docsify-copy-code-button span{cursor:pointer;transition:all .25s ease}.docsify-copy-code-button{position:absolute;z-index:1;top:0;right:0;overflow:visible;padding:.65em .8em;border:0;border-radius:0;outline:0;font-size:1em;background:grey;background:var(--theme-color,grey);color:#fff;opacity:0}.docsify-copy-code-button span{border-radius:3px;background:inherit;pointer-events:none}.docsify-copy-code-button .error,.docsify-copy-code-button .success{position:absolute;z-index:-100;top:50%;right:0;padding:.5em .65em;font-size:.825em;opacity:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.docsify-copy-code-button.error .error,.docsify-copy-code-button.success .success{right:100%;opacity:1;-webkit-transform:translate(-115%,-50%);transform:translate(-115%,-50%)}.docsify-copy-code-button:focus,pre:hover .docsify-copy-code-button{opacity:1}"),document.querySelector('link[href*="docsify-copy-code"]')&&console.warn("[Deprecation] Link to external docsify-copy-code stylesheet is no longer necessary."),window.DocsifyCopyCodePlugin={init:function(){return function(o,e){o.ready(function(){console.warn("[Deprecation] Manually initializing docsify-copy-code using window.DocsifyCopyCodePlugin.init() is no longer necessary.")})}}},window.$docsify=window.$docsify||{},window.$docsify.plugins=[function(o,r){o.doneEach(function(){var o=Array.apply(null,document.querySelectorAll("pre[data-lang]")),c={buttonText:"Copy to clipboard",errorText:"Error",successText:"Copied"};r.config.copyCode&&Object.keys(c).forEach(function(t){var n=r.config.copyCode[t];"string"==typeof n?c[t]=n:"object"===s(n)&&Object.keys(n).some(function(o){var e=-1',''.concat(c.buttonText,""),''.concat(c.errorText,""),''.concat(c.successText,""),""].join("");o.forEach(function(o){o.insertAdjacentHTML("beforeend",e)})}),o.mounted(function(){document.querySelector(".content").addEventListener("click",function(o){if(o.target.classList.contains("docsify-copy-code-button")){var e="BUTTON"===o.target.tagName?o.target:o.target.parentNode,t=document.createRange(),n=e.parentNode.querySelector("code"),c=window.getSelection();t.selectNode(n),c.removeAllRanges(),c.addRange(t);try{document.execCommand("copy")&&(e.classList.add("success"),setTimeout(function(){e.classList.remove("success")},1e3))}catch(o){console.error("docsify-copy-code: ".concat(o)),e.classList.add("error"),setTimeout(function(){e.classList.remove("error")},1e3)}"function"==typeof(c=window.getSelection()).removeRange?c.removeRange(t):"function"==typeof c.removeAllRanges&&c.removeAllRanges()}})})}].concat(window.$docsify.plugins||[])}();
9 | //# sourceMappingURL=docsify-copy-code.min.js.map
10 |
--------------------------------------------------------------------------------
/static/js/docsify-pagination.min.js:
--------------------------------------------------------------------------------
1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";var t,p=(function(t,e){function n(t,e){return e.querySelector(t)}(e=t.exports=function(t,e){return n(t,e=e||document)}).all=function(t,e){return(e=e||document).querySelectorAll(t)},e.engine=function(t){if(!t.one)throw new Error(".one callback required");if(!t.all)throw new Error(".all callback required");return n=t.one,e.all=t.all,e}}(t={exports:{}},t.exports),t.exports);p.all,p.engine;try{var a=p}catch(t){a=p}var e=Element.prototype,r=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector,u=function(t,e){if(!t||1!==t.nodeType)return!1;if(r)return r.call(t,e);for(var n=a.all(e,t.parentNode),i=0;i*{line-height:1;vertical-align:middle}.pagination-item-label svg{height:.8em;width:auto;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1px}.pagination-item--next{margin-left:auto;text-align:right}.pagination-item--next svg{margin-left:.5em}.pagination-item--previous svg{margin-right:.5em}.pagination-item-title{font-size:1.6em}.pagination-item-subtitle{text-transform:uppercase;opacity:.3}");var o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function i(t,e){for(var n=0;n ul > li"),p("p",e)),this.hyperlink=m(t))}return l(n,[{key:"toJSON",value:function(){if(this.hyperlink)return{name:this.hyperlink.innerText,href:this.hyperlink.getAttribute("href"),chapterName:this.chapter&&this.chapter.innerText||""}}}]),n}();var x={container:function(){return''},inner:function(t,e){return[t.prev&&'\n \n ",t.next&&'\n \n "].filter(Boolean).join("")}};window.$docsify=window.$docsify||{},window.$docsify.plugins=[function(t,e){var n=c({},s(e.config),e.config.pagination||{});function i(){var t=p("."+h);t&&(t.innerHTML=x.inner(function(t,e){var n=e.crossChapter,i=e.routerMode;try{var a=i===d.HISTORY?t.route.path:"#"+t.route.path,r=g(p.all(".sidebar-nav li a")).filter(function(t){return!u(t,".section-link")}),o=r.find(v(a)),l=g((f(o,"ul")||{}).children).filter(function(t){return"LI"===t.tagName.toUpperCase()}),c=n?r.findIndex(v(a)):l.findIndex(function(t){var e=m(t);return e&&v(a,e)}),s=n?r:l;return{prev:new y(s[c-1]).toJSON(),next:new y(s[c+1]).toJSON()}}catch(t){return{}}}(e,n),n))}t.afterEach(function(t){return t+x.container()}),t.doneEach(function(){return i()})}].concat(window.$docsify.plugins||[])});
--------------------------------------------------------------------------------
/static/js/docsify-scroll-to-top.min.js:
--------------------------------------------------------------------------------
1 | var CONFIG={auto:true,text:"Top",right:15,bottom:15,offset:500};var install=function(hook,vm){var opts=vm.config.scrollToTop||CONFIG;CONFIG.auto=opts.auto&&typeof opts.auto==="boolean"?opts.auto:CONFIG.auto;CONFIG.text=opts.text&&typeof opts.text==="string"?opts.text:CONFIG.text;CONFIG.right=opts.right&&typeof opts.right==="number"?opts.right:CONFIG.right;CONFIG.bottom=opts.bottom&&typeof opts.bottom==="number"?opts.bottom:CONFIG.bottom;CONFIG.offset=opts.offset&&typeof opts.offset==="number"?opts.offset:CONFIG.offset;var onScroll=function(e){if(!CONFIG.auto){return}var offset=window.document.documentElement.scrollTop;var $scrollBtn=Docsify.dom.find("span.scroll-to-top");$scrollBtn.style.display=offset>=CONFIG.offset?"block":"none"};hook.mounted(function(){var scrollBtn=document.createElement("span");scrollBtn.className="scroll-to-top";scrollBtn.style.display=CONFIG.auto?"none":"block";scrollBtn.style.overflow="hidden";scrollBtn.style.position="fixed";scrollBtn.style.right=CONFIG.right+"px";scrollBtn.style.bottom=CONFIG.bottom+"px";scrollBtn.style.width="50px";scrollBtn.style.height="50px";scrollBtn.style.background="white";scrollBtn.style.color="#666";scrollBtn.style.border="1px solid #ddd";scrollBtn.style.borderRadius="4px";scrollBtn.style.lineHeight="42px";scrollBtn.style.fontSize="16px";scrollBtn.style.textAlign="center";scrollBtn.style.boxShadow="0px 0px 6px #eee";scrollBtn.style.cursor="pointer";var textNode=document.createTextNode(CONFIG.text);scrollBtn.appendChild(textNode);document.body.appendChild(scrollBtn);window.addEventListener("scroll",onScroll);scrollBtn.onclick=function(e){e.stopPropagation();var step=window.scrollY/15;var scroll=function(){window.scrollTo(0,window.scrollY-step);if(window.scrollY>0){setTimeout(scroll,15)}};scroll()}})};$docsify.plugins=[].concat(install,$docsify.plugins);
--------------------------------------------------------------------------------
/static/js/docsify-sidebar-collapse.min.js:
--------------------------------------------------------------------------------
1 | !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var t;function a(e){if(e&&null!=t){var n=e.getBoundingClientRect().top;document.querySelector(".sidebar").scrollBy(0,n-t)}}function n(){requestAnimationFrame(function(){var e=document.querySelector(".app-sub-sidebar > .active");if(e)for(e.parentNode.parentNode.querySelectorAll(".app-sub-sidebar").forEach(function(e){return e.classList.remove("open")});e.parentNode.classList.contains("app-sub-sidebar")&&!e.parentNode.classList.contains("open");)e.parentNode.classList.add("open"),e=e.parentNode})}function o(e){t=e.target.getBoundingClientRect().top;var n=s(e.target,"LI",2);n&&(n.classList.contains("open")?(n.classList.remove("open"),setTimeout(function(){n.classList.add("collapse")},0)):(!function(e){if(e)for(e.classList.remove("open","active");e&&"sidebar-nav"!==e.className&&e.parentNode;)"LI"!==e.parentNode.tagName&&"app-sub-sidebar"!==e.parentNode.className||e.parentNode.classList.remove("open"),e=e.parentNode}(r()),i(n),setTimeout(function(){n.classList.remove("collapse")},0)),a(n))}function r(){var e=document.querySelector(".sidebar-nav .active");e||(e=s(document.querySelector('.sidebar-nav a[href="'.concat(decodeURIComponent(location.hash).replace(/ /gi,"%20"),'"]')),"LI",2))&&e.classList.add("active");return e}function i(e){if(e)for(e.classList.add("open","active");e&&"sidebar-nav"!==e.className&&e.parentNode;)"LI"!==e.parentNode.tagName&&"app-sub-sidebar"!==e.parentNode.className||e.parentNode.classList.add("open"),e=e.parentNode}function s(e,n,t){if(e&&e.tagName===n)return e;for(var a=0;e;){if(t<++a)return;if(e.parentNode.tagName===n)return e.parentNode;e=e.parentNode}}e(".sidebar-nav > ul > li ul {\n display: none;\n}\n\n.app-sub-sidebar {\n display: none;\n}\n\n.app-sub-sidebar.open {\n display: block;\n}\n\n.sidebar-nav .open > ul:not(.app-sub-sidebar),\n.sidebar-nav .active:not(.collapse) > ul {\n display: block;\n}\n\n/* 抖动 */\n.sidebar-nav li.open:not(.collapse) > ul {\n display: block;\n}\n\n.active + ul.app-sub-sidebar {\n display: block;\n}\n"),document.addEventListener("scroll",n);e("@media screen and (max-width: 768px) {\n /* 移动端适配 */\n .markdown-section {\n max-width: none;\n padding: 16px;\n }\n /* 改变原来按钮热区大小 */\n .sidebar-toggle {\n padding: 0 0 10px 10px;\n }\n /* my pin */\n .sidebar-pin {\n appearance: none;\n outline: none;\n position: fixed;\n bottom: 0;\n border: none;\n width: 40px;\n height: 40px;\n background: transparent;\n }\n}\n");var d="DOCSIFY_SIDEBAR_PIN_FLAG";function c(){var e=localStorage.getItem(d);e="true"===e,localStorage.setItem(d,!e),document.querySelector(".content").style.transform=e?document.querySelector(".sidebar").style.transform="translateX(0)":document.querySelector(".sidebar").style.transform="translateX(300px)"}!function(){if(!(7681){return self.each(function(){$(this).sidebar(options)})}var width=self.outerWidth();var height=self.outerHeight();var settings=$.extend({speed:200,side:"left",isClosed:false,close:true},options);self.on("sidebar:open",function(ev,data){var properties={};properties[settings.side]=0;settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=false;self.trigger("sidebar:opened")})});self.on("sidebar:close",function(ev,data){var properties={};if(settings.side==="left"||settings.side==="right"){properties[settings.side]=-self.outerWidth()}else{properties[settings.side]=-self.outerHeight()}settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=true;self.trigger("sidebar:closed")})});self.on("sidebar:toggle",function(ev,data){if(settings.isClosed){self.trigger("sidebar:open",[data])}else{self.trigger("sidebar:close",[data])}});function closeWithNoAnimation(){self.trigger("sidebar:close",[{speed:0}])}if(!settings.isClosed&&settings.close){closeWithNoAnimation()}$(window).on("resize",function(){if(!settings.isClosed){return}closeWithNoAnimation()});self.data("sidebar",settings);return self};$.fn.sidebar.version="3.3.2"})(jQuery);
2 |
--------------------------------------------------------------------------------
/static/js/prism-bash.min.js:
--------------------------------------------------------------------------------
1 | !function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=a.variable[1].inside,o=0;o/g,function(){return"(?:\\\\.|[^\\\\\n\r]|(?:\n|\r\n?)(?![\r\n]))"}),RegExp("((?:^|[^\\\\])(?:\\\\{2})*)(?:"+n+")")}var e="(?:\\\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\\\|\r\n`])+",t="\\|?__(?:\\|__)+\\|?(?:(?:\n|\r\n?)|(?![^]))".replace(/__/g,function(){return e}),a="\\|?[ \t]*:?-{3,}:?[ \t]*(?:\\|[ \t]*:?-{3,}:?[ \t]*)+\\|?(?:\n|\r\n?)";s.languages.markdown=s.languages.extend("markup",{}),s.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"font-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:s.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+t+a+"(?:"+t+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+t+a+")(?:"+t+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(e),inside:s.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+t+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+t+"$"),inside:{"table-header":{pattern:RegExp(e),alias:"important",inside:s.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n("\\b__(?:(?!_)|_(?:(?!_))+_)+__\\b|\\*\\*(?:(?!\\*)|\\*(?:(?!\\*))+\\*)+\\*\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n("\\b_(?:(?!_)|__(?:(?!_))+__)+_\\b|\\*(?:(?!\\*)|\\*\\*(?:(?!\\*))+\\*\\*)+\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n("(~~?)(?:(?!~))+\\2"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n('!?\\[(?:(?!\\]))+\\](?:\\([^\\s)]+(?:[\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \t]?\\[(?:(?!\\]))+\\])'),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(e){["url","bold","italic","strike","code-snippet"].forEach(function(n){e!==n&&(s.languages.markdown[e].inside.content.inside[n]=s.languages.markdown[n])})}),s.hooks.add("after-tokenize",function(n){"markdown"!==n.language&&"md"!==n.language||!function n(e){if(e&&"string"!=typeof e)for(var t=0,a=e.length;t",quot:'"'},u=String.fromCodePoint||String.fromCharCode;s.languages.md=s.languages.markdown}(Prism);
--------------------------------------------------------------------------------
/static/js/prism-nginx.min.js:
--------------------------------------------------------------------------------
1 | !function(e){var n=/\$(?:\w[a-z\d]*(?:_[^\x00-\x1F\s"'\\()$]*)?|\{[^}\s"'\\]+\})/i;Prism.languages.nginx={comment:{pattern:/(^|[\s{};])#.*/,lookbehind:!0},directive:{pattern:/(^|\s)\w(?:[^;{}"'\\\s]|\\.|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\s+(?:#.*(?!.)|(?![#\s])))*?(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:{string:{pattern:/((?:^|[^\\])(?:\\\\)*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,lookbehind:!0,inside:{escape:{pattern:/\\["'\\nrt]/,alias:"entity"},variable:n}},comment:{pattern:/(\s)#.*/,lookbehind:!0,greedy:!0},keyword:{pattern:/^\S+/,greedy:!0},boolean:{pattern:/(\s)(?:off|on)(?!\S)/,lookbehind:!0},number:{pattern:/(\s)\d+[a-z]*(?!\S)/i,lookbehind:!0},variable:n}},punctuation:/[{};]/}}();
--------------------------------------------------------------------------------
/static/js/prism-python.js:
--------------------------------------------------------------------------------
1 | Prism.languages.python = {
2 | 'comment': {
3 | pattern: /(^|[^\\])#.*/,
4 | lookbehind: true
5 | },
6 | 'string-interpolation': {
7 | pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
8 | greedy: true,
9 | inside: {
10 | 'interpolation': {
11 | // "{" "}"
12 | pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
13 | lookbehind: true,
14 | inside: {
15 | 'format-spec': {
16 | pattern: /(:)[^:(){}]+(?=\}$)/,
17 | lookbehind: true
18 | },
19 | 'conversion-option': {
20 | pattern: //,
21 | alias: 'punctuation'
22 | },
23 | rest: null
24 | }
25 | },
26 | 'string': /[\s\S]+/
27 | }
28 | },
29 | 'triple-quoted-string': {
30 | pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,
31 | greedy: true,
32 | alias: 'string'
33 | },
34 | 'string': {
35 | pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
36 | greedy: true
37 | },
38 | 'function': {
39 | pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
40 | lookbehind: true
41 | },
42 | 'class-name': {
43 | pattern: /(\bclass\s+)\w+/i,
44 | lookbehind: true
45 | },
46 | 'decorator': {
47 | pattern: /(^[\t ]*)@\w+(?:\.\w+)*/im,
48 | lookbehind: true,
49 | alias: ['annotation', 'punctuation'],
50 | inside: {
51 | 'punctuation': /\./
52 | }
53 | },
54 | 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
55 | 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
56 | 'boolean': /\b(?:True|False|None)\b/,
57 | 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?\b/i,
58 | 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
59 | 'punctuation': /[{}[\];(),.:]/
60 | };
61 |
62 | Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
63 |
64 | Prism.languages.py = Prism.languages.python;
65 |
--------------------------------------------------------------------------------
/static/js/prism-python.min.js:
--------------------------------------------------------------------------------
1 | Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},"string-interpolation":{pattern:/(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/im,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:True|False|None)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python;
--------------------------------------------------------------------------------
/static/js/prism.min.js:
--------------------------------------------------------------------------------
1 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(o){var u=/\blang(?:uage)?-([\w-]+)\b/i,t=0,e={},j={manual:o.Prism&&o.Prism.manual,disableWorkerMessageHandler:o.Prism&&o.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof C?new C(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=i.reach);y+=b.value.length,b=b.next){var v=b.value;if(n.length>t.length)return;if(!(v instanceof C)){var F,k=1;if(m){if(!(F=O(f,y,t,p)))break;var x=F.index,w=F.index+F[0].length,P=y;for(P+=b.value.length;P<=x;)b=b.next,P+=b.value.length;if(P-=b.value.length,y=P,b.value instanceof C)continue;for(var A=b;A!==n.tail&&(Pi.reach&&(i.reach=_);v=b.prev;S&&(v=z(n,v,S),y+=S.length),T(n,v,k);$=new C(l,d?j.tokenize($,d):$,h,$);b=z(n,v,$),E&&z(n,b,E),1i.reach&&(i.reach=_.reach))}}}}}(e,r,t,r.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=j.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=j.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}},Token:C};function C(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function O(e,t,n,a){e.lastIndex=t;n=e.exec(n);return n&&a&&n[1]&&(a=n[1].length,n.index+=a,n[0]=n[0].slice(a)),n}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function z(e,t,n){var a=t.next,n={value:n,prev:t,next:a};return t.next=n,a.prev=n,e.length++,n}function T(e,t,n){for(var a=t.next,r=0;r"+r.content+""+r.tag+">"},!o.document)return o.addEventListener&&(j.disableWorkerMessageHandler||o.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,e=t.code,t=t.immediateClose;o.postMessage(j.highlight(e,j.languages[n],n)),t&&o.close()},!1)),j;var n=j.util.currentScript();function a(){j.manual||j.highlightAll()}return n&&(j.filename=n.src,n.hasAttribute("data-manual")&&(j.manual=!0)),j.manual||("loading"===(e=document.readyState)||"interactive"===e&&n&&n.defer?document.addEventListener("DOMContentLoaded",a):window.requestAnimationFrame?window.requestAnimationFrame(a):window.setTimeout(a,16)),j}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism),Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;n={"included-cdata":{pattern://i,inside:n}};n["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};t={};t[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;e=e.languages.markup;e&&(e.tag.addInlined("style","css"),e.tag.addAttribute("style","css"))}(Prism),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(){var i,l,o,u,a,e;function c(e,t){var n=(n=e.className).replace(a," ")+" language-"+t;e.className=n.replace(/\s+/g," ").trim()}void 0!==Prism&&"undefined"!=typeof document&&(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},u="pre[data-src]:not(["+(l="data-src-status")+'="loaded"]):not(['+l+'="'+(o="loading")+'"])',a=/\blang(?:uage)?-([\w-]+)\b/i,Prism.hooks.add("before-highlightall",function(e){e.selector+=", "+u}),Prism.hooks.add("before-sanity-check",function(e){var t,n,a,r,s=e.element;s.matches(u)&&(e.code="",s.setAttribute(l,o),(t=s.appendChild(document.createElement("CODE"))).textContent="Loading…",n=s.getAttribute("data-src"),"none"===(e=e.language)&&(a=(/\.(\w+)$/.exec(n)||[,"none"])[1],e=i[a]||a),c(t,e),c(s,e),(a=Prism.plugins.autoloader)&&a.loadLanguages(e),(r=new XMLHttpRequest).open("GET",n,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?(s.setAttribute(l,"loaded"),t.textContent=r.responseText,Prism.highlightElement(t)):(s.setAttribute(l,"failed"),400<=r.status?t.textContent="✖ Error "+r.status+" while fetching file: "+r.statusText:t.textContent="✖ Error: File does not exist or is empty"))},r.send(null))}),e=!(Prism.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(u),a=0;t=n[a++];)Prism.highlightElement(t)}}),Prism.fileHighlight=function(){e||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),e=!0),Prism.plugins.fileHighlight.highlight.apply(this,arguments)})}();
--------------------------------------------------------------------------------
/static/js/search.min.js:
--------------------------------------------------------------------------------
1 | !function(){var u={},m={EXPIRE_KEY:"docsify.search.expires",INDEX_KEY:"docsify.search.index"};function h(e){return e.text||"table"!==e.type||(e.cells.unshift(e.header),e.text=e.cells.map(function(e){return e.join(" | ")}).join(" |\n ")),e.text}function f(e){return e.text||"list"!==e.type||(e.text=e.raw),e.text}function g(r,e,o,s){void 0===e&&(e="");var c,e=window.marked.lexer(e),d=window.Docsify.slugify,l={},p="";return e.forEach(function(e,n){if("heading"===e.type&&e.depth<=s){var t=function(e){void 0===e&&(e="");var a={};return{str:e=e&&e.replace(/^'/,"").replace(/'$/,"").replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g,function(e,n,t){return-1===n.indexOf(":")?(a[n]=t&&t.replace(/"/g,"")||!0,""):e}).trim(),config:a}}(e.text),a=t.str,t=t.config;c=t.id?o.toURL(r,{id:d(t.id)}):o.toURL(r,{id:d((t=e.text,i={"&":"&","<":"<",">":">",'"':""","'":"'"},String(t).replace(/[&<>"']/g,function(e){return i[e]})))}),a&&(p=a.replace(//,"").replace(/{docsify-ignore}/,"").replace(//,"").replace(/{docsify-ignore-all}/,"").trim()),l[c]={slug:c,title:p,body:""}}else{if(0===n&&(c=o.toURL(r),l[c]={slug:c,title:"/"!==r?r.slice(1):"Home Page",body:e.text||""}),!c)return;l[c]?l[c].body?(e.text=h(e),e.text=f(e),l[c].body+="\n"+(e.text||"")):(e.text=h(e),e.text=f(e),l[c].body=l[c].body?l[c].body+e.text:e.text):l[c]={slug:c,title:"",body:""}}var i}),d.clear(),l}function p(e){return e&&e.normalize?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):e}function r(i,r){var t,a,n,e,o="auto"===i.paths,s=o?(t=r.router,a=[],Docsify.dom.findAll(".sidebar-nav a:not(.section-link):not([data-nosearch])").forEach(function(e){var n=e.href,e=e.getAttribute("href"),n=t.parse(n).path;n&&-1===a.indexOf(n)&&!Docsify.util.isAbsolutePath(e)&&a.push(n)}),a):i.paths,c="";s.length&&o&&i.pathNamespaces?(n=s[0],Array.isArray(i.pathNamespaces)?c=i.pathNamespaces.filter(function(e){return n.slice(0,e.length)===e})[0]||c:i.pathNamespaces instanceof RegExp&&((d=n.match(i.pathNamespaces))&&(c=d[0])),e=-1===s.indexOf(c+"/"),d=-1===s.indexOf(c+"/README"),e&&d&&s.unshift(c+"/")):-1===s.indexOf("/")&&-1===s.indexOf("/README")&&s.unshift("/");var d,l=((d=i.namespace)?m.EXPIRE_KEY+"/"+d:m.EXPIRE_KEY)+c,p=((d=i.namespace)?m.INDEX_KEY+"/"+d:m.INDEX_KEY)+c,c=localStorage.getItem(l)l.length&&(a=l.length),t="..."+c.substring(n,a).replace(t,function(e){return''+e+""})+"...",o+=t)}),0\n\n'+e.title+"
\n"+e.content+"
\n\n"}),t.classList.add("show"),a.classList.add("show"),t.innerHTML=r||''+s+"
",o.hideOtherSidebarContent&&(i.classList.add("hide"),n.classList.add("hide"))}function d(e){o=e}function l(e,n){var t,a,i=n.router.parse().query.s;d(e),Docsify.dom.style("\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .input-wrap {\n display: flex;\n align-items: center;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 0 7px;\n line-height: 36px;\n font-size: 14px;\n border: 1px solid transparent;\n}\n\n.search input:focus {\n box-shadow: 0 0 5px var(--theme-color, #42b983);\n border: 1px solid var(--theme-color, #42b983);\n}\n\n.search input::-webkit-search-decoration,\n.search input::-webkit-search-cancel-button,\n.search input {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n.search .clear-button {\n cursor: pointer;\n width: 36px;\n text-align: right;\n display: none;\n}\n\n.search .clear-button.show {\n display: block;\n}\n\n.search .clear-button svg {\n transform: scale(.5);\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}\n\n.app-name.hide, .sidebar-nav.hide {\n display: none;\n}"),function(e){void 0===e&&(e="");var n='\n \n ',e=Docsify.dom.create("div",n),n=Docsify.dom.find("aside");Docsify.dom.toggleClass(e,"search"),Docsify.dom.before(n,e)}(i),n=Docsify.dom.find("div.search"),a=Docsify.dom.find(n,"input"),e=Docsify.dom.find(n,".input-wrap"),Docsify.dom.on(n,"click",function(e){return-1===["A","H2","P","EM"].indexOf(e.target.tagName)&&e.stopPropagation()}),Docsify.dom.on(a,"input",function(n){clearTimeout(t),t=setTimeout(function(e){return c(n.target.value.trim())},100)}),Docsify.dom.on(e,"click",function(e){"INPUT"!==e.target.tagName&&(a.value="",c())}),i&&setTimeout(function(e){return c(i)},500)}function y(e,n){var t,a,i,r,o;d(e),t=e.placeholder,a=n.route.path,(r=Docsify.dom.getNode('.search input[type="search"]'))&&("string"==typeof t?r.placeholder=t:(i=Object.keys(t).filter(function(e){return-1v.scrollOffset&&setTimeout(p,150))}),window.addEventListener("resize",p);var b={open:o,close:p,toggle:d,update:function(e){var t=0 一种全新的物联网开发方式
3 | > A new way of IoT development.
4 |
5 |
6 | ## 概述 Overview
7 | 使用QuecPython,你可以使用Python快速实现各种物联网应用,简单、高效、可靠。
8 | With QuecPython, you can develop any IoT application much esaier. It's easy, efficient and reliable.
9 |
10 |
11 | ## 特性 Feature
12 | * 无需编译,随写随测 No need complie anymore
13 | * 轻松入门,易于上手 Easy to use
14 | * 完整API More API
15 | * 丰富用例 More API Demo
16 | * 垂直行业方案 IoT industry Solutions
17 | * 代码加密,安全可靠 Code encrypt
18 |
19 | ## 立即开始 Getting started
20 |
21 | * 如果您是python新手,对python语法尚不熟悉,可以先从[python基础](/zh-cn/python/)开始阅读
22 | * 为了便于开发者更快上手QuecPython,我们提供了[文档中心](https://python.quectel.com/doc),您可以按照文档中心学习顺序来进行学习和实践
23 | * 开发过程中遇到的问题可以从[QuecPython FAQ&DEBUG](https://python.quectel.com/doc/doc/FAQ/zh/index.html)中获取解决办法,如果您还有其他问题,可以在我们的[工单系统](https://workorder.quectel.com/)提交您的问题以获取帮助
24 |
25 | ## 了解更多 More
26 | 请访问我们的 [官网](//qpy.quectel.com)
27 | Please visit our official website.
--------------------------------------------------------------------------------
/zh-cn/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/zh-cn/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**视频教程**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**python基础**](/zh-cn/python/)
5 |
6 | * [**python 基本属性**](/zh-cn/api/pythonBasic.md)
7 | * [**QuecPython 标准库**](/zh-cn/api/pythonStdlib.md)
8 | * [**QuecPython 类库**](/zh-cn/api/QuecPythonClasslib.md)
9 | * [**QuecPython 第三方库**](/zh-cn/api/QuecPythonThirdlib.md)
10 | * [**QuecPython 异常处理**](/zh-cn/faq/)
11 |
12 |
13 | * [**官方网站**](//python.quectel.com)
14 | * [**文档中心**](//python.quectel.com/doc/)
15 | * [**资料下载**](//python.quectel.com/download)
--------------------------------------------------------------------------------
/zh-cn/api/README.md:
--------------------------------------------------------------------------------
1 | !> [入门请参考文档中心](https://python.quectel.com/doc/)
2 |
3 | [python 基本属性](/zh-cn/api/pythonBasic.md)
4 |
5 | [python 标准库](/zh-cn/api/pythonStdlib.md)
6 |
7 | [QuecPython 类库](/zh-cn/api/QuecPythonClasslib.md)
8 |
9 | [QuecPython 第三方库](/zh-cn/api/QuecPythonThirdlib.md)
10 |
11 |
--------------------------------------------------------------------------------
/zh-cn/api/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/zh-cn/api/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**视频教程**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**python基础**](/zh-cn/python/)
5 |
6 | * [**python 基本属性**](/zh-cn/api/pythonBasic.md)
7 | * [**QuecPython 标准库**](/zh-cn/api/pythonStdlib.md)
8 | * [**QuecPython 类库**](/zh-cn/api/QuecPythonClasslib.md)
9 | * [**QuecPython 第三方库**](/zh-cn/api/QuecPythonThirdlib.md)
10 | * [**QuecPython 异常处理**](/zh-cn/faq/)
11 |
12 |
13 | * [**官方网站**](//python.quectel.com)
14 | * [**文档中心**](//python.quectel.com/doc/)
15 | * [**资料下载**](//python.quectel.com/download)
--------------------------------------------------------------------------------
/zh-cn/api/pythonBasic.md:
--------------------------------------------------------------------------------
1 | ### 内置函数
2 |
3 | Python 解释器内置了很多函数和类型,您可以在任何时候使用它们,以下按字母表顺序列出它们。更多信息请参阅CPython文档:[Built-in Functions](https://docs.python.org/3.5/library/functions.html)
4 |
5 | | | | 内置函数 | | |
6 | | --------- | ------------- | ------------ | -------------- | ---------- |
7 | | abs() | all() | any() | bin() | callable() |
8 | | chr() | classmethod() | compile() | delattr() | dir() |
9 | | divmod() | enumerate() | eval() | exec() | filter() |
10 | | getattr() | globals() | hasattr() | hash() | hex() |
11 | | id() | input() | isinstance() | issubclass() | iter() |
12 | | len() | locals() | map() | max() | min() |
13 | | next() | oct() | open() | ord() | pow() |
14 | | print() | property() | range() | repr() | reversed() |
15 | | round() | setattr() | sorted() | staticmothed() | sum() |
16 | | super() | type() | zip() | | |
17 |
18 |
19 |
20 | ### 内置常量
21 |
22 | 有少数的常量存在与内置命名空间中,如下表所示。更多信息请参阅阅CPython文档:[Built-in Constants](https://docs.python.org/3.5/library/constants.html)
23 |
24 | | 内置常量 | |
25 | | -------------- | ------------------------------------------------------------ |
26 | | False | bool 类型的假值 |
27 | | True | bool 类型的真值 |
28 | | None | Nonetype类型的唯一值 |
29 | | \_\_debug\_\_ | Python没有以 -O 选项启动,则此常量为真值 |
30 | | Ellipsis | 与用户定义的容器数据类型的扩展切片语法结合使用 |
31 | | NotImplemented | 二进制特殊方法应返回的特殊值(例如,__eq()__、__lt()__等)表示操作没有针对其他类型实现 |
32 |
33 |
34 |
35 | ### 内置类型
36 |
37 | 下表列出内置的数据类型,更多详情请参阅阅CPython文档:[Built-in Types](https://docs.python.org/3.5/library/stdtypes.html)
38 |
39 | | 内置类型 | |
40 | | ---------- | ---------------------------------- |
41 | | int | 整数,数值类型 |
42 | | float | 浮点数,数值类型 |
43 | | complex | 复数,数值类型 |
44 | | bool | bool,数值类型 |
45 | | list | 列表,序列类型 |
46 | | tuple | 元组,序列类型 |
47 | | range | range对象,序列类型 |
48 | | str | 字符串,序列类型 |
49 | | bytes | 单个字节构成的不可变序列,序列类型 |
50 | | bytearray | bytes对象的可变对应物,序列类型 |
51 | | memoryview | 二进制序列 |
52 | | dict | 字典,映射类型 |
53 | | set | 集合 |
54 | | frozenset | 集合,不可修改,具有哈希值 |
55 | | object | 对象,python3.x后class默认的基类 |
--------------------------------------------------------------------------------
/zh-cn/api/pythonStdlib.md:
--------------------------------------------------------------------------------
1 | #### uos - 基本系统服务
2 |
3 | uos模块包含文件系统访问和挂载构建,该模块实现了CPython模块相应模块的子集。更多信息请参阅阅CPython文档:[os](https://docs.python.org/3.5/library/os.html#module-os)
4 |
5 | ##### 删除文件
6 |
7 | > **uos.remove(path)**
8 |
9 | 删除文件。path表示文件名。
10 |
11 | ##### 改变当前目录
12 |
13 | > **uos.chdir(path)**
14 |
15 | 改变当前目录。path表示目录名。
16 |
17 | ##### 获取当前路径
18 |
19 | > **uos.getcwd()**
20 |
21 | 获取当前路径。
22 |
23 | ##### 列出指定目录文件
24 |
25 | > **uos.listdir( [dir] )**
26 |
27 | 没有参数列出当前目录文件,否则列出给定目录的文件。dir为可选参数,表示目录名,默认为 ‘/’ 目录。
28 |
29 | 示例:
30 |
31 | ```
32 | >>> uos.listdir()
33 | [‘file1’, ‘read.txt’, ‘demo.py’]
34 | ```
35 |
36 | ##### 创建新目录
37 |
38 | > **uos.mkdir(path)**
39 |
40 | 创建一个新的目录。path表示准备创建的目录名。
41 |
42 | 示例:
43 |
44 | ```
45 | >>> uos.mkdir('testdir')
46 | >>> uos.listdir()
47 | [‘file1’, ‘read.txt’, ‘demo.py’, 'testdir']
48 | ```
49 |
50 | ##### 重命名文件
51 |
52 | > **uos.rename(old_path, new_path)**
53 |
54 | 重命名文件。old_path表示旧文件或目录名,new_path表示新文件或目录名。
55 |
56 | 示例:
57 |
58 | ```
59 | >>> uos.rename('testdir', 'testdir1')
60 | ```
61 |
62 | ##### 删除指定目录
63 |
64 | > **uos.rmdir(path)**
65 |
66 | 删除指定目录。path表示目录名。
67 |
68 | 示例:
69 |
70 | ```
71 | >>> uos.rmdir('testdir')
72 | >>> uos.listdir()
73 | [‘file1’, ‘read.txt’, ‘demo.py’]
74 | ```
75 |
76 | ##### 列出当前目录参数
77 |
78 | > **uos.ilistdir( [dir] )**
79 |
80 | 该函数返回一个迭代器,该迭代器会生成所列出条目对应的3元组。dir为可选参数,表示目录名,没有参数时,默认列出当前目录,有参数时,则列出dir参数指定的目录。元组的形式为 `(name, type, inode[, size])`:
81 |
82 | * name 是条目的名称,字符串类型,如果dir是字节对象,则名称为字节;
83 | * type 是条目的类型,整型数,0x4000表示目录,0x8000表示常规文件;
84 | * 是一个与文件的索引节点相对应的整数,对于没有这种概念的文件系统来说,可能为0;
85 | * 一些平台可能会返回一个4元组,其中包含条目的size。对于文件条目,size表示文件大小的整数,如果未知,则为-1。对于目录项,其含义目前尚未定义。
86 |
87 | ##### 获取文件或目录的状态
88 |
89 | > **uos.stat(path)**
90 |
91 | 获取文件或目录的状态。path表示文件或目录名。返回值是一个元组,返回值形式为:
92 |
93 | `(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)`
94 |
95 | * `mode` – inode保护模式
96 | * `ino` – inode节点号
97 | * `dev` – inode驻留的设备
98 | * `nlink` – inode的链接数
99 | * `uid ` – 所有者的用户ID
100 | * `gid` – 所有者的组ID
101 | * `size` – 文件大小,单位字节
102 | * `atime` – 上次访问的时间
103 | * `mtime` – 最后一次修改的时间
104 | * `ctime` – 操作系统报告的“ctime”,在某些系统上是最新的元数据更改的时间,在其它系统上是创建时间,详细信息参见平台文档
105 |
106 | ##### 获取文件系统状态信息
107 |
108 | > **uos.statvfs(path)**
109 |
110 | 获取文件系统状态信息。path表示文件或目录名。返回一个包含文件系统信息的元组:
111 |
112 | `(f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files, f_ffree, f_favail, f_flag, f_namemax)`
113 |
114 | * `f_bsize` – 文件系统块大小,单位字节
115 | * `f_frsize` – 分栈大小,单位字节
116 | * `f_blocks` – 文件系统数据块总数
117 | * `f_bfree` – 可用块数
118 | * `f_bavai` – 非超级用户可获取的块数
119 | * `f_files` – 文件结点总数
120 | * `f_ffree` – 可用文件结点数
121 | * `f_favail` – 超级用户的可用文件结点数
122 | * `f_flag` – 挂载标记
123 | * `f_namemax` – 最大文件长度,单位字节
124 |
125 | 示例:
126 |
127 | ```
128 | >>> import uos
129 | >>> res = uos.statvfs("main.py")
130 | >>> print(res)
131 | (4096, 4096, 256, 249, 249, 0, 0, 0, 0, 255)
132 | ```
133 |
134 | ##### 获取关于底层信息或其操作系统的信息
135 |
136 | > **uos.uname()**
137 |
138 | 获取关于底层信息或其操作系统的信息。该接口与micropython官方接口返回值形式有所区别,返回一个元组,形式为:
139 |
140 | `(sysname, nodename, release, version, machine)`
141 |
142 | * `sysname` – 底层系统的名称,string类型
143 | * `nodename` – 网络名称(可以与 sysname 相同) ,string类型
144 | * `release` – 底层系统的版本,string类型
145 | * `version` – MicroPython版本和构建日期,string类型
146 | * `machine` – 底层硬件(如主板、CPU)的标识符,string类型
147 | * `qpyver` – QuecPython 短版本号,string类型
148 |
149 | 示例:
150 |
151 | ```python
152 | >>> import uos
153 | >>> uos.uname()
154 | ('sysname=EC600S-CNLB', 'nodename=EC600S', 'release=1.12.0', 'version=v1.12 on 2020-06-23', 'machine=EC600S with QUECTEL', 'qpyver=V0001')
155 | >>> uos.uname()[0].split('=')[1] # 可通过这种方式来获取sysname的值
156 | 'EC600S-CNLB'
157 | ```
158 |
159 |
160 |
161 | > **uos.uname2()**
162 |
163 | 获取关于底层信息或其操作系统的信息。该接口与micropython官方接口返回值形式一致。注意与上面uos.uname()接口返回值的区别,返回值形式为:
164 |
165 | `(sysname='xxx', nodename='xxx', release='xxx', version='xxx', machine='xxx', qpyver='xxx')`
166 |
167 | * `sysname` – 底层系统的名称,string类型
168 | * `nodename` – 网络名称(可以与 sysname 相同) ,string类型
169 | * `release` – 底层系统的版本,string类型
170 | * `version` – MicroPython版本和构建日期,string类型
171 | * `machine` – 底层硬件(如主板、CPU)的标识符,string类型
172 | * `qpyver` – QuecPython 短版本号,string类型
173 |
174 | 示例:
175 |
176 | ```python
177 | >>> import uos
178 | >>> uos.uname2()
179 | (sysname='EC600S-CNLB', nodename='EC600S', release='1.12.0', version='v1.12 on 2020-06-23', machine='EC600S with QUECTEL', qpyver='V0001')
180 | >>> uos.uname2().sysname # 可通过这种方式直接获取sysname的值
181 | 'EC600S-CNLB'
182 | >>> uos.uname2().machine
183 | 'EC600S with QUECTEL'
184 | ```
185 |
186 |
187 |
188 | ##### 返回具有*n个*随机字节的bytes对象
189 |
190 | > **uos.urandom(n)**
191 |
192 | 返回具有*n个*随机字节的bytes对象,只要有可能,它就会由硬件随机数生成器生成。
193 |
194 | 示例:
195 |
196 | ```
197 | >>> import uos
198 | >>> uos.urandom(5)
199 | b'\xb3\xc9Y\x1b\xe9'
200 | ```
201 |
202 |
203 |
204 | ##### 注册存储设备 - SPI - SD卡
205 |
206 | 目前仅EC600N/EC800N平台支持。
207 |
208 | > **uos.VfsFat(spi_port, spimode, spiclk, spics)**
209 |
210 | 初始化SD卡,和SD卡通信。使用SPI通信方式。
211 |
212 | * 参数
213 |
214 | | 参数 | 参数类型 | 参数说明 |
215 | | -------- | -------- | ------------------------------------------------------------ |
216 | | spi_port | int | 通道选择[0,1] |
217 | | spimode | int | SPI 的工作模式(模式0最常用):
时钟极性CPOL: 即SPI空闲时,时钟信号SCLK的电平(0:空闲时低电平; 1:空闲时高电平)
0 : CPOL=0, CPHA=0
1 : CPOL=0, CPHA=1
2: CPOL=1, CPHA=0
3: CPOL=1, CPHA=1 |
218 | | spiclk | int | 时钟频率 0 : 812.5kHz 1 : 1.625MHz 2 : 3.25MHz 3 : 6.5MHz 4 : 13MHz |
219 | | spics | int | 指定CS片选引脚为任意GPIO,硬件CS可以接这里指定的脚,也可以接默认的SPI CS脚
1~n:指定Pin.GPIO1~Pin.GPIOn为CS脚 |
220 |
221 | * 返回值
222 |
223 | 成功则返回VfsFat object,失败则会卡住。
224 |
225 | * 示例
226 |
227 | ```python
228 | >>> cdev = uos.VfsFat(1, 0, 4, 1)
229 | ```
230 |
231 |
232 |
233 | ##### 注册存储设备 - SDIO - SD卡
234 |
235 | 目前仅EC600U/EC200U平台支持。
236 |
237 | > **VfsSd(str)**
238 |
239 | 初始化SD卡,使用SDIO通信方式。
240 |
241 | * 参数
242 |
243 | | 参数 | 参数类型 | 参数说明 |
244 | | ---- | -------- | ----------------------------------- |
245 | | str | str | 传入"sd_fs" |
246 |
247 | * 返回值
248 |
249 | 成功则返回vfs object,失败则会报错。
250 |
251 | - 引脚说明
252 |
253 | | 平台 | 引脚 |
254 | | ------ | ------------------------------------------------------------ |
255 | | EC600U | CMD:引脚号48
DATA0:引脚号39
DATA1:引脚号40
DATA2:引脚号49
DATA3:引脚号50
CLK:引脚号132 |
256 | | EC200U | CMD:引脚号33
DATA0:引脚号31
DATA1:引脚号30
DATA2:引脚号29
DATA3:引脚号28
CLK:引脚号32 |
257 |
258 | * 示例
259 |
260 | ```python
261 | >>> from uos import VfsSd
262 | >>> udev = VfsSd("sd_fs")
263 | ```
264 |
265 | ###### 设置检测管脚
266 |
267 | > **set_det(vfs_obj.GPIOn,mode)**
268 |
269 | 指定sd卡插拔卡的检测管脚和模式。
270 |
271 | * 参数
272 |
273 | | 参数 | 参数类型 | 参数说明 |
274 | | ------------- | -------- | ------------------------------------------------------------ |
275 | | vfs_obj.GPIOn | int | 用于sd卡插拔卡检测的GPIO引脚号,参照Pin模块的定义 |
276 | | mode | int | 0:sd卡插上后,检测口为低电平;sd卡取出后,检测口为高电平
1:sd卡插上后,检测口为高电平;sd卡取出后,检测口为低电平 |
277 |
278 | * 返回值
279 |
280 | 成功返回0,失败返回-1。
281 |
282 | * 示例
283 |
284 | ```python
285 | >>> from uos import VfsSd
286 | >>> udev = VfsSd("sd_fs")
287 | >>> uos.mount(udev, '/sd')
288 | >>> udev.set_det(udev.GPIO10,0)#使用GPIO10作为卡检测管脚,sd卡插上,检测口为低电平,sd卡取出,检测口为高电平(实际使用根据硬件)
289 | ```
290 |
291 | ###### 设置插拔卡回调函数
292 |
293 | > **set_callback(fun)**
294 |
295 | 设定发生插拔卡事件时的用户回调函数。
296 |
297 | * 参数
298 |
299 | | 参数 | 参数类型 | 参数说明 |
300 | | ---- | -------- | ------------------------------------------------------------ |
301 | | fun | function | 插拔卡回调 [ind_type]
ind_type: 事件类型,0:拔卡 1:插卡 |
302 |
303 | * 返回值
304 |
305 | 成功返回0,失败返回-1。
306 |
307 |
308 | SD卡使用示例(SDIO接口)
309 |
310 | 目前仅EC600U/EC200U平台支持。
311 |
312 | ```python
313 | from uos import VfsSd
314 | import ql_fs
315 | udev = VfsSd("sd_fs")
316 | uos.mount(udev, '/sd')
317 | udev.set_det(udev.GPIO10,0)
318 | #文件读写
319 | f = open('/sd/test.txt','w+')
320 | f.write('1234567890abcdefghijkl')
321 | f.close()
322 | uos.listdir('/sd')
323 | f = open('/sd/test.txt','r')
324 | f.read()
325 | f.close()
326 | #插拔卡回调函数
327 | def call_back(para):
328 | if(para == 1):
329 | print("insert")
330 | print(uos.listdir('/usr'))
331 | print(ql_fs.file_copy('/usr/1.txt','/sd/test.txt'))#复制sd卡里的test.txt内容到usr下的1.txt中
332 | print(uos.listdir('/usr'))
333 | elif(para == 0):
334 | print("plug out")
335 |
336 | udev.set_callback(call_back)
337 | ```
338 |
339 |
340 |
341 | ##### **注册存储设备 - SPI NOR FLASH**
342 |
343 | 目前仅EG915U支持
344 |
345 | > uos.VfsLfs1(readsize,progsize,lookahead,pname,spi_port,spi_clk)
346 |
347 | 初始化spi nor flash,和外挂nor flash通信。使用SPI通信方式。
348 |
349 | * 参数
350 |
351 | | 参数 | 参数类型 | 参数说明 |
352 | | --------- | -------- | ------------------------------------------------------------ |
353 | | readsize | int | 预留,暂未使用 |
354 | | progsize | int | 预留,暂未使用 |
355 | | lookahead | int | 预留,暂未使用 |
356 | | pname | str | 固定为“ext_fs”。后续扩展 |
357 | | spi_port | int | 支持的端口参照SPI章节说明 |
358 | | spi_clk | int | 时钟频率:
EG915U:0:6.25M 1:12.5M 2:25M 3:50M 4:3.125M 5:1.5625M 6:781.25K |
359 |
360 | * 返回值
361 |
362 | 成功则返回VfsLfs1 object,失败则 OSError 19。
363 |
364 | * 示例
365 |
366 | ```python
367 | >>>ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",1,0)
368 | >>>uos.mount(ldev,'/ext')
369 | >>>f = open('/ext/test.txt','w+')
370 | >>>f.write('hello world!!!')
371 | >>>f.close()
372 |
373 | >>>uos.listdir('ext')
374 |
375 | >>>f = open('/ext/test.txt','r')
376 | >>>f.read()
377 | >>>f.close()
378 |
379 | ```
380 |
381 |
382 |
383 |
384 | ##### 挂载文件系统
385 |
386 | > **uos.mount(vfs_obj, path)**
387 |
388 | 挂载底层文件系统到VFS。
389 |
390 | * 参数
391 |
392 | | 参数 | 参数类型 | 参数说明 |
393 | | ------- | ---------- | ---------------- |
394 | | vfs_obj | vfs object | 文件系统对象 |
395 | | path | str | 文件系统的根目录 |
396 |
397 | * 返回值
398 |
399 | 无。
400 |
401 | * 示例
402 |
403 | ```python
404 | >>> cdev = uos.VfsFat(1, 0, 4, 1)
405 | >>> uos.mount(cdev, '/sd')
406 | ```
407 |
408 | - SD卡(SPI接口)使用示例
409 |
410 | 目前仅EC600N/EC800N平台支持。
411 |
412 | ```python
413 | >>> cdev = uos.VfsFat(1, 0, 4, 1)
414 | >>> uos.mount(cdev, '/sd')
415 | >>> f = open('/sd/test.txt','w+')
416 | >>> f.write('0123456')
417 | >>> f.close()
418 | >>> uos.listdir('/sd')
419 | >>> f = open('/sd/test.txt','r')
420 | >>> f.read()
421 | >>> f.close()
422 | ```
423 |
424 |
425 |
426 | #### gc - 内存碎片回收
427 |
428 | gc 模块实现内存垃圾回收机制,该模块实现了CPython模块相应模块的子集。更多信息请参阅阅CPython文档:[gc](https://docs.python.org/3.5/library/gc.html#module-gc)
429 |
430 | ##### 启用自动回收内存碎片机制
431 |
432 | > **gc.enable()**
433 |
434 | 启用自动回收内存碎片机制。
435 |
436 | ##### 禁用自动回收机制
437 |
438 | > **gc.disable()**
439 |
440 | 禁用自动回收机制。
441 |
442 | ##### 回收内存碎片
443 |
444 | > **gc.collect()**
445 |
446 | 回收内存碎片。
447 |
448 | ##### 返回分配的堆RAM的字节数
449 |
450 | > **gc.mem_alloc()**
451 |
452 | 返回分配的堆RAM的字节数。此功能是MicroPython扩展。
453 |
454 | ##### 返回可用堆RAM的字节数
455 |
456 | > **gc.mem_free()**
457 |
458 | 返回可用堆RAM的字节数,如果此数量未知,则返回-1。此功能是MicroPython扩展。
459 |
460 |
461 |
462 | #### ubinascii - 二进制与ASCII转换
463 |
464 | ubinascii 模块实现了二进制数据与各种ASCII编码之间的转换(双向),该模块实现了CPython模块相应模块的子集。更多信息请参阅阅CPython文档:[binascii](https://docs.python.org/3.5/library/binascii.html#module-binascii)
465 |
466 | ##### 解码base64编码的数据
467 |
468 | > **ubinascii.a2b_base64(data)**
469 |
470 | 解码base64编码的数据,会自动忽略输入中的无效字符,返回 bytes 对象。
471 |
472 | ##### 以base64格式编码二进制数据
473 |
474 | > **ubinascii.b2a_base64(data)**
475 |
476 | 以base64格式编码二进制数据,返回编码数据。后面跟换行符,作为 bytes 对象。
477 |
478 | ##### 将二进制数据转换为十六进制字符串表示
479 |
480 | > **ubinascii.hexlify(data, [sep])**
481 |
482 | 将二进制数据转换为十六进制字符串表示。
483 |
484 | 示例:
485 |
486 | ```
487 | >>> import ubinascii
488 | # 没有sep参数
489 | >>> ubinascii.hexlify('\x11\x22123')
490 | b'1122313233'
491 | >>> ubinascii.hexlify('abcdfg')
492 | b'616263646667'
493 | # 指定了第二个参数sep,它将用于分隔两个十六进制数
494 | >>> ubinascii.hexlify('\x11\x22123', ' ')
495 | b'11 22 31 32 33'
496 | >>> ubinascii.hexlify('\x11\x22123', ',')
497 | b'11,22,31,32,33'
498 | ```
499 |
500 | ##### 将十六进制形式的字符串转换成二进制形式的字符串表示
501 |
502 | > **ubinascii.unhexlify(data)**
503 |
504 | 将十六进制形式的字符串转换成二进制形式的字符串表示。
505 |
506 | 示例:
507 |
508 | ```
509 | >>> import ubinascii
510 | >>> ubinascii.unhexlify('313222')
511 | b'12"'
512 | ```
513 |
514 |
515 |
516 | #### ucollections - 集合和容器类型
517 |
518 | ucollections 模块用于创建一个新的容器类型,用于保存各种对象。该模块实现了CPython模块相应模块的子集。更多信息请参阅阅CPython文档:[collections](https://docs.python.org/3.5/library/collections.html#module-collections)
519 |
520 | ##### 创建一个新namedtuple容器类型
521 |
522 | > **mytuple = ucollections.namedtuple(name, fields)**
523 |
524 | 创建一个具有特定名称和一组字段的新namedtuple容器类型,namedtuple是元组的子类,允许通过索引来访问它的字段。
525 |
526 | 参数
527 |
528 | | 参数 | 参数类型 | 参数说明 |
529 | | ------ | -------- | ------------------------------ |
530 | | name | str | 新创建容器的类型名称 |
531 | | fields | tuple | 新创建容器类型包含子类型的字段 |
532 |
533 | 示例:
534 |
535 | ```
536 | >>> import ucollections
537 | >>> mytuple = ucollections.namedtuple("mytuple", ("id", "name"))
538 | >>> t1 = mytuple(1, "foo")
539 | >>> t2 = mytuple(2, "bar")
540 | >>> print(t1.name)
541 | foo
542 | ```
543 |
544 | ##### 创建deque双向队列
545 |
546 | > **dq = ucollections.deque(iterable, maxlen, flag)**
547 |
548 | 创建deque双向队列
549 |
550 | * 参数
551 |
552 | | 参数 | 参数类型 | 参数说明 |
553 | | -------- | -------- | ------------------------------------------------------------ |
554 | | iterable | tuple | iterable必须是空元组 |
555 | | maxlen | int | 指定maxlen并将双端队列限制为此最大长度 |
556 | | flag | int | 可选参数;0(默认):不检查队列是否溢出,达到最大长度时继续append会丢弃之前的值 ,1:当队列达到最大设定长度会抛出IndexError: full |
557 |
558 | * 返回值
559 |
560 | deque对象
561 |
562 |
563 |
564 | ##### deque对象方法
565 |
566 | > **dq.append(data)**
567 |
568 | 往队列中插入值。
569 |
570 | * 参数
571 |
572 | | 参数 | 参数类型 | 参数说明 |
573 | | ---- | ------------ | -------------------- |
574 | | data | 基本数据类型 | 需要添加到队列的数值 |
575 |
576 | * 返回值
577 |
578 | 无
579 |
580 | ##### 从deque的左侧移除并返回移除的数据
581 |
582 | > **dq.popleft()**
583 |
584 | 从deque的左侧移除并返回移除的数据。如果deque为空,会引起索引错误
585 |
586 | * 参数
587 |
588 | 无
589 |
590 | * 返回值
591 |
592 | 返回pop出的值
593 |
594 |
595 |
596 | **使用示例**
597 |
598 | ```python
599 | from ucollections import deque
600 |
601 | dq = deque((),5)
602 | dq.append(1)
603 | dq.append(["a"])
604 | dq.append("a")
605 |
606 | dq.popleft() # 1
607 | dq.popleft() # ["a"]
608 | dq.popleft() # a
609 | ```
610 |
611 |
612 |
613 | #### urandom - 生成随机数
614 |
615 | urandom 模块提供了生成随机数的工具。
616 |
617 | ##### 随机生成对象 obj 中的元素
618 |
619 | > **urandom.choice(obj)**
620 |
621 | 随机生成对象 obj 中的元素,obj 类型 string。
622 |
623 | 示例:
624 |
625 | ```
626 | >>> import urandom
627 | >>> urandom.choice("QuecPython")
628 | 't'
629 | ```
630 |
631 | ##### 随机产生一个在k bits范围内的十进制数
632 |
633 | > **urandom.getrandbits(k)**
634 |
635 | 随机产生一个在k bits范围内的十进制数。
636 |
637 | 示例:
638 |
639 | ```
640 | >>> import urandom
641 | >>> urandom.getrandbits(1) #1位二进制位,范围为0~1(十进制:0~1)
642 | 1
643 | >>> urandom.getrandbits(1)
644 | 0
645 | >>> urandom.getrandbits(8) #8位二进制位,范围为0000 0000~1111 11111(十进制:0~255)
646 | 224
647 | ```
648 |
649 | ##### 随机生成一个 start 到 end 之间的整数
650 |
651 | > **urandom.randint(start, end)**
652 |
653 | 随机生成一个 start 到 end 之间的整数。
654 |
655 | 示例:
656 |
657 | ```
658 | >>> import urandom
659 | >>> urandom.randint(1, 4)
660 | 4
661 | >>> urandom.randint(1, 4)
662 | 2
663 | ```
664 |
665 | ##### 随机生成一个 0 到 1 之间的浮点数
666 |
667 | > **urandom.random()**
668 |
669 | 随机生成一个 0 到 1 之间的浮点数。
670 |
671 | 示例:
672 |
673 | ```
674 | >>> import urandom
675 | >>> urandom.random()
676 | 0.8465231
677 | ```
678 |
679 | ##### 随机生成 start 到 end 间并且递增为 step 的正整数
680 |
681 | > **urandom.randrange(start, end, step)**
682 |
683 | 随机生成 start 到 end 间并且递增为 step 的正整数。
684 |
685 | 示例:
686 |
687 | ```
688 | >>> import urandom
689 | >>> urandom.randrange(0, 8, 2)
690 | 0
691 | >>> urandom.randrange(0, 8, 2)
692 | 6
693 | ```
694 |
695 | ##### 指定随机数种子
696 |
697 | > **urandom.seed(sed)**
698 |
699 | 指定随机数种子,通常和其它随机数生成函数搭配使用。
700 |
701 | 示例:
702 |
703 | ```
704 | >>> import urandom
705 | >>> urandom.seed(20) #指定随机数种子
706 | >>> for i in range(0, 15): #生成0~15范围内的随机序列
707 | ... print(urandom.randint(1, 10))
708 | ...
709 | 8
710 | 10
711 | 9
712 | 10
713 | 2
714 | 1
715 | 9
716 | 3
717 | 2
718 | 2
719 | 6
720 | 1
721 | 10
722 | 9
723 | 6
724 | ```
725 |
726 | ##### 随机生成 start 到 end 范围内的浮点数
727 |
728 | > **urandom.uniform(start, end)**
729 |
730 | 随机生成 start 到 end 范围内的浮点数。
731 |
732 | 示例:
733 |
734 | ```
735 | >>> import urandom
736 | >>> urandom.uniform(3, 5)
737 | 3.219261
738 | >>> urandom.uniform(3, 5)
739 | 4.00403
740 | ```
741 |
742 | **使用示例**
743 |
744 | ```python
745 | '''
746 | @Author: Baron
747 | @Date: 2020-06-22
748 | @LastEditTime: 2020-06-22 17:16:20
749 | @Description: example for module urandom
750 | @FilePath: example_urandom_file.py
751 | '''
752 | import urandom as random
753 | import log
754 | import utime
755 |
756 | '''
757 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
758 | '''
759 | PROJECT_NAME = "QuecPython_Random_example"
760 | PROJECT_VERSION = "1.0.0"
761 |
762 | log.basicConfig(level=log.INFO)
763 | random_log = log.getLogger("random")
764 |
765 |
766 | if __name__ == '__main__':
767 | # urandom.randint(start, end)
768 | # 随机1 ~ 4之间
769 | num = random.randint(1, 4)
770 | random_log.info(num)
771 |
772 | # random between 0~1
773 | num = random.random()
774 | random_log.info(num)
775 |
776 | # urandom.unifrom(start, end)
777 | # 在开始和结束之间生成浮点数
778 | num = random.uniform(2, 4)
779 | random_log.info(num)
780 |
781 | # urandom.randrange(start, end, step)
782 | # 2-bit binary,the range is [00~11] (0~3)
783 | num = random.getrandbits(2)
784 | random_log.info(num)
785 |
786 | # 8-bit binary,the range is [0000 0000~1111 11111] (0~255)
787 | num = random.getrandbits(8)
788 | random_log.info(num)
789 |
790 | # urandom.randrange(start, end, step)
791 | # 从开始到结束随机生成递增的正整数
792 | num = random.randrange(2, 8, 2)
793 | random_log.info(num)
794 |
795 | # urandom.choice(obj)
796 | # 随机生成对象中元素的数量
797 | num = random.choice("QuecPython")
798 | random_log.info(num)
799 |
800 | ```
801 |
802 |
803 |
804 | #### math - 数学运算
805 |
806 | math 模块提供数学运算函数。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[math](https://docs.python.org/3.5/library/math.html#module-math)
807 |
808 | ##### 返回x的y次方
809 |
810 | > **math.pow(x, y)**
811 |
812 | 返回x的y次方,返回值是浮点数。
813 |
814 | 示例:
815 |
816 | ```
817 | >>> import math
818 | >>> math.pow(2, 3)
819 | 8.0
820 | ```
821 |
822 | ##### 返回x的反余弦弧度值
823 |
824 | > **math.acos(x)**
825 |
826 | 返回x的反余弦弧度值,返回值为浮点数。x是-1~1之间的数,包括-1和1,如果小于-1或者大于1,会产生错误。
827 |
828 | 示例:
829 |
830 | ```
831 | >>> import math
832 | >>> math.acos(0.6)
833 | 0.9272952
834 | ```
835 |
836 | ##### 返回x的反正弦弧度值
837 |
838 | > **math.asin(x)**
839 |
840 | 返回x的反正弦弧度值,返回值为浮点数。x是-1~1之间的数,包括-1和1,如果小于-1或者大于1,会产生错误。
841 |
842 | 示例:
843 |
844 | ```
845 | >>> import math
846 | >>> math.asin(-1)
847 | -1.570796
848 | ```
849 |
850 | ##### 返回x的反正切弧度值
851 |
852 | > **math.atan(x)**
853 |
854 | 返回x的反正切弧度值,返回值为浮点数。
855 |
856 | 示例:
857 |
858 | ```
859 | >>> import math
860 | >>> math.atan(-8)
861 | -1.446441
862 | >>> math.atan(6.4)
863 | 1.4158
864 | ```
865 |
866 | ##### 返回给定的 X 及 Y 坐标值的反正切值
867 |
868 | > **math.atan2(x, y)**
869 |
870 | 返回给定的 X 及 Y 坐标值的反正切值,返回值为浮点数。
871 |
872 | 示例:
873 |
874 | ```
875 | >>> import math
876 | >>> math.atan2(-0.50,0.48)
877 | -0.8058035
878 | >>> math.atan2(7, 9)
879 | 0.6610432
880 | ```
881 |
882 | ##### 返回数字的上入整数
883 |
884 | > **math.ceil(x)**
885 |
886 | 返回数字的上入整数。
887 |
888 | 示例:
889 |
890 | ```
891 | >>> import math
892 | >>> math.ceil(4.1)
893 | 5
894 | ```
895 |
896 | ##### 把y的正负号加到x前面
897 |
898 | > **math.copysign(x, y)**
899 |
900 | 把y的正负号加到x前面,可以使用0,返回值为浮点数。
901 |
902 | 示例:
903 |
904 | ```
905 | >>> import math
906 | >>> math.copysign(5, 0)
907 | 5.0
908 | >>> math.copysign(5, -4)
909 | -5.0
910 | >>> math.copysign(5, 9)
911 | 5.0
912 | ```
913 |
914 | ##### 返回x的弧度的余弦值
915 |
916 | > **math.cos(x)**
917 |
918 | 返回x的弧度的余弦值,范围再-1~1之间,返回值为浮点数。
919 |
920 | 示例:
921 |
922 | ```
923 | >>> import math
924 | >>> math.cos(3)
925 | -0.9899925
926 | ```
927 |
928 | ##### 将弧度转换为角度
929 |
930 | > **math.degrees(x)**
931 |
932 | 将弧度转换为角度,返回值为浮点数。
933 |
934 | 示例:
935 |
936 | ```
937 | >>> import math
938 | >>> math.degrees(5)
939 | 286.4789
940 | >>> math.degrees(math.pi/2)
941 | 90.0
942 | ```
943 |
944 | ##### 数学常量 `e`
945 |
946 | > **math.e**
947 |
948 | 数学常量 `e`,`e`即自然常数。
949 |
950 | ##### 返回e的x次幂
951 |
952 | > **math.exp(x)**
953 |
954 | 返回e的x次幂,返回值为浮点数。
955 |
956 | 示例:
957 |
958 | ```
959 | >>> import math
960 | >>> math.exp(1)
961 | 2.718282
962 | >>> print(math.e)
963 | 2.718282
964 | ```
965 |
966 | ##### 返回数字的绝对值
967 |
968 | > **math.fabs(x)**
969 |
970 | 返回数字的绝对值,返回值为浮点数。
971 |
972 | 示例:
973 |
974 | ```
975 | >>> import math
976 | >>> math.fabs(-3.88)
977 | 3.88
978 | ```
979 |
980 | ##### 返回数字的下舍整数
981 |
982 | > **math.floor(x)**
983 |
984 | 返回数字的下舍整数。
985 |
986 | 示例:
987 |
988 | ```
989 | >>> import math
990 | >>> math.floor(8.7)
991 | 8
992 | >>> math.floor(9)
993 | 9
994 | >>> math.floor(-7.6)
995 | -8
996 | ```
997 |
998 | ##### 返回x/y的余数
999 |
1000 | > **math.fmod(x, y)**
1001 |
1002 | 返回x/y的余数,返回值为浮点数。
1003 |
1004 | 示例:
1005 |
1006 | ```
1007 | >>> import math
1008 | >>> math.fmod(15, 4)
1009 | 3.0
1010 | >>> math.fmod(15, 3)
1011 | 0.0
1012 | ```
1013 |
1014 | ##### 返回由x的小数部分和整数部分组成的元组
1015 |
1016 | > **math.modf(x)**
1017 |
1018 | 返回由x的小数部分和整数部分组成的元组。
1019 |
1020 | 示例:
1021 |
1022 | ```
1023 | >>> import math
1024 | >>> math.modf(17.592)
1025 | (0.5919991, 17.0)
1026 | ```
1027 |
1028 | ##### 返回一个元组(m,e)
1029 |
1030 | > **math.frexp(x)**
1031 |
1032 | 返回一个元组(m,e),其计算方式为:x分别除0.5和1,得到一个值的范围,2e的值在这个范围内,e取符合要求的最大整数值,然后x/(2e),得到m的值。如果x等于0,则m和e的值都为0,m的绝对值的范围为(0.5,1)之间,不包括0.5和1。
1033 |
1034 | 示例:
1035 |
1036 | ```
1037 | >>> import math
1038 | >>> math.frexp(52)
1039 | (0.8125, 6)
1040 | ```
1041 |
1042 | ##### 判断 x 是否为有限数
1043 |
1044 | > **math.isfinite(x)**
1045 |
1046 | 判断 x 是否为有限数,是则返回True,否则返回False。
1047 |
1048 | 示例:
1049 |
1050 | ```
1051 | >>> import math
1052 | >>> math.isfinite(8)
1053 | True
1054 | ```
1055 |
1056 | ##### 判断是否无穷大或负无穷大
1057 |
1058 | > **math.isinf(x)**
1059 |
1060 | 如果x是正无穷大或负无穷大,则返回True,否则返回False。
1061 |
1062 | 示例:
1063 |
1064 | ```
1065 | >>> import math
1066 | >>> math.isinf(123)
1067 | False
1068 | ```
1069 |
1070 | ##### 判断是否数字
1071 |
1072 | > **math.isnan(x)**
1073 |
1074 | 如果x不是数字,返回True,否则返回False。
1075 |
1076 | 示例:
1077 |
1078 | ```
1079 | >>> import math
1080 | >>> math.isnan(23)
1081 | False
1082 | ```
1083 |
1084 | ##### 返回x*(2**i)的值
1085 |
1086 | > **math.ldexp(x, exp)**
1087 |
1088 | 返回x*(2**i)的值。
1089 |
1090 | 示例:
1091 |
1092 | ```
1093 | >>> import math
1094 | >>> math.ldexp(2, 1)
1095 | 4.0
1096 | ```
1097 |
1098 | ##### 返回x的自然对数
1099 |
1100 | > **math.log(x)**
1101 |
1102 | 返回x的自然对数,x > 0,小于0会报错。
1103 |
1104 | 示例:
1105 |
1106 | ```
1107 | >>> import math
1108 | >>> math.log(2)
1109 | 0.6931472
1110 | ```
1111 |
1112 | ##### 数学常量 pi
1113 |
1114 | > **math.pi**
1115 |
1116 | 数学常量 pi(圆周率,一般以π来表示)。
1117 |
1118 | ##### 将角度转换为弧度
1119 |
1120 | > **math.radians(x)**
1121 |
1122 | 将角度转换为弧度,返回值为浮点数。
1123 |
1124 | 示例:
1125 |
1126 | ```
1127 | >>> import math
1128 | >>> math.radians(90)
1129 | 1.570796
1130 | ```
1131 |
1132 | ##### 返回x弧度的正弦值
1133 |
1134 | > **math.sin(x)**
1135 |
1136 | 返回x弧度的正弦值,数值在 -1 到 1 之间。
1137 |
1138 | 示例:
1139 |
1140 | ```
1141 | >>> import math
1142 | >>> math.sin(-18)
1143 | 0.7509873
1144 | >>> math.sin(50)
1145 | -0.2623749
1146 | ```
1147 |
1148 | ##### 返回数字x的平方根
1149 |
1150 | > **math.sqrt(x)**
1151 |
1152 | 返回数字x的平方根,返回值为浮点数。
1153 |
1154 | 示例:
1155 |
1156 | ```
1157 | >>> import math
1158 | >>> math.sqrt(4)
1159 | 2.0
1160 | >>> math.sqrt(7)
1161 | 2.645751
1162 | ```
1163 |
1164 | ##### 返回 x 弧度的正切值
1165 |
1166 | > **math.tan(x)**
1167 |
1168 | 返回 x 弧度的正切值,数值在 -1 到 1 之间,为浮点数。
1169 |
1170 | 示例:
1171 |
1172 | ```
1173 | >>> import math
1174 | >>> math.tan(9)
1175 | -0.4523157
1176 | ```
1177 |
1178 | ##### 返回x的整数部分
1179 |
1180 | > **math.trunc(x)**
1181 |
1182 | 返回x的整数部分。
1183 |
1184 | 示例:
1185 |
1186 | ```
1187 | >>> import math
1188 | >>> math.trunc(7.123)
1189 | 7
1190 | ```
1191 |
1192 | **使用示例**
1193 |
1194 | ```python
1195 | # 数学运算math函数示例
1196 |
1197 | import math
1198 | import log
1199 | import utime
1200 |
1201 |
1202 | '''
1203 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
1204 | '''
1205 | PROJECT_NAME = "QuecPython_Math_example"
1206 | PROJECT_VERSION = "1.0.0"
1207 |
1208 |
1209 | if __name__ == '__main__':
1210 | # 设置日志输出级别
1211 | log.basicConfig(level=log.INFO)
1212 | math_log = log.getLogger("Math")
1213 |
1214 | # x**y运算后的值
1215 | result = math.pow(2,3)
1216 | math_log.info(result)
1217 | # 8.0
1218 |
1219 | # 取大于等于x的最小的整数值,如果x是一个整数,则返回x
1220 | result = math.ceil(4.12)
1221 | math_log.info(result)
1222 | # 5
1223 |
1224 | # 把y的正负号加到x前面,可以使用0
1225 | result = math.copysign(2,-3)
1226 | math_log.info(result)
1227 | # -2.0
1228 |
1229 | # 求x的余弦,x必须是弧度
1230 | result = math.cos(math.pi/4)
1231 | math_log.info(result)
1232 | # 0.7071067811865476
1233 |
1234 | # 把x从弧度转换成角度
1235 | result = math.degrees(math.pi/4)
1236 | math_log.info(result)
1237 | # 45.0
1238 |
1239 | # e表示一个常量
1240 | result = math.e
1241 | math_log.info(result)
1242 | # 2.718281828459045
1243 |
1244 | # exp()返回math.e(其值为2.71828)的x次方
1245 | result = math.exp(2)
1246 | math_log.info(result)
1247 | # 7.38905609893065
1248 |
1249 | # fabs()返回x的绝对值
1250 | result = math.fabs(-0.03)
1251 | math_log.info(result)
1252 | # 0.03
1253 |
1254 | # floor()取小于等于x的最大的整数值,如果x是一个整数,则返回自身
1255 | result = math.floor(4.999)
1256 | math_log.info(result)
1257 | # 4
1258 |
1259 | # fmod()得到x/y的余数,其值是一个浮点数
1260 | result = math.fmod(20,3)
1261 | math_log.info(result)
1262 | # 2.0
1263 |
1264 | # frexp()返回一个元组(m,e),其计算方式为:x分别除0.5和1,得到一个值的范围,2e的值在这个范围内,e取符合要求的最大整数值,然后x/(2e),得到m的值。如果x等于0,则m和e的值都为0,m的绝对值的范围为(0.5,1)之间,不包括0.5和1
1265 | result = math.frexp(75)
1266 | math_log.info(result)
1267 | # (0.5859375, 7)
1268 |
1269 | # isfinite()如果x不是无穷大的数字,则返回True,否则返回False
1270 | result = math.isfinite(0.1)
1271 | math_log.info(result)
1272 | # True
1273 |
1274 | # isinf()如果x是正无穷大或负无穷大,则返回True,否则返回False
1275 | result = math.isinf(234)
1276 | math_log.info(result)
1277 | # False
1278 |
1279 | # isnan()如果x不是数字True,否则返回False
1280 | result = math.isnan(23)
1281 | math_log.info(result)
1282 | # False
1283 |
1284 | # ldexp()返回x*(2**i)的值
1285 | result = math.ldexp(5,5)
1286 | math_log.info(result)
1287 | # 160.0
1288 |
1289 | # modf()返回由x的小数部分和整数部分组成的元组
1290 | result = math.modf(math.pi)
1291 | math_log.info(result)
1292 | # (0.14159265358979312, 3.0)
1293 |
1294 | # pi:数字常量,圆周率
1295 | result = math.pi
1296 | math_log.info(result)
1297 | # 3.141592653589793
1298 |
1299 | # sin()求x(x为弧度)的正弦值
1300 | result = math.sin(math.pi/4)
1301 | math_log.info(result)
1302 | # 0.7071067811865476
1303 |
1304 | # sqrt()求x的平方根
1305 | result = math.sqrt(100)
1306 | math_log.info(result)
1307 | # 10.0
1308 |
1309 | # tan()返回x(x为弧度)的正切值
1310 | result = math.tan(math.pi/4)
1311 | math_log.info(result)
1312 | # 0.9999999999999999
1313 |
1314 | # trunc()返回x的整数部分
1315 | result = math.trunc(6.789)
1316 | math_log.info(result)
1317 | # 6
1318 |
1319 | ```
1320 |
1321 |
1322 |
1323 | #### usocket - socket模块
1324 |
1325 | usocket 模块提供对BSD套接字接口的访问。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[socket](https://docs.python.org/3.5/library/socket.html#module-socket)
1326 |
1327 | ##### 创建一个新的套接字
1328 |
1329 | > **usocket.socket(af=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP)**
1330 |
1331 | 根据给定的地址族、套接字类型以及协议类型参数,创建一个新的套接字。注意,在大多数情况下不需要指定*proto*,也不建议这样做,因为某些MicroPython端口可能会省略 `IPPROTO_*`常量。
1332 |
1333 | **常量说明**
1334 |
1335 | af - 地址族
1336 |
1337 | * usocket.AF_INET :IPV4
1338 |
1339 | * usocket.AF_INET6 :IPV6
1340 |
1341 | type - socket类型
1342 |
1343 | * usocket.SOCK_STREAM :对应TCP的流式套接字
1344 |
1345 | * usocket.SOCK_DGRAM :对应UDP的数据包套接字
1346 |
1347 | * usocket.SOCK_RAW :原始套接字
1348 |
1349 | proto - 协议号
1350 |
1351 | * usocket.IPPROTO_TCP
1352 |
1353 | * usocket.IPPROTO_UDP
1354 |
1355 | * usocket.IPPROTO_TCP_SER :对应TCP socket 服务端套接字
1356 |
1357 | 其他
1358 |
1359 | * usocket.SOL_SOCKET - 套接字选项级别,
1360 |
1361 | * usocket.SO_REUSEADDR - 允许绑定地址快速重用
1362 |
1363 | 示例:
1364 |
1365 | ```
1366 | import usocket
1367 | # 创建基于TCP的流式套接字
1368 | socket = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
1369 | # 创建基于UDP的数据报套接字
1370 | socket = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
1371 | # 创建基于TCP的服务端套接字
1372 | socket = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM, usocket.IPPROTO_TCP_SER)
1373 | ```
1374 |
1375 | ##### 将主机域名(host)和端口(port)转换为用于创建套接字的5元组序列
1376 |
1377 | > **usocket.getaddrinfo(host, port)**
1378 |
1379 | 将主机域名(host)和端口(port)转换为用于创建套接字的5元组序列,元组结构如下:
1380 |
1381 | `(family, type, proto, canonname, sockaddr)`
1382 |
1383 |
1384 |
1385 | **socket类的方法**
1386 |
1387 | ##### 服务端绑定指定地址address
1388 |
1389 |
1390 | > **socket.bind(address)**
1391 |
1392 | 服务端绑定指定地址address的服务器。
1393 |
1394 | * `address` :包含地址和端口号的元组或列表
1395 |
1396 | 注意:该方法在服务端套接字使用时,绑定address时会将address设为客户端可连接address。其他客户端是否可连接,需确认运营商网络是否支持。
1397 |
1398 | 示例:
1399 |
1400 | ```
1401 | #绑定拨号IP为服务器地址,端口自定义
1402 | socket.bind(("",80))
1403 | #绑定自定义address
1404 | socket.bind(("192.168.0.1",80))
1405 | ```
1406 |
1407 | ##### 允许服务端接受连接
1408 |
1409 |
1410 | > **socket.listen(backlog)**
1411 |
1412 | 允许服务端接受连接,可指定最大连接数。
1413 |
1414 | * `backlog` :接受套接字的最大个数,至少为0。
1415 |
1416 | ##### 接受连接请求
1417 |
1418 | > **socket.accept()**
1419 |
1420 | 接受连接请求,返回元组,包含新的套接字和客户端地址以及客户端端口,形式为:`(conn, address, port)`
1421 |
1422 | * `conn` :新的套接字对象,可以用来发送和接收数据
1423 |
1424 | * `address` :连接到服务器的客户端地址
1425 |
1426 | * `port` :连接到服务器的客户端端口
1427 |
1428 | ##### 连接到指定地址address的服务器
1429 |
1430 | > **socket.connect(address)**
1431 |
1432 | 连接到指定地址address的服务器。
1433 |
1434 | * `address` :包含地址和端口号的元组或列表
1435 |
1436 | ##### 从套接字中读取size字节数据
1437 |
1438 | > **socket.read( [ size ] )**
1439 |
1440 | 从套接字中读取size字节数据,返回一个字节对象。如果没有指定size,则会从套接字读取所有可读数据,直到读取到数据结束,此时作用和 `socket.readall()` 相同。
1441 |
1442 | ##### 将字节读取到缓冲区buf中
1443 |
1444 | > **socket.readinto(buf, [ , nbytes ])**
1445 |
1446 | 将字节读取到缓冲区buf中。如果指定了nbytes,则最多读取nbytes数量的字节;如果没有指定nbytes,则最多读取len(buf)字节。返回值是实际读取的字节数。
1447 |
1448 | ##### 按行读取数据
1449 |
1450 | > **socket.readline()**
1451 |
1452 | 按行读取数据,遇到换行符结束,返回读取的数据行。
1453 |
1454 | ##### 写入缓冲区的数据
1455 |
1456 | > **socket.write(buf)**
1457 |
1458 | 写入缓冲区的数据,buf为待写入的数据,返回实际写入的字节数。
1459 |
1460 | ##### 发送数据
1461 |
1462 | > **socket.send(bytes)**
1463 |
1464 | 发送数据,返回实际发送的字节数。
1465 |
1466 | * `bytes` :bytes型数据
1467 |
1468 | ##### 将所有数据都发送到套接字
1469 |
1470 | > **socket.sendall(bytes)**
1471 |
1472 | 将所有数据都发送到套接字。与`send()`方法不同的是,此方法将尝试通过依次逐块发送数据来发送所有数据。
1473 |
1474 | 注意:该方法再非阻塞套接字上的行为是不确定的,建议再MicroPython中,使用 `write()` 方法,该方法具有相同的“禁止短写”策略来阻塞套接字,并且将返回在非阻塞套接字上发送的字节数。
1475 |
1476 | * `bytes` :bytes型数据
1477 |
1478 | ##### 将数据发送到套接字
1479 |
1480 | > **socket.sendto(bytes, address)**
1481 |
1482 | 将数据发送到套接字。该套接字不应连接到远程套接字,因为目标套接字是由*address*指定的。
1483 |
1484 | * `bytes` :bytes型数据
1485 |
1486 | * `address` :包含地址和端口号的元组或列表
1487 |
1488 | ##### 从套接字接收数据
1489 |
1490 | > **socket.recv(bufsize)**
1491 |
1492 | 从套接字接收数据。返回值是一个字节对象,表示接收到的数据。一次接收的最大数据量由bufsize指定。
1493 |
1494 | * `bufsize` :一次接收的最大数据量
1495 |
1496 | ##### 将套接字标记为关闭并释放所有资源
1497 |
1498 | > **socket.close()**
1499 |
1500 | 将套接字标记为关闭并释放所有资源。
1501 |
1502 | ##### 从套接字接收数据
1503 |
1504 | > **socket.recvfrom(bufsize)**
1505 |
1506 | 从套接字接收数据。返回一个元组,包含字节对象和地址。
1507 |
1508 | 返回值形式为:`(bytes, address)`
1509 |
1510 | * bytes :接收数据的字节对象
1511 |
1512 | * address :发送数据的套接字的地址
1513 |
1514 | ##### 设置套接字选项的值
1515 |
1516 | > **socket.setsockopt(level, optname, value)**
1517 |
1518 | 设置套接字选项的值。
1519 |
1520 | `level ` :套接字选项级别
1521 |
1522 |
1523 | * usocket.SOL_SOCKET
1524 |
1525 | `optname`:socket选项
1526 |
1527 | * usocket.SO_REUSEADDR //设置端口复用允许。
1528 |
1529 | * usocket.TCP_KEEPALIVE //设置TCP保活包间隔时间。
1530 |
1531 | value :既可以是一个整数,也可以是一个表示缓冲区的bytes类对象
1532 |
1533 | 示例:
1534 |
1535 | ```
1536 | #设置端口复用允许
1537 | socket.setsockopt(usocket.SOL_SOCKET, usocket.SO_REUSEADDR, 1)
1538 | #设置TCP保活包间隔时间,value 单位为分钟,范围:1-120
1539 | socket.setsockopt(usocket.SOL_SOCKET, usocket.TCP_KEEPALIVE, 1)
1540 | ```
1541 |
1542 | ##### 设置套接字为阻塞模式或者非阻塞模式
1543 |
1544 |
1545 |
1546 | > **socket.setblocking(flag)**
1547 |
1548 | 设置套接字为阻塞模式或者非阻塞模式。如果标志为false,则将套接字设置为非阻塞,否则设置为阻塞模式。
1549 |
1550 | 该方法是某些 `settimeout()` 调用的简写:
1551 |
1552 | `socket.setblocking(True)` 相当于 `socket.settimeout(None)`
1553 |
1554 | `socket.setblocking(False)` 相当于 `socket.settimeout(0)`
1555 |
1556 | ##### 设置套接字的发送和接收超时时间
1557 |
1558 | > **socket.settimeout(value)**
1559 |
1560 | 设置套接字的发送和接收超时时间,单位秒。
1561 |
1562 | * `value` :可以是表示秒的非负浮点数,也可以是None。如果给出一个非零值,则[`OSError`](http://docs.micropython.org/en/latest/library/builtins.html#OSError)在该操作完成之前已超过超时时间值,则随后的套接字操作将引发异常。如果给定零,则将套接字置于非阻塞模式。如果未指定,则套接字将处于阻塞模式。
1563 |
1564 | **返回与套接字关联的文件对象**
1565 |
1566 | > **socket.makefile(mode='rb')**
1567 |
1568 | 返回与套接字关联的文件对象,返回值类型与指定的参数有关。仅支持二进制模式 (rb和wb)。
1569 |
1570 | ##### 获取套接字的状态
1571 |
1572 | > **socket.getsocketsta()**
1573 |
1574 | 获取TCP套接字的状态,状态值描述如下:
1575 |
1576 | | 状态值 | 状态 | 描述 |
1577 | | ------ | ----------- | ------------------------------------------------------------ |
1578 | | 0 | CLOSED | 套接字创建了,但没有使用这个套接字 |
1579 | | 1 | LISTEN | 套接字正在监听连接 |
1580 | | 2 | SYN_SENT | 套接字正在试图主动建立连接,即发送SYN后还没有收到ACK |
1581 | | 3 | SYN_RCVD | 套接字正在处于连接的初始同步状态,即收到对方的SYN,但还没收到自己发过去的SYN的ACK |
1582 | | 4 | ESTABLISHED | 连接已建立 |
1583 | | 5 | FIN_WAIT_1 | 套接字已关闭,正在关闭连接,即发送FIN,没有收到ACK也没有收到FIN |
1584 | | 6 | FIN_WAIT_2 | 套接字已关闭,正在等待远程套接字关闭,即在FIN_WAIT_1状态下收到发过去FIN对应的ACK |
1585 | | 7 | CLOSE_WAIT | 远程套接字已经关闭,正在等待关闭这个套接字,被动关闭的一方收到FIN |
1586 | | 8 | CLOSING | 套接字已关闭,远程套接字正在关闭,暂时挂起关闭确认,即在FIN_WAIT_1状态下收到被动方的FIN |
1587 | | 9 | LAST_ACK | 远程套接字已关闭,正在等待本地套接字的关闭确认,被动方在CLOSE_WAIT状态下发送FIN |
1588 | | 10 | TIME_WAIT | 套接字已经关闭,正在等待远程套接字的关闭,即FIN、ACK、FIN、ACK都完毕,经过2MSL时间后变为CLOSED状态 |
1589 |
1590 | 注意:
1591 |
1592 | BG95平台不支持该API。
1593 | 如果用户调用了 `socket.close()` 方法之后,再调用 `socket.getsocketsta()` 会返回-1,因为此时创建的对象资源等都已经被释放。
1594 |
1595 |
1596 | **socket通信示例**:
1597 |
1598 | ```python
1599 | '''
1600 | @Author: Baron
1601 | @Date: 2020-04-24
1602 | @LastEditTime: 2020-04-26 09:56:08
1603 | @Description: example for module usocket
1604 | @FilePath: example_socket_file.py
1605 | '''
1606 | # 导入usocket模块
1607 | import usocket
1608 | import log
1609 | import utime
1610 | import checkNet
1611 |
1612 |
1613 | '''
1614 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
1615 | '''
1616 | PROJECT_NAME = "QuecPython_Socket_example"
1617 | PROJECT_VERSION = "1.0.0"
1618 |
1619 | checknet = checkNet.CheckNetwork(PROJECT_NAME, PROJECT_VERSION)
1620 |
1621 | # 设置日志输出级别
1622 | log.basicConfig(level=log.INFO)
1623 | socket_log = log.getLogger("SOCKET")
1624 |
1625 | if __name__ == '__main__':
1626 | stagecode, subcode = checknet.wait_network_connected(30)
1627 | if stagecode == 3 and subcode == 1:
1628 | socket_log.info('Network connection successful!')
1629 |
1630 | # 创建一个socket实例
1631 | sock = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
1632 | # 解析域名
1633 | sockaddr=usocket.getaddrinfo('www.tongxinmao.com', 80)[0][-1]
1634 | # 建立连接
1635 | sock.connect(sockaddr)
1636 | # 向服务端发送消息
1637 | ret=sock.send('GET /News HTTP/1.1\r\nHost: www.tongxinmao.com\r\nAccept-Encoding: deflate\r\nConnection: keep-alive\r\n\r\n')
1638 | socket_log.info('send %d bytes' % ret)
1639 | #接收服务端消息
1640 | data=sock.recv(256)
1641 | socket_log.info('recv %s bytes:' % len(data))
1642 | socket_log.info(data.decode())
1643 |
1644 | # 关闭连接
1645 | sock.close()
1646 | else:
1647 | socket_log.info('Network connection failed! stagecode = {}, subcode = {}'.format(stagecode, subcode))
1648 |
1649 | ```
1650 |
1651 |
1652 |
1653 | #### uio - 输入输出流
1654 |
1655 | uio 模块包含其他类型的stream(类文件)对象和辅助函数。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[io](https://docs.python.org/3.5/library/io.html#module-io)
1656 |
1657 | ##### 打开文件
1658 |
1659 | > __fd = uio.open(name, mode=’r’, **kwarg)__
1660 |
1661 | 打开文件,内置`open()`函数是该函数的别名。
1662 |
1663 | * `name` :文件名
1664 |
1665 | * `mode` :打开模式
1666 |
1667 | - r 只读模式打开文件
1668 | - w 写入模式打开文件,每次写入会覆盖上次写入数据
1669 | - a 只写追加模式打开文件,可连续写入文件数据而不是覆盖数据
1670 |
1671 |
1672 | * `**kwarg`:可变长参数列表
1673 |
1674 | ##### 关闭打开的文件
1675 |
1676 | > **fd.close()**
1677 |
1678 | 关闭打开的文件。
1679 |
1680 |
1681 |
1682 | #### ustruct - 打包和解压原始数据类型
1683 |
1684 | 该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[struct](https://docs.python.org/3.5/library/struct.html#module-struct)
1685 |
1686 | **字节顺序,大小和对齐方式**
1687 |
1688 | 默认情况下,C类型以机器的本机格式和字节顺序表示,并在必要时通过跳过填充字节来正确对齐(根据C编译器使用的规则)。根据下表,格式字符串的第一个字符可用于指示打包数据的字节顺序,大小和对齐方式:
1689 |
1690 | | Character | Byte order | Size | Alignment |
1691 | | --------- | ---------------------- | -------- | --------- |
1692 | | `@` | native | native | native |
1693 | | `=` | native | standard | none |
1694 | | `<` | little-endian | standard | none |
1695 | | `>` | big-endian | standard | none |
1696 | | `!` | network (= big-endian) | standard | none |
1697 |
1698 | **格式化字符表**
1699 |
1700 | | Format | C Type | Python type | Standard size |
1701 | | ------ | -------------------- | ----------- | ------------- |
1702 | | `b` | `signed char` | integer | 1 |
1703 | | `B` | `unsigned char` | integer | 1 |
1704 | | `h` | `short` | integer | 2 |
1705 | | `H` | `unsigned short` | integer | 2 |
1706 | | `i` | `int` | integer | 4 |
1707 | | `I` | `unsigned int` | integer | 4 |
1708 | | `l` | `long` | integer | 4 |
1709 | | `L` | `unsigned long` | integer | 4 |
1710 | | `q` | `long long` | integer | 8 |
1711 | | `Q` | `unsigned long long` | integer | 8 |
1712 | | `f` | `float` | float | 4 |
1713 | | `d` | `double` | float | 8 |
1714 | | `P` | `void *` | integer | 4 |
1715 |
1716 | 默认情况下,C类型以机器的本机格式和字节顺序表示,并在必要时通过跳过填充字节来正确对齐(根据C编译器使用的规则)
1717 |
1718 | ##### 返回存放 fmt 需要的字节数
1719 |
1720 | > **ustruct.calcsize(fmt)**
1721 |
1722 | 返回存放 fmt 需要的字节数。
1723 |
1724 | * `fmt` :格式字符的类型,详情见上文格化式字符表
1725 |
1726 | 示例:
1727 |
1728 | ```
1729 | >>> import ustruct
1730 | >>> ustruct.calcsize('i')
1731 | 4
1732 | >>> ustruct.calcsize('f')
1733 | 4
1734 | >>> ustruct.calcsize('d')
1735 | 8
1736 | ```
1737 |
1738 | ##### 按照格式字符串 fmt 压缩参数v1、 v2、…
1739 |
1740 | > **ustruct.pack(fmt, v1, v2, ...)**
1741 |
1742 | 按照格式字符串 fmt 压缩参数v1、 v2、…返回值是参数编码后的字节对象。
1743 |
1744 | * `fmt` :格式字符的类型,详情见上文格化式字符表
1745 |
1746 | ##### 根据格式化字符串 fmt 对数据进行解压
1747 |
1748 | > **ustruct.unpack(fmt, data)**
1749 |
1750 | 根据格式化字符串 fmt 对数据进行解压,返回值为一个元组。
1751 |
1752 | 示例:
1753 |
1754 | ```
1755 | >>> import ustruct
1756 | >>> ustruct.pack('ii', 7, 9) #打包2两个整数
1757 | b'\x07\x00\x00\x00\t\x00\x00\x00'
1758 | >>> ustruct.unpack('ii', b'\x07\x00\x00\x00\t\x00\x00\x00') #解压两个整数
1759 | (7, 9)
1760 | ```
1761 |
1762 | ##### 根据格式字符串fmt将值v1、v2、 …打包到从`offset`开始的缓冲区中
1763 |
1764 | > **ustruct.pack_into(fmt, buffer, offset, v1, v2, ...)**
1765 |
1766 | 根据格式字符串fmt将值v1、v2、 …打包到从`offset`开始的缓冲区中。从缓冲区的末尾算起,`offset`可能为负。
1767 |
1768 | * `fmt` :格式字符的类型,详情见上文格化式字符表
1769 |
1770 | ##### 根据格式化字符串 `fmt` 解析从 `offest` 开始的数据解压
1771 |
1772 | > **ustruct.unpack_from(fmt, data, offset=0)**
1773 |
1774 | 根据格式化字符串 `fmt` 解析从 `offest` 开始的数据解压,从缓冲区末尾开始计数的偏移量可能为负值。返回值是解压值的元组。
1775 |
1776 |
1777 |
1778 | #### ujson - JSON编码和解码
1779 |
1780 | ujson 模块实现在Python数据对象和JSON数据格式之间进行转换的功能。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[json](https://docs.python.org/3.5/library/json.html#module-json)
1781 |
1782 | ##### 将 `obj` 数据对象转化成 JSON字符串
1783 |
1784 | > **ujson.dump(obj, stream)**
1785 |
1786 | 将 `obj` 数据对象转化成 JSON字符串,将其写入到给定的 `stream` 中。
1787 |
1788 | ##### 将 `dict` 类型的数据转换成str
1789 |
1790 | > **ujson.dumps(dict)**
1791 |
1792 | 将 `dict` 类型的数据转换成str。
1793 |
1794 | ##### 解析给定的数据 `stream`
1795 |
1796 | > **ujson.load(stream)**
1797 |
1798 | 解析给定的数据 `stream`,将其解释为JSON字符串并反序列化成Python对象。
1799 |
1800 | ##### 解析JSON字符串并返回`obj`对象
1801 |
1802 | > **ujson.loads(str)**
1803 |
1804 | 解析JSON字符串并返回`obj`对象
1805 |
1806 |
1807 |
1808 | **使用示例**
1809 |
1810 | ```python
1811 | '''
1812 | @Author: Baron
1813 | @Date: 2020-06-17
1814 | @LastEditTime: 2020-06-17 17:06:08
1815 | @Description: example for module ujson
1816 | @FilePath: example_json_file.py
1817 | '''
1818 |
1819 | # ujson.loads 用于解码 JSON 数据。该函数返回 Python 字段的数据类型。
1820 |
1821 | import ujson
1822 | import log
1823 | import utime
1824 |
1825 |
1826 | '''
1827 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
1828 | '''
1829 | PROJECT_NAME = "QuecPython_Json_example"
1830 | PROJECT_VERSION = "1.0.0"
1831 |
1832 |
1833 | # 设置日志输出级别
1834 | log.basicConfig(level=log.INFO)
1835 | ujson_log = log.getLogger("UJSON loads")
1836 |
1837 |
1838 | if __name__ == '__main__':
1839 | inp = {'bar': ('baz', None, 1, 2)}
1840 | ujson_log.info(type(inp))
1841 | #
1842 |
1843 | # 将Dict转换为json
1844 | s = ujson.dumps(inp)
1845 | ujson_log.info(s)
1846 | ujson_log.info(type(s))
1847 | # {"bar": ["baz", null, 1, 2]},
1848 |
1849 | # 将json转换为Dict
1850 | outp = ujson.loads(s)
1851 | ujson_log.info(outp)
1852 | ujson_log.info(type(outp))
1853 | # ujson.dump()和juson.load()主要用来读写json文件
1854 |
1855 | ```
1856 |
1857 |
1858 |
1859 | #### utime - 与时间相关功能
1860 |
1861 | utime 模块用于获取当前时间和日期、测量时间间隔和延迟。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[time](https://docs.python.org/3.5/library/time.html#module-time)
1862 |
1863 | ##### 格式化时间戳
1864 |
1865 | > **utime.localtime([secs])**
1866 |
1867 | 该函数用来将一个以秒表示的时间转换为一个元组,元组包含了了年、月、日、时、分、秒、星期、一年中第几天;如果没有给定参数sec,则使用RTC时间。返回值形式如下:
1868 |
1869 | `(year, month, mday, hour, minute, second, weekday, yearday)`
1870 |
1871 | * `year` :年份,int型
1872 |
1873 | * `month` :月份,1~12,int型
1874 |
1875 | * `mday` :日,当月多少号,1~31,int型
1876 |
1877 | * `hour` :小时,0~23,int型
1878 |
1879 | * `minute` :分钟,0~59,int型
1880 |
1881 | * `second` :秒,0~59,int型
1882 |
1883 | * `weekday` :星期,周一到周日是0~6,int型
1884 |
1885 | * `yearday` :一年中的第多少天,int型
1886 |
1887 | 示例:
1888 |
1889 | ```
1890 | >>> import utime
1891 | >>> utime.localtime()
1892 | (2020, 9, 29, 8, 54, 42, 1, 273)
1893 | >>> utime.localtime(646898736)
1894 | (2020, 7, 1, 6, 5, 36, 2, 183)
1895 | ```
1896 |
1897 | ##### 反向格式化时间戳
1898 |
1899 | > **utime.mktime(date)**
1900 |
1901 | 该函数作用与locatime()相反,它将一个存放在元组中的时间转换为以秒计的时间戳。
1902 |
1903 | 示例:
1904 |
1905 | ```
1906 | >>> import utime
1907 | >>> date = (2020, 9, 29, 8, 54, 42, 1, 273)
1908 | >>> utime.mktime(date)
1909 | 1601340882
1910 | ```
1911 |
1912 | ##### 休眠给定秒数的时间
1913 |
1914 | > **utime.sleep(seconds)**
1915 |
1916 | 休眠给定秒数的时间。
1917 |
1918 | 注意:sleep()函数的调用会导致程序休眠阻塞。
1919 |
1920 | ##### 休眠给定毫秒数的时间
1921 |
1922 | > **utime.sleep_ms(ms)**
1923 |
1924 | 休眠给定毫秒数的时间。
1925 |
1926 | 注意:sleep_ms()函数的调用会导致程序休眠阻塞。
1927 |
1928 | ##### 休眠给定微秒的时间
1929 |
1930 | > **utime.sleep_us(us)**
1931 |
1932 | 休眠给定微秒的时间。
1933 |
1934 | 注意:sleep_us()函数的调用会导致程序休眠阻塞。
1935 |
1936 | ##### 返回不断递增的毫秒计数器
1937 |
1938 | > **utime.ticks_ms()**
1939 |
1940 | 返回不断递增的毫秒计数器,在某些值后会重新计数(未指定)。计数值本身无特定意义,只适合用在 `ticks_diff()`函数中。
1941 |
1942 | 注意:sleep_us()函数的调用会导致程序休眠阻塞。
1943 |
1944 | ##### 返回不断递增的微秒计数器
1945 |
1946 | > **utime.ticks_us()**
1947 |
1948 | 和`ticks_ms()`类似,只是返回微秒计数器。
1949 |
1950 | ##### 和 ticks_ms/ticks_us 类似,具有更高精度 (使用 CPU 时钟)
1951 |
1952 | > **utime.ticks_cpu()**
1953 |
1954 | 和 ticks_ms/ticks_us 类似,具有更高精度 (使用 CPU 时钟)。
1955 |
1956 | ##### 计算两次调用` ticks_ms()`,`ticks_us()`或 `ticks_cpu()`之间的时间
1957 |
1958 | > **utime.ticks_diff(ticks1, ticks2)**
1959 |
1960 | 计算两次调用` ticks_ms()`, `ticks_us()`,或 `ticks_cpu()`之间的时间。因为这些函数的计数值可能会回绕,所以不能直接相减,需要使用 ticks_diff() 函数。“旧” 时间需要在 “新” 时间之前,否则结果无法确定。这个函数不要用在计算很长的时间 (因为 ticks_*() 函数会回绕,通常周期不是很长)。通常用法是在带超时的轮询事件中调用。
1961 |
1962 | 示例:
1963 |
1964 | ```python
1965 | import utime
1966 | start = utime.ticks_us()
1967 | while pin.value() == 0:
1968 | if utime.ticks_diff(utime.ticks_us(), start) > 500:
1969 | raise TimeoutError
1970 | ```
1971 |
1972 | ##### 返回自纪元以来的秒数
1973 |
1974 | > **utime.time()**
1975 |
1976 | 返回自纪元以来的秒数(以整数形式)。如果未设置RTC,则此函数返回自特定于端口的参考时间点以来的秒数(对于不具有电池后备RTC的嵌入式板,通常是由于加电或复位)。如果要开发可移植的MicroPython应用程序,则不应依赖此功能提供高于秒的精度。如果需要更高的精度,请使用 `ticks_ms()`和`ticks_us()`函数,如果需要日历时间,则 `localtime()`不带参数会更好。
1977 |
1978 | ##### 获取时区
1979 |
1980 | > **utime.getTimeZone()**
1981 |
1982 | 获取当前时区,单位小时,范围[-12, 12],负值表示西时区,正值表示东时区,0表示零时区。
1983 |
1984 | ##### 设置时区
1985 |
1986 | > **utime.setTimeZone(offset)**
1987 |
1988 | 设置时区,单位小时,范围[-12, 12],负值表示西时区,正值表示东时区,0表示零时区。设置时区后,本地时间会随之变化为对应时区的时间。
1989 |
1990 | **使用示例**
1991 |
1992 | ```python
1993 | '''
1994 | @Author: Baron
1995 | @Date: 2020-06-17
1996 | @LastEditTime: 2020-06-17 17:06:08
1997 | @Description: example for module utime
1998 | @FilePath: example_utime_loacltime_file.py
1999 | '''
2000 | import utime
2001 | import log
2002 |
2003 |
2004 | '''
2005 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
2006 | '''
2007 | PROJECT_NAME = "QuecPython_localtime_example"
2008 | PROJECT_VERSION = "1.0.0"
2009 |
2010 |
2011 | # 设置日志输出级别
2012 | log.basicConfig(level=log.INFO)
2013 | time_log = log.getLogger("LocalTime")
2014 |
2015 | if __name__ == '__main__':
2016 | # 获取本地时间,返回元组
2017 | tupe_t = utime.localtime()
2018 | time_log.info(tupe_t)
2019 | # 返回当前时间戳,参数为元组
2020 | t = utime.mktime(utime.localtime())
2021 | time_log.info(t)
2022 | # 休眠sleep示例
2023 | for i in [0, 1, 2, 3, 4, 5]:
2024 | utime.sleep(1) # 休眠(单位 m)
2025 | time_log.info(i)
2026 |
2027 | for i in [0, 1, 2, 3, 4, 5]:
2028 | utime.sleep_ms(1000) # 休眠(单位 ms)
2029 | time_log.info(i)
2030 | ```
2031 |
2032 |
2033 |
2034 | #### sys - 系统相关功能
2035 |
2036 | sys 模块中提供了与QuecPython运行环境有关的函数和变量。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[sys](https://docs.python.org/3.5/library/sys.html#module-sys)
2037 |
2038 | 说明:新架构代码升级了MPY的版本,sys变更为usys。导入模块时建议使用以下方式进行导入
2039 |
2040 | ```python
2041 | try:
2042 | import usys as sys
2043 | except ImportError:
2044 | import sys
2045 | ```
2046 |
2047 | **常数说明**
2048 |
2049 | > **sys.argv**
2050 |
2051 | 当前程序启动的可变参数列表。
2052 |
2053 | > **sys.byteorder**
2054 |
2055 | 字节顺序 (‘little’ - 小端, ‘big’ - 大端)。
2056 |
2057 | > **sys.implementation**
2058 |
2059 | 返回当前microPython版本信息。对于MicroPython,它具有以下属性:
2060 |
2061 | - name - 字符串“ micropython”
2062 | - version - 元组(主要,次要,微型),例如(1、7、0)
2063 |
2064 | 建议使用此对象来将MicroPython与其他Python实现区分开。
2065 |
2066 | > **sys.maxsize**
2067 |
2068 | 本机整数类型可以在当前平台上保留的最大值,如果它小于平台最大值,则为MicroPython整数类型表示的最大值(对于不支持长整型的MicroPython端口就是这种情况)。
2069 |
2070 | > **sys.modules**
2071 |
2072 | 已载入模块的字典。
2073 |
2074 | > **sys.platform**
2075 |
2076 | MicroPython运行的平台。
2077 |
2078 | > **sys.stdin**
2079 |
2080 | 标准输入(默认是USB虚拟串口,可选其他串口)。
2081 |
2082 | > **sys.stdout**
2083 |
2084 | 标准输出(默认是USB虚拟串口,可选其他串口)。
2085 |
2086 | > **sys.version**
2087 |
2088 | MicroPython 语言版本,字符串格式。
2089 |
2090 | > **sys.version_info**
2091 |
2092 | MicroPython 语言版本,整数元组格式。
2093 |
2094 |
2095 |
2096 | **方法**
2097 |
2098 | > **sys.exit(retval=0)**
2099 |
2100 | 使用给定的参数退出当前程序。与此同时,该函数会引发`SystemExit`退出。如果给定了参数,则将其值作为参数赋值给`SystemExit`。
2101 |
2102 |
2103 |
2104 | > **sys.print_exception(exc, file=sys.stdout)**
2105 |
2106 | 打印异常到文件对象,默认是 sys.stdout,即输出异常信息的标准输出。
2107 |
2108 |
2109 |
2110 | #### uzlib - zlib解压缩
2111 |
2112 | uzlib 模块解压缩用[DEFLATE算法](https://en.wikipedia.org/wiki/DEFLATE)压缩的二进制数据 (通常在zlib库和gzip存档器中使用),压缩尚未实现。该模块实现相应CPython模块的子集。更多信息请参阅阅CPython文档:[zlib](https://docs.python.org/3.5/library/zlib.html#module-zlib)
2113 |
2114 | 注意:解压缩前,应检查模块内可使用的空间,确保有足够空间解压文件。
2115 |
2116 | ##### 返回解压后的 bytes 对象
2117 |
2118 | > **uzlib.decompress(data, wbits=0, bufsize=0)**
2119 |
2120 | 返回解压后的 bytes 对象。`wbits`是解压时使用的DEFLATE字典窗口大小(8-15,字典大小是`wbits`值的2的幂)。如果该值为正,则假定`data`为zlib流(带有zlib标头),如果为负,则假定为原始的DEFLATE流。`bufsize`参数是为了与CPython兼容,将被忽略。
2121 |
2122 | ##### 创建一个`stream`装饰器
2123 |
2124 | > **class uzlib.DecompIO(stream, wbits=0)**
2125 |
2126 | 创建一个`stream`装饰器,该装饰器允许在另一个流中透明地压缩数据。这允许处理数据大于可用堆大小的压缩流。wbits的值除了上面所述的值以外,还可以取值24..31(16 + 8..15),这表示输入流具有gzip标头。
2127 |
2128 |
2129 |
2130 | #### _thread - 多线程
2131 |
2132 | _thread 模块提供创建新线程的方法,并提供互斥锁。
2133 |
2134 | ##### 获取当前线程号
2135 |
2136 | > **_thread.get_ident()**
2137 |
2138 | 获取当前线程号。
2139 |
2140 | ##### 获取系统剩余内存大小
2141 |
2142 | > **_thread.get_heap_size()**
2143 |
2144 | 获取系统剩余内存大小。
2145 |
2146 | ##### 设置创建新线程使用的栈大小
2147 |
2148 | > **_thread.stack_size(size)**
2149 |
2150 | 设置创建新线程使用的栈大小(以字节为单位),默认为8448字节,最小8192字节。
2151 |
2152 | ##### 创建一个新线程
2153 |
2154 | > **_thread.start_new_thread(function, args)**
2155 |
2156 | 创建一个新线程,接收执行函数和被执行函数参数,当 function 函数无参时传入空的元组。返回线程的id。
2157 |
2158 | ##### 根据线程id删除一个线程
2159 |
2160 | > **_thread.stop_thread(thread_id)**
2161 |
2162 | 删除一个线程,thread_id为创建线程时返回的线程id。当 thread_id为0时则删除当前线程。不可删除主线程。
2163 |
2164 | ##### 创建一个互斥锁对象
2165 |
2166 | > **_thread.allocate_lock()**
2167 |
2168 | 创建一个互斥锁对象。
2169 |
2170 | 示例:
2171 |
2172 | ```
2173 | import _thread
2174 | lock = _thread.allocate_lock()
2175 | ```
2176 |
2177 | ##### 获取锁
2178 |
2179 | > **lock.acquire()**
2180 |
2181 | 获取锁,成功返回True,否则返回False。
2182 |
2183 | ##### 释放锁
2184 |
2185 | > **lock.release()**
2186 |
2187 | 释放锁。
2188 |
2189 | ##### 返回锁的状态
2190 |
2191 | > **lock.locked()**
2192 |
2193 | 返回锁的状态,True表示被某个线程获取,False则表示没有。
2194 |
2195 | ##### 删除锁
2196 |
2197 | > **_thread.delete_lock(lock)**
2198 |
2199 | 删除已经创建的锁。
2200 |
2201 |
2202 |
2203 | **_thread使用示例**
2204 |
2205 | ```python
2206 | '''
2207 | @Author: Baron
2208 | @Date: 2020-06-22
2209 | @LastEditTime: 2020-06-22 17:16:20
2210 | @Description: example for module _thread
2211 | @FilePath: example_thread_file.py
2212 | '''
2213 | import _thread
2214 | import log
2215 | import utime
2216 |
2217 |
2218 | '''
2219 | 下面两个全局变量是必须有的,用户可以根据自己的实际项目修改下面两个全局变量的值
2220 | '''
2221 | PROJECT_NAME = "QuecPython_Thread_example"
2222 | PROJECT_VERSION = "1.0.0"
2223 |
2224 |
2225 | # 设置日志输出级别
2226 | log.basicConfig(level=log.INFO)
2227 | thread_log = log.getLogger("Thread")
2228 |
2229 | a = 0
2230 | state = 1
2231 | state1 = 1
2232 | # 创建一个lock的实例
2233 | lock = _thread.allocate_lock()
2234 |
2235 | def th_func(delay, id):
2236 | global a
2237 | global state,state1
2238 | while True:
2239 | lock.acquire() # 获取锁
2240 | if a >= 10:
2241 | thread_log.info('thread %d exit' % id)
2242 | lock.release() # 释放锁
2243 | if id == 1:
2244 | state = 0
2245 | else:
2246 | state1 = 0
2247 | break
2248 | a += 1
2249 | thread_log.info('[thread %d] a is %d' % (id, a))
2250 | lock.release() # 释放锁
2251 | utime.sleep(delay)
2252 |
2253 | def th_func1():
2254 | while True:
2255 | thread_log.info('thread th_func1 is running')
2256 | utime.sleep(1)
2257 |
2258 | if __name__ == '__main__':
2259 | for i in range(2):
2260 | _thread.start_new_thread(th_func, (i + 1, i)) # 创建一个线程,当函数无参时传入空的元组
2261 |
2262 | thread_id = _thread.start_new_thread(th_func1, ()) # 创建一个线程,当函数无参时传入空的元组
2263 |
2264 | while state or state1:
2265 | pass
2266 |
2267 | _thread.stop_thread(thread_id) # 删除线程
2268 | _thread.delete_lock(lock) # 删除锁
2269 | thread_log.info('thread th_func1 is stopped')
2270 | ```
2271 |
2272 |
2273 |
2274 | #### uhashlib - 哈希算法
2275 |
2276 | 模块功能: 实现二进制数据散列算法,目前支持sha256,sha1,MD5。
2277 |
2278 | ##### 创建一个SHA256哈希对象
2279 |
2280 | > **hash_obj = uhashlib.sha256(bytes)**
2281 |
2282 | 创建一个SHA256哈希对象
2283 |
2284 | * 参数
2285 |
2286 | | 参数 | 参数类型 | 参数说明 |
2287 | | ----- | -------- | ----------------------------------------------------- |
2288 | | bytes | bytes | 可选参数,可在创建时传入bytes数据,也可通过update方法 |
2289 |
2290 | * 返回值
2291 |
2292 | SHA256哈希对象
2293 |
2294 | ##### 创建一个SHA1哈希对象
2295 |
2296 | > **hash_obj = uhashlib.sha1(bytes)**
2297 |
2298 | 创建一个SHA1哈希对象
2299 |
2300 | * 参数
2301 |
2302 | | 参数 | 参数类型 | 参数说明 |
2303 | | ----- | -------- | ----------------------------------------------------- |
2304 | | bytes | bytes | 可选参数,可在创建时传入bytes数据,也可通过update方法 |
2305 |
2306 | * 返回值
2307 |
2308 | SHA1哈希对象
2309 |
2310 | ##### 创建一个MD5哈希对象
2311 |
2312 | > **hash_obj = uhashlib.md5(bytes)**
2313 |
2314 | 创建一个MD5哈希对象
2315 |
2316 | * 参数
2317 |
2318 | | 参数 | 参数类型 | 参数说明 |
2319 | | ----- | -------- | ----------------------------------------------------- |
2320 | | bytes | bytes | 可选参数,可在创建时传入bytes数据,也可通过update方法 |
2321 |
2322 | * 返回值
2323 |
2324 | MD5哈希对象
2325 |
2326 |
2327 |
2328 | **哈希对象方法**
2329 |
2330 | ##### 将更多的bytes数据加到散列
2331 |
2332 | > **hash_obj .update(bytes)**
2333 |
2334 | 将更多的bytes数据加到散列
2335 |
2336 | * 参数
2337 |
2338 | | 参数 | 参数类型 | 参数说明 |
2339 | | ----- | -------- | ---------------- |
2340 | | bytes | bytes | 需要被加密的数据 |
2341 |
2342 | * 返回值
2343 |
2344 | 无
2345 |
2346 | ##### 返回通过哈希传递的所有数据的散列
2347 |
2348 | > **hash_obj .digest()**
2349 |
2350 | 返回通过哈希传递的所有数据的散列,数据为字节类型。调用此方法后,无法再将更多的数据送入散列。
2351 |
2352 | * 参数
2353 |
2354 | 无
2355 |
2356 | * 返回值
2357 |
2358 | 返回加密后字节类型的数据
2359 |
2360 |
2361 |
2362 | **使用实例**
2363 |
2364 | ```python
2365 | import uhashlib
2366 | import ubinascii
2367 |
2368 | hash_obj = uhashlib.sha256() # 创建hash对象
2369 | hash_obj.update(b"QuecPython")
2370 | res = hash_obj.digest()
2371 | # b"\x1e\xc6gq\xb3\xa9\xac>\xa4\xc4O\x00\x9eTW\x97\xd4.\x9e}Bo\xff\x82u\x89Th\xfe'\xc6\xcd"
2372 | # 转成十六进制表示
2373 | hex_msg = ubinascii.hexlify(res)
2374 | # b'1ec66771b3a9ac3ea4c44f009e545797d42e9e7d426fff8275895468fe27c6cd'
2375 | ```
2376 |
2377 |
--------------------------------------------------------------------------------
/zh-cn/faq/README.md:
--------------------------------------------------------------------------------
1 | # QuecPython异常处理手册
2 |
3 | ## QuecPython错误码汇总
4 |
5 | **QuecPython中定义的各种错误代码常量(持续更新中)**
6 |
7 | | 错误码常量 | 错误码 | 释义 |
8 | | ----------------------- | ------ | ----------------------------------------------- |
9 | | QUEC_PY_FAIL | -1 | Generic failure codes |
10 | | QUEC_PY_OK | 0 | Quec_py value indicating success (no error) |
11 | | QUEC_PY_EPERM | 1 | Operation not permitted |
12 | | QUEC_PY_ENOENT | 2 | No such file or directory |
13 | | QUEC_PY_ESRCH | 3 | No such process |
14 | | QUEC_PY_EINTR | 4 | Interrupted system call |
15 | | QUEC_PY_EIO | 5 | I/O error |
16 | | QUEC_PY_ENXIO | 6 | No such device or address |
17 | | QUEC_PY_E2BIG | 7 | Argument list too long |
18 | | QUEC_PY_ENOEXEC | 8 | Exec format error |
19 | | QUEC_PY_EBADF | 9 | Bad file number |
20 | | QUEC_PY_ECHILD | 10 | No child processes |
21 | | QUEC_PY_EAGAIN | 11 | Try again |
22 | | QUEC_PY_ENOMEM | 12 | Out of memory |
23 | | QUEC_PY_EACCES | 13 | Permission denied |
24 | | QUEC_PY_EFAULT | 14 | Bad address |
25 | | QUEC_PY_ENOTBLK | 15 | Block device required |
26 | | QUEC_PY_EBUSY | 16 | Device or resource busy |
27 | | QUEC_PY_EEXIST | 17 | File exists |
28 | | QUEC_PY_EXDEV | 18 | Cross-device link |
29 | | QUEC_PY_ENODEV | 19 | No such device |
30 | | QUEC_PY_ENOTDIR | 20 | Not a directory |
31 | | QUEC_PY_EISDIR | 21 | Is a directory |
32 | | QUEC_PY_EINVAL | 22 | Invalid argument |
33 | | QUEC_PY_ENFILE | 23 | File table overflow |
34 | | QUEC_PY_EMFILE | 24 | Too many open files |
35 | | QUEC_PY_ENOTTY | 25 | Not a typewriter |
36 | | QUEC_PY_ETXTBSY | 26 | Text file busy |
37 | | QUEC_PY_EFBIG | 27 | File too large |
38 | | QUEC_PY_ENOSPC | 28 | No space left on device |
39 | | QUEC_PY_ESPIPE | 29 | Illegal seek |
40 | | QUEC_PY_EROFS | 30 | Read-only file system |
41 | | QUEC_PY_EMLINK | 31 | Too many links |
42 | | QUEC_PY_EPIPE | 32 | Broken pipe |
43 | | QUEC_PY_EDOM | 33 | Math argument out of domain of func |
44 | | QUEC_PY_ERANGE | 34 | Math result not representable |
45 | | QUEC_PY_EDEADLK | 35 | Resource deadlock would occur |
46 | | QUEC_PY_ENAMETOOLONG | 36 | File name too long |
47 | | QUEC_PY_ENOLCK | 37 | No record locks available |
48 | | QUEC_PY_ENOSYS | 38 | Function not implemented |
49 | | QUEC_PY_ENOTEMPTY | 39 | Directory not empty |
50 | | QUEC_PY_ELOOP | 40 | Too many symbolic links encountered |
51 | | QUEC_PY_EWOULDBLOCK | 41 | Operation would block |
52 | | QUEC_PY_ENOMSG | 42 | No message of desired type |
53 | | QUEC_PY_EIDRM | 43 | Identifier removed |
54 | | QUEC_PY_ECHRNG | 44 | Channel number out of range |
55 | | QUEC_PY_EL2NSYNC | 45 | Level 2 not synchronized |
56 | | QUEC_PY_EL3HLT | 46 | Level 3 halted |
57 | | QUEC_PY_EL3RST | 47 | Level 3 reset |
58 | | QUEC_PY_ELNRNG | 48 | Link number out of range |
59 | | QUEC_PY_EUNATCH | 49 | Protocol driver not attached |
60 | | QUEC_PY_ENOCSI | 50 | No CSI structure available |
61 | | QUEC_PY_EL2HLT | 51 | Level 2 halted |
62 | | QUEC_PY_EBADE | 52 | Invalid exchange |
63 | | QUEC_PY_EBADR | 53 | Invalid request descriptor |
64 | | QUEC_PY_EXFULL | 54 | Exchange full |
65 | | QUEC_PY_ENOANO | 55 | No anode |
66 | | QUEC_PY_EBADRQC | 56 | Invalid request code |
67 | | QUEC_PY_EBADSLT | 57 | Invalid slot |
68 | | QUEC_PY_EDEADLOCK | 58 | Deadlock |
69 | | QUEC_PY_EBFONT | 59 | Bad font file format |
70 | | QUEC_PY_ENOSTR | 60 | Device not a stream |
71 | | QUEC_PY_ENODATA | 61 | No data available |
72 | | QUEC_PY_ETIME | 62 | Timer expired |
73 | | QUEC_PY_ENOSR | 63 | Out of streams resources |
74 | | QUEC_PY_ENONET | 64 | Machine is not on the network |
75 | | QUEC_PY_ENOPKG | 65 | Package not installed |
76 | | QUEC_PY_EREMOTE | 66 | Object is remote |
77 | | QUEC_PY_ENOLINK | 67 | Link has been severed |
78 | | QUEC_PY_EADV | 68 | Advertise error |
79 | | QUEC_PY_ESRMNT | 69 | Srmount error |
80 | | QUEC_PY_ECOMM | 70 | Communication error on send |
81 | | QUEC_PY_EPROTO | 71 | Protocol error |
82 | | QUEC_PY_EMULTIHOP | 72 | Multihop attempted |
83 | | QUEC_PY_EDOTDOT | 73 | RFS specific error |
84 | | QUEC_PY_EBADMSG | 74 | Not a data message |
85 | | QUEC_PY_EOVERFLOW | 75 | Value too large for defined data type |
86 | | QUEC_PY_ENOTUNIQ | 76 | Name not unique on network |
87 | | QUEC_PY_EBADFD | 77 | File descriptor in bad state |
88 | | QUEC_PY_EREMCHG | 78 | Remote address changed |
89 | | QUEC_PY_ELIBACC | 79 | Can not access a needed shared library |
90 | | QUEC_PY_ELIBBAD | 80 | Accessing a corrupted shared library |
91 | | QUEC_PY_ELIBSCN | 81 | .lib section in a.out corrupted |
92 | | QUEC_PY_ELIBMAX | 82 | Attempting to link in too many shared libraries |
93 | | QUEC_PY_ELIBEXEC | 83 | Cannot exec a shared library directly |
94 | | QUEC_PY_EILSEQ | 84 | Illegal byte sequence |
95 | | QUEC_PY_ERESTART | 85 | Interrupted system call should be restarted |
96 | | QUEC_PY_ESTRPIPE | 86 | Streams pipe error |
97 | | QUEC_PY_EUSERS | 87 | Too many users |
98 | | QUEC_PY_ENOTSOCK | 88 | Socket operation on non-socket |
99 | | QUEC_PY_EDESTADDRREQ | 89 | Destination address required |
100 | | QUEC_PY_EMSGSIZE | 90 | Message too long |
101 | | QUEC_PY_EPROTOTYPE | 91 | Protocol wrong type for socket |
102 | | QUEC_PY_ENOPROTOOPT | 92 | Protocol not available |
103 | | QUEC_PY_EPROTONOSUPPORT | 93 | Protocol not supported |
104 | | QUEC_PY_ESOCKTNOSUPPORT | 94 | Socket type not supported |
105 | | QUEC_PY_EOPNOTSUPP | 95 | Operation not supported on transport endpoint |
106 | | QUEC_PY_EAFNOSUPPORT | 97 | Address family not supported by protocol |
107 | | QUEC_PY_EADDRINUSE | 98 | Address already in use |
108 | | QUEC_PY_ECONNABORTED | 103 | Software caused connection abort |
109 | | QUEC_PY_ECONNRESET | 104 | Connection reset by peer |
110 | | QUEC_PY_ENOBUFS | 105 | No buffer space available |
111 | | QUEC_PY_EISCONN | 106 | Transport endpoint is already connected |
112 | | QUEC_PY_ENOTCONN | 107 | Transport endpoint is not connected |
113 | | QUEC_PY_ETIMEDOUT | 110 | Connection timed out |
114 | | QUEC_PY_ECONNREFUSED | 111 | Connection refused |
115 | | QUEC_PY_EHOSTUNREACH | 113 | No route to host |
116 | | QUEC_PY_EALREADY | 114 | Operation already in progress |
117 | | QUEC_PY_EINPROGRESS | 115 | Operation now in progress |
118 |
119 | ### 错误码到错误消息
120 |
121 | ```python
122 | import uerrno.errno_to_str()
123 |
124 | # 暂未实现
125 | errInfo = uerrno.errno_to_str()
126 | print(errInfo)
127 | ```
128 |
129 | ## QuecPython异常检查流程
130 |
131 | ### 异常重启处理
132 |
133 | 固件版本默认是业务模式,即出现底层异常错误时会自动重启,防止模块程序停止导致无法使用。当我们处于调试期时需要暴露并定位问题原因,此时需要设置三条AT指令(AT口执行):
134 |
135 | - at+qdumpcfg=0,0
136 | - at+qdumpcfg=1,0
137 | - at+log=19,1
138 |
139 | 依次执行上述三条AT指令即可进入调试模式,此时若出现底层异常错误则会进入DUMP模式,出现DUMP端口,此时您可以有两种选择:
140 |
141 | **方法一**:提供固件版本、测试步骤及测试代码,前往QuecPython官网提交问题工单
142 | **方法二**:使用Tera term窗口调试工具(使用方法:百度即可)抓取Dumplog,同时提供固件版本、测试步骤及测试代码,前往QuecPython官网提交问题工单,节省复现问题时间。
143 |
144 | **需要注意此指令重启后仍然生效,如需退出调试模式,有以下三种方法。**
145 | 1、用AT指令直接关闭
146 | 2、AT+RSTSET恢复出厂设置
147 | 3、更改固件烧录时擦除nvm
148 |
149 | ## QuecPython开关机reason含义和使用
150 |
151 | ### 寄存器含义
152 |
153 | #### power_up_reason
154 |
155 | 对应寄存器:NINGBO_PWRUP_LOG_REG
156 | 各bit的含义:
157 |
158 | | 0x01即bit0 | onkey硬件唤醒 |
159 | | ---------- | :-------------- |
160 | | 0x02即bit1 | exton1硬件唤醒 |
161 | | 0x04即bit2 | exton2硬件唤醒 |
162 | | 0x08即bit3 | bat硬件唤醒 |
163 | | 0x10即bit4 | rtc_alarm唤醒 |
164 | | 0x20即bit5 | fault唤醒 |
165 | | 0x40即bit6 | vbus_detect唤醒 |
166 |
167 | >
168 | > 目前使用的有:exton1硬件唤醒(powerkey硬件接的是exton1),fault唤醒,vbus_detect唤醒。
169 |
170 | #### power_down_reason
171 |
172 | 对应寄存器:NINGBO_POWERDOWN_LOG_REG
173 | 各bit的含义:
174 |
175 | | 0x01即bit0 | over temperature关机 |
176 | | ---------- | :--------------------------------- |
177 | | 0x02即bit1 | PMIC VINLDO电压低于2.9V关机 |
178 | | 0x04即bit2 | SW_PDOWN软件调用power_down接口关机 |
179 | | 0x08即bit3 | 无 |
180 | | 0x10即bit4 | PMIC watch dog关机 |
181 | | 0x20即bit5 | long press of ONKEY关机 |
182 | | 0x40即bit6 | VINLDO电压过高关机 |
183 | | 0x80即bit7 | VRTC LOW关机 |
184 |
185 | >
186 | > 目前long press of ONKEY关机不使用。
187 |
188 | #### power_down_reason2
189 |
190 | 目前只关注power_down_reason寄存器,该寄存器不需要使用。
191 |
192 | ### 开机原因
193 |
194 | #### 开关机过程
195 |
196 | **1.长按powerkey关机**
197 | 检测到长按动作,最终调用PMIC_SW_PDOWN
198 |
199 | **2.硬件RESET**
200 | 调用CPU RESET引脚,PMIC不掉电, PWRUP_LOG_REG和POWERDOWN_LOG_REG寄存器也不会更新
201 |
202 | **3.软件RESET**
203 | a.若是调用PMIC_SW_RESET先使能FAULT_WAKEUP,再调SW_PDOWN,然后会FAULT唤醒重启。
204 | b.若是异常重启类似硬件RESET,只是CPU RESET,PMIC不掉电。
205 |
206 | **4.按 powerkey开机**
207 | 为exton1硬件唤醒
208 |
209 | **5.插USB开机**
210 | 为vbus_detect唤醒
211 |
212 | #### 开机原因获取
213 |
214 | *每次开机读取过power_down_reason之后,会将其标志清掉,power_up_reason不支持清除。*
215 |
216 | **1.powerkey**
217 | 需满足power_up_reason==0x02,且power_down_reason!=0
218 |
219 | **2.硬件、异常RESET**
220 | 由于PMIC不掉电, PWRUP_LOG_REG寄存器不会更新,POWERDOWN_LOG_REG寄存器被清掉,则需满足power_up_reason==0x02,且power_down_reason==0。或满足power_up_reason==0x40, 且power_down_reason==0。
221 |
222 | **3.软件RESET**
223 | 如果是插着USB则需满足power_up_reason==0x60,且power_down_reason==0x04。
224 |
225 | **4.Vbus**
226 | 需满足power_up_reason==0x40,且power_down_reason!=0x00。
227 |
228 | **5.其他开机原因在前面这些原因之后按bit含义获取。**
229 |
230 | ### 关机原因
231 |
232 | 关机原因如代码中按照bit含义获取即可。
233 |
234 | ### 开关机原因接口使用
235 |
236 | 目前boot侧和kernel侧都会提供开关机原因接口,由于获取开关机原因之后需要将POWERDOWN_LOG_REG寄存器中的关机原因标志清除,所以在boot侧调用过该接口的话,在kernel侧就不能调了,否则获取的值会有异常。现在boot侧的接口默认没调用。
237 |
238 |
--------------------------------------------------------------------------------
/zh-cn/faq/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/zh-cn/faq/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**视频教程**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**python基础**](/zh-cn/python/)
5 |
6 | * [**python 基本属性**](/zh-cn/api/pythonBasic.md)
7 | * [**QuecPython 标准库**](/zh-cn/api/pythonStdlib.md)
8 | * [**QuecPython 类库**](/zh-cn/api/QuecPythonClasslib.md)
9 | * [**QuecPython 第三方库**](/zh-cn/api/QuecPythonThirdlib.md)
10 | * [**QuecPython 异常处理**](/zh-cn/faq/)
11 |
12 |
13 | * [**官方网站**](//python.quectel.com)
14 | * [**文档中心**](//python.quectel.com/doc/)
15 | * [**资料下载**](//python.quectel.com/download)
--------------------------------------------------------------------------------
/zh-cn/python/_navbar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [中文](/zh-cn/)
4 | * [En](/en-us/)
5 |
--------------------------------------------------------------------------------
/zh-cn/python/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | * [**视频教程**](https://space.bilibili.com/491326023/channel/detail?cid=150963)
4 | * [**python基础**](/zh-cn/python/)
5 |
6 | * [**python 基本属性**](/zh-cn/api/pythonBasic.md)
7 | * [**QuecPython 标准库**](/zh-cn/api/pythonStdlib.md)
8 | * [**QuecPython 类库**](/zh-cn/api/QuecPythonClasslib.md)
9 | * [**QuecPython 第三方库**](/zh-cn/api/QuecPythonThirdlib.md)
10 | * [**QuecPython 异常处理**](/zh-cn/faq/)
11 |
12 |
13 | * [**官方网站**](//python.quectel.com)
14 | * [**文档中心**](//python.quectel.com/doc/)
15 | * [**资料下载**](//python.quectel.com/download)
--------------------------------------------------------------------------------
/zh-cn/python/images/1240.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1240.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1241.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1241.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1242.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1242.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1243.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1243.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1244.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1244.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1245.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1245.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1246.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1246.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1247.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1247.jpg
--------------------------------------------------------------------------------
/zh-cn/python/images/1248.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuecPython/wiki/f2d6221dcfb903fe98e7ca451b2d6bdde550fb14/zh-cn/python/images/1248.jpg
--------------------------------------------------------------------------------