In fact, this method called Quadratic Discriminant Analysis (QDA) which in a 1-dimensional area is same as Naive Bayes classifier NBC.
Here's the implementation of a naive bayes example in google-colab notebook without using sklearn
in order to better understanding.