Metadata-Version: 2.1
Name: BusyBox
Version: 0.7.0
Summary: Service Inject For MVC
Home-page: https://github.com/AngelovLee/BusyBox
Author: Jansen Leo
Author-email: 2835347017@qq.com
Maintainer: Jansen Leo
Maintainer-email: 2835347017@qq.com
License: MIT License
Description: > 示例一:
        - 单实例化
        ```python
        from BusyBox.ServiceBox import Box
        
        class AppleService(object):
        
            def name(self):
                return 'test'
        
        if __name__ == '__main__':
            box = Box()
            box.inject(AppleService)
            box.apple_service.name()
        ```
        > 示例二:
        - 带参 多实例化
        ```python
        from BusyBox.ServiceBox import Box
        
        class TestService(object):
        
            def __init__(self, params1):
                self.params1 = params1
        
            def handle(self):
                return self.params1
        
        
        class RestService(object):
        
            def __init__(self, params1):
                self.params1 = params1
        
            def handle(self):
                return self.params1
        
        if __name__ == '__main__':
            box = Box()
            box.inject(TestService, RestService, payload=dict(params1=1))
            box.rest_service.handle()
            box.test_service.handle()
        ```
        > 示例三:
        - 类命名中带实例
        ```python
        from BusyBox.ServiceBox import Box
        
        class Bus1Service(object):
        
            def name(self):
                return 'test'
        
        if __name__ == '__main__':
            box = Box()
            box.inject(Bus1Service)
            box.bus1_service.name()
        ```
        > 示例四:
        - 类命名中带实例
        ```python
        from BusyBox.ServiceBox import Box
        
        box = Box()
        
        @box.depend()
        class CowService(object):
        
            @staticmethod
            def name():
                return 'test'
        
        if __name__ == '__main__':
            box = Box()
            box.inject(CowService)
            box.cow_service.name()
        ```
        > 示例五:
        - __init__方法带参实例
        ```python
        from BusyBox.ServiceBox import Box
        
        box = Box()
        
        @box.depend()
        class EasyService(object):
        
            def __init__(self, params1, *args, **kwargs):
                self.args = args
                self.kwargs = kwargs
                self.params1 = params1
        
            def name(self):
                return self.params1, self.args, self.kwargs
        
        if __name__ == '__main__':
            box = Box()
            box.invoke('easy_service', 1, 2, 3, a=4, b=5)
            box.easy_service.name()
        ```
Keywords: inject,depend,invoke,BusyBox
Platform: linux
Platform: windows
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Description-Content-Type: text/markdown
