Пример #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 PythonModule /*!*/ 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));
        }