Пример #1
0
        private static IEnumerator<byte> FileEnumerator(PythonFile/*!*/ file) {
            for (; ; ) {
                string data = file.read(1);
                if (data.Length == 0) {
                    yield break;
                }

                yield return (byte)data[0];
            }
        }
Пример #2
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;
 }
Пример #3
0
            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);
            }