xbom icon indicating copy to clipboard operation
xbom copied to clipboard

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

Open KunalSin9h opened this issue 5 months ago • 0 comments

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.

KunalSin9h avatar Aug 11 '25 17:08 KunalSin9h