diff options
author | Elisey Zanko <elisey.zanko@gmail.com> | 2015-04-20 10:44:09 -0700 |
---|---|---|
committer | Josh Rosen <joshrosen@databricks.com> | 2015-04-20 10:44:09 -0700 |
commit | 77176619a97d07811ab20e1dde4677359d85eb33 (patch) | |
tree | 3d362532bd4a21d2c888425791418e6001485d80 /python/pyspark/ml | |
parent | 968ad972175390bb0a96918fd3c7b318d70fa466 (diff) | |
download | spark-77176619a97d07811ab20e1dde4677359d85eb33.tar.gz spark-77176619a97d07811ab20e1dde4677359d85eb33.tar.bz2 spark-77176619a97d07811ab20e1dde4677359d85eb33.zip |
[SPARK-6661] Python type errors should print type, not object
Author: Elisey Zanko <elisey.zanko@gmail.com>
Closes #5361 from 31z4/spark-6661 and squashes the following commits:
73c5d79 [Elisey Zanko] Python type errors should print type, not object
Diffstat (limited to 'python/pyspark/ml')
-rw-r--r-- | python/pyspark/ml/param/__init__.py | 2 | ||||
-rw-r--r-- | python/pyspark/ml/pipeline.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/python/pyspark/ml/param/__init__.py b/python/pyspark/ml/param/__init__.py index 9fccb65675..49c20b4cf7 100644 --- a/python/pyspark/ml/param/__init__.py +++ b/python/pyspark/ml/param/__init__.py @@ -30,7 +30,7 @@ class Param(object): def __init__(self, parent, name, doc): if not isinstance(parent, Params): - raise ValueError("Parent must be a Params but got type %s." % type(parent).__name__) + raise TypeError("Parent must be a Params but got type %s." % type(parent)) self.parent = parent self.name = str(name) self.doc = str(doc) diff --git a/python/pyspark/ml/pipeline.py b/python/pyspark/ml/pipeline.py index d94ecfff09..7c1ec3026d 100644 --- a/python/pyspark/ml/pipeline.py +++ b/python/pyspark/ml/pipeline.py @@ -131,8 +131,8 @@ class Pipeline(Estimator): stages = paramMap[self.stages] for stage in stages: if not (isinstance(stage, Estimator) or isinstance(stage, Transformer)): - raise ValueError( - "Cannot recognize a pipeline stage of type %s." % type(stage).__name__) + raise TypeError( + "Cannot recognize a pipeline stage of type %s." % type(stage)) indexOfLastEstimator = -1 for i, stage in enumerate(stages): if isinstance(stage, Estimator): |