azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

[QA] investigate why pylance shows linting error for get_answers

Open kristapratico opened this issue 3 years ago • 2 comments

image

kristapratico avatar Aug 04 '22 17:08 kristapratico

Label prediction was below confidence level 0.6 for Model:ServiceLabels: 'Compute:0.13728407,Storage:0.07206131,EngSys:0.06978722'

azure-sdk avatar Aug 04 '22 17:08 azure-sdk

This may be solved by using the autorest postprocessing script: https://github.com/Azure/autorest.python/blob/autorestv3/docs/customizations.md#postprocessing

This regenerates the imports in the init: https://github.com/Azure/autorest.python/blob/autorestv3/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/init.py

kristapratico avatar Aug 05 '22 23:08 kristapratico

Hello, @kristapratico!

Shouldn't a simple change to the argument name be enough? short_answer_options -> options I made a https://github.com/Azure/azure-sdk-for-python/pull/25833 with this change. May you please check it out?

Thank you!

wonhyeongseo avatar Aug 24 '22 08:08 wonhyeongseo

Hey @wonhyeongseo thanks for taking a look at this issue. short_answer_options is the correct name for this keyword argument. We can't change the name to options because 1) this is a breaking change for our customers and 2) get_answers already takes a positional argument called options which accepts an AnswersOptions type. That being said, the error is arising from a naming clash in the generated code vs the patched code. To fix this, we will need to regenerate the code using the post-processing script mentioned in https://github.com/Azure/azure-sdk-for-python/issues/25557#issuecomment-1207091007. Let me know if you're up for trying that script, happy to help.

kristapratico avatar Aug 24 '22 22:08 kristapratico

Hello @kristapratico! Thank you for your guidance. I tried to edit the _patch.py to no avail. I stumbled upon this thread in pylint. It seems the problem came up 22 days ago. Can it be a pylint bug?

wonhyeongseo avatar Aug 26 '22 07:08 wonhyeongseo

Hey @wonhyeongseo I think the post-processing script edits the __init__ file, not the _patch.py. Can you elaborate on what problem you ran into?

kristapratico avatar Aug 26 '22 16:08 kristapratico