Pylint - How to Fix ID: Possibly Non-Member Errors?

I am new to pylint. I ran the following through pylint and got an error when I try to iterate through a dictionary:

"ID:maybe-no-member Instance of 'bool' has no 'iteritems' member (but some types could not be 
 inferred)"

This is a Flask application, and I am passing a json-encoded dictionary through AJAX to '/ my_endpoint /'. Then I need to iterate over this dictionary and do some things.

@app.route('/my_endpoint/')
def my_endpoint():
    """My Description"""
    try:
        my_params = json.loads(request.args.get('names'))
    except TypeError:
        my_params = None

    if my_params is not None:
        for key,value in my_params.iteritems(): # error occurs here
            ...

Attempting google errors does not lead to any descriptions of what the error means or any solutions. Thank!

+4
source share
1 answer

( ). , json.loads bool, "false". bool iteritems.

, , , , bool. , , .

isinstance(my_params, dict) ?

+3

Source: https://habr.com/ru/post/1534166/


All Articles