Skip to content

[python]: signature not matching for code having both variable and function name same. #45

@KunalSin9h

Description

@KunalSin9h

Code: From official website:

from transformers import pipeline

pipeline = pipeline(task="text-generation", model="google/gemma-2-2b")
pipeline("the secret to baking a really good cake is ")
[{'generated_text': 'the secret to baking a really good cake is 1. the right ingredients 2. the'}]

xBom signature: transformers.pipeline

Expected Behaviour: Should detect the signature
Acutal behaviour: since pipeline (the variable) = pipeline(...) (the function) call, having conflict with name (although, valid python code), our xbom is not able to match the signature.

Fix: use different variable name

from transformers import pipeline

workflow = pipeline(task="text-generation", model="google/gemma-2-2b")
workflow("the secret to baking a really good cake is ")
[{'generated_text': 'the secret to baking a really good cake is 1. the right ingredients 2. the'}]

Result: we detected the signature

Image

The issue is only with python as in Java having same name for variable and function is not possible.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions