hide deprecated args to operations in python
This commit is contained in:
parent
742ff4c108
commit
b40bad04bb
21
TODO
21
TODO
@ -8,26 +8,11 @@
|
||||
|
||||
- why don't we get gtk-doc expansions in the leading chapters? we turn them on
|
||||
|
||||
- python fitsload has both "access" and "sequential" as kwargs, is this right?
|
||||
why do we need both?
|
||||
- does Vips.py need to hide deprecated operations?
|
||||
|
||||
try:
|
||||
- note we automatically copy modified args in Vips.py
|
||||
|
||||
$ vips fitsload
|
||||
load a FITS image
|
||||
usage:
|
||||
fitsload filename out
|
||||
where:
|
||||
filename - Filename to load from, input gchararray
|
||||
out - Output image, output VipsImage
|
||||
optional arguments:
|
||||
flags - Flags for this file, output VipsForeignFlags
|
||||
disc - Open to disc, input gboolean
|
||||
access - Required access pattern for this file, input VipsAccess
|
||||
|
||||
seq is not there ... do we need to hide deprecated?
|
||||
|
||||
check cplusplus as well
|
||||
- does cplusplus need to hide deprecated args and operations?
|
||||
|
||||
- test other arg types
|
||||
|
||||
|
@ -164,6 +164,24 @@ class Argument:
|
||||
|
||||
Vips.Argument = Argument
|
||||
|
||||
class Operation(Vips.Operation):
|
||||
|
||||
def __init__(self):
|
||||
Vips.Operation.__init__(self)
|
||||
|
||||
# find all the args for this op, sort into priority order
|
||||
# remember to ignore deprecated ones
|
||||
def get_args(self):
|
||||
args = [Argument(self, x) for x in self.props]
|
||||
args = [y for y in args
|
||||
if not (y.flags & Vips.ArgumentFlags.DEPRECATED)]
|
||||
args.sort(lambda a, b: a.priority - b.priority)
|
||||
|
||||
return args
|
||||
|
||||
Operation = override(Operation)
|
||||
__all__.append('Operation')
|
||||
|
||||
# search a list recursively for a Vips.Image object
|
||||
def find_image(x):
|
||||
if isinstance(x, Vips.Image):
|
||||
@ -194,9 +212,7 @@ def _call_base(name, required, optional, self = None, option_string = None):
|
||||
if op.set_from_string(option_string) != 0:
|
||||
raise Error('Bad arguments.')
|
||||
|
||||
# find all the args for this op, sort into priority order
|
||||
args = [Argument(op, x) for x in op.props]
|
||||
args.sort(lambda a, b: a.priority - b.priority)
|
||||
args = op.get_args()
|
||||
|
||||
enm = Vips.ArgumentFlags
|
||||
|
||||
@ -276,8 +292,7 @@ def _call_base(name, required, optional, self = None, option_string = None):
|
||||
|
||||
# rescan args if op2 is different from op
|
||||
if op2 != op:
|
||||
args = [Argument(op2, x) for x in op2.props]
|
||||
args.sort(lambda a, b: a.priority - b.priority)
|
||||
args = op2.get_args()
|
||||
optional_output = {x.name: x for x in args if x.flags & enm.OUTPUT and
|
||||
not x.flags & enm.REQUIRED}
|
||||
|
||||
@ -400,8 +415,7 @@ def generate_docstring(name):
|
||||
return 'No such operator ' + name
|
||||
|
||||
# find all the args for this op, sort into priority order
|
||||
args = [Argument(op, x) for x in op.props]
|
||||
args.sort(lambda a, b: a.priority - b.priority)
|
||||
args = op.get_args()
|
||||
|
||||
enm = Vips.ArgumentFlags
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user