Skip to content

Commit

Permalink
Make isort happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac committed Mar 26, 2024
1 parent c4ac28c commit e3c14be
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 32 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
#
##############################################################################

import platform
import os
import platform

from setuptools import Extension
from setuptools import find_packages
from setuptools import setup


version = '5.3.dev0'

here = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 3 additions & 1 deletion src/persistent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import sys


__all__ = [
'IPersistent',
'Persistent',
Expand All @@ -31,9 +32,10 @@

# Take care not to shadow the module names
from persistent import interfaces as _interfaces
from persistent import timestamp as _timestamp
from persistent import persistence as _persistence
from persistent import picklecache as _picklecache
from persistent import timestamp as _timestamp


IPersistent = _interfaces.IPersistent
Persistent = _persistence.Persistent
Expand Down
7 changes: 4 additions & 3 deletions src/persistent/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
#
##############################################################################

import sys
import os
import sys
import types

from zope.interface import implementedBy
from zope.interface import classImplements
from zope.interface import implementedBy


__all__ = [
'use_c_impl',
Expand Down Expand Up @@ -52,9 +53,9 @@ def _c_optimizations_available():
"""
catch = () if _c_optimizations_required() else (ImportError,)
try:
from persistent import _timestamp
from persistent import cPersistence
from persistent import cPickleCache
from persistent import _timestamp
return {
'persistent.persistence': cPersistence,
'persistent.picklecache': cPickleCache,
Expand Down
2 changes: 2 additions & 0 deletions src/persistent/_ring_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
##############################################################################

import os

from cffi import FFI


this_dir = os.path.dirname(os.path.abspath(__file__))

ffi = FFI()
Expand Down
2 changes: 1 addition & 1 deletion src/persistent/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"""Persistence Interfaces
"""

from zope.interface import Interface
from zope.interface import Attribute
from zope.interface import Interface

from persistent._compat import use_c_impl

Expand Down
4 changes: 3 additions & 1 deletion src/persistent/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

"""Python implementation of persistent list."""
import sys
import persistent
from collections import UserList

import persistent


# The slice object you get when you write list[:]
_SLICE_ALL = slice(None, None, None)

Expand Down
4 changes: 3 additions & 1 deletion src/persistent/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
##############################################################################

"""Python implementation of persistent base types."""
import persistent
from collections import UserDict as IterableUserDict

import persistent


class default:

def __init__(self, func):
Expand Down
10 changes: 6 additions & 4 deletions src/persistent/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import copyreg
import struct
from sys import intern

from zope.interface import implementer

from persistent import interfaces
from persistent._compat import use_c_impl
from persistent.interfaces import SERIAL_TYPE
from persistent.timestamp import TimeStamp
from persistent.timestamp import _ZERO
import copyreg
from sys import intern
from persistent._compat import use_c_impl
from persistent.timestamp import TimeStamp


__all__ = [
'Persistent',
Expand Down
10 changes: 5 additions & 5 deletions src/persistent/picklecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
#
##############################################################################
import gc

from weakref import WeakValueDictionary

from zope.interface import implementer
from zope.interface import classImplements
from zope.interface import implementer

from persistent._compat import use_c_impl
from persistent._compat import PYPY
from persistent._compat import use_c_impl
from persistent.interfaces import GHOST
from persistent.interfaces import IPickleCache
from persistent.interfaces import IExtendedPickleCache
from persistent.interfaces import OID_TYPE
from persistent.interfaces import UPTODATE
from persistent.interfaces import IExtendedPickleCache
from persistent.interfaces import IPickleCache
from persistent.persistence import PersistentPy
from persistent.persistence import _estimated_size_in_24_bits
from persistent.ring import Ring


__all__ = [
'PickleCache',
'PickleCachePy',
Expand Down
1 change: 1 addition & 0 deletions src/persistent/ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from persistent import _ring


class IRing(Interface):
"""Conceptually, a doubly-linked list for efficiently keeping track of least-
and most-recently used :class:`persistent.interfaces.IPersistent` objects.
Expand Down
1 change: 1 addition & 0 deletions src/persistent/tests/attrhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from persistent import Persistent


def _resettingJar():
from persistent.tests.utils import ResettingJar
return ResettingJar()
Expand Down
1 change: 1 addition & 0 deletions src/persistent/tests/cucumbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from persistent import Persistent


def print_dict(d):
d = sorted(d.items())
print('{%s}' % (', '.join(
Expand Down
3 changes: 2 additions & 1 deletion src/persistent/tests/test__compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"""

import unittest
import os
import unittest

from persistent import _compat as compat


class TestCOptimizationsFuncs(unittest.TestCase):
# pylint:disable=protected-access
def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion src/persistent/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
# disable: accessing protected members, too many methods
# pylint: disable=W0212,R0904

import doctest
import os.path
import unittest
import doctest

import manuel.capture
import manuel.codeblock
Expand Down
1 change: 0 additions & 1 deletion src/persistent/tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import unittest


from persistent.tests.utils import TrivialJar
from persistent.tests.utils import copy_test

Expand Down
2 changes: 1 addition & 1 deletion src/persistent/tests/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
##############################################################################
import unittest


from persistent.tests.utils import TrivialJar
from persistent.tests.utils import copy_test


# pylint:disable=blacklisted-name, protected-access

class Test_default(unittest.TestCase):
Expand Down
15 changes: 13 additions & 2 deletions src/persistent/tests/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
#
##############################################################################

import copyreg
import re
import unittest
from collections import UserDict as IterableUserDict

import copyreg
from persistent._compat import PYPY
from persistent.tests.utils import skipIfNoCExtension
from collections import UserDict as IterableUserDict


# pylint:disable=R0904,W0212,E1101
# pylint:disable=attribute-defined-outside-init,too-many-lines
Expand All @@ -45,6 +46,7 @@ def _makeOne(self, *args, **kw):

def _makeJar(self, real_cache=False):
from zope.interface import implementer

from persistent.interfaces import IPersistentDataManager

@implementer(IPersistentDataManager)
Expand Down Expand Up @@ -75,6 +77,7 @@ def register(self, obj):

def _makeBrokenJar(self):
from zope.interface import implementer

from persistent.interfaces import IPersistentDataManager

@implementer(IPersistentDataManager)
Expand Down Expand Up @@ -105,11 +108,13 @@ def _makeOneWithJar(self, klass=None, broken_jar=False, real_cache=False):

def test_class_conforms_to_IPersistent(self):
from zope.interface.verify import verifyClass

from persistent.interfaces import IPersistent
verifyClass(IPersistent, self._getTargetClass())

def test_instance_conforms_to_IPersistent(self):
from zope.interface.verify import verifyObject

from persistent.interfaces import IPersistent
verifyObject(IPersistent, self._makeOne())

Expand Down Expand Up @@ -1141,6 +1146,7 @@ def _get_cucumber(self, name):

def test_pickle_roundtrip_simple(self):
import pickle

# XXX s.b. 'examples'
Simple = self._get_cucumber('Simple')
inst = Simple('testing')
Expand All @@ -1152,6 +1158,7 @@ def test_pickle_roundtrip_simple(self):

def test_pickle_roundtrip_w_getnewargs_and_getstate(self):
import pickle

# XXX s.b. 'examples'
Custom = self._get_cucumber('Custom')
inst = Custom('x', 'y')
Expand All @@ -1163,6 +1170,7 @@ def test_pickle_roundtrip_w_getnewargs_and_getstate(self):

def test_pickle_roundtrip_w_slots_missing_slot(self):
import pickle

# XXX s.b. 'examples'
SubSlotted = self._get_cucumber('SubSlotted')
inst = SubSlotted('x', 'y', 'z')
Expand All @@ -1174,6 +1182,7 @@ def test_pickle_roundtrip_w_slots_missing_slot(self):

def test_pickle_roundtrip_w_slots_filled_slot(self):
import pickle

# XXX s.b. 'examples'
SubSlotted = self._get_cucumber('SubSlotted')
inst = SubSlotted('x', 'y', 'z')
Expand All @@ -1186,6 +1195,7 @@ def test_pickle_roundtrip_w_slots_filled_slot(self):

def test_pickle_roundtrip_w_slots_and_empty_dict(self):
import pickle

# XXX s.b. 'examples'
SubSubSlotted = self._get_cucumber('SubSubSlotted')
inst = SubSubSlotted('x', 'y', 'z')
Expand All @@ -1197,6 +1207,7 @@ def test_pickle_roundtrip_w_slots_and_empty_dict(self):

def test_pickle_roundtrip_w_slots_and_filled_dict(self):
import pickle

# XXX s.b. 'examples'
SubSubSlotted = self._get_cucumber('SubSubSlotted')
inst = SubSubSlotted('x', 'y', 'z', foo='bar', baz='bam')
Expand Down
8 changes: 5 additions & 3 deletions src/persistent/tests/test_picklecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import gc
import unittest

from persistent.interfaces import UPTODATE
from persistent._compat import PYPY
from persistent.interfaces import UPTODATE
from persistent.tests.utils import skipIfNoCExtension


Expand Down Expand Up @@ -1240,9 +1240,11 @@ class DummyPersistent(self._getRealPersistentClass()):
def test_inst_does_not_conform_to_IExtendedPickleCache(self):
# Test that ``@use_c_impl`` is only applying the correct
# interface declaration to the C implementation.
from persistent.interfaces import IExtendedPickleCache
from zope.interface.verify import verifyObject
from zope.interface.exceptions import Invalid
from zope.interface.verify import verifyObject

from persistent.interfaces import IExtendedPickleCache

# We don't claim to implement it.
self.assertFalse(IExtendedPickleCache.providedBy(self._makeOne()))
# And we don't even provide everything it asks for.
Expand Down
1 change: 1 addition & 0 deletions src/persistent/tests/test_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from .. import ring


# pylint:disable=protected-access

class DummyPersistent:
Expand Down
2 changes: 1 addition & 1 deletion src/persistent/tests/test_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from persistent.tests.utils import skipIfNoCExtension



class Test__UTC(unittest.TestCase):

def _getTargetClass(self):
Expand Down Expand Up @@ -157,6 +156,7 @@ def test_repr(self):

def test_comparisons_to_non_timestamps(self):
import operator

# Check the corner cases when comparing non-comparable types
ts = self._makeOne(2011, 2, 16, 14, 37, 22.0)

Expand Down
Loading

0 comments on commit e3c14be

Please sign in to comment.