Module indcomp.exceptions
The indcomp.exceptions
module includes all custom exceptions.
Expand source code
"""The `indcomp.exceptions` module includes all custom exceptions.
"""
class NoWeightsException(Exception):
"""Raised if a class method that requires weights is invoked, before weights have
been calculated
"""
def __init__(self, *args):
super().__init__()
def __str__(self):
return (
"This instance has not had weights calculated yet. Call `calc_weights`"
+ " before using this method."
)
class ColumnNotFoundException(Exception):
"""Raised if provided column name not found in dataframe"""
def __init__(self, *args):
super().__init__()
self.col = args[0]
self.source = args[1]
def __str__(self):
return f"Column name '{self.col}' not found in {self.source} dataframe"
class StatisticException(Exception):
"""Raised if match dictionary is configured with an unsupported statistic"""
def __init__(self, *args):
super().__init__()
self.stat = args[0]
def __str__(self):
return (
"Supported statistics are ('mean', 'std', 'min', 'max'), provided as the "
+ f"first item in the match dictionary values. Provided: '{self.stat}'"
)
class MeanMinMaxConfigException(Exception):
"""Raised if match dictionary is incorrectly configured for mean/min/max
statistic"""
def __init__(self, *args):
super().__init__()
self.vals = args[0]
def __str__(self):
return (
"Configuring for 'mean' requires two items in the match dictionary values."
+ f" {len(self.vals)} provided: {self.vals}"
)
class StdConfigException(Exception):
"""Raised if match dictionary is incorrectly configured for std statistic"""
def __init__(self, *args):
super().__init__()
self.vals = args[0]
def __str__(self):
return (
"Configuring for 'std' requires three items in the match dictionary values."
+ f" {len(self.vals)} provided: {self.vals}"
)
class ConfigException(Exception):
"""Raised if match dictionary values provided with only one string"""
def __init__(self, *args):
super().__init__()
self.vals = args[0]
def __str__(self):
return (
"Match dictionary values require two items for 'mean', or three items for"
+ f" 'std'. Provided: '{self.vals}'"
)
Classes
class ColumnNotFoundException (*args)
-
Raised if provided column name not found in dataframe
Expand source code
class ColumnNotFoundException(Exception): """Raised if provided column name not found in dataframe""" def __init__(self, *args): super().__init__() self.col = args[0] self.source = args[1] def __str__(self): return f"Column name '{self.col}' not found in {self.source} dataframe"
Ancestors
- builtins.Exception
- builtins.BaseException
class ConfigException (*args)
-
Raised if match dictionary values provided with only one string
Expand source code
class ConfigException(Exception): """Raised if match dictionary values provided with only one string""" def __init__(self, *args): super().__init__() self.vals = args[0] def __str__(self): return ( "Match dictionary values require two items for 'mean', or three items for" + f" 'std'. Provided: '{self.vals}'" )
Ancestors
- builtins.Exception
- builtins.BaseException
class MeanMinMaxConfigException (*args)
-
Raised if match dictionary is incorrectly configured for mean/min/max statistic
Expand source code
class MeanMinMaxConfigException(Exception): """Raised if match dictionary is incorrectly configured for mean/min/max statistic""" def __init__(self, *args): super().__init__() self.vals = args[0] def __str__(self): return ( "Configuring for 'mean' requires two items in the match dictionary values." + f" {len(self.vals)} provided: {self.vals}" )
Ancestors
- builtins.Exception
- builtins.BaseException
class NoWeightsException (*args)
-
Raised if a class method that requires weights is invoked, before weights have been calculated
Expand source code
class NoWeightsException(Exception): """Raised if a class method that requires weights is invoked, before weights have been calculated """ def __init__(self, *args): super().__init__() def __str__(self): return ( "This instance has not had weights calculated yet. Call `calc_weights`" + " before using this method." )
Ancestors
- builtins.Exception
- builtins.BaseException
class StatisticException (*args)
-
Raised if match dictionary is configured with an unsupported statistic
Expand source code
class StatisticException(Exception): """Raised if match dictionary is configured with an unsupported statistic""" def __init__(self, *args): super().__init__() self.stat = args[0] def __str__(self): return ( "Supported statistics are ('mean', 'std', 'min', 'max'), provided as the " + f"first item in the match dictionary values. Provided: '{self.stat}'" )
Ancestors
- builtins.Exception
- builtins.BaseException
class StdConfigException (*args)
-
Raised if match dictionary is incorrectly configured for std statistic
Expand source code
class StdConfigException(Exception): """Raised if match dictionary is incorrectly configured for std statistic""" def __init__(self, *args): super().__init__() self.vals = args[0] def __str__(self): return ( "Configuring for 'std' requires three items in the match dictionary values." + f" {len(self.vals)} provided: {self.vals}" )
Ancestors
- builtins.Exception
- builtins.BaseException