-
Couldn't load subscription status.
- Fork 1
docs: missing docstrings for functions & classes #13
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
Changes from 52 commits
11222db
5551b58
bfde221
e017901
144bdc2
7a1f6a6
acd9209
6028f88
94ba284
59eb432
048566c
f5719f8
2c0c0a2
05bf7dc
31185df
bd605a5
23f87ad
216a92b
3b34162
d5ba00c
ccfb6ce
9526cc2
a921666
60fd3fb
d86e8a1
325abb9
539b3dd
5ce0fa9
a9eb4a6
bbb3378
f364372
a703d5c
f94dc9c
ec1aeca
29801d9
28a7faa
0d47d9a
717cd4e
466e037
8dabb7b
6437b70
8e26153
f41acd5
17eaefa
a71ca06
a1ecbec
b701555
50570db
a1ad37d
3c3572b
dc43995
b829809
c6d924b
0806ab8
9e1be73
9aa0c63
467cdaa
c4857a4
e04627c
9f286fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,14 +60,18 @@ def __len__(self): | |
|
|
||
|
|
||
| class terminal(str): | ||
| """ | ||
| terminal represents the unit symbol that can be part of a SQL values clause. | ||
| """ | ||
| """Represent the unit symbol that can be part of a SQL values clause.""" | ||
|
|
||
| pass | ||
|
|
||
|
|
||
| class a_args(object): | ||
| """Expression arguments. | ||
|
|
||
| :type argv: list | ||
| :param argv: A List of expression arguments. | ||
| """ | ||
|
|
||
| def __init__(self, argv): | ||
| self.argv = argv | ||
|
|
||
|
|
@@ -102,9 +106,11 @@ def __getitem__(self, index): | |
| return self.argv[index] | ||
|
|
||
| def homogenous(self): | ||
| """ | ||
| Return True if all the arguments are pyformat | ||
| args and have the same number of arguments. | ||
| """Check arguments of the expression to be homogeneous. | ||
|
|
||
| :rtype: bool | ||
| :return: True if all the arguments of the expression are in pyformat | ||
| and each has the same length, False otherwise. | ||
| """ | ||
| if not self._is_equal_length(): | ||
| return False | ||
|
|
@@ -120,8 +126,10 @@ def homogenous(self): | |
| return True | ||
|
|
||
| def _is_equal_length(self): | ||
| """ | ||
| Return False if all the arguments have the same length. | ||
| """Return False if all the arguments have the same length. | ||
|
|
||
| :rtype: bool | ||
| :return: False if the sequences of the arguments have the same length. | ||
| """ | ||
| if len(self) == 0: | ||
| return True | ||
|
|
@@ -135,6 +143,12 @@ def _is_equal_length(self): | |
|
|
||
|
|
||
| class values(a_args): | ||
| """A wrapper for values. | ||
|
|
||
| :rtype: str | ||
| :returns: A string of the values expression in a tree view. | ||
| """ | ||
|
|
||
| def __str__(self): | ||
| return "VALUES%s" % super().__str__() | ||
|
||
|
|
||
|
|
@@ -147,6 +161,19 @@ def parse_values(stmt): | |
|
|
||
|
|
||
| def expect(word, token): | ||
| """Parse the given expression recursively. | ||
|
|
||
| :type word: str | ||
| :param word: A string expression. | ||
|
|
||
| :type token: str | ||
| :param token: An expression token. | ||
|
|
||
| :rtype: (str, Any) | ||
| :returns: A tuple containing the rest of the expression string and the tree | ||
| of the already parsed. | ||
| :raises :class:`ProgrammingError`: If there is a parsing error. | ||
| """ | ||
| word = word.strip() | ||
| if token == VALUES: | ||
| if not word.startswith("VALUES"): | ||
|
|
@@ -242,5 +269,13 @@ def expect(word, token): | |
|
|
||
|
|
||
| def as_values(values_stmt): | ||
| """Return the parsed values. | ||
|
|
||
| :type values_stmt: str | ||
| :param values_stmt: Raw values. | ||
|
|
||
| :rtype: Any | ||
| :returns: A tree of the already parsed expression. | ||
| """ | ||
| _, _values = parse_values(values_stmt) | ||
| return _values | ||

Uh oh!
There was an error while loading. Please reload this page.