diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-11-21 20:36:35 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-11-22 15:03:17 +0000 |
commit | 0b95f0055be252b13e99b0a944466f60b5e367ff (patch) | |
tree | 6ae4135fd408c4e69582c4f6fa458b007553aeab /lib/sqlalchemy | |
parent | e04baa2953fb5d0d29f5dca01ea6882bf1fa1cd4 (diff) | |
download | sqlalchemy-0b95f0055be252b13e99b0a944466f60b5e367ff.tar.gz |
Remove object in class definition
References: #4600
Change-Id: I2a62ddfe00bc562720f0eae700a497495d7a987a
Diffstat (limited to 'lib/sqlalchemy')
95 files changed, 229 insertions, 229 deletions
diff --git a/lib/sqlalchemy/connectors/__init__.py b/lib/sqlalchemy/connectors/__init__.py index fee8b3836..eaa3e1a58 100644 --- a/lib/sqlalchemy/connectors/__init__.py +++ b/lib/sqlalchemy/connectors/__init__.py @@ -6,5 +6,5 @@ # the MIT License: https://www.opensource.org/licenses/mit-license.php -class Connector(object): +class Connector: pass diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 974cae4f7..e5745bf69 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1146,7 +1146,7 @@ class _BASETIMEIMPL(TIME): __visit_name__ = "_BASETIMEIMPL" -class _DateTimeBase(object): +class _DateTimeBase: def bind_processor(self, dialect): def process(value): if type(value) == datetime.date: @@ -1181,7 +1181,7 @@ class DATETIMEOFFSET(_DateTimeBase, sqltypes.DateTime): self.precision = precision -class _UnicodeLiteral(object): +class _UnicodeLiteral: def literal_processor(self, dialect): def process(value): diff --git a/lib/sqlalchemy/dialects/mssql/json.py b/lib/sqlalchemy/dialects/mssql/json.py index d5157312c..ae9059777 100644 --- a/lib/sqlalchemy/dialects/mssql/json.py +++ b/lib/sqlalchemy/dialects/mssql/json.py @@ -77,7 +77,7 @@ class JSON(sqltypes.JSON): # Note: these objects currently match exactly those of MySQL, however since # these are not generalizable to all JSON implementations, remain separately # implemented for each dialect. -class _FormatTypeMixin(object): +class _FormatTypeMixin: def _format_value(self, value): raise NotImplementedError() diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py index 0a56a03de..6ce55d392 100644 --- a/lib/sqlalchemy/dialects/mssql/pyodbc.py +++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py @@ -294,7 +294,7 @@ from ... import util from ...connectors.pyodbc import PyODBCConnector -class _ms_numeric_pyodbc(object): +class _ms_numeric_pyodbc: """Turns Decimals with adjusted() < 0 or > 7 into strings. @@ -366,7 +366,7 @@ class _MSFloat_pyodbc(_ms_numeric_pyodbc, sqltypes.Float): pass -class _ms_binary_pyodbc(object): +class _ms_binary_pyodbc: """Wraps binary values in dialect-specific Binary wrapper. If the value is null, return a pyodbc-specific BinaryNull object to prevent pyODBC [and FreeTDS] from defaulting binary @@ -389,7 +389,7 @@ class _ms_binary_pyodbc(object): return process -class _ODBCDateTimeBindProcessor(object): +class _ODBCDateTimeBindProcessor: """Add bind processors to handle datetimeoffset behaviors""" has_tz = False diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index af2d7bdbb..54fe1f57f 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -3196,7 +3196,7 @@ class MySQLDialect(default.DefaultDialect): return rows -class _DecodingRow(object): +class _DecodingRow: """Return unicode-decoded values based on type inspection. Smooth over data type issues (esp. with alpha driver versions) and diff --git a/lib/sqlalchemy/dialects/mysql/json.py b/lib/sqlalchemy/dialects/mysql/json.py index 8d052cc7c..384d3b9b6 100644 --- a/lib/sqlalchemy/dialects/mysql/json.py +++ b/lib/sqlalchemy/dialects/mysql/json.py @@ -36,7 +36,7 @@ class JSON(sqltypes.JSON): pass -class _FormatTypeMixin(object): +class _FormatTypeMixin: def _format_value(self, value): raise NotImplementedError() diff --git a/lib/sqlalchemy/dialects/mysql/reflection.py b/lib/sqlalchemy/dialects/mysql/reflection.py index 503c9614c..8d5b24f0c 100644 --- a/lib/sqlalchemy/dialects/mysql/reflection.py +++ b/lib/sqlalchemy/dialects/mysql/reflection.py @@ -17,7 +17,7 @@ from ... import types as sqltypes from ... import util -class ReflectedState(object): +class ReflectedState: """Stores raw information about a SHOW CREATE TABLE statement.""" def __init__(self): @@ -30,7 +30,7 @@ class ReflectedState(object): @log.class_logger -class MySQLTableDefinitionParser(object): +class MySQLTableDefinitionParser: """Parses the results of a SHOW CREATE TABLE statement.""" def __init__(self, dialect, preparer): diff --git a/lib/sqlalchemy/dialects/mysql/types.py b/lib/sqlalchemy/dialects/mysql/types.py index dee58b4a5..abbf943a9 100644 --- a/lib/sqlalchemy/dialects/mysql/types.py +++ b/lib/sqlalchemy/dialects/mysql/types.py @@ -12,7 +12,7 @@ from ... import types as sqltypes from ... import util -class _NumericType(object): +class _NumericType: """Base for MySQL numeric types. This is the base both for NUMERIC as well as INTEGER, hence diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py index c54179c81..d141ee731 100644 --- a/lib/sqlalchemy/dialects/postgresql/ranges.py +++ b/lib/sqlalchemy/dialects/postgresql/ranges.py @@ -10,7 +10,7 @@ from ... import types as sqltypes __all__ = ("INT4RANGE", "INT8RANGE", "NUMRANGE") -class RangeOperators(object): +class RangeOperators: """ This mixin provides functionality for the Range Operators listed in Table 9-44 of the `PostgreSQL documentation`__ for Range diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 6c22c8ef3..7ded73973 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -863,7 +863,7 @@ class _SQliteJson(JSON): return process -class _DateTimeMixin(object): +class _DateTimeMixin: _reg = None _storage_format = None diff --git a/lib/sqlalchemy/dialects/sqlite/json.py b/lib/sqlalchemy/dialects/sqlite/json.py index 614f95405..b412fa5a5 100644 --- a/lib/sqlalchemy/dialects/sqlite/json.py +++ b/lib/sqlalchemy/dialects/sqlite/json.py @@ -36,7 +36,7 @@ class JSON(sqltypes.JSON): # Note: these objects currently match exactly those of MySQL, however since # these are not generalizable to all JSON implementations, remain separately # implemented for each dialect. -class _FormatTypeMixin(object): +class _FormatTypeMixin: def _format_value(self, value): raise NotImplementedError() diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 24f8a8a87..389270e45 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -2603,7 +2603,7 @@ class Engine(ConnectionEventsTarget, log.Identified): return self.pool.connect() -class OptionEngineMixin(object): +class OptionEngineMixin: _sa_propagate_class_events = False def __init__(self, proxied, execution_options): diff --git a/lib/sqlalchemy/engine/cursor.py b/lib/sqlalchemy/engine/cursor.py index 0099d69ff..54db9f6c2 100644 --- a/lib/sqlalchemy/engine/cursor.py +++ b/lib/sqlalchemy/engine/cursor.py @@ -692,7 +692,7 @@ class CursorResultMetaData(ResultMetaData): self._translated_indexes = self._tuplefilter = None -class ResultFetchStrategy(object): +class ResultFetchStrategy: """Define a fetching strategy for a result object. @@ -1095,7 +1095,7 @@ class _NoResultMetaData(ResultMetaData): _NO_RESULT_METADATA = _NoResultMetaData() -class BaseCursorResult(object): +class BaseCursorResult: """Base class for database result objects.""" out_parameters = None diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 9a138e69e..3af24d913 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -674,7 +674,7 @@ class DefaultDialect(interfaces.Dialect): return connection -class _RendersLiteral(object): +class _RendersLiteral: def literal_processor(self, dialect): def process(value): return "'%s'" % value diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 7150f386c..6772a27bd 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -11,7 +11,7 @@ from ..sql.compiler import Compiled # noqa from ..sql.compiler import TypeCompiler # noqa -class Dialect(object): +class Dialect: """Define the behavior of a specific database and DB-API combination. Any aspect of metadata definition, SQL query generation, @@ -1109,7 +1109,7 @@ class Dialect(object): raise NotImplementedError() -class CreateEnginePlugin(object): +class CreateEnginePlugin: """A set of hooks intended to augment the construction of an :class:`_engine.Engine` object based on entrypoint names in a URL. @@ -1343,7 +1343,7 @@ class CreateEnginePlugin(object): """ -class ExecutionContext(object): +class ExecutionContext: """A messenger object for a Dialect that corresponds to a single execution. @@ -1601,7 +1601,7 @@ class Connectable(ConnectionEventsTarget): raise NotImplementedError() -class ExceptionContext(object): +class ExceptionContext: """Encapsulate information about an error condition in progress. This object exists solely to be passed to the @@ -1750,7 +1750,7 @@ class ExceptionContext(object): """ -class AdaptedConnection(object): +class AdaptedConnection: """Interface of an adapted connection object to support the DBAPI protocol. Used by asyncio dialects to provide a sync-style pep-249 facade on top diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py index fed353e9c..c918f15b3 100644 --- a/lib/sqlalchemy/engine/reflection.py +++ b/lib/sqlalchemy/engine/reflection.py @@ -58,7 +58,7 @@ def cache(fn, self, con, *args, **kw): @inspection._self_inspects -class Inspector(object): +class Inspector: """Performs database schema inspection. The Inspector acts as a proxy to the reflection methods of the diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index 113cdcf35..4187c6c13 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -35,7 +35,7 @@ else: return lambda row: (it(row),) -class ResultMetaData(object): +class ResultMetaData: """Base for metadata about result rows.""" __slots__ = () @@ -655,7 +655,7 @@ class ResultInternal(InPlaceGenerative): return uniques, strategy -class _WithKeys(object): +class _WithKeys: # used mainly to share documentation on the keys method. def keys(self): """Return an iterable view which yields the string keys that would @@ -1516,7 +1516,7 @@ class MappingResult(_WithKeys, FilterResult): ) -class FrozenResult(object): +class FrozenResult: """Represents a :class:`.Result` object in a "frozen" state suitable for caching. diff --git a/lib/sqlalchemy/engine/row.py b/lib/sqlalchemy/engine/row.py index e268cfec9..782fc21b8 100644 --- a/lib/sqlalchemy/engine/row.py +++ b/lib/sqlalchemy/engine/row.py @@ -53,7 +53,7 @@ try: except ImportError: _baserow_usecext = False - class BaseRow(object): + class BaseRow: __slots__ = ("_parent", "_data", "_keymap", "_key_style") def __init__(self, parent, processors, keymap, key_style, data): diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index bda1c7fae..a1d76f2b0 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -13,5 +13,5 @@ from .mock import MockConnection # noqa -class MockEngineStrategy(object): +class MockEngineStrategy: MockConnection = MockConnection diff --git a/lib/sqlalchemy/engine/util.py b/lib/sqlalchemy/engine/util.py index 36691504c..4467bafd3 100644 --- a/lib/sqlalchemy/engine/util.py +++ b/lib/sqlalchemy/engine/util.py @@ -81,7 +81,7 @@ def _distill_raw_params(params): raise exc.ArgumentError("mapping or sequence expected for parameters") -class TransactionalContext(object): +class TransactionalContext: """Apply Python context manager behavior to transaction objects. Performs validation to ensure the subject of the transaction is not diff --git a/lib/sqlalchemy/event/attr.py b/lib/sqlalchemy/event/attr.py index a0c299221..77eb0472c 100644 --- a/lib/sqlalchemy/event/attr.py +++ b/lib/sqlalchemy/event/attr.py @@ -51,7 +51,7 @@ class RefCollection(util.MemoizedSlots): return weakref.ref(self, registry._collection_gced) -class _empty_collection(object): +class _empty_collection: def append(self, element): pass diff --git a/lib/sqlalchemy/event/base.py b/lib/sqlalchemy/event/base.py index f8cbfbd7f..b084207b4 100644 --- a/lib/sqlalchemy/event/base.py +++ b/lib/sqlalchemy/event/base.py @@ -38,7 +38,7 @@ def _is_event_name(name): ) or name.startswith("_sa_event") -class _UnpickleDispatch(object): +class _UnpickleDispatch: """Serializable callable that re-generates an instance of :class:`_Dispatch` given a particular :class:`.Events` subclass. @@ -54,7 +54,7 @@ class _UnpickleDispatch(object): raise AttributeError("No class with a 'dispatch' member present.") -class _Dispatch(object): +class _Dispatch: """Mirror the event listening definitions of an Events class with listener collections. @@ -275,7 +275,7 @@ class Events(util.with_metaclass(_EventMeta, object)): cls.dispatch._clear() -class _JoinedDispatcher(object): +class _JoinedDispatcher: """Represent a connection between two _Dispatch objects.""" __slots__ = "local", "parent", "_instance_cls" @@ -302,7 +302,7 @@ class _JoinedDispatcher(object): return self.parent._events -class dispatcher(object): +class dispatcher: """Descriptor used by target classes to deliver the _Dispatch class at the class level and produce new _Dispatch instances for target diff --git a/lib/sqlalchemy/event/registry.py b/lib/sqlalchemy/event/registry.py index ca85f3368..d81f27cd4 100644 --- a/lib/sqlalchemy/event/registry.py +++ b/lib/sqlalchemy/event/registry.py @@ -148,7 +148,7 @@ def _clear(owner, elements): del _key_to_collection[key] -class _EventKey(object): +class _EventKey: """Represent :func:`.listen` arguments.""" __slots__ = ( diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index 7fa77120c..ef246d04f 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -19,7 +19,7 @@ from .util import compat _version_token = None -class HasDescriptionCode(object): +class HasDescriptionCode: """helper which adds 'code' as an attribute and '_code_str' as a method""" code = None @@ -375,7 +375,7 @@ class UnboundExecutionError(InvalidRequestError): """SQL was attempted without a database connection to execute it on.""" -class DontWrapMixin(object): +class DontWrapMixin: """A mixin class which, when applied to a user-defined Exception class, will not be wrapped inside of :exc:`.StatementError` if the error is emitted within the process of executing a statement. diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index a93f2c229..0aa836a3c 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -306,7 +306,7 @@ class AssociationProxy(interfaces.InspectionAttrInfo): ) -class AssociationProxyInstance(object): +class AssociationProxyInstance: """A per-class object that serves class- and object-specific results. This is used by :class:`.AssociationProxy` when it is invoked @@ -936,7 +936,7 @@ class ColumnAssociationProxyInstance( ) -class _lazy_collection(object): +class _lazy_collection: def __init__(self, obj, target): self.parent = obj self.target = target @@ -952,7 +952,7 @@ class _lazy_collection(object): self.target = state["target"] -class _AssociationCollection(object): +class _AssociationCollection: def __init__(self, lazy_collection, creator, getter, setter, parent): """Constructs an _AssociationCollection. diff --git a/lib/sqlalchemy/ext/automap.py b/lib/sqlalchemy/ext/automap.py index 7cb2c4400..b62c514c7 100644 --- a/lib/sqlalchemy/ext/automap.py +++ b/lib/sqlalchemy/ext/automap.py @@ -717,7 +717,7 @@ def generate_relationship( raise TypeError("Unknown relationship function: %s" % return_fn) -class AutomapBase(object): +class AutomapBase: """Base class for an "automap" schema. The :class:`.AutomapBase` class can be compared to the "declarative base" diff --git a/lib/sqlalchemy/ext/baked.py b/lib/sqlalchemy/ext/baked.py index 61328fce9..efdafff96 100644 --- a/lib/sqlalchemy/ext/baked.py +++ b/lib/sqlalchemy/ext/baked.py @@ -30,7 +30,7 @@ from ..util import collections_abc log = logging.getLogger(__name__) -class Bakery(object): +class Bakery: """Callable which returns a :class:`.BakedQuery`. This object is returned by the class method @@ -52,7 +52,7 @@ class Bakery(object): return self.cls(self.cache, initial_fn, args) -class BakedQuery(object): +class BakedQuery: """A builder object for :class:`.query.Query` objects.""" __slots__ = "steps", "_bakery", "_cache_key", "_spoiled" @@ -309,7 +309,7 @@ class BakedQuery(object): return query -class Result(object): +class Result: """Invokes a :class:`.BakedQuery` against a :class:`.Session`. The :class:`_baked.Result` object is where the actual :class:`.query.Query` diff --git a/lib/sqlalchemy/ext/compiler.py b/lib/sqlalchemy/ext/compiler.py index 354b0ca4a..d961e2c81 100644 --- a/lib/sqlalchemy/ext/compiler.py +++ b/lib/sqlalchemy/ext/compiler.py @@ -416,7 +416,7 @@ def deregister(class_): del class_._compiler_dispatcher -class _dispatcher(object): +class _dispatcher: def __init__(self): self.specs = {} diff --git a/lib/sqlalchemy/ext/declarative/extensions.py b/lib/sqlalchemy/ext/declarative/extensions.py index 1a12b1205..1862592f5 100644 --- a/lib/sqlalchemy/ext/declarative/extensions.py +++ b/lib/sqlalchemy/ext/declarative/extensions.py @@ -37,7 +37,7 @@ def instrument_declarative(cls, cls_registry, metadata): ) -class ConcreteBase(object): +class ConcreteBase: """A helper class for 'concrete' declarative mappings. :class:`.ConcreteBase` will use the :func:`.polymorphic_union` @@ -315,7 +315,7 @@ class AbstractConcreteBase(ConcreteBase): ) -class DeferredReflection(object): +class DeferredReflection: """A helper class for construction of mappings based on a deferred reflection step. diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index eab3f2b73..67c42cde6 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -137,7 +137,7 @@ usage of the absolute value function:: from sqlalchemy import func - class Interval(object): + class Interval: # ... @hybrid_property @@ -166,7 +166,7 @@ object for class-level expressions:: the new hybrid with the additional state will be attached to the class with the non-matching name. To use the example above:: - class Interval(object): + class Interval: # ... @hybrid_property @@ -189,7 +189,7 @@ Defining Setters Hybrid properties can also define setter methods. If we wanted ``length`` above, when set, to modify the endpoint value:: - class Interval(object): + class Interval: # ... @hybrid_property @@ -231,7 +231,7 @@ accommodate a value passed to :meth:`_query.Query.update` which can affect this, using the :meth:`.hybrid_property.update_expression` decorator. A handler that works similarly to our setter would be:: - class Interval(object): + class Interval: # ... @hybrid_property @@ -267,7 +267,7 @@ above. of the hybrid must match that of how it is accessed. Something like this wouldn't work:: - class Interval(object): + class Interval: # ... def _get(self): @@ -849,7 +849,7 @@ class hybrid_method(interfaces.InspectionAttrInfo): from sqlalchemy.ext.hybrid import hybrid_method - class SomeClass(object): + class SomeClass: @hybrid_method def value(self, x, y): return self._value + x + y @@ -902,7 +902,7 @@ class hybrid_property(interfaces.InspectionAttrInfo): from sqlalchemy.ext.hybrid import hybrid_property - class SomeClass(object): + class SomeClass: @hybrid_property def value(self): return self._value @@ -958,7 +958,7 @@ class hybrid_property(interfaces.InspectionAttrInfo): to be used without conflicting with the same-named attributes normally present on the :class:`.QueryableAttribute`:: - class SuperClass(object): + class SuperClass: # ... @hybrid_property diff --git a/lib/sqlalchemy/ext/instrumentation.py b/lib/sqlalchemy/ext/instrumentation.py index 54f3e64c5..72448fbdc 100644 --- a/lib/sqlalchemy/ext/instrumentation.py +++ b/lib/sqlalchemy/ext/instrumentation.py @@ -193,7 +193,7 @@ orm_instrumentation._instrumentation_factory = ( orm_instrumentation.instrumentation_finders = instrumentation_finders -class InstrumentationManager(object): +class InstrumentationManager: """User-defined class instrumentation extension. :class:`.InstrumentationManager` can be subclassed in order diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index 4eed3b2af..7e277d379 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -113,7 +113,7 @@ mapping against the ``my_data`` table:: from sqlalchemy import mapper - class MyDataClass(object): + class MyDataClass: pass # associates mutation listeners with MyDataClass.data @@ -286,7 +286,7 @@ objects to each of the ``Vertex.start`` and ``Vertex.end`` attributes:: Column('y2', Integer), ) - class Vertex(object): + class Vertex: pass mapper(Vertex, vertices, properties={ @@ -366,7 +366,7 @@ from ..sql.base import SchemaEventTarget from ..util import memoized_property -class MutableBase(object): +class MutableBase: """Common base class to :class:`.Mutable` and :class:`.MutableComposite`. diff --git a/lib/sqlalchemy/log.py b/lib/sqlalchemy/log.py index 9ec3842a6..2eb11750b 100644 --- a/lib/sqlalchemy/log.py +++ b/lib/sqlalchemy/log.py @@ -57,7 +57,7 @@ def class_logger(cls): return cls -class Identified(object): +class Identified: logging_name = None def _should_log_debug(self): @@ -67,7 +67,7 @@ class Identified(object): return self.logger.isEnabledFor(logging.INFO) -class InstanceLogger(object): +class InstanceLogger: """A logger adapter (wrapper) for :class:`.Identified` subclasses. This allows multiple instances (e.g. Engine or Pool instances) @@ -204,7 +204,7 @@ def instance_logger(instance, echoflag=None): instance.logger = logger -class echo_property(object): +class echo_property: __doc__ = """\ When ``True``, enable log output for this element. diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 513144b87..dc5813866 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -637,7 +637,7 @@ OP_BULK_REPLACE = util.symbol("BULK_REPLACE") OP_MODIFIED = util.symbol("MODIFIED") -class AttributeEvent(object): +class AttributeEvent: """A token propagated throughout the course of a chain of attribute events. @@ -690,7 +690,7 @@ class AttributeEvent(object): Event = AttributeEvent -class AttributeImpl(object): +class AttributeImpl: """internal implementation for instrumented attributes.""" def __init__( diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 6553cf669..2cd4134d6 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -450,7 +450,7 @@ def class_mapper(class_, configure=True): return mapper -class InspectionAttr(object): +class InspectionAttr: """A base class applied to all ORM objects that can be returned by the :func:`_sa.inspect` function. @@ -563,7 +563,7 @@ class InspectionAttrInfo(InspectionAttr): return {} -class _MappedAttribute(object): +class _MappedAttribute: """Mixin for attributes which should be replaced by mapper-assigned attributes. diff --git a/lib/sqlalchemy/orm/clsregistry.py b/lib/sqlalchemy/orm/clsregistry.py index 4ec31bcf7..0d45fb40d 100644 --- a/lib/sqlalchemy/orm/clsregistry.py +++ b/lib/sqlalchemy/orm/clsregistry.py @@ -118,7 +118,7 @@ def _key_is_empty(key, decl_class_registry, test): return not test(thing) -class _MultipleClassMarker(object): +class _MultipleClassMarker: """refers to multiple classes of the same name within _decl_class_registry. @@ -182,7 +182,7 @@ class _MultipleClassMarker(object): self.contents.add(weakref.ref(item, self._remove_item)) -class _ModuleMarker(object): +class _ModuleMarker: """Refers to a module name within _decl_class_registry. @@ -239,7 +239,7 @@ class _ModuleMarker(object): existing.remove_item(cls) -class _ModNS(object): +class _ModNS: __slots__ = ("__parent",) def __init__(self, parent): @@ -263,7 +263,7 @@ class _ModNS(object): ) -class _GetColumns(object): +class _GetColumns: __slots__ = ("cls",) def __init__(self, cls): @@ -297,7 +297,7 @@ inspection._inspects(_GetColumns)( ) -class _GetTable(object): +class _GetTable: __slots__ = "key", "metadata" def __init__(self, key, metadata): @@ -314,7 +314,7 @@ def _determine_container(key, value): return _GetColumns(value) -class _class_resolver(object): +class _class_resolver: __slots__ = ( "cls", "prop", diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index f9afd4ebf..01d77e92b 100644 --- a/lib/sqlalchemy/orm/collections.py +++ b/lib/sqlalchemy/orm/collections.py @@ -20,7 +20,7 @@ provided. One is a bundle of generic decorators that map function arguments and return values to events:: from sqlalchemy.orm.collections import collection - class MyClass(object): + class MyClass: # ... @collection.adds(1) @@ -125,7 +125,7 @@ __all__ = [ __instrumentation_mutex = util.threading.Lock() -class _PlainColumnGetter(object): +class _PlainColumnGetter: """Plain column getter, stores collection of Column objects directly. @@ -160,7 +160,7 @@ class _PlainColumnGetter(object): return key[0] -class _SerializableColumnGetter(object): +class _SerializableColumnGetter: """Column-based getter used in version 0.7.6 only. Remains here for pickle compatibility with 0.7.6. @@ -251,7 +251,7 @@ def column_mapped_collection(mapping_spec): return lambda: MappedCollection(keyfunc) -class _SerializableAttrGetter(object): +class _SerializableAttrGetter: def __init__(self, name): self.name = name self.getter = operator.attrgetter(name) @@ -299,7 +299,7 @@ def mapped_collection(keyfunc): return lambda: MappedCollection(keyfunc) -class collection(object): +class collection: """Decorators for entity collection classes. The decorators fall into two groups: annotations and interception recipes. @@ -567,7 +567,7 @@ collection_adapter = operator.attrgetter("_sa_adapter") """Fetch the :class:`.CollectionAdapter` for a collection.""" -class CollectionAdapter(object): +class CollectionAdapter: """Bridges between the ORM and arbitrary Python collections. Proxies base-level collection operations (append, remove, iterate) diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 0a93d993a..986daf7eb 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -47,7 +47,7 @@ _EMPTY_DICT = util.immutabledict() LABEL_STYLE_LEGACY_ORM = util.symbol("LABEL_STYLE_LEGACY_ORM") -class QueryContext(object): +class QueryContext: __slots__ = ( "compile_state", "query", @@ -2312,7 +2312,7 @@ def _legacy_determine_last_joined_entity(setup_joins, entity_zero): return None -class _QueryEntity(object): +class _QueryEntity: """represent an entity column returned within a Query result.""" __slots__ = () diff --git a/lib/sqlalchemy/orm/decl_api.py b/lib/sqlalchemy/orm/decl_api.py index 94cda236d..21bb9d81b 100644 --- a/lib/sqlalchemy/orm/decl_api.py +++ b/lib/sqlalchemy/orm/decl_api.py @@ -138,7 +138,7 @@ class declared_attr(interfaces._MappedAttribute, property): easily reused across different mappings. The example below illustrates both:: - class ProvidesUser(object): + class ProvidesUser: "A mixin that adds a 'user' relationship to classes." @declared_attr @@ -271,7 +271,7 @@ class declared_attr(interfaces._MappedAttribute, property): Below, both MyClass as well as MySubClass will have a distinct ``id`` Column object established:: - class HasIdMixin(object): + class HasIdMixin: @declared_attr.cascading def id(cls): if has_inherited_table(cls): @@ -477,7 +477,7 @@ def declarative_base( ) -class registry(object): +class registry: """Generalized registry for mapping classes. The :class:`_orm.registry` serves as the basis for maintaining a collection @@ -861,7 +861,7 @@ class registry(object): mapper_registry = registry() @mapper_registry.as_declarative_base() - class Base(object): + class Base: @declared_attr def __tablename__(cls): return cls.__name__.lower() @@ -1006,7 +1006,7 @@ def as_declarative(**kw): from sqlalchemy.orm import as_declarative @as_declarative() - class Base(object): + class Base: @declared_attr def __tablename__(cls): return cls.__name__.lower() diff --git a/lib/sqlalchemy/orm/decl_base.py b/lib/sqlalchemy/orm/decl_base.py index bf1bc537d..bab890b82 100644 --- a/lib/sqlalchemy/orm/decl_base.py +++ b/lib/sqlalchemy/orm/decl_base.py @@ -151,7 +151,7 @@ def _check_declared_props_nocascade(obj, name, cls): return False -class _MapperConfig(object): +class _MapperConfig: __slots__ = ("cls", "classname", "properties", "declared_attr_reg") @classmethod diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 27919050e..220dc1bbb 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -22,7 +22,7 @@ from .. import sql from .. import util -class DependencyProcessor(object): +class DependencyProcessor: def __init__(self, prop): self.prop = prop self.cascade = prop.cascade diff --git a/lib/sqlalchemy/orm/descriptor_props.py b/lib/sqlalchemy/orm/descriptor_props.py index 535067d88..82946ca37 100644 --- a/lib/sqlalchemy/orm/descriptor_props.py +++ b/lib/sqlalchemy/orm/descriptor_props.py @@ -37,7 +37,7 @@ class DescriptorProperty(MapperProperty): def instrument_class(self, mapper): prop = self - class _ProxyImpl(object): + class _ProxyImpl: accepts_scalar_loader = False load_on_unexpire = True collection = False @@ -523,7 +523,7 @@ class ConcreteInheritedProperty(DescriptorProperty): % (self.parent, self.key, self.parent) ) - class NoninheritedConcreteProp(object): + class NoninheritedConcreteProp: def __set__(s, obj, value): warn() @@ -595,7 +595,7 @@ class SynonymProperty(DescriptorProperty): Column('job_status', String(50)) ) - class MyClass(object): + class MyClass: @property def _job_status_descriptor(self): return "Status: %s" % self._job_status diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index 405498aaf..67deb3b01 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -263,7 +263,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl): self.remove(state, dict_, value, initiator, passive=passive) -class DynamicCollectionAdapter(object): +class DynamicCollectionAdapter: """simplified CollectionAdapter for internal API consistency""" def __init__(self, data): @@ -284,7 +284,7 @@ class DynamicCollectionAdapter(object): __nonzero__ = __bool__ -class AppenderMixin(object): +class AppenderMixin: query_class = None def __init__(self, attr, state): @@ -434,7 +434,7 @@ def mixin_user_query(cls): return type(name, (AppenderMixin, cls), {"query_class": cls}) -class CollectionHistory(object): +class CollectionHistory: """Overrides AttributeHistory to receive append/remove events directly.""" def __init__(self, attr, state, apply_to=None): diff --git a/lib/sqlalchemy/orm/evaluator.py b/lib/sqlalchemy/orm/evaluator.py index fcc7368c4..19e0be9d0 100644 --- a/lib/sqlalchemy/orm/evaluator.py +++ b/lib/sqlalchemy/orm/evaluator.py @@ -66,7 +66,7 @@ _notimplemented_ops = set( ) -class EvaluatorCompiler(object): +class EvaluatorCompiler: def __init__(self, target_cls=None): self.target_cls = target_cls diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 2c8d155ad..b358b8be3 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -122,7 +122,7 @@ class InstrumentationEvents(event.Events): """Called when an attribute is instrumented.""" -class _InstrumentationEventsHold(object): +class _InstrumentationEventsHold: """temporary marker object used to transfer from _accept_with() to _listen() on the InstrumentationEvents class. @@ -535,7 +535,7 @@ class _EventsHold(event.RefCollection): def _clear(cls): cls.all_holds.clear() - class HoldEvents(object): + class HoldEvents: _dispatch_target = None @classmethod diff --git a/lib/sqlalchemy/orm/identity.py b/lib/sqlalchemy/orm/identity.py index 10d924b48..917a79f91 100644 --- a/lib/sqlalchemy/orm/identity.py +++ b/lib/sqlalchemy/orm/identity.py @@ -11,7 +11,7 @@ from . import util as orm_util from .. import exc as sa_exc -class IdentityMap(object): +class IdentityMap: def __init__(self): self._dict = {} self._modified = set() diff --git a/lib/sqlalchemy/orm/instrumentation.py b/lib/sqlalchemy/orm/instrumentation.py index 626643ce1..cb330ea17 100644 --- a/lib/sqlalchemy/orm/instrumentation.py +++ b/lib/sqlalchemy/orm/instrumentation.py @@ -470,7 +470,7 @@ class ClassManager(HasMemoized, dict): ) -class _SerializeManager(object): +class _SerializeManager: """Provide serialization of a :class:`.ClassManager`. The :class:`.InstanceState` uses ``__init__()`` on serialize @@ -504,7 +504,7 @@ class _SerializeManager(object): manager.dispatch.unpickle(state, state_dict) -class InstrumentationFactory(object): +class InstrumentationFactory: """Factory for new ClassManager instances.""" def create_manager_for_cls(self, class_): diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 9eb362c43..c425f012b 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -859,7 +859,7 @@ class MapperOption(ORMOption): self.process_query(query) -class LoaderStrategy(object): +class LoaderStrategy: """Describe the loading behavior of a StrategizedProperty object. The ``LoaderStrategy`` interacts with the querying process in three diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index d004db0a3..94ad7b80d 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -1304,7 +1304,7 @@ def _decorate_polymorphic_switch( return polymorphic_instance -class PostLoad(object): +class PostLoad: """Track loaders and states for "post load" operations.""" __slots__ = "loaders", "states", "load_keys" diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index c987f6b16..8cf253efb 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -3408,7 +3408,7 @@ class AliasOption(interfaces.LoaderOption): pass -class BulkUD(object): +class BulkUD: """State used for the orm.Query version of update() / delete(). This object is now specific to Query only. diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index d021ac9a2..b692daf21 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -2604,7 +2604,7 @@ def _annotate_columns(element, annotations): return element -class JoinCondition(object): +class JoinCondition: def __init__( self, parent_persist_selectable, @@ -3677,7 +3677,7 @@ class JoinCondition(object): return lazywhere, bind_to_col, equated_columns -class _ColInAnnotations(object): +class _ColInAnnotations: """Serializable object that tests for a name in c._annotations.""" __slots__ = ("name",) diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index df3012df1..2d04ea32c 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -18,7 +18,7 @@ from ..util import warn_deprecated __all__ = ["scoped_session", "ScopedSessionMixin"] -class ScopedSessionMixin(object): +class ScopedSessionMixin: @property def _proxied(self): return self.registry() @@ -190,7 +190,7 @@ class scoped_session(ScopedSessionMixin): Session = scoped_session(sessionmaker()) - class MyClass(object): + class MyClass: query = Session.query_property() # after mappers are defined @@ -207,7 +207,7 @@ class scoped_session(ScopedSessionMixin): """ - class query(object): + class query: def __get__(s, instance, owner): try: mapper = class_mapper(owner) diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 8be5fbee7..e18e35847 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -65,7 +65,7 @@ def _state_session(state): return state.session -class _SessionClassMethods(object): +class _SessionClassMethods: """Class-level methods for :class:`.Session`, :class:`.sessionmaker`.""" @classmethod diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py index 994cbe53e..0434f5f32 100644 --- a/lib/sqlalchemy/orm/state.py +++ b/lib/sqlalchemy/orm/state.py @@ -899,7 +899,7 @@ class InstanceState(interfaces.InspectionAttrInfo): state._strong_obj = None -class AttributeState(object): +class AttributeState: """Provide an inspection interface corresponding to a particular attribute on a particular mapped object. @@ -997,7 +997,7 @@ class AttributeState(object): return self.state.get_history(self.key, PASSIVE_OFF ^ INIT_OK) -class PendingCollection(object): +class PendingCollection: """A writable placeholder for an unloaded collection. Stores items appended to and removed from a collection that has not yet diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 71c4a6976..130ff2d1e 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -535,7 +535,7 @@ class DeferredColumnLoader(LoaderStrategy): ) -class LoadDeferredColumns(object): +class LoadDeferredColumns: """serializable loader object used by DeferredColumnLoader""" def __init__(self, key, raiseload=False): @@ -1119,7 +1119,7 @@ class LazyLoader(AbstractRelationshipLoader, util.MemoizedSlots): populators["new"].append((self.key, reset_for_lazy_callable)) -class LoadLazyAttribute(object): +class LoadLazyAttribute: """semi-serializable loader object used by LazyLoader Historically, this object would be carried along with instances that @@ -1569,7 +1569,7 @@ class SubqueryLoader(PostLoader): return q - class _SubqCollections(object): + class _SubqCollections: """Given a :class:`_query.Query` used to emit the "subquery load", provide a load interface that executes the query at the first moment a value is needed. diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index 23a8c4533..997fca1ac 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -1186,7 +1186,7 @@ class _UnboundLoad(Load): return None -class loader_option(object): +class loader_option: def __init__(self): pass diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index f29d11bcd..03456e572 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -150,7 +150,7 @@ def track_cascade_events(descriptor, prop): event.listen(descriptor, "set", set_, raw=True, retval=True) -class UOWTransaction(object): +class UOWTransaction: def __init__(self, session): self.session = session @@ -477,7 +477,7 @@ class UOWTransaction(object): self.session._register_persistent(other) -class IterateMappersMixin(object): +class IterateMappersMixin: def _mappers(self, uow): if self.fromparent: return iter( @@ -539,7 +539,7 @@ class Preprocess(IterateMappersMixin): return False -class PostSortRec(object): +class PostSortRec: __slots__ = ("disabled",) def __new__(cls, uow, *args): diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 0e8449068..3295bd39e 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -418,7 +418,7 @@ class ORMAdapter(sql_util.ColumnAdapter): return not entity or entity.isa(self.mapper) -class AliasedClass(object): +class AliasedClass: r"""Represents an "aliased" form of a mapped class for usage with Query. The ORM equivalent of a :func:`~sqlalchemy.sql.expression.alias` @@ -881,7 +881,7 @@ class AliasedInsp( return "aliased(%s)" % (self._target.__name__,) -class _WrapUserEntity(object): +class _WrapUserEntity: """A wrapper used within the loader_criteria lambda caller so that we can bypass declared_attr descriptors on unmapped mixins, which normally emit a warning for such use. diff --git a/lib/sqlalchemy/pool/base.py b/lib/sqlalchemy/pool/base.py index ec55da730..1a3dcd0e4 100644 --- a/lib/sqlalchemy/pool/base.py +++ b/lib/sqlalchemy/pool/base.py @@ -25,7 +25,7 @@ reset_commit = util.symbol("reset_commit") reset_none = util.symbol("reset_none") -class _ConnDialect(object): +class _ConnDialect: """partial implementation of :class:`.Dialect` which provides DBAPI connection methods. @@ -332,7 +332,7 @@ class Pool(log.Identified): raise NotImplementedError() -class _ConnectionRecord(object): +class _ConnectionRecord: """Internal object which maintains an individual DBAPI connection referenced by a :class:`_pool.Pool`. @@ -781,7 +781,7 @@ def _finalize_fairy( _strong_ref_connection_records = {} -class _ConnectionFairy(object): +class _ConnectionFairy: """Proxies a DBAPI connection and provides return-on-dereference support. diff --git a/lib/sqlalchemy/pool/dbapi_proxy.py b/lib/sqlalchemy/pool/dbapi_proxy.py index 7dfb59e36..e271d43fd 100644 --- a/lib/sqlalchemy/pool/dbapi_proxy.py +++ b/lib/sqlalchemy/pool/dbapi_proxy.py @@ -61,7 +61,7 @@ def clear_managers(): proxies.clear() -class _DBProxy(object): +class _DBProxy: """Layers connection pooling behavior on top of a standard DB-API module. diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index e6618937a..88f045fe6 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -20,7 +20,7 @@ from .. import util EMPTY_ANNOTATIONS = util.immutabledict() -class SupportsAnnotations(object): +class SupportsAnnotations: _annotations = EMPTY_ANNOTATIONS @util.memoized_property @@ -122,7 +122,7 @@ class SupportsWrappingAnnotations(SupportsAnnotations): return self -class Annotated(object): +class Annotated: """clones a SupportsAnnotated and applies an 'annotations' dictionary. Unlike regular clones, this clone also mimics __hash__() and diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 0c375b6d7..b57da3289 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -35,7 +35,7 @@ type_api = None NO_ARG = util.symbol("NO_ARG") -class Immutable(object): +class Immutable: """mark a ClauseElement as 'immutable' when expressions are cloned.""" _is_immutable = True @@ -276,7 +276,7 @@ def _kw_reg_for_dialect(dialect_name): return dict(dialect_cls.construct_arguments) -class DialectKWArgs(object): +class DialectKWArgs: """Establish the ability for a class to have dialect-specific arguments with defaults and constructor validation. @@ -451,7 +451,7 @@ class DialectKWArgs(object): construct_arg_dictionary[arg_name] = kwargs[k] -class CompileState(object): +class CompileState: """Produces additional object state necessary for a statement to be compiled. @@ -1056,7 +1056,7 @@ class prefix_anon_map(dict): return value -class SchemaEventTarget(object): +class SchemaEventTarget: """Base class for elements that are the targets of :class:`.DDLEvents` events. @@ -1079,7 +1079,7 @@ class SchemaVisitor(ClauseVisitor): __traverse_options__ = {"schema_visitor": True} -class ColumnCollection(object): +class ColumnCollection: """Collection of :class:`_expression.ColumnElement` instances, typically for :class:`_sql.FromClause` objects. diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py index f888bad4c..f051ba12f 100644 --- a/lib/sqlalchemy/sql/coercions.py +++ b/lib/sqlalchemy/sql/coercions.py @@ -235,7 +235,7 @@ def expect_col_expression_collection(role, expressions): yield resolved, column, strname, add_element -class RoleImpl(object): +class RoleImpl: __slots__ = ("_role_class", "name", "_use_inspection") def _literal_coercion(self, element, **kw): @@ -282,7 +282,7 @@ class RoleImpl(object): util.raise_(exc.ArgumentError(msg, code=code), replace_context=err) -class _Deannotate(object): +class _Deannotate: __slots__ = () def _post_coercion(self, resolved, **kw): @@ -291,13 +291,13 @@ class _Deannotate(object): return _deep_deannotate(resolved) -class _StringOnly(object): +class _StringOnly: __slots__ = () _resolve_literal_only = True -class _ReturnsStringKey(object): +class _ReturnsStringKey: __slots__ = () def _implicit_coercions( @@ -312,7 +312,7 @@ class _ReturnsStringKey(object): return element -class _ColumnCoercions(object): +class _ColumnCoercions: __slots__ = () def _warn_for_scalar_subquery_coercion(self): @@ -358,7 +358,7 @@ def _no_text_coercion( ) -class _NoTextCoercion(object): +class _NoTextCoercion: __slots__ = () def _literal_coercion(self, element, argname=None, **kw): @@ -370,7 +370,7 @@ class _NoTextCoercion(object): self._raise_for_expected(element, argname) -class _CoerceLiterals(object): +class _CoerceLiterals: __slots__ = () _coerce_consts = False _coerce_star = False @@ -417,7 +417,7 @@ class LiteralValueImpl(RoleImpl): return element -class _SelectIsNotFrom(object): +class _SelectIsNotFrom: __slots__ = () def _raise_for_expected(self, element, argname=None, resolved=None, **kw): diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 191a07299..482afb42f 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -357,7 +357,7 @@ class FromLinter(collections.namedtuple("FromLinter", ["froms", "edges"])): util.warn(message) -class Compiled(object): +class Compiled: """Represent a compiled SQL or DDL expression. @@ -4970,7 +4970,7 @@ class StrSQLTypeCompiler(GenericTypeCompiler): return get_col_spec(**kw) -class IdentifierPreparer(object): +class IdentifierPreparer: """Handle quoting and case-folding of identifiers based on options.""" diff --git a/lib/sqlalchemy/sql/dml.py b/lib/sqlalchemy/sql/dml.py index 03968d284..e45c6b888 100644 --- a/lib/sqlalchemy/sql/dml.py +++ b/lib/sqlalchemy/sql/dml.py @@ -1017,7 +1017,7 @@ class Insert(ValuesBase): self.select = coercions.expect(roles.DMLSelectRole, select) -class DMLWhereBase(object): +class DMLWhereBase: _where_criteria = () @_generative diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index a279f634d..6893d99ee 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -1142,7 +1142,7 @@ class ColumnElement( return self._anon_label(label, add_hash=idx) -class WrapsColumnExpression(object): +class WrapsColumnExpression: """Mixin that defines a :class:`_expression.ColumnElement` as a wrapper with special labeling behavior for an expression that already has a name. diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 35b0cb7d7..31f4fab0d 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -662,7 +662,7 @@ class ScalarFunctionColumn(NamedColumn): self.type = sqltypes.to_instance(type_) -class _FunctionGenerator(object): +class _FunctionGenerator: """Generate SQL function expressions. :data:`.func` is a special object instance which generates SQL diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py index e7c19b9a0..110260799 100644 --- a/lib/sqlalchemy/sql/lambdas.py +++ b/lib/sqlalchemy/sql/lambdas.py @@ -596,7 +596,7 @@ class LinkedLambdaElement(StatementLambdaElement): return fn(self.parent_lambda._resolved) -class AnalyzedCode(object): +class AnalyzedCode: __slots__ = ( "track_closure_variables", "track_bound_values", @@ -941,7 +941,7 @@ class AnalyzedCode(object): ) -class NonAnalyzedFunction(object): +class NonAnalyzedFunction: __slots__ = ("expr",) closure_bindparams = None @@ -955,7 +955,7 @@ class NonAnalyzedFunction(object): return self.expr -class AnalyzedFunction(object): +class AnalyzedFunction: __slots__ = ( "analyzed_code", "fn", diff --git a/lib/sqlalchemy/sql/naming.py b/lib/sqlalchemy/sql/naming.py index d01eabb58..3d86018ee 100644 --- a/lib/sqlalchemy/sql/naming.py +++ b/lib/sqlalchemy/sql/naming.py @@ -27,7 +27,7 @@ from .. import event from .. import exc -class ConventionDict(object): +class ConventionDict: def __init__(self, const, table, convention): self.const = const self._is_fk = isinstance(const, ForeignKeyConstraint) diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index b64bea07a..675048cd0 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -33,7 +33,7 @@ from operator import truediv from .. import util -class Operators(object): +class Operators: """Base of comparison and logical operators. Implements base methods @@ -227,7 +227,7 @@ class Operators(object): raise NotImplementedError(str(op)) -class custom_op(object): +class custom_op: """Represent a 'custom' operator. :class:`.custom_op` is normally instantiated when the diff --git a/lib/sqlalchemy/sql/roles.py b/lib/sqlalchemy/sql/roles.py index 70ad4cefa..4e009aa26 100644 --- a/lib/sqlalchemy/sql/roles.py +++ b/lib/sqlalchemy/sql/roles.py @@ -8,7 +8,7 @@ from .. import util -class SQLRole(object): +class SQLRole: """Define a "role" within a SQL statement structure. Classes within SQL Core participate within SQLRole hierarchies in order @@ -23,12 +23,12 @@ class SQLRole(object): uses_inspection = False -class UsesInspection(object): +class UsesInspection: _post_inspect = None uses_inspection = True -class AllowsLambdaRole(object): +class AllowsLambdaRole: allows_lambda = True diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index c8f26f906..4bd49c468 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -2639,7 +2639,7 @@ class ColumnDefault(DefaultGenerator): return "ColumnDefault(%r)" % (self.arg,) -class IdentityOptions(object): +class IdentityOptions: """Defines options for a named database sequence or an identity column. .. versionadded:: 1.3.18 @@ -3173,7 +3173,7 @@ class Constraint(DialectKWArgs, SchemaItem): raise NotImplementedError() -class ColumnCollectionMixin(object): +class ColumnCollectionMixin: columns = None """A :class:`_expression.ColumnCollection` of :class:`_schema.Column` diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 350e55c49..a04b205b5 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -228,7 +228,7 @@ class Selectable(ReturnsRows): ) -class HasPrefixes(object): +class HasPrefixes: _prefixes = () _has_prefixes_traverse_internals = [ @@ -284,7 +284,7 @@ class HasPrefixes(object): ) -class HasSuffixes(object): +class HasSuffixes: _suffixes = () _has_suffixes_traverse_internals = [ @@ -335,7 +335,7 @@ class HasSuffixes(object): ) -class HasHints(object): +class HasHints: _hints = util.immutabledict() _statement_hints = () @@ -1549,7 +1549,7 @@ class Join(roles.DMLTableRole, FromClause): return [self] + self.left._from_objects + self.right._from_objects -class NoInit(object): +class NoInit: def __init__(self, *arg, **kw): raise NotImplementedError( "The %s class is not intended to be constructed " @@ -3360,7 +3360,7 @@ class SelectStatementGrouping(GroupedElement, SelectBase): return self.element._from_objects -class DeprecatedSelectBaseGenerations(object): +class DeprecatedSelectBaseGenerations: """A collection of methods available on :class:`_sql.Select` and :class:`_sql.CompoundSelect`, these are all **deprecated** methods as they modify the object in-place. @@ -4214,7 +4214,7 @@ class CompoundSelect(HasCompileState, GenerativeSelect): self._bind = bind -class DeprecatedSelectGenerations(object): +class DeprecatedSelectGenerations: """A collection of methods available on :class:`_sql.Select`, these are all **deprecated** methods as they modify the :class:`_sql.Select` object in -place. @@ -4730,7 +4730,7 @@ class SelectState(util.MemoizedSlots, CompileState): return replace_from_obj_index -class _SelectFromElements(object): +class _SelectFromElements: def _iterate_from_elements(self): # note this does not include elements # in _setup_joins or _legacy_setup_joins diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 52033f586..1687c9f29 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -44,7 +44,7 @@ from ..util import OrderedDict from ..util import pickle -class _LookupExpressionAdapter(object): +class _LookupExpressionAdapter: """Mixin expression adaptations based on lookup tables. @@ -75,7 +75,7 @@ class _LookupExpressionAdapter(object): comparator_factory = Comparator -class Concatenable(object): +class Concatenable: """A mixin that marks a type as supporting 'concatenation', typically strings.""" @@ -95,7 +95,7 @@ class Concatenable(object): comparator_factory = Comparator -class Indexable(object): +class Indexable: """A mixin that marks a type as supporting indexing operations, such as array or JSON structures. diff --git a/lib/sqlalchemy/sql/traversals.py b/lib/sqlalchemy/sql/traversals.py index 3d377271f..6acd794aa 100644 --- a/lib/sqlalchemy/sql/traversals.py +++ b/lib/sqlalchemy/sql/traversals.py @@ -48,7 +48,7 @@ def _preconfigure_traversals(target_hierarchy): ) -class HasCacheKey(object): +class HasCacheKey: _cache_key_traversal = NO_CACHE __slots__ = () @@ -713,7 +713,7 @@ class _CacheKey(ExtendedInternalTraversal): _cache_key_traversal_visitor = _CacheKey() -class HasCopyInternals(object): +class HasCopyInternals: def _clone(self, **kw): raise NotImplementedError() diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 5e929c4a9..01763f266 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -810,7 +810,7 @@ class VisitableCheckKWArg(util.EnsureKWArgType, TraversibleType): pass -class ExternalType(object): +class ExternalType: """mixin that defines attributes and behaviors specific to third-party datatypes. @@ -1064,7 +1064,7 @@ class UserDefinedType( return self -class Emulated(object): +class Emulated: """Mixin for base types that emulate the behavior of a DB-native type. An :class:`.Emulated` type will use an available database type @@ -1111,7 +1111,7 @@ class Emulated(object): return super(Emulated, self).adapt(impltype, **kw) -class NativeForEmulated(object): +class NativeForEmulated: """Indicates DB-native types supported by an :class:`.Emulated` type. .. versionadded:: 1.2.0b3 diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 7fcb45709..6394c43a0 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -461,7 +461,7 @@ def _quote_ddl_expr(element): return repr(element) -class _repr_base(object): +class _repr_base: _LIST = 0 _TUPLE = 1 _DICT = 2 @@ -969,7 +969,7 @@ class ColumnAdapter(ClauseAdapter): self.allow_label_resolve = allow_label_resolve self._wrap = None - class _IncludeExcludeMapping(object): + class _IncludeExcludeMapping: def __init__(self, parent, columns): self.parent = parent self.columns = columns diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 7111c5efd..82cb7a253 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -506,7 +506,7 @@ class ExtendedInternalTraversal(InternalTraversal): HasCacheKey objects.""" -class ExternalTraversal(object): +class ExternalTraversal: """Base class for visitor objects which can traverse externally using the :func:`.visitors.traverse` function. diff --git a/lib/sqlalchemy/testing/assertions.py b/lib/sqlalchemy/testing/assertions.py index 3aa2649f4..ed634befe 100644 --- a/lib/sqlalchemy/testing/assertions.py +++ b/lib/sqlalchemy/testing/assertions.py @@ -368,7 +368,7 @@ def _assert_raises( return ec.error -class _ErrorContainer(object): +class _ErrorContainer: error = None @@ -414,7 +414,7 @@ def expect_raises_message(except_cls, msg, check_context=True): return _expect_raises(except_cls, msg=msg, check_context=check_context) -class AssertsCompiledSQL(object): +class AssertsCompiledSQL: def assert_compile( self, clause, @@ -496,14 +496,14 @@ class AssertsCompiledSQL(object): if compile_kwargs: kw["compile_kwargs"] = compile_kwargs - class DontAccess(object): + class DontAccess: def __getattribute__(self, key): raise NotImplementedError( "compiler accessed .statement; use " "compiler.current_executable" ) - class CheckCompilerAccess(object): + class CheckCompilerAccess: def __init__(self, test_statement): self.test_statement = test_statement self._annotations = {} @@ -596,7 +596,7 @@ class AssertsCompiledSQL(object): ) -class ComparesTables(object): +class ComparesTables: def assert_tables_equal(self, table, reflected_table, strict_types=False): assert len(table.c) == len(reflected_table.c) for c, reflected_c in zip(table.c, reflected_table.c): @@ -640,7 +640,7 @@ class ComparesTables(object): ) -class AssertsExecutionResults(object): +class AssertsExecutionResults: def assert_result(self, result, class_, *objects): result = list(result) print(repr(result)) diff --git a/lib/sqlalchemy/testing/assertsql.py b/lib/sqlalchemy/testing/assertsql.py index 9816c99b7..485a13f82 100644 --- a/lib/sqlalchemy/testing/assertsql.py +++ b/lib/sqlalchemy/testing/assertsql.py @@ -16,7 +16,7 @@ from ..engine.default import DefaultDialect from ..schema import _DDLCompiles -class AssertRule(object): +class AssertRule: is_consumed = False errormessage = None @@ -382,7 +382,7 @@ class Or(AllOf): self.errormessage = list(self.rules)[0].errormessage -class SQLExecuteObserved(object): +class SQLExecuteObserved: def __init__(self, context, clauseelement, multiparams, params): self.context = context self.clauseelement = clauseelement @@ -408,7 +408,7 @@ class SQLCursorExecuteObserved( pass -class SQLAsserter(object): +class SQLAsserter: def __init__(self): self.accumulated = [] diff --git a/lib/sqlalchemy/testing/config.py b/lib/sqlalchemy/testing/config.py index 097eb94e4..8faeea634 100644 --- a/lib/sqlalchemy/testing/config.py +++ b/lib/sqlalchemy/testing/config.py @@ -106,7 +106,7 @@ def mark_base_test_class(): return _fixture_functions.mark_base_test_class() -class Config(object): +class Config: def __init__(self, db, db_opts, options, file_config): self._set_name(db) self.db = db diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py index 815009e78..98de5df5c 100644 --- a/lib/sqlalchemy/testing/engines.py +++ b/lib/sqlalchemy/testing/engines.py @@ -19,7 +19,7 @@ from .. import event from .. import pool -class ConnectionKiller(object): +class ConnectionKiller: def __init__(self): self.proxy_refs = weakref.WeakKeyDictionary() self.testing_engines = collections.defaultdict(set) @@ -202,7 +202,7 @@ def all_dialects(exclude=None): yield mod.dialect() -class ReconnectFixture(object): +class ReconnectFixture: def __init__(self, dbapi): self.dbapi = dbapi self.connections = [] @@ -362,7 +362,7 @@ def mock_engine(dialect_name=None): return engine -class DBAPIProxyCursor(object): +class DBAPIProxyCursor: """Proxy a DBAPI cursor. Tests can provide subclasses of this to intercept @@ -391,7 +391,7 @@ class DBAPIProxyCursor(object): return getattr(self.cursor, key) -class DBAPIProxyConnection(object): +class DBAPIProxyConnection: """Proxy a DBAPI connection. Tests can provide subclasses of this to intercept diff --git a/lib/sqlalchemy/testing/entities.py b/lib/sqlalchemy/testing/entities.py index 9daa5c61f..15b6388fb 100644 --- a/lib/sqlalchemy/testing/entities.py +++ b/lib/sqlalchemy/testing/entities.py @@ -12,7 +12,7 @@ from ..util import compat _repr_stack = set() -class BasicEntity(object): +class BasicEntity: def __init__(self, **kw): for key, value in kw.items(): setattr(self, key, value) @@ -39,7 +39,7 @@ class BasicEntity(object): _recursion_stack = set() -class ComparableMixin(object): +class ComparableMixin: def __ne__(self, other): return not self.__eq__(other) diff --git a/lib/sqlalchemy/testing/exclusions.py b/lib/sqlalchemy/testing/exclusions.py index e8fce5a4c..7b2343128 100644 --- a/lib/sqlalchemy/testing/exclusions.py +++ b/lib/sqlalchemy/testing/exclusions.py @@ -31,7 +31,7 @@ def fails_if(predicate, reason=None): return rule -class compound(object): +class compound: def __init__(self): self.fails = set() self.skips = set() @@ -186,7 +186,7 @@ def succeeds_if(predicate, reason=None): return fails_if(NotPredicate(predicate), reason) -class Predicate(object): +class Predicate: @classmethod def as_predicate(cls, predicate, description=None): if isinstance(predicate, compound): diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py index 1899e5b7c..d5e8e376a 100644 --- a/lib/sqlalchemy/testing/fixtures.py +++ b/lib/sqlalchemy/testing/fixtures.py @@ -26,7 +26,7 @@ from ..schema import sort_tables_and_constraints @config.mark_base_test_class() -class TestBase(object): +class TestBase: # A sequence of requirement names matching testing.requires decorators __requires__ = () @@ -299,7 +299,7 @@ class TestBase(object): _connection_fixture_connection = None -class FutureEngineMixin(object): +class FutureEngineMixin: """alembic's suite still using this""" @@ -504,7 +504,7 @@ class TablesTest(TestBase): ) -class NoCache(object): +class NoCache: @config.fixture(autouse=True, scope="function") def _disable_cache(self): _cache = config.db._compiled_cache @@ -513,7 +513,7 @@ class NoCache(object): config.db._compiled_cache = _cache -class RemovesEvents(object): +class RemovesEvents: @util.memoized_property def _event_fns(self): return set() @@ -704,7 +704,7 @@ class DeclarativeMappedTest(MappedTest): cls_registry[classname] = cls DeclarativeMeta.__init__(cls, classname, bases, dict_) - class DeclarativeBasic(object): + class DeclarativeBasic: __table_cls__ = schema.Table _DeclBase = declarative_base( diff --git a/lib/sqlalchemy/testing/pickleable.py b/lib/sqlalchemy/testing/pickleable.py index 430cb5fb6..cf11ab03d 100644 --- a/lib/sqlalchemy/testing/pickleable.py +++ b/lib/sqlalchemy/testing/pickleable.py @@ -45,13 +45,13 @@ class Parent(fixtures.ComparableEntity): pass -class Screen(object): +class Screen: def __init__(self, obj, parent=None): self.obj = obj self.parent = parent -class Foo(object): +class Foo: def __init__(self, moredata, stuff="im stuff"): self.data = "im data" self.stuff = stuff @@ -67,7 +67,7 @@ class Foo(object): ) -class Bar(object): +class Bar: def __init__(self, x, y): self.x = x self.y = y @@ -104,7 +104,7 @@ class OldSchoolWithoutCompare: self.y = y -class BarWithoutCompare(object): +class BarWithoutCompare: def __init__(self, x, y): self.x = x self.y = y @@ -113,7 +113,7 @@ class BarWithoutCompare(object): return "Bar(%d, %d)" % (self.x, self.y) -class NotComparable(object): +class NotComparable: def __init__(self, data): self.data = data @@ -127,7 +127,7 @@ class NotComparable(object): return NotImplemented -class BrokenComparable(object): +class BrokenComparable: def __init__(self, data): self.data = data diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py index d2e4a0f69..b382e97f6 100644 --- a/lib/sqlalchemy/testing/plugin/plugin_base.py +++ b/lib/sqlalchemy/testing/plugin/plugin_base.py @@ -38,7 +38,7 @@ else: import ConfigParser as configparser import collections as collections_abc # noqa - class ABC(object): + class ABC: __metaclass__ = abc.ABCMeta diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py index 10344c8d6..b6a6e75b1 100644 --- a/lib/sqlalchemy/testing/profiling.py +++ b/lib/sqlalchemy/testing/profiling.py @@ -55,7 +55,7 @@ def _start_current_test(id_): _profile_stats.reset_count() -class ProfileStatsFile(object): +class ProfileStatsFile: """Store per-platform/fn profiling results in a file. There was no json module available when this was written, but now diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py index a911ba69c..15613957c 100644 --- a/lib/sqlalchemy/testing/provision.py +++ b/lib/sqlalchemy/testing/provision.py @@ -17,7 +17,7 @@ log = logging.getLogger(__name__) FOLLOWER_IDENT = None -class register(object): +class register: def __init__(self): self.fns = {} diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 43849efca..325c0a9bb 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -25,7 +25,7 @@ from .. import util from ..pool import QueuePool -class Requirements(object): +class Requirements: pass diff --git a/lib/sqlalchemy/testing/schema.py b/lib/sqlalchemy/testing/schema.py index 9b5546ce7..60ea5284f 100644 --- a/lib/sqlalchemy/testing/schema.py +++ b/lib/sqlalchemy/testing/schema.py @@ -88,7 +88,7 @@ def Column(*args, **kw): return col -class eq_type_affinity(object): +class eq_type_affinity: """Helper to compare types inside of datastructures based on affinity. E.g.:: @@ -125,7 +125,7 @@ class eq_type_affinity(object): return self.target._type_affinity is not other._type_affinity -class eq_clause_element(object): +class eq_clause_element: """Helper to compare SQL structures based on compare()""" def __init__(self, target): diff --git a/lib/sqlalchemy/testing/suite/test_types.py b/lib/sqlalchemy/testing/suite/test_types.py index aa796df76..4a5396ed8 100644 --- a/lib/sqlalchemy/testing/suite/test_types.py +++ b/lib/sqlalchemy/testing/suite/test_types.py @@ -45,7 +45,7 @@ from ...orm import Session from ...util import u -class _LiteralRoundTripFixture(object): +class _LiteralRoundTripFixture: supports_whereclause = True @testing.fixture diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index 54ed522d4..9efbeb7db 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -24,7 +24,7 @@ from .compat import threading EMPTY_SET = frozenset() -class ImmutableContainer(object): +class ImmutableContainer: def _immutable(self, *arg, **kw): raise TypeError("%s object is immutable" % self.__class__.__name__) @@ -140,7 +140,7 @@ class FacadeDict(ImmutableContainer, dict): return "FacadeDict(%s)" % dict.__repr__(self) -class Properties(object): +class Properties: """Provide a __getattr__/__setattr__ interface over a dict.""" __slots__ = ("_data",) @@ -454,7 +454,7 @@ class OrderedSet(set): __isub__ = difference_update -class IdentitySet(object): +class IdentitySet: """A set that considers only object id() for uniqueness. This strategy has edge cases for builtin types- it's possible to have @@ -676,7 +676,7 @@ class IdentitySet(object): return "%s(%r)" % (type(self).__name__, list(self._members.values())) -class WeakSequence(object): +class WeakSequence: def __init__(self, __elements=()): # adapted from weakref.WeakKeyDictionary, prevent reference # cycles in the collection itself @@ -780,7 +780,7 @@ def unique_list(seq, hashfunc=None): ] -class UniqueAppender(object): +class UniqueAppender: """Appends items to a collection ensuring uniqueness. Additional appends() of the same object are ignored. Membership is @@ -960,7 +960,7 @@ class LRUCache(dict): self._mutex.release() -class ScopedRegistry(object): +class ScopedRegistry: """A Registry that can store one or multiple instances of a single class on the basis of a "scope" function. diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index 5749b3337..75b2a9a8d 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -47,7 +47,7 @@ FullArgSpec = collections.namedtuple( ) -class nullcontext(object): +class nullcontext: """Context manager that does no additional processing. Vendored from Python 3.7. @@ -244,7 +244,7 @@ else: from abc import ABCMeta - class ABC(object): + class ABC: __metaclass__ = ABCMeta try: diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 84c5fddec..ac2c6e6a4 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -35,7 +35,7 @@ def md5_hex(x): return m.hexdigest() -class safe_reraise(object): +class safe_reraise: """Reraise an exception after invoking some handler code. @@ -316,7 +316,7 @@ def %(name)s(%(args)s): return decorated -class PluginLoader(object): +class PluginLoader: def __init__(self, group, auto_fn=None): self.group = group self.impls = {} @@ -845,7 +845,7 @@ def generic_repr(obj, additional_kw=(), to_inspect=None, omit_kwarg=()): return "%s(%s)" % (obj.__class__.__name__, ", ".join(output)) -class portable_instancemethod(object): +class portable_instancemethod: """Turn an instancemethod into a (parent, name) pair to produce a serializable callable. @@ -1063,7 +1063,7 @@ def as_interface(obj, cls=None, methods=None, required=None): % (obj, qualifier, ", ".join(interface)) ) - class AnonymousInterface(object): + class AnonymousInterface: """A callable-holding shell.""" if cls: @@ -1087,7 +1087,7 @@ def as_interface(obj, cls=None, methods=None, required=None): ) -class memoized_property(object): +class memoized_property: """A read-only @property that is only evaluated once.""" def __init__(self, fget, doc=None): @@ -1132,7 +1132,7 @@ def memoized_instancemethod(fn): return update_wrapper(oneshot, fn) -class HasMemoized(object): +class HasMemoized: """A class that maintains the names of memoized elements in a collection for easy cache clearing, generative, etc. @@ -1154,7 +1154,7 @@ class HasMemoized(object): self.__dict__[key] = value self._memoized_keys |= {key} - class memoized_attribute(object): + class memoized_attribute: """A read-only @property that is only evaluated once.""" def __init__(self, fget, doc=None): @@ -1188,7 +1188,7 @@ class HasMemoized(object): return update_wrapper(oneshot, fn) -class MemoizedSlots(object): +class MemoizedSlots: """Apply memoized items to an object using a __getattr__ scheme. This allows the functionality of memoized_property and @@ -1420,7 +1420,7 @@ class classproperty(property): return desc.fget(cls) -class hybridproperty(object): +class hybridproperty: def __init__(self, func): self.func = func self.clslevel = func @@ -1437,7 +1437,7 @@ class hybridproperty(object): return self -class hybridmethod(object): +class hybridmethod: """Decorate a function as cls- or instance- level.""" def __init__(self, func): @@ -1480,7 +1480,7 @@ class _symbol(int): _symbol.__name__ = "symbol" -class symbol(object): +class symbol: """A constant symbol. >>> symbol('foo') is symbol('foo') |