From 43478c60394e09246ee6275f89ae434e429cc5b5 Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Wed, 29 Nov 2017 09:56:06 -0700 Subject: Fix typos --- sqlparse/engine/grouping.py | 6 +++--- sqlparse/engine/statement_splitter.py | 6 +++--- sqlparse/filters/aligned_indent.py | 4 ++-- sqlparse/filters/output.py | 4 ++-- sqlparse/keywords.py | 4 ++-- sqlparse/lexer.py | 2 +- sqlparse/sql.py | 6 +++--- sqlparse/tokens.py | 4 ++-- tests/conftest.py | 4 ++-- tests/test_cli.py | 2 +- tests/test_grouping.py | 2 +- tests/test_parse.py | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index fa87c9f..5078389 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -28,8 +28,8 @@ def _group_matching(tlist, cls): continue if token.is_group and not isinstance(token, cls): - # Check inside previously grouped (ie. parenthesis) if group - # of differnt type is inside (ie, case). though ideally should + # Check inside previously grouped (i.e. parenthesis) if group + # of different type is inside (i.e., case). though ideally should # should check for all open/close tokens at once to avoid recursion _group_matching(token, cls) continue @@ -365,7 +365,7 @@ def _group(tlist, cls, match, extend=True, recurse=True ): - """Groups together tokens that are joined by a middle token. ie. x < y""" + """Groups together tokens that are joined by a middle token. i.e. x < y""" tidx_offset = 0 pidx, prev_ = None, None diff --git a/sqlparse/engine/statement_splitter.py b/sqlparse/engine/statement_splitter.py index 6c5b599..87fe993 100644 --- a/sqlparse/engine/statement_splitter.py +++ b/sqlparse/engine/statement_splitter.py @@ -29,7 +29,7 @@ class StatementSplitter(object): # ANSI # if normal token return # wouldn't parenthesis increase/decrease a level? - # no, inside a paranthesis can't start new statement + # no, inside a parenthesis can't start new statement if ttype not in T.Keyword: return 0 @@ -56,9 +56,9 @@ class StatementSplitter(object): return 1 return 0 - # Should this respect a preceeding BEGIN? + # Should this respect a preceding BEGIN? # In CASE ... WHEN ... END this results in a split level -1. - # Would having multiple CASE WHEN END and a Assigment Operator + # Would having multiple CASE WHEN END and a Assignment Operator # cause the statement to cut off prematurely? if unified == 'END': self._begin_depth = max(0, self._begin_depth - 1) diff --git a/sqlparse/filters/aligned_indent.py b/sqlparse/filters/aligned_indent.py index c04d06d..2eb2197 100644 --- a/sqlparse/filters/aligned_indent.py +++ b/sqlparse/filters/aligned_indent.py @@ -31,7 +31,7 @@ class AlignedIndentFilter(object): def nl(self, offset=1): # offset = 1 represent a single space after SELECT offset = -len(offset) if not isinstance(offset, int) else offset - # add two for the space and parens + # add two for the space and parenthesis indent = self.indent * (2 + self._max_kwd_len) return sql.Token(T.Whitespace, self.n + self.char * ( @@ -50,7 +50,7 @@ class AlignedIndentFilter(object): if token is not None: with indent(self): tlist.insert_after(tlist[0], self.nl('SELECT')) - # process the inside of the parantheses + # process the inside of the parenthesis self._process_default(tlist) # de-indent last parenthesis diff --git a/sqlparse/filters/output.py b/sqlparse/filters/output.py index c3425df..ca96080 100644 --- a/sqlparse/filters/output.py +++ b/sqlparse/filters/output.py @@ -33,7 +33,7 @@ class OutputFilter(object): class OutputPythonFilter(OutputFilter): def _process(self, stream, varname, has_nl): - # SQL query asignation to varname + # SQL query assignation to varname if self.count > 1: yield sql.Token(T.Whitespace, '\n') yield sql.Token(T.Name, varname) @@ -79,7 +79,7 @@ class OutputPHPFilter(OutputFilter): varname_prefix = '$' def _process(self, stream, varname, has_nl): - # SQL query asignation to varname (quote header) + # SQL query assignation to varname (quote header) if self.count > 1: yield sql.Token(T.Whitespace, '\n') yield sql.Token(T.Name, varname) diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index a1242ab..af5e348 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -45,7 +45,7 @@ SQL_REGEX = { # FIXME(andi): VALUES shouldn't be listed here # see https://github.com/andialbrecht/sqlparse/pull/64 # IN is special, it may be followed by a parenthesis, but - # is never a functino, see issue183 + # is never a function, see issue183 (r'(CASE|IN|VALUES|USING)\b', tokens.Keyword), (r'(@|##|#)[A-ZÀ-Ü]\w+', tokens.Name), @@ -55,7 +55,7 @@ SQL_REGEX = { # TODO: Spaces before period not implemented (r'[A-ZÀ-Ü]\w*(?=\s*\.)', tokens.Name), # 'Name' . # FIXME(atronah): never match, - # because `re.match` doesn't work with lookbehind regexp feature + # because `re.match` doesn't work with look-behind regexp feature (r'(?<=\.)[A-ZÀ-Ü]\w*', tokens.Name), # .'Name' (r'[A-ZÀ-Ü]\w*(?=\()', tokens.Name), # side effect: change kw to func (r'-?0x[\dA-F]+', tokens.Number.Hexadecimal), diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 60e43da..d1b1699 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -35,7 +35,7 @@ class Lexer(object): Split ``text`` into (tokentype, text) pairs. - ``stack`` is the inital stack (default: ``['root']``) + ``stack`` is the initial stack (default: ``['root']``) """ if isinstance(text, file_types): text = text.read() diff --git a/sqlparse/sql.py b/sqlparse/sql.py index f698782..99f133e 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -20,7 +20,7 @@ class Token(object): """Base class for all other classes in this module. It represents a single token and has two instance attributes: - ``value`` is the unchange value of the token and ``ttype`` is + ``value`` is the unchanged value of the token and ``ttype`` is the type of the token. """ @@ -73,7 +73,7 @@ class Token(object): *values* is a list of possible values for this token. The values are OR'ed together so if only one of the values matches ``True`` is returned. Except for keyword tokens the comparison is - case-sensitive. For convenience it's ok to pass in a single string. + case-sensitive. For convenience it's OK to pass in a single string. If *regex* is ``True`` (default is ``False``) the given values are treated as regular expressions. """ @@ -363,7 +363,7 @@ class TokenList(Token): def get_parent_name(self): """Return name of the parent object if any. - A parent object is identified by the first occuring dot. + A parent object is identified by the first occurring dot. """ dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.')) _, prev_ = self.token_prev(dot_idx) diff --git a/sqlparse/tokens.py b/sqlparse/tokens.py index 6864f69..efc1e09 100644 --- a/sqlparse/tokens.py +++ b/sqlparse/tokens.py @@ -25,7 +25,7 @@ class _TokenType(tuple): return new def __repr__(self): - # self can be False only if its the `root` ie. Token itself + # self can be False only if its the `root` i.e. Token itself return 'Token' + ('.' if self else '') + '.'.join(self) @@ -55,7 +55,7 @@ Assignment = Token.Assignment # Generic types for non-source code Generic = Token.Generic -# String and some others are not direct childs of Token. +# String and some others are not direct children of Token. # alias them: Token.Token = Token Token.String = String diff --git a/tests/conftest.py b/tests/conftest.py index d107f5a..f2eb28e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,7 +17,7 @@ def filepath(): def make_filepath(filename): # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture - # Alternate solution is to use paramtrization `inderect=True` + # Alternate solution is to use parametrization `indirect=True` # http://stackoverflow.com/a/33879151 # Syntax is noisy and requires specific variable names return os.path.join(FILES_DIR, filename) @@ -31,7 +31,7 @@ def load_file(filepath): def make_load_file(filename, encoding='utf-8'): # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture - # Alternate solution is to use paramtrization `inderect=True` + # Alternate solution is to use parametrization `indirect=True` # http://stackoverflow.com/a/33879151 # Syntax is noisy and requires specific variable names # And seems to be limited to only 1 argument. diff --git a/tests/test_cli.py b/tests/test_cli.py index 485afd3..c96aa5f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,7 +35,7 @@ def test_valid_args(filepath): def test_invalid_choise(filepath): path = filepath('function.sql') with pytest.raises(SystemExit): - sqlparse.cli.main([path, '-l', 'spanish']) + sqlparse.cli.main([path, '-l', 'Spanish']) def test_invalid_args(filepath, capsys): diff --git a/tests/test_grouping.py b/tests/test_grouping.py index 1f3a19e..f26f8b3 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -283,7 +283,7 @@ def test_grouping_alias_case(): def test_grouping_subquery_no_parens(): # Not totally sure if this is the right approach... - # When a THEN clause contains a subquery w/o parens around it *and* + # When a THEN clause contains a subquery w/o parenthesis around it *and* # a WHERE condition, the WHERE grouper consumes END too. # This takes makes sure that it doesn't fail. p = sqlparse.parse('CASE WHEN 1 THEN select 2 where foo = 1 end')[0] diff --git a/tests/test_parse.py b/tests/test_parse.py index 4ba6ca1..b6f4fff 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -270,8 +270,8 @@ def test_array_literal(): def test_typed_array_definition(): - # array indices aren't grouped with builtins, but make sure we can extract - # indentifer names + # array indices aren't grouped with built-ins, but make sure we can extract + # identifier names p = sqlparse.parse('x int, y int[], z int')[0] names = [x.get_name() for x in p.get_sublists() if isinstance(x, sql.Identifier)] -- cgit v1.2.1