def __new__(
        cls,
        argv,
        input_files,
        description,
        env=None,
        output_files=(),
        output_directories=(),
        timeout_seconds=_default_timeout_seconds,
        jdk_home=None,
    ):
        if env is None:
            env = ()
        else:
            if not isinstance(env, dict):
                raise TypeCheckError(
                    cls.__name__,
                    "arg 'env' was invalid: value {} (with type {}) must be a dict"
                    .format(env, type(env)))
            env = tuple(item for pair in env.items() for item in pair)

        return super(ExecuteProcessRequest, cls).__new__(
            cls,
            argv=argv,
            env=env,
            input_files=input_files,
            description=description,
            output_files=output_files,
            output_directories=output_directories,
            timeout_seconds=timeout_seconds,
            jdk_home=jdk_home,
        )
Beispiel #2
0
 def _verify_env_is_dict(cls, env):
   if not isinstance(env, dict):
     raise TypeCheckError(
       cls.__name__,
       "arg 'env' was invalid: value {} (with type {}) must be a dict".format(
         env,
         type(env)
       )
     )
Beispiel #3
0
    def __new__(cls, bin_path):
        this_object = super(BinaryLocation, cls).__new__(cls, str(bin_path))

        bin_path = this_object.bin_path

        if os.path.isfile(bin_path) and os.access(bin_path, os.X_OK):
            return this_object

        raise TypeCheckError(
            cls.__name__,
            "path {} does not name an existing executable file.".format(
                bin_path))