ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 323 forks source link

Creational design pattern - singleton pattern to country.py #431

Closed NoBitLeft closed 3 years ago

NoBitLeft commented 3 years ago

The country.py was imported many different helpers, so I used the singleton pattern to make the class only have one single instance, which makes the country only have one country object. This ensures that a class has at most one instance and provides a global access to that instance.