diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-08-28 17:49:28 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-08-28 17:58:46 +0300 |
commit | 05f1a7bca5400633bcb52b58affe23880df1fd0e (patch) | |
tree | 87744c3c5cb786fddbe15004779b941988a0b7d7 /contrib/python/zope.interface/py3/zope/interface/common | |
parent | dc1a94ab8d6985d2dcf888fa1881e7b80f7042b1 (diff) | |
download | ydb-05f1a7bca5400633bcb52b58affe23880df1fd0e.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/zope.interface/py3/zope/interface/common')
7 files changed, 161 insertions, 102 deletions
diff --git a/contrib/python/zope.interface/py3/zope/interface/common/__init__.py b/contrib/python/zope.interface/py3/zope/interface/common/__init__.py index f308f9edd6..256ddc9178 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/__init__.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/__init__.py @@ -24,11 +24,11 @@ __all__ = [ # Nothing public here. ] - # pylint:disable=inherit-non-class, # pylint:disable=no-self-argument,no-method-argument # pylint:disable=unexpected-special-method-signature + class optional: # Apply this decorator to a method definition to make it # optional (remove it from the list of required names), overriding @@ -115,8 +115,9 @@ class ABCInterfaceClass(InterfaceClass): """ # If we could figure out invalidation, and used some special - # Specification/Declaration instances, and override the method ``providedBy`` here, - # perhaps we could more closely integrate with ABC virtual inheritance? + # Specification/Declaration instances, and override the method + # ``providedBy`` here, perhaps we could more closely integrate with ABC + # virtual inheritance? def __init__(self, name, bases, attrs): # go ahead and give us a name to ease debugging. @@ -128,7 +129,9 @@ class ABCInterfaceClass(InterfaceClass): # Something like ``IList(ISequence)``: We're extending # abc interfaces but not an ABC interface ourself. InterfaceClass.__init__(self, name, bases, attrs) - ABCInterfaceClass.__register_classes(self, extra_classes, ignored_classes) + ABCInterfaceClass.__register_classes( + self, extra_classes, ignored_classes, + ) self.__class__ = InterfaceClass return @@ -143,8 +146,9 @@ class ABCInterfaceClass(InterfaceClass): # e.g., ``__ror__ = __or__``. k: self.__method_from_function(v, k) for k, v in vars(based_on).items() - if isinstance(v, FunctionType) and not self.__is_private_name(k) - and not self.__is_reverse_protocol_name(k) + if isinstance(v, FunctionType) and + not self.__is_private_name(k) and + not self.__is_reverse_protocol_name(k) } methods['__doc__'] = self.__create_class_doc(attrs) @@ -163,12 +167,13 @@ class ABCInterfaceClass(InterfaceClass): return '' docs = "\n\nThe following methods are optional:\n - " + "\n-".join( - "{}\n{}".format(k, v.__doc__) for k, v in optionals.items() + f"{k}\n{v.__doc__}" for k, v in optionals.items() ) return docs def __create_class_doc(self, attrs): based_on = self.__abc + def ref(c): mod = c.__module__ name = c.__name__ @@ -176,13 +181,16 @@ class ABCInterfaceClass(InterfaceClass): return "`%s`" % name if mod == '_io': mod = 'io' - return "`{}.{}`".format(mod, name) + return f"`{mod}.{name}`" + implementations_doc = "\n - ".join( ref(c) for c in sorted(self.getRegisteredConformers(), key=ref) ) if implementations_doc: - implementations_doc = "\n\nKnown implementations are:\n\n - " + implementations_doc + implementations_doc = ( + "\n\nKnown implementations are:\n\n - " + implementations_doc + ) based_on_doc = (based_on.__doc__ or '') based_on_doc = based_on_doc.splitlines() @@ -196,7 +204,6 @@ class ABCInterfaceClass(InterfaceClass): ) return doc - @staticmethod def __is_private_name(name): if name.startswith('__') and name.endswith('__'): @@ -221,8 +228,14 @@ class ABCInterfaceClass(InterfaceClass): def __register_classes(self, conformers=None, ignored_classes=None): # Make the concrete classes already present in our ABC's registry # declare that they implement this interface. - conformers = conformers if conformers is not None else self.getRegisteredConformers() - ignored = ignored_classes if ignored_classes is not None else self.__ignored_classes + conformers = ( + conformers if conformers is not None + else self.getRegisteredConformers() + ) + ignored = ( + ignored_classes if ignored_classes is not None + else self.__ignored_classes + ) for cls in conformers: if cls in ignored: continue @@ -246,7 +259,9 @@ class ABCInterfaceClass(InterfaceClass): # of checking that, so its quite possible that registrations # are in fact ignored, winding up just in the _abc_cache. try: - registered = list(based_on._abc_registry) + list(based_on._abc_cache) + registered = ( + list(based_on._abc_registry) + list(based_on._abc_cache) + ) except AttributeError: # Rewritten in C in CPython 3.7. # These expose the underlying weakref. @@ -261,13 +276,16 @@ class ABCInterfaceClass(InterfaceClass): def _create_ABCInterface(): - # It's a two-step process to create the root ABCInterface, because - # without specifying a corresponding ABC, using the normal constructor - # gets us a plain InterfaceClass object, and there is no ABC to associate with the + # It's a two-step process to create the root ABCInterface, because without + # specifying a corresponding ABC, using the normal constructor gets us a + # plain InterfaceClass object, and there is no ABC to associate with the # root. abc_name_bases_attrs = ('ABCInterface', (Interface,), {}) - instance = ABCInterfaceClass.__new__(ABCInterfaceClass, *abc_name_bases_attrs) + instance = ABCInterfaceClass.__new__( + ABCInterfaceClass, *abc_name_bases_attrs, + ) InterfaceClass.__init__(instance, *abc_name_bases_attrs) return instance + ABCInterface = _create_ABCInterface() diff --git a/contrib/python/zope.interface/py3/zope/interface/common/builtins.py b/contrib/python/zope.interface/py3/zope/interface/common/builtins.py index 6e13e06482..09de5b3b2f 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/builtins.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/builtins.py @@ -35,6 +35,7 @@ __all__ = [ 'IFile', ] + # pylint:disable=no-self-argument class IList(collections.IMutableSequence): """ @@ -86,6 +87,8 @@ class INativeString(ITextString): On all Python versions, this is :class:`str`. Tt extends :class:`ITextString`. """ + + # We're not extending ABCInterface so extra_classes won't work classImplements(str, INativeString) @@ -108,8 +111,8 @@ class IFile(io.IIOBase): """ Interface for :class:`file`. - It is recommended to use the interfaces from :mod:`zope.interface.common.io` - instead of this interface. + It is recommended to use the interfaces from + :mod:`zope.interface.common.io` instead of this interface. On Python 3, there is no single implementation of this interface; depending on the arguments, the :func:`open` builtin can return diff --git a/contrib/python/zope.interface/py3/zope/interface/common/collections.py b/contrib/python/zope.interface/py3/zope/interface/common/collections.py index 3c751c05c8..543266d9cf 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/collections.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/collections.py @@ -13,10 +13,10 @@ Interface definitions paralleling the abstract base classes defined in :mod:`collections.abc`. -After this module is imported, the standard library types will declare -that they implement the appropriate interface. While most standard -library types will properly implement that interface (that -is, ``verifyObject(ISequence, list()))`` will pass, for example), a few might not: +After this module is imported, the standard library types will declare that +they implement the appropriate interface. While most standard library types +will properly implement that interface (that is, ``verifyObject(ISequence, +list()))`` will pass, for example), a few might not: - `memoryview` doesn't feature all the defined methods of ``ISequence`` such as ``count``; it is still declared to provide @@ -67,6 +67,7 @@ def _new_in_ver(name, ver, return missing + __all__ = [ 'IAsyncGenerator', 'IAsyncIterable', @@ -93,6 +94,7 @@ __all__ = [ 'IValuesView', ] + class IContainer(ABCInterface): abc = abc.Container @@ -104,9 +106,11 @@ class IContainer(ABCInterface): to implement ``in``. """ + class IHashable(ABCInterface): abc = abc.Hashable + class IIterable(ABCInterface): abc = abc.Iterable @@ -117,9 +121,11 @@ class IIterable(ABCInterface): implement `iter` using the old ``__getitem__`` protocol. """ + class IIterator(IIterable): abc = abc.Iterator + class IReversible(IIterable): abc = _new_in_ver('Reversible', True, (IIterable.getABC(),)) @@ -131,6 +137,7 @@ class IReversible(IIterable): `reversed` builtin. """ + class IGenerator(IIterator): # New in Python 3.5 abc = _new_in_ver('Generator', True, (IIterator.getABC(),)) @@ -142,21 +149,25 @@ class ISized(ABCInterface): # ICallable is not defined because there's no standard signature. + class ICollection(ISized, IIterable, IContainer): - abc = _new_in_ver('Collection', True, - (ISized.getABC(), IIterable.getABC(), IContainer.getABC())) + abc = _new_in_ver( + 'Collection', + True, + (ISized.getABC(), IIterable.getABC(), IContainer.getABC()) + ) class ISequence(IReversible, ICollection): abc = abc.Sequence extra_classes = (UserString,) - # On Python 2, basestring is registered as an ISequence, and + # On Python 2, basestring was registered as an ISequence, and # its subclass str is an IByteString. If we also register str as # an ISequence, that tends to lead to inconsistent resolution order. - ignored_classes = (basestring,) if str is bytes else () # pylint:disable=undefined-variable + ignored_classes = () @optional def __reversed__(): @@ -173,6 +184,7 @@ class ISequence(IReversible, implement `iter` using the old ``__getitem__`` protocol. """ + class IMutableSequence(ISequence): abc = abc.MutableSequence extra_classes = (UserList,) @@ -182,9 +194,9 @@ class IByteString(ISequence): """ This unifies `bytes` and `bytearray`. """ - abc = _new_in_ver('ByteString', True, - (ISequence.getABC(),), - (bytes, bytearray)) + abc = _new_in_ver( + 'ByteString', True, (ISequence.getABC(),), (bytes, bytearray), + ) class ISet(ICollection): @@ -210,6 +222,7 @@ class IMutableMapping(IMapping): extra_classes = (dict, UserDict,) ignored_classes = (OrderedDict,) + class IMappingView(ISized): abc = abc.MappingView @@ -233,6 +246,7 @@ class IValuesView(IMappingView, ICollection): to implement ``in``. """ + class IAwaitable(ABCInterface): abc = _new_in_ver('Awaitable', True) diff --git a/contrib/python/zope.interface/py3/zope/interface/common/idatetime.py b/contrib/python/zope.interface/py3/zope/interface/common/idatetime.py index aeda07aa0e..24b2606e80 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/idatetime.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/idatetime.py @@ -89,10 +89,10 @@ class IDateClass(Interface): """Return the local date from a POSIX timestamp (like time.time()) This may raise `ValueError`, if the timestamp is out of the range of - values supported by the platform C ``localtime()`` function. It's common - for this to be restricted to years from 1970 through 2038. Note that - on non-POSIX systems that include leap seconds in their notion of a - timestamp, leap seconds are ignored by `fromtimestamp`. + values supported by the platform C ``localtime()`` function. It's + common for this to be restricted to years from 1970 through 2038. Note + that on non-POSIX systems that include leap seconds in their notion of + a timestamp, leap seconds are ignored by `fromtimestamp`. """ def fromordinal(ordinal): @@ -122,13 +122,17 @@ class IDate(IDateClass): month = Attribute("Between 1 and 12 inclusive") day = Attribute( - "Between 1 and the number of days in the given month of the given year.") + "Between 1 and the number of days " + "in the given month of the given year." + ) def replace(year, month, day): """Return a date with the same value. Except for those members given new values by whichever keyword - arguments are specified. For example, if ``d == date(2002, 12, 31)``, then + arguments are specified. + + For example, if ``d == date(2002, 12, 31)``, then ``d.replace(day=26) == date(2000, 12, 26)``. """ @@ -238,10 +242,10 @@ class IDateTimeClass(Interface): def now(tz=None): """Return the current local date and time. - If optional argument *tz* is None or not specified, this is like `today`, - but, if possible, supplies more precision than can be gotten from going - through a `time.time` timestamp (for example, this may be possible on - platforms supplying the C ``gettimeofday()`` function). + If optional argument *tz* is None or not specified, this is like + `today`, but, if possible, supplies more precision than can be gotten + from going through a `time.time` timestamp (for example, this may be + possible on platforms supplying the C ``gettimeofday()`` function). Else tz must be an instance of a class tzinfo subclass, and the current date and time are converted to tz's time zone. In this case the result @@ -269,7 +273,7 @@ class IDateTimeClass(Interface): Else tz must be an instance of a class tzinfo subclass, and the timestamp is converted to tz's time zone. In this case the result is equivalent to - ``tz.fromutc(datetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))``. + ``tz.fromutc(datetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))`` fromtimestamp() may raise `ValueError`, if the timestamp is out of the range of values supported by the platform C localtime() or gmtime() @@ -286,8 +290,8 @@ class IDateTimeClass(Interface): """Return the UTC datetime from the POSIX timestamp with tzinfo None. This may raise `ValueError`, if the timestamp is out of the range of - values supported by the platform C ``gmtime()`` function. It's common for - this to be restricted to years in 1970 through 2038. + values supported by the platform C ``gmtime()`` function. It's common + for this to be restricted to years in 1970 through 2038. .. seealso:: `fromtimestamp`. """ @@ -312,7 +316,7 @@ class IDateTimeClass(Interface): class IDateTime(IDate, IDateTimeClass): - """Object contains all the information from a date object and a time object. + """Contains all the information from a date object and a time object. Implemented by `datetime.datetime`. """ @@ -337,7 +341,7 @@ class IDateTime(IDate, IDateTimeClass): or None if none was passed""") def date(): - """Return date object with same year, month and day.""" + """Return date object with same year, month and day.""" def time(): """Return time object with same hour, minute, second, microsecond. @@ -358,8 +362,8 @@ class IDateTime(IDate, IDateTimeClass): """Return a datetime with the same members, except for those members given new values by whichever keyword arguments are specified. - Note that ``tzinfo=None`` can be specified to create a naive datetime from - an aware datetime with no conversion of date and time members. + Note that ``tzinfo=None`` can be specified to create a naive datetime + from an aware datetime with no conversion of date and time members. """ def astimezone(tz): @@ -377,13 +381,16 @@ class IDateTime(IDate, IDateTimeClass): after astz = dt.astimezone(tz), astz - astz.utcoffset() - will usually have the same date and time members as dt - dt.utcoffset(). - The discussion of class `datetime.tzinfo` explains the cases at Daylight Saving - Time transition boundaries where this cannot be achieved (an issue only - if tz models both standard and daylight time). + will usually have the same date and time members as dt - + dt.utcoffset(). The discussion of class `datetime.tzinfo` explains + the cases at Daylight Saving Time transition boundaries where this + cannot be achieved (an issue only if tz models both standard and + daylight time). + + If you merely want to attach a time zone object *tz* to a datetime + *dt* without adjustment of date and time members, use + ``dt.replace(tzinfo=tz)``. - If you merely want to attach a time zone object *tz* to a datetime *dt* - without adjustment of date and time members, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the time zone object from an aware datetime dt without conversion of date and time members, use ``dt.replace(tzinfo=None)``. @@ -405,7 +412,7 @@ class IDateTime(IDate, IDateTimeClass): """Return the timezone name.""" def timetuple(): - """Return a 9-element tuple of the form returned by `time.localtime`.""" + """Return a 9-tuple of the form returned by `time.localtime`.""" def utctimetuple(): """Return UTC time tuple compatilble with `time.gmtime`.""" @@ -453,17 +460,21 @@ class IDateTime(IDate, IDateTimeClass): """ def __str__(): - """For a datetime instance *d*, ``str(d)`` is equivalent to ``d.isoformat(' ')``. + """Convert to a stirng + + For a datetime instance *d*, ``str(d)`` is equivalent to + ``d.isoformat(' ')``. """ def ctime(): """Return a string representing the date and time. - ``datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'``. - ``d.ctime()`` is equivalent to ``time.ctime(time.mktime(d.timetuple()))`` on - platforms where the native C ``ctime()`` function (which `time.ctime` - invokes, but which `datetime.ctime` does not invoke) conforms to the - C standard. + ``datetime(2002, 12, 4, 20, 30, 40).ctime()`` yields + ``'Wed Dec 4 20:30:40 2002'``. + ``d.ctime()`` is equivalent to + ``time.ctime(time.mktime(d.timetuple()))`` on platforms where the + native C ``ctime()`` function (which `time.ctime` invokes, but which + `datetime.ctime` does not invoke) conforms to the C standard. """ def strftime(format): @@ -605,7 +616,7 @@ classImplements(datetime, IDateTime) classImplements(time, ITime) classImplements(tzinfo, ITZInfo) -## directlyProvides(timedelta, ITimeDeltaClass) -## directlyProvides(date, IDateClass) -## directlyProvides(datetime, IDateTimeClass) -## directlyProvides(time, ITimeClass) +# directlyProvides(timedelta, ITimeDeltaClass) +# directlyProvides(date, IDateClass) +# directlyProvides(datetime, IDateTimeClass) +# directlyProvides(time, ITimeClass) diff --git a/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py b/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py index 688e323a97..74386de024 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/interfaces.py @@ -19,7 +19,7 @@ from zope.interface import classImplements class IException(Interface): "Interface for `Exception`" -classImplements(Exception, IException) +classImplements(Exception, IException) # noqa E305 class IStandardError(IException): @@ -28,117 +28,117 @@ class IStandardError(IException): class IWarning(IException): "Interface for `Warning`" -classImplements(Warning, IWarning) +classImplements(Warning, IWarning) # noqa E305 class ISyntaxError(IStandardError): "Interface for `SyntaxError`" -classImplements(SyntaxError, ISyntaxError) +classImplements(SyntaxError, ISyntaxError) # noqa E305 class ILookupError(IStandardError): "Interface for `LookupError`" -classImplements(LookupError, ILookupError) +classImplements(LookupError, ILookupError) # noqa E305 class IValueError(IStandardError): "Interface for `ValueError`" -classImplements(ValueError, IValueError) +classImplements(ValueError, IValueError) # noqa E305 class IRuntimeError(IStandardError): "Interface for `RuntimeError`" -classImplements(RuntimeError, IRuntimeError) +classImplements(RuntimeError, IRuntimeError) # noqa E305 class IArithmeticError(IStandardError): "Interface for `ArithmeticError`" -classImplements(ArithmeticError, IArithmeticError) +classImplements(ArithmeticError, IArithmeticError) # noqa E305 class IAssertionError(IStandardError): "Interface for `AssertionError`" -classImplements(AssertionError, IAssertionError) +classImplements(AssertionError, IAssertionError) # noqa E305 class IAttributeError(IStandardError): "Interface for `AttributeError`" -classImplements(AttributeError, IAttributeError) +classImplements(AttributeError, IAttributeError) # noqa E305 class IDeprecationWarning(IWarning): "Interface for `DeprecationWarning`" -classImplements(DeprecationWarning, IDeprecationWarning) +classImplements(DeprecationWarning, IDeprecationWarning) # noqa E305 class IEOFError(IStandardError): "Interface for `EOFError`" -classImplements(EOFError, IEOFError) +classImplements(EOFError, IEOFError) # noqa E305 class IEnvironmentError(IStandardError): "Interface for `EnvironmentError`" -classImplements(EnvironmentError, IEnvironmentError) +classImplements(EnvironmentError, IEnvironmentError) # noqa E305 class IFloatingPointError(IArithmeticError): "Interface for `FloatingPointError`" -classImplements(FloatingPointError, IFloatingPointError) +classImplements(FloatingPointError, IFloatingPointError) # noqa E305 class IIOError(IEnvironmentError): "Interface for `IOError`" -classImplements(IOError, IIOError) +classImplements(IOError, IIOError) # noqa E305 class IImportError(IStandardError): "Interface for `ImportError`" -classImplements(ImportError, IImportError) +classImplements(ImportError, IImportError) # noqa E305 class IIndentationError(ISyntaxError): "Interface for `IndentationError`" -classImplements(IndentationError, IIndentationError) +classImplements(IndentationError, IIndentationError) # noqa E305 class IIndexError(ILookupError): "Interface for `IndexError`" -classImplements(IndexError, IIndexError) +classImplements(IndexError, IIndexError) # noqa E305 class IKeyError(ILookupError): "Interface for `KeyError`" -classImplements(KeyError, IKeyError) +classImplements(KeyError, IKeyError) # noqa E305 class IKeyboardInterrupt(IStandardError): "Interface for `KeyboardInterrupt`" -classImplements(KeyboardInterrupt, IKeyboardInterrupt) +classImplements(KeyboardInterrupt, IKeyboardInterrupt) # noqa E305 class IMemoryError(IStandardError): "Interface for `MemoryError`" -classImplements(MemoryError, IMemoryError) +classImplements(MemoryError, IMemoryError) # noqa E305 class INameError(IStandardError): "Interface for `NameError`" -classImplements(NameError, INameError) +classImplements(NameError, INameError) # noqa E305 class INotImplementedError(IRuntimeError): "Interface for `NotImplementedError`" -classImplements(NotImplementedError, INotImplementedError) +classImplements(NotImplementedError, INotImplementedError) # noqa E305 class IOSError(IEnvironmentError): "Interface for `OSError`" -classImplements(OSError, IOSError) +classImplements(OSError, IOSError) # noqa E305 class IOverflowError(IArithmeticError): "Interface for `ArithmeticError`" -classImplements(OverflowError, IOverflowError) +classImplements(OverflowError, IOverflowError) # noqa E305 class IOverflowWarning(IWarning): @@ -151,59 +151,59 @@ class IOverflowWarning(IWarning): class IReferenceError(IStandardError): "Interface for `ReferenceError`" -classImplements(ReferenceError, IReferenceError) +classImplements(ReferenceError, IReferenceError) # noqa E305 class IRuntimeWarning(IWarning): "Interface for `RuntimeWarning`" -classImplements(RuntimeWarning, IRuntimeWarning) +classImplements(RuntimeWarning, IRuntimeWarning) # noqa E305 class IStopIteration(IException): "Interface for `StopIteration`" -classImplements(StopIteration, IStopIteration) +classImplements(StopIteration, IStopIteration) # noqa E305 class ISyntaxWarning(IWarning): "Interface for `SyntaxWarning`" -classImplements(SyntaxWarning, ISyntaxWarning) +classImplements(SyntaxWarning, ISyntaxWarning) # noqa E305 class ISystemError(IStandardError): "Interface for `SystemError`" -classImplements(SystemError, ISystemError) +classImplements(SystemError, ISystemError) # noqa E305 class ISystemExit(IException): "Interface for `SystemExit`" -classImplements(SystemExit, ISystemExit) +classImplements(SystemExit, ISystemExit) # noqa E305 class ITabError(IIndentationError): "Interface for `TabError`" -classImplements(TabError, ITabError) +classImplements(TabError, ITabError) # noqa E305 class ITypeError(IStandardError): "Interface for `TypeError`" -classImplements(TypeError, ITypeError) +classImplements(TypeError, ITypeError) # noqa E305 class IUnboundLocalError(INameError): "Interface for `UnboundLocalError`" -classImplements(UnboundLocalError, IUnboundLocalError) +classImplements(UnboundLocalError, IUnboundLocalError) # noqa E305 class IUnicodeError(IValueError): "Interface for `UnicodeError`" -classImplements(UnicodeError, IUnicodeError) +classImplements(UnicodeError, IUnicodeError) # noqa E305 class IUserWarning(IWarning): "Interface for `UserWarning`" -classImplements(UserWarning, IUserWarning) +classImplements(UserWarning, IUserWarning) # noqa E305 class IZeroDivisionError(IArithmeticError): "Interface for `ZeroDivisionError`" -classImplements(ZeroDivisionError, IZeroDivisionError) +classImplements(ZeroDivisionError, IZeroDivisionError) # noqa E305 diff --git a/contrib/python/zope.interface/py3/zope/interface/common/mapping.py b/contrib/python/zope.interface/py3/zope/interface/common/mapping.py index eb9a2900b7..d8ea074826 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/mapping.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/mapping.py @@ -96,9 +96,11 @@ class IEnumerableMapping(collections.ISized, IReadMapping): """Return the items of the mapping object. """ + class IMapping(IWriteMapping, IEnumerableMapping): ''' Simple mapping interface ''' + class IIterableMapping(IEnumerableMapping): """A mapping that has distinct methods for iterating without copying. @@ -115,6 +117,7 @@ class IClonableMapping(Interface): def copy(): "return copy of dict" + class IExtendedReadMapping(IIterableMapping): """ Something with a particular method equivalent to ``__contains__``. @@ -154,9 +157,14 @@ class IExtendedWriteMapping(IWriteMapping): """remove and return some (key, value) pair as a 2-tuple; but raise KeyError if mapping is empty""" + class IFullMapping( - collections.IMutableMapping, - IExtendedReadMapping, IExtendedWriteMapping, IClonableMapping, IMapping,): + collections.IMutableMapping, + IExtendedReadMapping, + IExtendedWriteMapping, + IClonableMapping, + IMapping, +): """ Full mapping interface. diff --git a/contrib/python/zope.interface/py3/zope/interface/common/sequence.py b/contrib/python/zope.interface/py3/zope/interface/common/sequence.py index 738f76d42a..c63f5a477a 100644 --- a/contrib/python/zope.interface/py3/zope/interface/common/sequence.py +++ b/contrib/python/zope.interface/py3/zope/interface/common/sequence.py @@ -55,6 +55,7 @@ class IMinimalSequence(collections.IIterable): Declaring this interface does not specify whether `__getitem__` supports slice objects.""" + class IFiniteSequence(collections.ISized, IMinimalSequence): """ A sequence of bound size. @@ -63,6 +64,7 @@ class IFiniteSequence(collections.ISized, IMinimalSequence): Extend ``ISized`` """ + class IReadSequence(collections.IContainer, IFiniteSequence): """ read interface shared by tuple and list @@ -120,6 +122,7 @@ class IExtendedReadSequence(IReadSequence): Return first index of *value* """ + class IUniqueMemberWriteSequence(Interface): """The write contract for a sequence that may enforce unique members""" @@ -161,12 +164,14 @@ class IUniqueMemberWriteSequence(Interface): def extend(iterable): """Extend list by appending elements from the iterable""" + class IWriteSequence(IUniqueMemberWriteSequence): """Full write contract for sequences""" def __imul__(n): """``x.__imul__(n) <==> x *= n``""" + class ISequence(IReadSequence, IWriteSequence): """ Full sequence contract. |