projectmesa / mesa

Mesa is an open-source Python library for agent-based modeling, ideal for simulating complex systems and exploring emergent behaviors.
https://mesa.readthedocs.io
Other
2.3k stars 846 forks source link

Functions Annotations in the time module create problems with automatic code completion tools such as Pycharm. #926

Open ambitious-octopus opened 3 years ago

ambitious-octopus commented 3 years ago

Describe the bug

Functions Annotations in the time module create problems with automatic code completion tools such as Pycharm. https://github.com/projectmesa/mesa/blob/2e66e9f70f9b4c58d90654ba590fc011263c483c/mesa/time.py#L85 To Reproduce

Using Pycharm with Kite and reproducing the sample code MoneyModel: When iterating between agents within the scheduler if an attribute or method of an agent is requested, Pycharm will display the "unresolved attribute reference '"method"' for class Agent" error. This is because Pycharm expects an object of the Agent class when it finds an object that inherits from the Agent class but is not an agent object (MoneyAgent). Important: The code works perfectly when running, but autocompletion does not work during editing and Pycharm display errors.

jackiekazil commented 3 years ago

I am not sure if any of the developers on this project have PyCharm/work with PyCharm. Any chance you can submit a fix for this?

ambitious-octopus commented 3 years ago

I will work on it!

jackiekazil commented 3 years ago

Great! Looking forward to the fix! Let us know if you have any questions!