Skip to content

Commit bd647f0

Browse files
Pyi add (#10)
* 添加 ure 模块的类型存根文件 * 添加了sms.pyi存根文件的描述 * ure提交上去发现打不开,重新提交 * ure打不开,尝试推送 * 解决ure乱码问题
1 parent 905f112 commit bd647f0

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

quecpython_stubs/sms.pyi

-593 Bytes
Binary file not shown.

quecpython_stubs/ure.pyi

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
"""
2+
Function: Regular Expression
3+
The ure module provides regular expression matching operations.
4+
5+
Supported operators:
6+
'.' - Match any character
7+
'[]' - Match set of characters (individual characters and ranges)
8+
'^' - Match the start of the string
9+
'$' - Match the end of the string
10+
'?' - Match zero or one of the previous sub-pattern
11+
'*' - Match zero or more of the previous sub-pattern
12+
'+' - Match one or more of the previous sub-pattern
13+
'??' - Non-greedy version of ? (match zero or one)
14+
'*?' - Non-greedy version of * (match zero or more)
15+
'+?' - Non-greedy version of + (match one or more)
16+
'|' - Match either the left-hand side or the right-hand side
17+
'\d' - Match digit
18+
'\D' - Match non-digit
19+
'\s' - Match whitespace
20+
'\S' - Match non-whitespace
21+
'\w' - Match "word characters" (ASCII only)
22+
'\W' - Match non-"word characters" (ASCII only)
23+
24+
Not supported operators:
25+
'{m,n}' - Counted repetitions
26+
'(?P<name>...)' - Named groups
27+
'(?:...)' - Non-capturing groups
28+
'\b' - Word boundary assertions
29+
'\B' - Non-word boundary assertions
30+
'\r' - Carriage return (use Python's escaping instead)
31+
'\n' - Newline (use Python's escaping instead)
32+
33+
Descriptions taken from:
34+
https://developer.quectel.com/doc/quecpython/API_reference/en/stdlib/ure.html
35+
"""
36+
37+
class error(Exception):
38+
"""Exception raised for invalid regular expressions."""
39+
pass
40+
41+
def compile(regex):
42+
"""
43+
Compiles a regular expression and generates a regular-expression object
44+
45+
:param regex: Regular expression string
46+
:return: Compiled regex object
47+
"""
48+
49+
50+
def match(regex, string):
51+
"""
52+
Matches the compiled regular expression against string from the start
53+
54+
:param regex: Regular expression string or compiled object
55+
:param string: The string to be matched
56+
:return: Match object if successful, otherwise None
57+
"""
58+
59+
60+
def search(regex, string):
61+
"""
62+
Searches for the compiled regular expression in string
63+
64+
:param regex: Regular expression string or compiled object
65+
:param string: The string to search in
66+
:return: Match object if found, otherwise None
67+
"""
68+
69+
70+
class Match:
71+
"""Match object returned by successful match/search"""
72+
73+
def group(self, index=0):
74+
"""
75+
Returns the string captured by the group
76+
77+
:param index: Group index (0 = entire match)
78+
:return: Captured substring
79+
:raises: Error when group does not exist
80+
"""

0 commit comments

Comments
 (0)