Skip to content

Commit ff7459e

Browse files
committed
First batch of ruff/black autorefactors/format.
1 parent bd2c628 commit ff7459e

File tree

7 files changed

+95
-99
lines changed

7 files changed

+95
-99
lines changed

src/lazy_object_proxy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
except ImportError:
2121
__version__ = '1.9.0'
2222

23-
__all__ = ("Proxy",)
23+
__all__ = ('Proxy',)

src/lazy_object_proxy/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
def with_metaclass(meta, *bases):
55
"""Create a base class with a metaclass."""
6-
return meta("NewBase", bases, {})
6+
return meta('NewBase', bases, {})

src/lazy_object_proxy/simple.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def proxy_wrapper(self, *args):
1414
return proxy_wrapper
1515

1616

17-
class _ProxyMethods(object):
17+
class _ProxyMethods:
1818
# We use properties to override the values of __module__ and
1919
# __doc__. If we add these in ObjectProxy, the derived class
2020
# __dict__ will still be setup to have string variants of these
@@ -95,7 +95,7 @@ def __repr__(self, __getattr__=object.__getattribute__):
9595
type(self).__name__, id(self), self.__wrapped__, id(self.__wrapped__), self.__factory__
9696
)
9797
else:
98-
return '<{} at 0x{:x} with factory {!r}>'.format(type(self).__name__, id(self), self.__factory__)
98+
return f'<{type(self).__name__} at 0x{id(self):x} with factory {self.__factory__!r}>'
9999

100100
def __fspath__(self):
101101
wrapped = self.__wrapped__

src/lazy_object_proxy/slots.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .utils import identity
77

88

9-
class _ProxyMethods(object):
9+
class _ProxyMethods:
1010
# We use properties to override the values of __module__ and
1111
# __doc__. If we add these in ObjectProxy, the derived class
1212
# __dict__ will still be setup to have string variants of these
@@ -124,8 +124,8 @@ def __name__(self, value):
124124
def __class__(self):
125125
return self.__wrapped__.__class__
126126

127-
@__class__.setter # noqa: F811
128-
def __class__(self, value): # noqa: F811
127+
@__class__.setter
128+
def __class__(self, value):
129129
self.__wrapped__.__class__ = value
130130

131131
@property
@@ -149,11 +149,9 @@ def __repr__(self, __getattr__=object.__getattribute__):
149149
try:
150150
target = __getattr__(self, '__target__')
151151
except AttributeError:
152-
return '<{} at 0x{:x} with factory {!r}>'.format(type(self).__name__, id(self), self.__factory__)
152+
return f'<{type(self).__name__} at 0x{id(self):x} with factory {self.__factory__!r}>'
153153
else:
154-
return '<{} at 0x{:x} wrapping {!r} at 0x{:x} with factory {!r}>'.format(
155-
type(self).__name__, id(self), target, id(target), self.__factory__
156-
)
154+
return f'<{type(self).__name__} at 0x{id(self):x} wrapping {target!r} at 0x{id(target):x} with factory {self.__factory__!r}>'
157155

158156
def __fspath__(self):
159157
wrapped = self.__wrapped__

src/lazy_object_proxy/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def identity(obj):
4949
return obj
5050

5151

52-
class cached_property(object):
52+
class cached_property:
5353
def __init__(self, func):
5454
self.func = func
5555

tests/conftest.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
PYPY = '__pypy__' in sys.builtin_module_names
66

77

8-
@pytest.fixture(scope="session")
8+
@pytest.fixture(scope='session')
99
def lop_loader():
1010
def load_implementation(name):
1111
class FakeModule:
1212
subclass = False
1313
kind = name
14-
if name == "slots":
14+
if name == 'slots':
1515
from lazy_object_proxy.slots import Proxy
16-
elif name == "simple":
16+
elif name == 'simple':
1717
from lazy_object_proxy.simple import Proxy
18-
elif name == "cext":
18+
elif name == 'cext':
1919
try:
2020
from lazy_object_proxy.cext import Proxy
2121
except ImportError:
2222
if PYPY:
23-
pytest.skip(reason="C Extension not available.")
23+
pytest.skip(reason='C Extension not available.')
2424
else:
2525
raise
26-
elif name == "objproxies":
27-
Proxy = pytest.importorskip("objproxies").LazyProxy
28-
elif name == "django":
29-
Proxy = pytest.importorskip("django.utils.functional").SimpleLazyObject
26+
elif name == 'objproxies':
27+
Proxy = pytest.importorskip('objproxies').LazyProxy
28+
elif name == 'django':
29+
Proxy = pytest.importorskip('django.utils.functional').SimpleLazyObject
3030
else:
31-
raise RuntimeError("Unsupported param: %r." % name)
31+
raise RuntimeError('Unsupported param: %r.' % name)
3232

3333
Proxy
3434

@@ -38,32 +38,32 @@ class FakeModule:
3838

3939

4040
@pytest.fixture(
41-
scope="session",
41+
scope='session',
4242
params=[
43-
"slots",
44-
"cext",
45-
"simple",
43+
'slots',
44+
'cext',
45+
'simple',
4646
# "external-django", "external-objproxies"
4747
],
4848
)
4949
def lop_implementation(request, lop_loader):
5050
return lop_loader(request.param)
5151

5252

53-
@pytest.fixture(scope="session", params=[True, False], ids=['subclassed', 'normal'])
53+
@pytest.fixture(scope='session', params=[True, False], ids=['subclassed', 'normal'])
5454
def lop_subclass(request, lop_implementation):
5555
if request.param:
5656

5757
class submod(lop_implementation):
5858
subclass = True
59-
Proxy = type("SubclassOf_" + lop_implementation.Proxy.__name__, (lop_implementation.Proxy,), {})
59+
Proxy = type('SubclassOf_' + lop_implementation.Proxy.__name__, (lop_implementation.Proxy,), {})
6060

6161
return submod
6262
else:
6363
return lop_implementation
6464

6565

66-
@pytest.fixture(scope="function")
66+
@pytest.fixture(scope='function')
6767
def lop(request, lop_subclass):
6868
if request.node.get_closest_marker('xfail_subclass'):
6969
request.applymarker(
@@ -72,6 +72,6 @@ def lop(request, lop_subclass):
7272
)
7373
)
7474
if request.node.get_closest_marker('xfail_simple'):
75-
request.applymarker(pytest.mark.xfail(reason="The lazy_object_proxy.simple.Proxy has some limitations."))
75+
request.applymarker(pytest.mark.xfail(reason='The lazy_object_proxy.simple.Proxy has some limitations.'))
7676

7777
return lop_subclass

0 commit comments

Comments
 (0)