Kamaropoulos / COVID19Py

A tiny Python package for easy access to up-to-date Coronavirus (COVID-19, SARS-CoV-2) cases data.
https://pypi.org/project/COVID19Py/
GNU General Public License v3.0
84 stars 57 forks source link

Singleton #126

Closed kevinn03 closed 3 years ago

kevinn03 commented 3 years ago

What does this implement?

Implemented the Singleton design pattern to the COVID19PY application. Introduced a private constructor and a get instance method to ensure only one instance of Covid19Py is allowed.

Create an instance example previous way: covid19 = COVID19Py.COVID19()

new way: covid19 = COVID19Py.COVID19.getInstance()

implemented setter methods for data source and url instead of passing arguments through the constructor