Skip to content

Commit

Permalink
raise exception instead of NotImplemented
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Feb 21, 2020
1 parent da4b6e2 commit f1cc9a7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
1 change: 1 addition & 0 deletions rasa/core/policies/ted_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def load(cls, path: Text) -> "TEDPolicy":
return cls(featurizer=featurizer, priority=priority, model=model, **meta)


# accessing _tf_layers with any key results in key-error, disable it
# pytype: disable=key-error


Expand Down
1 change: 1 addition & 0 deletions rasa/nlu/classifiers/diet_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ def _load_model(
return model


# accessing _tf_layers with any key results in key-error, disable it
# pytype: disable=key-error


Expand Down
35 changes: 23 additions & 12 deletions rasa/utils/tensorflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def train_dataset_function(_batch_size: int) -> tf.data.Dataset:
)

def _get_tf_evaluation_functions(
self, eager: bool, evaluation_model_data: Optional[RasaModelData],
self, eager: bool, evaluation_model_data: Optional[RasaModelData]
) -> Tuple[Optional[Callable], Optional[Callable]]:
"""Create evaluation tensorflow functions"""

Expand All @@ -248,10 +248,7 @@ def evaluation_dataset_function(_batch_size: int) -> tf.data.Dataset:
return (
evaluation_dataset_function,
self._get_tf_call_model_function(
evaluation_dataset_function,
self._total_batch_loss,
eager,
"evaluation",
evaluation_dataset_function, self._total_batch_loss, eager, "evaluation"
),
)

Expand Down Expand Up @@ -335,22 +332,36 @@ def linearly_increasing_batch_size(
return int(batch_size[0])

def compile(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def evaluate(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def test_on_batch(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def predict_on_batch(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def fit_generator(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def evaluate_generator(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)

def predict_generator(self, *args, **kwargs) -> None:
raise NotImplemented
raise Exception(
"This method should neither be called nor implemented in our code."
)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ license_file = LICENSE.txt

[flake8]
max-line-length = 88
ignore = W503, E121, E126, E211, E225, E501, E203, E402, F401, F811, E231, F901
ignore = W503, E121, E126, E211, E225, E501, E203, E402, F401, F811, E231

0 comments on commit f1cc9a7

Please sign in to comment.