Executes moses detokenizer on eval_path file and saves result to
        eval_path + ".detok" file.

        :param eval_path: path to the tokenized input
541424
def run_detokenizer(self, eval_path):
        
        logging.info('Running detokenizer')
        detok_path = os.path.join(self.dataset_dir, config.DETOKENIZER)
        detok_eval_path = eval_path + '.detok'

        with open(detok_eval_path, 'w') as detok_eval_file, \
                open(eval_path, 'r') as eval_file:
            subprocess.run(['perl', f'{detok_path}'], stdin=eval_file,
                           stdout=detok_eval_file, stderr=subprocess.DEVNULL)
261958
def load_config_file(config_path)
      abort "Can not find config file at #{config_path}" if !File.readable?(config_path)
      config = File.read(config_path)
      # trim off anything after __END__
      config.sub!(/^__END__\n.*/, '')
      @app.module_eval(config)
    end
390365
def execute(self, input_data):
        '''  '''

        # Copy info from input
        view = input_data['view_pcap']

        # Grab a couple of handles
        extracted_files = input_data['view_pcap']['extracted_files']

        # Dump a couple of fields
        del view['extracted_files']        

        # Grab additional info about the extracted files
        view['extracted_files'] = [self.workbench.work_request('meta_deep', md5, 
            ['md5', 'sha256', 'entropy', 'ssdeep', 'file_size', 'file_type']) for md5 in extracted_files]

        return view
370139
def build_eval_path(self, epoch, iteration):
        
        if iteration is not None:
            eval_fname = f'eval_epoch_{epoch}_iter_{iteration}'
        else:
            eval_fname = f'eval_epoch_{epoch}'
        eval_path = os.path.join(self.save_path, eval_fname)
        return eval_path
813266
def evaluate(self, path):
        
        result = False
        cause = None

        for f in self.filters:

            cause, result = f.evaluate(path)
            if not result:
                break

        return cause, result
64249
def _eval(self, node):
        
        try:
            handler = self.nodes[type(node)]
        except KeyError:
            raise ValueError("Sorry, {0} is not available in this evaluator".format(type(node).__name__))

        return handler(node)
149152
def do_execute(self):
        
        fname = str(self.input.payload)
        if not os.path.exists(fname):
            return "File '" + fname + "' does not exist!"
        if not os.path.isfile(fname):
            return "Location '" + fname + "' is not a file!"
        if self.resolve_option("use_custom_loader"):
            self._loader = self.resolve_option("custom_loader")
        else:
            self._loader = converters.loader_for_file(fname)
        dataset = self._loader.load_file(fname, incremental=bool(self.resolve_option("incremental")))
        if not self.resolve_option("incremental"):
            self._output.append(Token(dataset))
        else:
            self._iterator = self._loader.__iter__()
        return None
1011528
def load
      return unless File.exist?(@path) && !loaded?

      @source = File.read(@path)
      context = Context.new(self)
      eval @source, context.binding, @path.to_s, 1 # rubocop:disable Lint/Eval
      @loaded = true
    end
245223
def loop_eval input
    if eval_binding.kind_of?(Binding)
      eval_binding.eval(input, "(#{name})", line)
    else
      eval_binding.instance_eval(input, "(#{name})", line)
    end
  end
417821
def do_reparse(self, arg):
        
        #We just get the full path of the currently active test and hit reparse.
        full = arg == "full"
        from os import path
        fullpath = path.abspath(self.tests[self.active].stagedir)
        self.tests[self.active] = Analysis(fullpath, full)
954309
def api_eval(expr_str)
      body = ["ver:\"#{@haystack_version}\""]
      body << "expr"
      body << '"'+expr_str+'"'
      res = self.connection.post('eval') do |req|
        req.headers['Content-Type'] = 'text/plain'
        req.body = body.join("\n")
      end
      JSON.parse! res.body
    end
40256
def _excepthook(self, etype, evalue, trace):
        
        if etype == ArgumentParserError:
            self.exit(code=CRITICAL,
                      message='error: {0}'.format(evalue),
                      extdata=self.parser.format_usage())
        else:
            self.exit(code=UNKNOWN,
                      message='Uncaught exception: {0} - {1}'
                              .format(etype.__name__, evalue),
                      extdata=''.join(traceback.format_tb(trace)))
1005199
def execute(self):
    
    teardown_verbosity = self._vars.PEX_TEARDOWN_VERBOSE
    try:
      pex_inherit_path = self._vars.PEX_INHERIT_PATH
      if pex_inherit_path == "false":
        pex_inherit_path = self._pex_info.inherit_path
      self.patch_sys(pex_inherit_path)
      working_set = self._activate()
      self.patch_pkg_resources(working_set)
      exit_code = self._wrap_coverage(self._wrap_profiling, self._execute)
      if exit_code:
        sys.exit(exit_code)
    except Exception:
      # Allow the current sys.excepthook to handle this app exception before we tear things down in
      # finally, then reraise so that the exit status is reflected correctly.
      sys.excepthook(*sys.exc_info())
      raise
    except SystemExit as se:
      # Print a SystemExit error message, avoiding a traceback in python3.
      # This must happen here, as sys.stderr is about to be torn down
      if not isinstance(se.code, int) and se.code is not None:
        print(se.code, file=sys.stderr)
      raise
    finally:
      # squash all exceptions on interpreter teardown -- the primary type here are
      # atexit handlers failing to run because of things such as:
      #   http://stackoverflow.com/questions/2572172/referencing-other-modules-in-atexit
      if not teardown_verbosity:
        sys.stderr.flush()
        sys.stderr = DevNull()
        sys.excepthook = lambda *a, **kw: None
62262
def eval(s, bndng=nil, filename=nil, lineno=nil)

      loadstring_and_call(s, bndng, filename, lineno)
    end
718278
def do_execute(self):
        
        if self.storagehandler is None:
            return "No storage handler available!"
        expr = str(self.resolve_option("expression")).replace(
            "{X}", str(self.storagehandler.storage[str(self.resolve_option("storage_name"))]))
        expr = self.storagehandler.expand(expr)
        self.storagehandler.storage[self.resolve_option("storage_name")] = eval(expr)
        self._output.append(self.input)
        return None
770527
def read(input)
      if input.is_a? Symbol
        @file = File.expand_path get_eval_file input
        File.read @file
      else
        @file = File.expand_path __FILE__
        input
      end
    end
259146
def cueExtractAndRun(args, file):
    
    filename = file['file_path']
    if args['execute']:
        holla = run(filename)
    else:
        holla = run(filename, True)
    return holla