Code Monkey home page Code Monkey logo

mamba's Introduction

Mamba (tripsta python lib)

Contents

  • Application Configuration
  • SoapClient for twisted

Local development

pip install -e <path-to-mamba-root>

Provided classes

mamba.application.BasicApplication

BasicApplication is a class that can handle ini reading and bootstrapping of resources in a lazy way

example

from __future__ import print_function, absolute_import, division
from mamba.application import BasicApplication

app = BasicApplication(application_env='test', ini_path='.', doc_root='.')

print(app.config)

class MyApp(BasicApplication):

    def init__MySQL(self):
        # do config
        return mysql

    init__mycallable = MyCallable()

methods that return deferreds always return deferreds

from twisted.internet import defer, reactor, task
from mamba.application import BasicApplication

class TestDeferredModel(object):
    def __init__(self):
        self.time = time()


class ApplicationWithLazyDeferreds(BasicApplication):

    def init__my_deferred(self):
        def _call_fn():
            return "hello"
        return task.deferLater(reactor, 0, _call_fn)

    def init__a_deferred_model(self):
        def _create_object():
            return TestDeferredModel()
        return task.deferLater(reactor, 0, _create_object)


# using with twisted.internet.defer.inlineCallbacks:
@defer.inlineCallbacks
def app_with_deferreds():
    app = ApplicationWithLazyDeferreds()
    v = yield app.my_deferred
    v2 = yield app.a_deferred_model

mamba's People

Contributors

asotiropoulos avatar cboursinos avatar dbaltas avatar georgeyord avatar mylk avatar pgk avatar tefra avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

pgk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.