Fak3 / getinstance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

pip install getinstance

Usage

from getinstance import InstanceManager

class Country:
    instances = InstanceManager()
    
    def __init__(self, name):
        self.name = name
        
    def hello(self, username):
        print(f'hello, {username} from {self.name}')
            
au = Country('Australia')
ru = Country('Russia')

print(list(Country.instances.all()))
print(Country.instances.get(name='Australia')) 
Country.instances.filter(name='Russia').hello(username='Alice')

About


Languages

Language:Python 96.1%Language:Shell 3.9%