Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __call__(self, *args, **kwargs):
if not self.trained:
if hasattr(self, 'fit_transform'):
self.trained = True
ret = self.fit_transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'fit'):
self.trained = True
self.fit(*args, **kwargs)
return Just(self) if not self.inv else self
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'predict'):
ret = self.predict(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'transform'):
ret = self.transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'draw'):
ret = self.draw(*args, **kwargs)
return Just(ret) if not self.inv else ret
raise ValueError(
def __call__(self, *args, **kwargs):
if not self.trained:
if hasattr(self, 'fit_transform'):
self.trained = True
ret = self.fit_transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'fit'):
self.trained = True
self.fit(*args, **kwargs)
return Just(self) if not self.inv else self
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'predict'):
ret = self.predict(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'transform'):
ret = self.transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'draw'):
ret = self.draw(*args, **kwargs)
return Just(ret) if not self.inv else ret
raise ValueError(
'combinator class must implement fit-transform/predict')
return Just(ret) if not self.inv else ret
if hasattr(self, 'fit'):
self.trained = True
self.fit(*args, **kwargs)
return Just(self) if not self.inv else self
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'predict'):
ret = self.predict(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'transform'):
ret = self.transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'draw'):
ret = self.draw(*args, **kwargs)
return Just(ret) if not self.inv else ret
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'fit_transform'):
self.trained = True
ret = self.fit_transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'fit'):
self.trained = True
self.fit(*args, **kwargs)
return Just(self) if not self.inv else self
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'predict'):
ret = self.predict(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'transform'):
ret = self.transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'draw'):
ret = self.draw(*args, **kwargs)
return Just(ret) if not self.inv else ret
raise ValueError(
'combinator class must implement fit-transform/predict')
def __call__(self, *args, **kwargs):
if not self.trained:
if hasattr(self, 'fit_transform'):
self.trained = True
ret = self.fit_transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'fit'):
self.trained = True
self.fit(*args, **kwargs)
return Just(self) if not self.inv else self
raise ValueError(
'combinator class must implement fit-transform/predict')
if hasattr(self, 'predict'):
ret = self.predict(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'transform'):
ret = self.transform(*args, **kwargs)
return Just(ret) if not self.inv else ret
if hasattr(self, 'draw'):
ret = self.draw(*args, **kwargs)
return Just(ret) if not self.inv else ret
raise ValueError(
'combinator class must implement fit-transform/predict')
The Maybe monoid works when the values it contains are also monoids with a defined mzero and mplus.
This allows you do things like::
>>> Just(1) + Just(9) == Just(10)
>>> Just("Hello ") + Just("World") == Just("Hello World")
>>> Just([1, 2, 3]) + Just([4, 5, 6]) == Just([1, 2, 3, 4, 5, 6])
The identity value is :class:`Nothing`::
>>> Just(1) + Nothing == Just(1)
"""
if other == Nothing:
return self
else:
return Just(self.value + other.data_frame)
def __call__(self, *args, **kwargs):
args_ = args + self.args
kwargs_ = dict(kwargs, **self.kwargs)
return Just(func(*args_, **kwargs_))