Skip to content

Commit 0c55a82

Browse files
committed
pylint
1 parent e559295 commit 0c55a82

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

causal_testing/specification/variable.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@ def __init__(self, name: str, datatype: T, distribution: rv_generic = None, hidd
3838
def __repr__(self):
3939
return f"{self.typestring()}: {self.name}::{self.datatype.__name__}"
4040

41-
def cast(self, val: Any) -> T:
42-
"""Cast the supplied value to the datatype T of the variable.
43-
44-
:param any val: The value to cast.
45-
:return: The supplied value as an instance of T.
46-
:rtype: T
47-
"""
48-
assert val is not None, f"Invalid value None for variable {self}"
49-
if isinstance(val, self.datatype):
50-
return val
51-
if isinstance(val, BoolRef) and self.datatype == bool:
52-
return str(val) == "True"
53-
if isinstance(val, RatNumRef) and self.datatype == float:
54-
return float(val.numerator().as_long() / val.denominator().as_long())
55-
if hasattr(val, "is_string_value") and val.is_string_value() and self.datatype == str:
56-
return val.as_string()
57-
if (isinstance(val, (float, int, bool))) and (self.datatype in (float, int, bool)):
58-
return self.datatype(val)
59-
return self.datatype(str(val))
60-
6141
def sample(self, n_samples: int) -> [T]:
6242
"""Generate a Latin Hypercube Sample of size n_samples according to the
6343
Variable's distribution.

0 commit comments

Comments
 (0)