How to use the vine.Vine function in vine

To help you get started, we’ve selected a few vine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github starlock / vino / app.py View on Github external
@json_endpoint
def api_tag(tag, page):
    return v.tag(tag, page=page)

@application.route('/')
def show_popular():
    return flask.render_template('tag.html', popular=True)

@application.route('/')
def show_tag(tag):
    return flask.render_template('tag.html', tag=tag)


if __name__ == '__main__':
    # The Vine API
    v = vine.Vine()
    v.login(os.environ["VINO_USER"], os.environ["VINO_PASSWORD"])

    # Memcached if available
    if "MEMCACHE_SERVERS" in os.environ:
        import pylibmc
        mc = pylibmc.Client(
            servers=[os.environ.get("MEMCACHE_SERVERS")],
            username=os.environ.get("MEMCACHE_USERNAME"),
            password=os.environ.get("MEMCACHE_PASSWORD"),
            binary=True)
    else:
        class MemcacheDummy(object):
            def get(self, *args):
                return None

            def set(self, *args, **kwargs):
github pyland / pyland / game / objects / vine / poison_vine / poison_vine.py View on Github external
eg. We could be able to write:
"""
#__ import_object  game_object/GameObject
"""
The game code, at runtime, could recognise the "#__"
and replace it with:
"""
import sys
sys.path.insert(1, os.path.dirname(os.path.realpath(__file__)) + '/..')
from vine import Vine
"""
As the GameObject is in the base objects folder.
"""


class PoisonVine(Vine):
    """ The poison vine is a special kind of vine that can kill the player

    """

    def _passive_grow(self, callback = lambda: None):
        def un_solidify():
            self.set_solidity(False)
            self.get_engine().add_event(callback)
        super()._passive_grow(callback = un_solidify)

    def player_action(self, player_object):#if not self.__visible:
        if not self.is_visible():
            return
        else:
            player_object.set_busy(True, callback = lambda: self.get_engine().show_dialogue("These vines look poisonous, better not touch them.", callback = lambda: player_object.set_busy(False)))