__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """Rope object analysis and inference package
  2. Rope makes some simplifying assumptions about a python program. It
  3. assumes that a program only performs assignments and function calls.
  4. Tracking assignments is simple and `PyName` objects handle that. The
  5. main problem is function calls. Rope uses these two approaches for
  6. obtaining call information:
  7. * Static object analysis: `rope.base.pycore.PyCore.analyze_module()`
  8. It can analyze modules to obtain information about functions. This
  9. is done by analyzing function calls in a module or scope. Currently
  10. SOA analyzes the scopes that are changed while saving or when the
  11. user asks to analyze a module. That is mainly because static
  12. analysis is time-consuming.
  13. * Dynamic object analysis: `rope.base.pycore.PyCore.run_module()`
  14. When you run a module or your testsuite, when DOA is enabled, it
  15. collects information about parameters passed to and objects returned
  16. from functions. The main problem with this approach is that it is
  17. quite slow; Not when looking up the information but when collecting
  18. them.
  19. An instance of `rope.base.oi.objectinfo.ObjectInfoManager` can be used
  20. for accessing these information. It saves the data in a
  21. `rope.base.oi.objectdb.ObjectDB` internally.
  22. Now if our objectdb does not know anything about a function and we
  23. need the value returned by it, static object inference, SOI, comes
  24. into play. It analyzes function body and tries to infer the object
  25. that is returned from it (we usually need the returned value for the
  26. given parameter objects).
  27. Rope might collect and store information for other `PyName`\s, too.
  28. For instance rope stores the object builtin containers hold.
  29. """