Announcing Enhanced Function Call Linkage for Python Codebase Parsing #366
JayGhiya
announced in
Announcements
Replies: 1 comment 1 reply
-
There are things like dynamic reassignments for class variables which need to be tracked. This is on my todo list. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Announcing Enhanced Function Call Linkage for Python Codebase Parsing
We’re excited to share a major enhancement in our Code Confluence project—a robust mechanism to accurately link function calls within your Python codebase! This new feature dives deep into the structure of your code, connecting procedural calls and class methods to their precise definitions, whether they’re defined in the same file or spread across your entire codebase.
What We Did
Our algorithm now intelligently processes Python files that include:
The extractor leverages Tree-sitter for fast, reliable parsing and employs a multi-layered resolution strategy to link function calls:
Local Resolution:
It first checks if a function call exists in the same procedural node. If a call is found without any object reference (i.e.,
node_name
isNone
), it’s directly marked as local.For class methods, calls made on
self
are resolved to the current class, ensuring that internal method calls are always prioritized.Cross-Class Linking:
DataProcessor.process_data()
) or an instance call (via an instantiation map), our solution updates the call’s metadata to point to the correct class.Procedural-to-Class & Class-to-Procedural Calls:
"_procedural_"
) is used in the context map to ensure that cross-references to procedural code are handled correctly.Internal Codebase & External Resolution:
Use Cases Covered
Procedural-to-Procedural Linking:
Calls within a module that refer to other functions defined in the same file are correctly identified and linked.
Class Method Self-References:
Calls on
self
inside a class are recognized as local to that class, ensuring accurate self-references.Cross-Class Communication:
When methods in one class call methods in another class within the same file, our algorithm maps these relationships precisely.
Instance Method Resolution:
Calls made on instance variables (identified via our instantiation map) are traced back to the appropriate class definitions.
Static Methods & Imported Functions:
We also support static method calls and imported function calls, leveraging the import map to generate fully qualified names for linking.
What’s Next?
We believe this feature brings our parsing and linkage capabilities to a new level of accuracy and reliability. However, we’re eager to hear your thoughts:
Please join the discussion and share your feedback, questions, or suggestions. Your input is invaluable as we continue to refine and enhance the Code Confluence experience.
Happy coding!
Beta Was this translation helpful? Give feedback.
All reactions