MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / args_match

Function args_match

src/__init__.py:22175–22197  ·  view source on GitHub ↗

Returns true if matches . Each item in is a type or tuple of types. Any of these types will match an item in . `None` will match anything in . `type(None)` will match an arg whose value is `None`.

(args, *types)

Source from the content-addressed store, hash-verified

22173
22174
22175def args_match(args, *types):
22176 '''
22177 Returns true if <args> matches <types>.
22178
22179 Each item in <types> is a type or tuple of types. Any of these types will
22180 match an item in <args>. `None` will match anything in <args>. `type(None)`
22181 will match an arg whose value is `None`.
22182 ''&#x27;
22183 j = 0
22184 for i in range(len(types)):
22185 type_ = types[i]
22186 if j >= len(args):
22187 if isinstance(type_, tuple) and None in type_:
22188 # arg is missing but has default value.
22189 continue
22190 else:
22191 return False
22192 if type_ is not None and not isinstance(args[j], type_):
22193 return False
22194 j += 1
22195 if j != len(args):
22196 return False
22197 return True
22198
22199
22200def calc_image_matrix(width, height, tr, rotate, keep):

Callers 3

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…