Skip to content

Initialization from dictionary does not provide code completion #50

@chrgraham

Description

@chrgraham

Python 3.6.5
dotmap 1.3.8
Pycharm Community 2019.1.1

I was hoping to use dotmap to provide dot notation code completion to some existing dictionaries. However, when initialized from an existing dictionary it does not seem to provide the code completion suggestions like it should.

Note that functionally everything works, you just have to already know what the keys are since the code completion fails.

from dotmap import DotMap

d1 = DotMap()
d1.dog = 'pug'
d1.cat = 'tabby'
print(d1)
# Start typing d1. and you get all of the existing keys suggested as results, as expected.
print(d1.dog)
print(d1.cat)

d2 = {'first': 'Carl', 'last': 'Smith'}
d2 = DotMap(d2)
print(d2)
# Start typing d2.    and none of the keys are suggested.
# However, if you know the key names and manually type them they function.
print(d2.first)
print(d2.last)

Screen Shot 2019-05-01 at 6 25 36 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions