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

Apply Builder pattern #92

Closed HuangHuangHuangShiqing closed 3 years ago

HuangHuangHuangShiqing commented 3 years ago

The builder pattern is applied in covid19.py, where the user can set url and data_source separately.

HuangHuangHuangShiqing commented 3 years ago

if users want to modify value of url or data_source, they don't need to create new object, they just need to use method constructURL or constructDataSource ex: obj = ObjectBuilder.ObjectBuilder() '''object covid with default url and data_source''' covid= ObjectBuilder.Director.contructWholeProduct(obj) '''change covid.data_source to nyt''' ObjectBuilder.Director.constructDataSource(obj,"nyt")