chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# coding:utf-8
|
||||
import numpy as np
|
||||
|
||||
|
||||
def check_data(a, b):
|
||||
if not isinstance(a, np.ndarray):
|
||||
a = np.array(a)
|
||||
|
||||
if not isinstance(b, np.ndarray):
|
||||
b = np.array(b)
|
||||
|
||||
if type(a) != type(b):
|
||||
raise ValueError("Type mismatch: %s and %s" % (type(a), type(b)))
|
||||
|
||||
if a.size != b.size:
|
||||
raise ValueError("Arrays must be equal in length.")
|
||||
return a, b
|
||||
|
||||
|
||||
def validate_input(function):
|
||||
def wrapper(a, b):
|
||||
a, b = check_data(a, b)
|
||||
return function(a, b)
|
||||
|
||||
return wrapper
|
||||
Reference in New Issue
Block a user