(*args, **kwargs)
return type(base.__name__, (base,), {"from_param": classmethod(from_param)})
Wraps `np.ctypeslib.ndpointer` to allow passing None for NULL pointers.
Wraps `np.ctypeslib.ndpointer` to allow passing None for NULL pointers.
Wraps np . ctypeslib . ndpointer to allow passing None for NULL pointers .
def ndptr(*args, **kwargs):
  """Wraps `np.ctypeslib.ndpointer` to allow passing None for NULL pointers."""
  base = np.ctypeslib.ndpointer(*args, **kwargs)

  def from_param(_, obj):
    if obj is None:
      return obj
    else:
      return base.from_param(obj)

  return type(base.__name__, (base,), {"from_param": classmethod(from_param)})
def ndptr ( * args , * * kwargs ) : base = np . ctypeslib . ndpointer ( * args , * * kwargs ) def from_param ( _ , obj ) : if obj is None : return obj else : return base . from_param ( obj ) return type ( base . __name__ , ( base , ) , { "from_param" : classmethod ( from_param ) } )