Add Binary Similarity Python Bindings - #8385
Conversation
| return cls() | ||
|
|
||
| @classmethod | ||
| def for_node(cls, node_id: int) -> 'SimilaritySessionCompletionQuery': |
There was a problem hiding this comment.
Type hint should be a defined type rather than an int
| class SimilarityEntityRef: | ||
| """Identifies an entity within a session node.""" | ||
|
|
||
| node_id: int |
There was a problem hiding this comment.
use a defined type instead of an int
| class SimilarityView: | ||
| """A graph or linear view produced for a similarity result.""" | ||
|
|
||
| group: str |
There was a problem hiding this comment.
Use a defined type instead of str
| class SimilarityRenderContext: | ||
| """Holds views used to display a similarity result.""" | ||
|
|
||
| def __init__(self, handle=None): |
There was a problem hiding this comment.
I know were inconsistent here but define a type hint for the handle. Its super helpful and can help avoid crashes
| raise KeyError(f"'{value}' is not a valid similarity session resolver type") | ||
| return CoreSimilaritySessionResolverType(handle=resolver_type) | ||
|
|
||
| def __contains__(cls: '_SimilaritySessionResolverTypeMetaClass', name: object) -> bool: |
| except KeyError: | ||
| return False | ||
|
|
||
| def get( |
There was a problem hiding this comment.
should this first param be self as its not a classmethod
| class DiffRenderer: | ||
| """Renders functions with similarity range annotations.""" | ||
|
|
||
| def __init__(self, handle=None): |
|
Did a quick review, nothing stood out to me as wrong. All of my comments are non-blocking nits:
I didn't check the core PR and you may have already done this but you should add these objects to the ActiveObjectCounter if you haven't already and add a test which validate that we're not leaking these objects. Actually one that confuses me and I don't know if its blocking or not SimilarityProviderType.create returns Optional['SimilarityProvider']:but |
Adds the python bindings we depend on for user examples and python core unit tests
Depends on: