Analyzes a directory of Python files, collecting and inferring type information as it parses all the files.
Inheritance: Analyzer
示例#1
0
 public AnalyzerTests()
 {
     this.fs      = new Pytocs.TypeInference.FakeFileSystem();
     this.logger  = new FakeLogger();
     this.options = new Dictionary <string, object>();
     this.nl      = Environment.NewLine;
     this.an      = new AnalyzerImpl(fs, logger, options, DateTime.Now);
 }
示例#2
0
 public void Setup()
 {
     this.fs = new Pytocs.TypeInference.FakeFileSystem();
     this.logger = new FakeLogger();
     this.options = new Dictionary<string, object>();
     this.nl = Environment.NewLine;
     this.an = new AnalyzerImpl(fs, logger, options, DateTime.Now);
 }
示例#3
0
        static void Main(string[] args)
        {
            var fs     = new FileSystem();
            var logger = new ConsoleLogger();

            if (args.Length == 0)
            {
                var xlator = new Translator("", "module_name", fs, logger);
                xlator.Translate("-", Console.In, Console.Out);
                Console.Out.Flush();
                return;
            }

            if (args[0].ToLower() == "-d")
            {
                //             org.yinwang.pysonar.demos.Demo.DemoMain(args);
                return;
            }

            if (args[0].ToLower() == "-r")
            {
#if READY_FOR_TYPES
                var typeAnalysis = new Pytocs.TypeInference.AnalyzerImpl(fs, logger, new Dictionary <string, object>(), DateTime.Now);
                typeAnalysis.Analyze(".");
                TranslateModules(typeAnalysis);
#else
                var walker = new DirectoryWalker("*.py");
                walker.Enumerate();
#endif
            }
            else
            {
                foreach (var fileName in args)
                {
                    var xlator = new Translator(
                        "",
                        Path.GetFileNameWithoutExtension(fileName),
                        new FileSystem(),
                        new ConsoleLogger());
                    xlator.TranslateFile(fileName, fileName + ".cs");
                }
            }
        }
示例#4
0
文件: Program.cs 项目: uxmal/pytocs
        static void Main(string[] args)
        {
            var fs = new FileSystem();
            var logger = new ConsoleLogger();
            if (args.Length == 0)
            {
                var xlator = new Translator("", "module_name", fs, logger);
                xlator.Translate("-", Console.In, Console.Out);
                Console.Out.Flush();
                return;
            }

            if (args[0].ToLower() == "-d")
            {
               //             org.yinwang.pysonar.demos.Demo.DemoMain(args);
                return;
            }

            if (args[0].ToLower() == "-r")
            {
            #if READY_FOR_TYPES
                var typeAnalysis = new Pytocs.TypeInference.AnalyzerImpl(fs, logger, new Dictionary<string, object>(), DateTime.Now);
                typeAnalysis.Analyze(".");
                TranslateModules(typeAnalysis);
            #else
                var walker = new DirectoryWalker("*.py");
                walker.Enumerate();
            #endif
            }
            else
            {
                foreach (var fileName in args)
                {
                    var xlator = new Translator(
                        "",
                        Path.GetFileNameWithoutExtension(fileName),
                        new FileSystem(),
                        new ConsoleLogger());
                    xlator.TranslateFile(fileName, fileName + ".cs");
                }
            }
        }
示例#5
0
文件: Builtins.cs 项目: uxmal/pytocs
 public Builtins(AnalyzerImpl analyzer)
 {
     this.analyzer = analyzer;
     buildTypes();
 }
示例#6
0
 public DataTypeFactory(AnalyzerImpl analyzer)
 {
     this.analyzer = analyzer;
 }