def validate(self): super(FileNode, self).validate() if self._params.get("path") is None: raise exceptions.ValidationError("'path' not set", self) path = self._params.get("path", "") if isinstance(path, basestring) and not os.path.exists(path): raise exceptions.ValidationError("'path': file not found", self)
def validate(self): super(PilScale, self).validate() if not self._params.get("scale"): raise exceptions.ValidationError("'scale' is not set", self) try: num = float(self._params.get("scale")) except ValueError: raise exceptions.ValidationError("'float' must be a float", self)
def validate(self): super(Rotate90, self).validate() if not self._params.get("num"): raise exceptions.ValidationError("'num' is not set", self) try: num = int(self._params.get("num")) except ValueError: raise exceptions.ValidationError("'num' must be an integer", self)
def validate(self): """Check we're in a good state.""" super(OcropusRecognizer, self).validate() if self._params.get("character_model", "").strip() == "": raise exceptions.ValidationError("no character model given.", self) if self._params.get("language_model", "").strip() == "": raise exceptions.ValidationError( "no language model given: %s" % self._params, self)
def validate(self): project_pk = self._params.get("project") try: pk = int(project_pk) except ValueError: raise exceptions.ValidationError("Project primary key not set.", self) val = self._params.get("pid") if not val.strip(): raise exceptions.ValidationError("Pid not set", self)
def validate(self): super(FindReplace, self).validate() try: re.compile(self._params.get("find")) except Exception, err: raise exceptions.ValidationError( "find: regular expression error: %s" % err, self)
def validate(self): """Check state of the inputs.""" self.logger.debug("%s: validating...", self) super(OcropusBase, self).validate() for i in range(len(self._inputs)): if self._inputs[i] is None: raise exceptions.ValidationError("missing input '%d'" % i, self)
def validate(self): missing = [] for pname in [p["name"] for p in self.parameters]: if not self._params.get(pname, "").strip(): missing.append(pname) if missing: raise exceptions.ValidationError( "Missing parameter(s): %s" % ", ".join(missing), self)
def validate(self): """Check params are OK.""" if self._params.get("path") is None: raise exceptions.ValidationError("'path' not set", self)
def validate(self): super(FileNode, self).validate() if self._params.get("path") is None: raise exceptions.ValidationError("'path' not set", self) if not os.path.exists(self._params.get("path", "")): raise exceptions.ValidationError("'path': file not found", self)