8000 Implement __slots__ within the Introspect class · libvips/pyvips@ee5a727 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee5a727

Browse files
kleisaukejcupitt
authored andcommitted
Implement __slots__ within the Introspect class
Signed-off-by: John Cupitt <jcupitt@gmail.com>
1 parent 5158c27 commit ee5a727

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pyvips/voperation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,26 @@ class Introspect(object):
2929
everything we know about it.
3030
3131
"""
32+
__slots__ = ('description', 'flags', 'details',
33+
'required_input', 'optional_input',
34+
'required_output', 'optional_output',
35+
'member_x', 'method_args')
3236

3337
def __init__(self, operation_name):
3438
op = Operation.new_from_name(operation_name)
3539

36-
self.name = operation_name
3740
self.description = op.get_description()
3841
self.flags = vips_lib.vips_operation_get_flags(op.pointer)
3942

4043
# build a list of constructor arg [name, flags] pairs in arg order
41-
self.arguments = []
44+
arguments = []
4245

4346
def add_args(name, flags):
4447
if (flags & _CONSTRUCT) != 0:
4548
# libvips uses '-' to separate parts of arg names, but we
4649
# need '_' for Python
4750
name = name.replace('-', '_')
48-
self.arguments.append([name, flags])
51+
arguments.append([name, flags])
4952

5053
if at_least_libvips(8, 7):
5154
p_names = ffi.new('char**[1]')
@@ -74,7 +77,7 @@ def add_construct(self, pspec, argument_class,
7477

7578
# build a hash from arg name to detailed arg information
7679
self.details = {}
77-
for name, flags in self.arguments:
80+
for name, flags in arguments:
7881
self.details[name] = {
7982
"name": name,
8083
"flags": flags,
@@ -88,7 +91,7 @@ def add_construct(self, pspec, argument_class,
8891
self.required_output = []
8992
self.optional_output = []
9093

91-
for name, flags in self.arguments:
94+
for name, flags in arguments:
9295
if ((flags & _INPUT) != 0 and
9396
(flags & _REQUIRED) != 0 and
9497
(flags & _DEPRECATED) == 0):

0 commit comments

Comments
 (0)
0