Commit 72f1c866 authored by alat-rights's avatar alat-rights
Browse files

mypy

parent 646305ff
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class OneHotFeaturizer(Featurizer):
    if len(charset) != len(set(charset)):
      raise ValueError("All values in charset must be unique.")
    self.charset = charset
    self.max_length = Optional[int]
    if max_length is not None:
      self.max_length = int(max_length)
    else:
@@ -96,7 +97,7 @@ class OneHotFeaturizer(Featurizer):
      The shape is `(max_length, len(charset) + 1)`.
      The index of unknown character is `len(charset)`.
    """
    if self.max_length is not None:
    if isinstance(self.max_length, int):
      if (len(string) > self.max_length):  # Validation
        raise ValueError("The length of {} is longer than `max_length`.")
      string = self.pad_string(string)  # Padding