Angelo Gladding
lahacker.net

dlv5vbq7lzlthol5 4b942a3185b37d00

angelo@lahacker.net

South Pasadena, California, United States currently feels like 84.91°F

Home CodekvCommits

Bringing all to date

by Angelo Gladding 09CEF88F29CC1A44

Changed Files

--- a/kv.py

+++ b/kv.py

         return key in self.cursor  -def db(prefix: str=None, delimiter=":", *schemas, **patterns) -> Database:+def db(prefix: str = None, delimiter=":", *schemas, **patterns) -> Database:     """     return a connection to a `redis` database 
      def keys(self):         """"""-        return self.db.keys()+        return [k[len(self.db_prefix)+1:].decode() for k in self.db.keys()+                if k.startswith(self.db_prefix.encode("utf-8"))]      def random_key(self):         """"""
             if match:                 break         else:-            raise RuntimeError("unknown schema for `{}`".format(template))+            raise KeyError("unknown schema for `{}`".format(template))         return key, key_type      def __getitem__(self, key_template):
         self.db.delete(key)      def __contains__(self, key_template):-        key = self._gen_key(key_template)[0]+        try:+            key = self._gen_key(key_template)[0]+        except KeyError:+            key = key_template         return self.db.exists(key)      def __getattr__(self, name):
      def ttl(self):         """get the time to live for a key"""-        return self.ttl(self.key)+        return self.db.ttl(self.key)      def pttl(self):-        return self.pttl(self.key)+        return self.db.pttl(self.key)      def __delete__(self):  # XXX ?         self.delete()
         """         return self.db.append(self.key, value) -    def decr(self, decrement: Number=1) -> Number:+    def decr(self, decrement: Number = 1) -> Number:         """         decrement the integer value of a key by the given number 
         # stripped_bytes = _bytes[2:-1]         # return bytes(stripped_bytes, "utf-8") -    def incr(self, increment: Number=1) -> Number:+    def incr(self, increment: Number = 1) -> Number:         """         increment the integer value of a key by the given number