private static IEnumerator<byte> FileEnumerator(PythonFile/*!*/ file) { for (; ; ) { string data = file.read(1); if (data.Length == 0) { yield break; } yield return (byte)data[0]; } }
private static Scope/*!*/ LoadPythonSource(PythonContext/*!*/ context, string/*!*/ name, PythonFile/*!*/ file, string/*!*/ fileName) { SourceUnit sourceUnit = context.CreateSnippet(file.read(), String.IsNullOrEmpty(fileName) ? null : fileName, SourceCodeKind.File); return context.CompileModule(fileName, name, sourceUnit, ModuleOptions.Initialize).Scope; }
public void fromfile(PythonFile f, int n) { int bytesNeeded = n * itemsize; string bytes = f.read(bytesNeeded); if (bytes.Length < bytesNeeded) throw PythonOps.EofError("file not large enough"); fromstring(bytes); }