P2PySonar2demo_project/main.pyView source
main.pyStatic analysis
Application entry point and cross-module calls.9 definitions34 references
   1 """Entry point for the PySonar2 type-inference demo."""
   2
   3 from pysonar_demo import PredictionEngine, SymbolTools, build_command_registry
   4 from pysonar_demo import classify_market, visible_market_names
   5
   6
   7 def run_demo():
   8     app = PredictionEngine("Prediction Lab")
   9     markets = [
  10         {
  11             "question": "Will Python remain a widely used programming language?",
  12             "yes_price": 0.72,
  13             "volume": 125000,
  14         },
  15         {
  16             "question": "Will a static analyzer find this reference?",
  17             "yes_price": 0.91,
  18             "volume": 42000,
  19         },
  20         {
  21             "question": "Will type inference improve developer tools?",
  22             "yes_price": 0.64,
  23             "volume": 88000,
  24         },
  25     ]
  26
  27     report = app.build_report(markets)
  28     print(report.title)
  29     for prediction in report.predictions:
  30         print(prediction.summary())
  31
  32     commands = build_command_registry()
  33     print(commands["inspect"].run(SymbolTools.normalize_symbol("market-score")))
  34     print(classify_market(report.strongest().market, threshold=0.6))
  35     print(visible_market_names([prediction.market for prediction in report.predictions]))
  36     return report
  37
  38
  39 REPORT = run_demo()