Skip to content

Pyi add #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added FETCH_HEAD
Empty file.
Empty file added feature_branch
Empty file.
Binary file modified quecpython_stubs/sms.pyi
Binary file not shown.
80 changes: 80 additions & 0 deletions quecpython_stubs/ure.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""
Function: Regular Expression
The ure module provides regular expression matching operations.

Supported operators:
'.' - Match any character
'[]' - Match set of characters (individual characters and ranges)
'^' - Match the start of the string
'$' - Match the end of the string
'?' - Match zero or one of the previous sub-pattern
'*' - Match zero or more of the previous sub-pattern
'+' - Match one or more of the previous sub-pattern
'??' - Non-greedy version of ? (match zero or one)
'*?' - Non-greedy version of * (match zero or more)
'+?' - Non-greedy version of + (match one or more)
'|' - Match either the left-hand side or the right-hand side
'\d' - Match digit
'\D' - Match non-digit
'\s' - Match whitespace
'\S' - Match non-whitespace
'\w' - Match "word characters" (ASCII only)
'\W' - Match non-"word characters" (ASCII only)

Not supported operators:
'{m,n}' - Counted repetitions
'(?P<name>...)' - Named groups
'(?:...)' - Non-capturing groups
'\b' - Word boundary assertions
'\B' - Non-word boundary assertions
'\r' - Carriage return (use Python's escaping instead)
'\n' - Newline (use Python's escaping instead)

Descriptions taken from:
https://developer.quectel.com/doc/quecpython/API_reference/en/stdlib/ure.html
"""

class error(Exception):
"""Exception raised for invalid regular expressions."""
pass

def compile(regex):
"""
Compiles a regular expression and generates a regular-expression object

:param regex: Regular expression string
:return: Compiled regex object
"""


def match(regex, string):
"""
Matches the compiled regular expression against string from the start

:param regex: Regular expression string or compiled object
:param string: The string to be matched
:return: Match object if successful, otherwise None
"""


def search(regex, string):
"""
Searches for the compiled regular expression in string

:param regex: Regular expression string or compiled object
:param string: The string to search in
:return: Match object if found, otherwise None
"""


class Match:
"""Match object returned by successful match/search"""

def group(self, index=0):
"""
Returns the string captured by the group

:param index: Group index (0 = entire match)
:return: Captured substring
:raises: Error when group does not exist
"""