codeforboston / home-energy-analysis-tool

https://www.codeforboston.org/projects/
MIT License
12 stars 31 forks source link

Refactor - combine init and calculate #276

Open ethanstrominger opened 1 week ago

ethanstrominger commented 1 week ago
home=Home(args)   # does some calculations
home.calculate() # does some calculations

to

home=Home.calculate(args)

Here is code for the beginning of Home.calculate:

    @classmethod
    def calculate(cls, *args):
        # Create an instance directly using __new__
        instance = cls.__new__(cls)
        -- code from __init__
       -- code from calculate