# Path: wire/utils.py
# def autoinc(redis, key):
#     key = "_incs:%s" % key
#     if not redis.exists(key):
#         redis.set(key, 0)
# 
#     return redis.incr(key)
# 
# Path: wire/utils.py
# class Hasher:
#     def __init__(self, strength=16):
#         self._strength = strength
# 
#     def hash(self, password, salt=False, encode=True):
#         if salt is False:
#             salt = urandom(32)
#         if encode:
#             salt = b64encode(salt)
#         return "$w$%s$%s$%s" % (
#             self._strength,
#             salt,
#             self._hash_multi(salt + password, self._strength)
#         )
# 
#     def check(self, attempt, h):
#         bits = h.split("$")
#         try:
#             if self._hash_multi(bits[3] + attempt, float(bits[2])) != bits[4]:
#                 raise HashMismatch()
#         except IndexError:
#             raise HashMismatch()
# 
#     def _hash_multi(self, string, strength):
#         for i in range(int(math.pow(2, strength))):
#             string = b2a_hex(whirlpool.hash(string))
#         return string


import copy
import json
import re
from datetime import datetime, time, date
from wire.utils import autoinc
from wire.utils import Hasher
        events = []
        for key in keys:
            e = Event(redis=self.redis, user=self.user)
            e.load(key)
            events.append(e)
        return events, count

    def update(self, data):
        form_fields = [
            'name',
            'date',
            'time',
            'location',
            'meeting_place',
            'description',
        ]
        for field in form_fields:
            try:
                self.data[field] = data[field]
            except KeyError:
                self.data[field] = ""

    def save(self):
        r = self.redis
        self._validate()

        if not self.key:
            self.data['creator'] = self.user.username
            self.key = autoinc(self.redis, 'event')
            r.lpush('_list:events', self.key)

# Path: wire/utils.py
# def autoinc(redis, key):
#     key = "_incs:%s" % key
#     if not redis.exists(key):
#         redis.set(key, 0)
# 
#     return redis.incr(key)
# 
# Path: wire/utils.py
# class Hasher:
#     def __init__(self, strength=16):
#         self._strength = strength
# 
#     def hash(self, password, salt=False, encode=True):
#         if salt is False:
#             salt = urandom(32)
#         if encode:
#             salt = b64encode(salt)
#         return "$w$%s$%s$%s" % (
#             self._strength,
#             salt,
#             self._hash_multi(salt + password, self._strength)
#         )
# 
#     def check(self, attempt, h):
#         bits = h.split("$")
#         try:
#             if self._hash_multi(bits[3] + attempt, float(bits[2])) != bits[4]:
#                 raise HashMismatch()
#         except IndexError:
#             raise HashMismatch()
# 
#     def _hash_multi(self, string, strength):
#         for i in range(int(math.pow(2, strength))):
#             string = b2a_hex(whirlpool.hash(string))
#         return string


# Path: wire/models.py
import copy
import json
import re
from datetime import datetime, time, date
from wire.utils import autoinc
from wire.utils import Hasher

        events = []
        for key in keys:
            e = Event(redis=self.redis, user=self.user)
            e.load(key)
            events.append(e)
        return events, count

    def update(self, data):
        form_fields = [
            'name',
            'date',
            'time',
            'location',
            'meeting_place',
            'description',
        ]
        for field in form_fields:
            try:
                self.data[field] = data[field]
            except KeyError:
                self.data[field] = ""

    def save(self):
        r = self.redis
        self._validate()

        if not self.key:
            self.data['creator'] = self.user.username
            self.key = autoinc(self.redis, 'event')
            r.lpush('_list:events', self.key)

            r.lpush('user:%s:events' % self.user.key, self.key)