Skip to content

Commit

Permalink
Merge branch 'main' into Rule_Special_Characters_In_Names
Browse files Browse the repository at this point in the history
  • Loading branch information
barrywhart committed Nov 24, 2021
2 parents a55794a + 67023b8 commit 465f286
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 14 deletions.
10 changes: 9 additions & 1 deletion src/sqlfluff/__init__.py
Expand Up @@ -3,14 +3,22 @@
import pytest

# Expose the public API.
from sqlfluff.api import lint, fix, parse, list_rules, list_dialects # noqa: F401
from sqlfluff.api import lint, fix, parse, list_rules, list_dialects

# Import metadata (using importlib_metadata backport for python versions <3.8)
if sys.version_info < (3, 8, 0):
import importlib_metadata as metadata
else:
from importlib import metadata

__all__ = (
"lint",
"fix",
"parse",
"list_rules",
"list_dialects",
)

# Get the current version
__version__ = metadata.version("sqlfluff")

Expand Down
11 changes: 9 additions & 2 deletions src/sqlfluff/api/__init__.py
@@ -1,7 +1,14 @@
"""Elements which wrap the sqlfluff core library for public use."""

# flake8: noqa: F401

# Expose the simple api
from sqlfluff.api.simple import lint, fix, parse, APIParsingError
from sqlfluff.api.info import list_rules, list_dialects

__all__ = (
"lint",
"fix",
"parse",
"APIParsingError",
"list_rules",
"list_dialects",
)
16 changes: 15 additions & 1 deletion src/sqlfluff/core/__init__.py
@@ -1,6 +1,5 @@
"""The core elements of sqlfluff."""

# flake8: noqa: F401
import tblib.pickling_support # type: ignore

# Config objects
Expand All @@ -26,6 +25,21 @@
# Timing objects
from sqlfluff.core.timing import TimingSummary

__all__ = (
"FluffConfig",
"Linter",
"Lexer",
"Parser",
"dialect_selector",
"dialect_readout",
"SQLBaseError",
"SQLTemplaterError",
"SQLLexError",
"SQLParseError",
"SQLLintError",
"SQLFluffUserError",
"TimingSummary",
)

# This is for "sqlfluff lint" and "sqlfluff fix" multiprocessing (--processes)
# support. If an exception (i.e. runtime error) occurs in a worker process, we
Expand Down
11 changes: 9 additions & 2 deletions src/sqlfluff/core/linter/__init__.py
@@ -1,8 +1,15 @@
"""Linter class and helper classes."""

# flake8: noqa: F401

from sqlfluff.core.linter.common import RuleTuple, ParsedString, NoQaDirective
from sqlfluff.core.linter.linted_file import LintedFile
from sqlfluff.core.linter.linting_result import LintingResult
from sqlfluff.core.linter.linter import Linter

__all__ = (
"RuleTuple",
"ParsedString",
"NoQaDirective",
"LintedFile",
"LintingResult",
"Linter",
)
41 changes: 38 additions & 3 deletions src/sqlfluff/core/parser/__init__.py
@@ -1,6 +1,4 @@
""" init file for the parser """

# flake8: noqa: F401
"""init file for the parser."""

from sqlfluff.core.parser.segments import (
BaseSegment,
Expand Down Expand Up @@ -36,3 +34,40 @@
from sqlfluff.core.parser.lexer import Lexer, StringLexer, RegexLexer
from sqlfluff.core.parser.parser import Parser
from sqlfluff.core.parser.matchable import Matchable

__all__ = (
"BaseSegment",
"BaseFileSegment",
"RawSegment",
"CodeSegment",
"UnlexableSegment",
"CommentSegment",
"WhitespaceSegment",
"NewlineSegment",
"KeywordSegment",
"SymbolSegment",
"Indent",
"Dedent",
"SegmentGenerator",
"Sequence",
"GreedyUntil",
"StartsWith",
"OneOf",
"Delimited",
"Bracketed",
"AnyNumberOf",
"Ref",
"Anything",
"Nothing",
"OptionallyBracketed",
"Conditional",
"StringParser",
"NamedParser",
"RegexParser",
"PositionMarker",
"Lexer",
"StringLexer",
"RegexLexer",
"Parser",
"Matchable",
)
17 changes: 15 additions & 2 deletions src/sqlfluff/core/parser/grammar/__init__.py
@@ -1,10 +1,23 @@
"""Definitions of grammars."""

# flake8: noqa: F401

from sqlfluff.core.parser.grammar.base import Ref, Anything, Nothing
from sqlfluff.core.parser.grammar.anyof import AnyNumberOf, OneOf, OptionallyBracketed
from sqlfluff.core.parser.grammar.delimited import Delimited
from sqlfluff.core.parser.grammar.greedy import GreedyUntil, StartsWith
from sqlfluff.core.parser.grammar.sequence import Sequence, Bracketed
from sqlfluff.core.parser.grammar.conditional import Conditional

__all__ = (
"Ref",
"Anything",
"Nothing",
"AnyNumberOf",
"OneOf",
"OptionallyBracketed",
"Delimited",
"GreedyUntil",
"StartsWith",
"Sequence",
"Bracketed",
"Conditional",
)
23 changes: 22 additions & 1 deletion src/sqlfluff/core/parser/segments/__init__.py
@@ -1,6 +1,5 @@
"""Definitions of the segment classes."""

# flake8: noqa: F401
from sqlfluff.core.parser.segments.base import (
BaseSegment,
BaseFileSegment,
Expand All @@ -25,3 +24,25 @@
Dedent,
TemplateSegment,
)

__all__ = (
"BaseSegment",
"BaseFileSegment",
"UnparsableSegment",
"BracketedSegment",
"SegmentGenerator",
"RawSegment",
"CodeSegment",
"UnlexableSegment",
"CommentSegment",
"WhitespaceSegment",
"NewlineSegment",
"KeywordSegment",
"SymbolSegment",
"EphemeralSegment",
"allow_ephemeral",
"MetaSegment",
"Indent",
"Dedent",
"TemplateSegment",
)
12 changes: 10 additions & 2 deletions src/sqlfluff/core/templaters/__init__.py
@@ -1,7 +1,5 @@
"""Templater Code."""

# flake8: noqa: F401

from sqlfluff.core.templaters.base import TemplatedFile

# Although these shouldn't usually be instantiated from here
Expand All @@ -15,3 +13,13 @@
def core_templaters():
"""Returns the templater tuples for the core templaters."""
yield from [RawTemplater, JinjaTemplater, PythonTemplater, PlaceholderTemplater]


__all__ = (
"TemplatedFile",
"RawTemplater",
"JinjaTemplater",
"PythonTemplater",
"PlaceholderTemplater",
"core_templaters",
)

0 comments on commit 465f286

Please sign in to comment.