Examples of PyFile


Examples of com.jetbrains.python.psi.PyFile

        if (selectionText != null) {
          sendCommand = sendCommand.withSelectionText(selectionText);
        }
        else {
          PyFile file = getPythonFile(e);
          if (file != null) {
            sendCommand = sendCommand.withFile(file.getVirtualFile());
          }
          else {
            throw new IllegalStateException();
          }
        }
View Full Code Here

Examples of com.jetbrains.python.psi.PyFile

    }
  }

  @Nullable
  private static String getFileText(AnActionEvent e) {
    PyFile file = getPythonFile(e);
    if (file != null) {
      return file.getText();
    }

    return null;
  }
View Full Code Here

Examples of org.python.core.PyFile

  public Object getStream(String key) {
    final StreamProxy val = Streams.get(key);
    if (val != null) {
      try {
        return new PyFile(val.open(FS));
      }
      catch (IOException ex) {}
    }
    return null;
  }
View Full Code Here

Examples of org.python.core.PyFile

    } else {
      try {
      File fileArg = (File) arg;
      InputStream fileStream = fileArg.toURL().openStream();
      interp.set(argName,
          new PyFile(fileStream));
      } catch (IOException e) {
        logger.log(LogService.LOG_ERROR, "Problem opening file" +
            " provided as an argument to jython script.", e);
        e.printStackTrace();
     
View Full Code Here

Examples of org.python.core.PyFile

        }
    }

    private static PyObject newFile(File file) {
        try {
            return new PyFile(new FileInputStream(file));
        } catch (IOException ioe) {
            throw Py.IOError(ioe);
        }
    }
View Full Code Here

Examples of org.python.core.PyFile

    }

    public static PyObject load_source(String modname, String filename) {
        PyObject mod = Py.None;
        //XXX: bufsize is ignored in PyFile now, but look 3rd arg if this ever changes.
        PyFile file = new PyFile(filename, "r", 1024);
        Object o = file.__tojava__(InputStream.class);
        if (o == Py.NoConversion) {
            throw Py.TypeError("must be a file-like object");
        }
        try {
            mod = org.python.core.imp.createFromSource(modname.intern(), FileUtil.readBytes((InputStream) o),
View Full Code Here

Examples of org.python.core.PyFile

                       throw Py.IOError(e);
                   }
                   try {
                       if (PosixModule.getPOSIX().isatty(file.getFD())) {
                           opts.interactive = true;
                           interp.interact(null, new PyFile(file));
                           return;
                       } else {
                           interp.execfile(file, opts.filename);
                       }
                   } finally {
View Full Code Here

Examples of org.python.core.PyFile

     *
     * @param inStream
     *            InputStream to use as input stream
     */
    public void setIn(java.io.InputStream inStream) {
        setIn(new PyFile(inStream));
    }
View Full Code Here

Examples of org.python.core.PyFile

     *
     * @param outStream
     *            OutputStream to use as output stream
     */
    public void setOut(java.io.OutputStream outStream) {
        setOut(new PyFile(outStream));
    }
View Full Code Here

Examples of org.python.core.PyFile

    public void setErr(java.io.Writer outStream) {
        setErr(new PyFileWriter(outStream));
    }

    public void setErr(java.io.OutputStream outStream) {
        setErr(new PyFile(outStream));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.