diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-28 14:08:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-28 15:17:26 -0400 |
| commit | c3f102c9fe9811fd5286628cc6aafa5fbc324621 (patch) | |
| tree | 4a78723089ded623701667de1eee21d22edbe6c1 /lib/sqlalchemy/sql | |
| parent | 75ac0abc7d5653d10006769a881374a46b706db5 (diff) | |
| download | sqlalchemy-c3f102c9fe9811fd5286628cc6aafa5fbc324621.tar.gz | |
upgrade to black 20.8b1
It's better, the majority of these changes look more readable to me.
also found some docstrings that had formatting / quoting issues.
Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/base.py | 35 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/coercions.py | 10 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/crud.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/ddl.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/dml.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/elements.py | 9 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/lambdas.py | 13 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 16 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/type_api.py | 5 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/util.py | 3 |
11 files changed, 63 insertions, 51 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 67ee8c907..f9b5ce7e1 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -558,10 +558,7 @@ class _MetaOptions(type): class Options(util.with_metaclass(_MetaOptions)): - """A cacheable option dictionary with defaults. - - - """ + """A cacheable option dictionary with defaults.""" def __init__(self, **kw): self.__dict__.update(kw) @@ -635,7 +632,7 @@ class Options(util.with_metaclass(_MetaOptions)): def from_execution_options( cls, key, attrs, exec_options, statement_exec_options ): - """"process Options argument in terms of execution options. + """process Options argument in terms of execution options. e.g.:: @@ -706,9 +703,7 @@ class ExecutableOption(HasCopyInternals, HasCacheKey): __visit_name__ = "executable_option" def _clone(self): - """Create a shallow copy of this ExecutableOption. - - """ + """Create a shallow copy of this ExecutableOption.""" c = self.__class__.__new__(self.__class__) c.__dict__ = dict(self.__dict__) return c @@ -812,7 +807,7 @@ class Executable(Generative): @_generative def execution_options(self, **kw): - """ Set non-SQL options for the statement which take effect during + """Set non-SQL options for the statement which take effect during execution. Execution options can be set on a per-statement or @@ -858,7 +853,7 @@ class Executable(Generative): self._execution_options = self._execution_options.union(kw) def get_execution_options(self): - """ Get the non-SQL options which will take effect during execution. + """Get the non-SQL options which will take effect during execution. .. versionadded:: 1.3 @@ -877,9 +872,7 @@ class Executable(Generative): ":class:`.Session`.", ) def execute(self, *multiparams, **params): - """Compile and execute this :class:`.Executable`. - - """ + """Compile and execute this :class:`.Executable`.""" e = self.bind if e is None: label = getattr(self, "description", self.__class__.__name__) @@ -1388,18 +1381,18 @@ class DedupeColumnCollection(ColumnCollection): def replace(self, column): """add the given column to this collection, removing unaliased - versions of this column as well as existing columns with the - same key. + versions of this column as well as existing columns with the + same key. - e.g.:: + e.g.:: - t = Table('sometable', metadata, Column('col1', Integer)) - t.columns.replace(Column('col1', Integer, key='columnone')) + t = Table('sometable', metadata, Column('col1', Integer)) + t.columns.replace(Column('col1', Integer, key='columnone')) - will remove the original 'col1' from the collection, and add - the new column under the name 'columnname'. + will remove the original 'col1' from the collection, and add + the new column under the name 'columnname'. - Used by schema.Column to override columns during table reflection. + Used by schema.Column to override columns during table reflection. """ diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py index 154564a08..558ced8bd 100644 --- a/lib/sqlalchemy/sql/coercions.py +++ b/lib/sqlalchemy/sql/coercions.py @@ -37,9 +37,13 @@ def _is_literal(element): """ - return not isinstance( - element, (Visitable, schema.SchemaEventTarget), - ) and not hasattr(element, "__clause_element__") + return ( + not isinstance( + element, + (Visitable, schema.SchemaEventTarget), + ) + and not hasattr(element, "__clause_element__") + ) def _deep_is_literal(element): diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index 986f63aad..1c68d6450 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -719,7 +719,8 @@ def _append_param_update( ( c, compiler.preparer.format_column( - c, use_table=include_table, + c, + use_table=include_table, ), compiler.process(c.onupdate.arg.self_group(), **kw), ) @@ -733,7 +734,8 @@ def _append_param_update( ( c, compiler.preparer.format_column( - c, use_table=include_table, + c, + use_table=include_table, ), _create_update_prefetch_bind_param(compiler, c, **kw), ) diff --git a/lib/sqlalchemy/sql/ddl.py b/lib/sqlalchemy/sql/ddl.py index 67c11f6c7..5f3074cdc 100644 --- a/lib/sqlalchemy/sql/ddl.py +++ b/lib/sqlalchemy/sql/ddl.py @@ -985,7 +985,9 @@ class SchemaDropper(DDLBase): def sort_tables( - tables, skip_fn=None, extra_dependencies=None, + tables, + skip_fn=None, + extra_dependencies=None, ): """Sort a collection of :class:`_schema.Table` objects based on dependency. diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index fd2efc6f9..5ddc9ef82 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -193,9 +193,7 @@ class UpdateBase( Executable, ClauseElement, ): - """Form the base for ``INSERT``, ``UPDATE``, and ``DELETE`` statements. - - """ + """Form the base for ``INSERT``, ``UPDATE``, and ``DELETE`` statements.""" __visit_name__ = "update_base" @@ -435,7 +433,7 @@ class UpdateBase( :param dialect_name: defaults to ``*``, if specified as the name of a particular dialect, will apply these hints only when that dialect is in use. - """ + """ if selectable is None: selectable = self.table diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 59f3fa86b..c8ae1e6b6 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -3526,7 +3526,10 @@ class BinaryExpression(ColumnElement): ("operator", InternalTraversal.dp_operator), ("negate", InternalTraversal.dp_operator), ("modifiers", InternalTraversal.dp_plain_dict), - ("type", InternalTraversal.dp_type,), # affects JSON CAST operators + ( + "type", + InternalTraversal.dp_type, + ), # affects JSON CAST operators ] _is_implicitly_boolean = True @@ -3638,8 +3641,8 @@ class Slice(ColumnElement): class IndexExpression(BinaryExpression): - """Represent the class of expressions that are like an "index" operation. - """ + """Represent the class of expressions that are like an "index" + operation.""" pass diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py index 7d52f97ee..676152781 100644 --- a/lib/sqlalchemy/sql/lambdas.py +++ b/lib/sqlalchemy/sql/lambdas.py @@ -604,7 +604,11 @@ class AnalyzedCode(object): # create trackers to catch those. analyzed_function = AnalyzedFunction( - self, lambda_element, None, lambda_kw, fn, + self, + lambda_element, + None, + lambda_kw, + fn, ) closure_trackers = self.closure_trackers @@ -781,7 +785,12 @@ class AnalyzedFunction(object): ) def __init__( - self, analyzed_code, lambda_element, apply_propagate_attrs, kw, fn, + self, + analyzed_code, + lambda_element, + apply_propagate_attrs, + kw, + fn, ): self.analyzed_code = analyzed_code self.fn = fn diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 496f8d9fb..e96da0e24 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -830,9 +830,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause): ":meth:`_reflection.Inspector.has_table`.", ) def exists(self, bind=None): - """Return True if this table exists. - - """ + """Return True if this table exists.""" if bind is None: bind = _bind_or_error(self) @@ -3634,10 +3632,14 @@ class PrimaryKeyConstraint(ColumnCollectionConstraint): if col.autoincrement is True: _validate_autoinc(col, True) return col - elif col.autoincrement in ( - "auto", - "ignore_fk", - ) and _validate_autoinc(col, False): + elif ( + col.autoincrement + in ( + "auto", + "ignore_fk", + ) + and _validate_autoinc(col, False) + ): return col else: diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index e2edf20b5..45d4f0b7f 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -361,7 +361,10 @@ class String(Concatenable, TypeEngine): needs_isinstance = ( needs_convert and dialect.returns_unicode_strings - in (String.RETURNS_CONDITIONAL, String.RETURNS_UNICODE,) + in ( + String.RETURNS_CONDITIONAL, + String.RETURNS_UNICODE, + ) and self._expect_unicode != "force_nocheck" ) if needs_convert: @@ -2286,7 +2289,7 @@ class JSON(Indexable, TypeEngine): :attr:`.types.JSON.NULL` - """ + """ self.none_as_null = none_as_null class JSONElementType(TypeEngine): diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 0da88dc54..614b70a41 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -1156,10 +1156,7 @@ class TypeDecorator(SchemaEventTarget, TypeEngine): @util.memoized_property def _has_literal_processor(self): - """memoized boolean, check if process_literal_param is implemented. - - - """ + """memoized boolean, check if process_literal_param is implemented.""" return ( self.__class__.process_literal_param.__code__ diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 264976cc8..96fa209fd 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -1011,8 +1011,7 @@ def _offset_or_limit_clause_asint_if_possible(clause): def _make_slice(limit_clause, offset_clause, start, stop): - """Compute LIMIT/OFFSET in terms of slice start/end - """ + """Compute LIMIT/OFFSET in terms of slice start/end""" # for calculated limit/offset, try to do the addition of # values to offset in Python, however if a SQL clause is present |
