Import NumPy on PyCharm

Go to ctrl-alt-s click “project:projet name” click project interperter double click pip search numpy from the top bar click on numpy click install package button if it doesnt work this can help you: https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

How to write a custom JSON decoder for a complex object?

The encoder/decoder example you reference (here) could be easily extended to allow different types of objects in the JSON input/output. However, if you just want a simple decoder to match your encoder (only having Edge objects encoded in your JSON file), use this decoder: class EdgeDecoder(json.JSONDecoder): def __init__(self, *args, **kwargs): json.JSONDecoder.__init__(self, object_hook=self.object_hook, *args, **kwargs) def … Read more

How do I put docstrings on Enums?

For many IDE’s now in 2022, the following will populate intellisense: class MyEnum(Enum): “”” MyEnum purpose and general doc string “”” VALUE = “Value” “”” This is the Value selection. Use this for Values “”” BUILD = “Build” “”” This is the Build selection. Use this for Buildings “”” Example in VSCode:

Adding python logging to FastApi endpoints, hosted on docker doesn’t display API Endpoints logs

Inspired by JPG’s answer, but using a pydantic model looked cleaner. You might want to expose more variables. This config worked good for me. from pydantic import BaseModel class LogConfig(BaseModel): “””Logging configuration to be set for the server””” LOGGER_NAME: str = “mycoolapp” LOG_FORMAT: str = “%(levelprefix)s | %(asctime)s | %(message)s” LOG_LEVEL: str = “DEBUG” # … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)