Example #1
0
        public void Generate()
        {
            var classes = new List <PyClass>();

            foreach (var filename in Directory.GetFiles(genTypes.Dirs.GetPythonRustDir(), "*.rs"))
            {
                var parser = new PyClassParser(filename);
                classes.AddRange(parser.ParseFile());
            }
            if (classes.Count == 0)
            {
                throw new InvalidOperationException();
            }

            WritePyi(classes);
        }
Example #2
0
        public void Generate()
        {
            var classes = new List <PyClass>();

            foreach (var filename in Directory.GetFiles(genTypes.Dirs.GetPythonRustDir(), "*.rs"))
            {
                // mypy fix: we can't use Python enums (too slow). mypy complains because our enums are
                // ints, so we create dummy classes in lib.rs that the enum *.py files reference.
                // Ignore all of them.
                if (Path.GetFileName(filename) == "lib.rs")
                {
                    continue;
                }
                var parser = new PyClassParser(filename);
                classes.AddRange(parser.ParseFile());
            }
            if (classes.Count == 0)
            {
                throw new InvalidOperationException();
            }

            WritePyi(classes);
        }