2

As an example, in this sample, the last attribute (dict_criteria) cannot be identified by Visual Code. Auto_completion doesn't work. BUT the code works pretty well.

1 import judilibre_connexion as j_co
2 import judilibre_url as j_url
3   
4 co = j_co.ConnexionJudi()
5 rec3 = j_url.SearchURL("licenciement")
6 co.send_request(rec3)
7 print(co.dict_answers[2].dict_criteria)

I create an object from ConnexionJudi class. Using the method send_request in line 6 adds in the instance attribute named dict_answer an object from another class (j_ans) and another module which I didn't import in this file. If I import it, the linter says that the import is useless.

current file -> co object -> co instance attribute (dict) -> value from key [2] (object from another class) -> attribute of this object.

Screenshot from the tool, the attribute is white instead of blue (it hasn't been identified by vs code):

enter image description here

1
  • 1
    This seems to be a bug. You can open a case in GitHub and provide code that can reproduce the problem at the same time Commented Jul 26, 2022 at 1:44

1 Answer 1

1

In order for Intellisense to know the attributes of a dictionary (or a list), you need to hint the type. E.g. my_dict: [str, list] = {}. Pay attention to the "append" method here: enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.