code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
import logging
from urllib.error import URLError
from urllib.request import urlopen
from github import Github
import redis
from redis_benchmarks_specification.__common__.env import (
STREAM_KEYNAME_GH_EVENTS_COMMIT,
)
def commit_schema_to_stream(
fields: dict,
conn: redis.StrictRedis,
gh_org,
gh... | /redis_benchmarks_specification-0.1.72-py3-none-any.whl/redis_benchmarks_specification/__common__/builder_schema.py | 0.465873 | 0.203094 | builder_schema.py | pypi |
import re
from datetime import datetime, timedelta
import click
from tqdm import tqdm
def convert_scan_cursor(cursor, max_cursor):
"""
See https://engineering.q42.nl/redis-scan-cursor/
Apply mask from max_cursor and reverse bits order
"""
N = len(bin(max_cursor)) - 2
value = bin(cursor)[2:]
... | /redis_bulk_cleaner-0.1.3.tar.gz/redis_bulk_cleaner-0.1.3/redis_bulk_cleaner/redis_bulk_cleaner.py | 0.662796 | 0.202108 | redis_bulk_cleaner.py | pypi |
import os
from urllib.parse import ParseResult
from urllib.parse import parse_qs
from urllib.parse import unquote
from urllib.parse import urlparse
import redis
from redis.connection import to_bool
URL_QUERY_ARGUMENT_PARSERS = {
"db": int,
"health_check_interval": int,
"max_connections": int,
"readonl... | /redis_cli-0.1.2-py3-none-any.whl/redis_cli/client.py | 0.493164 | 0.19729 | client.py | pypi |
import sys
from typing import Dict, Any
import redis
import json
from datetime import timedelta
from logging import getLogger
from redis_client.custom_types import LogLevel
from redis_client.logger import init_logger
class Cache:
def __init__(
self,
redis_host: str = "localhost",
redis_port: int = 6379,
re... | /redis-client-1.0.1.tar.gz/redis-client-1.0.1/redis_client/client.py | 0.422505 | 0.16175 | client.py | pypi |
import time
import itertools
import hashlib
import failover
from node import Node
from exceptions import (ClusterNotHealthy, ClusterNotConsistent)
from utils import (divide, echo)
class Cluster(object):
CLUSTER_HASH_SLOTS = 16384
def __init__(self, nodes, hash_slots=CLUSTER_HASH_SLOTS,
pare... | /redis-clu-0.0.7.tar.gz/redis-clu-0.0.7/redisclu/cluster.py | 0.459076 | 0.210827 | cluster.py | pypi |
Redis Collections
=================
`redis-collections` is a Python library that provides a high-level
interface to `Redis <http://redis.io/>`_, the excellent key-value store.
Quickstart
----------
Install the library with ``pip install redis-collections``.
Import the collections from the top-level ``redis_collecti... | /redis-collections-0.12.0.tar.gz/redis-collections-0.12.0/README.rst | 0.898042 | 0.714516 | README.rst | pypi |
import abc
from decimal import Decimal
from fractions import Fraction
import pickle
import uuid
import redis
NUMERIC_TYPES = (int,) + (float, Decimal, Fraction, complex)
class RedisCollection(metaclass=abc.ABCMeta):
"""Abstract class providing backend functionality for all the other
Redis collections.
"... | /redis-collections-0.12.0.tar.gz/redis-collections-0.12.0/redis_collections/base.py | 0.829423 | 0.298006 | base.py | pypi |
from redis.client import Pipeline
from .base import RedisCollection
class SortedSetBase(RedisCollection):
def _data(self, pipe=None):
pipe = self.redis if pipe is None else pipe
if isinstance(pipe, Pipeline):
pipe.zrange(self.key, 0, -1, withscores=True)
items = pipe.execu... | /redis-collections-0.12.0.tar.gz/redis-collections-0.12.0/redis_collections/sortedsets.py | 0.910603 | 0.254972 | sortedsets.py | pypi |
import collections.abc as collections_abc
from functools import reduce
import operator
from redis.client import Pipeline
from .base import RedisCollection
class Set(RedisCollection, collections_abc.MutableSet):
"""
Collection based on the built-in Python :class:`set` type.
Items are stored in a Redis ha... | /redis-collections-0.12.0.tar.gz/redis-collections-0.12.0/redis_collections/sets.py | 0.862598 | 0.357596 | sets.py | pypi |
import itertools
from collections import abc, UserString, UserList, UserDict, deque, defaultdict
from typing import List, Dict, Set, Any, Callable
from redis.exceptions import ResponseError
from .atomic import run_as_lua
from .mixins import RedisDataMixin
from .utils import temporary_key
__all__ = ["RedisMutableSet"... | /redis-cooker-2020.12.1.tar.gz/redis-cooker-2020.12.1/redis_cooker/collections.py | 0.608478 | 0.180107 | collections.py | pypi |
from datetime import timedelta
from functools import partial, update_wrapper
from typing import Any, Callable, Optional, Union
from redis import Redis
from .cache_element import CacheDateTime, CacheElement, CacheElementSingleType
from .cacheable import (
DictCacheable,
DictCacheType,
DictStringCacheable,
... | /redis-decorators-1.0.1.tar.gz/redis-decorators-1.0.1/redis_decorators/caching.py | 0.946188 | 0.153264 | caching.py | pypi |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from datetime import datetime
from typing import Generic, Optional, TypeVar
from redis import Redis
from .cacheable import Cacheable, StringCacheable
FetchType = TypeVar('FetchType')
StoreType = TypeVar('StoreType')
class CacheElement(Generic[Fe... | /redis-decorators-1.0.1.tar.gz/redis-decorators-1.0.1/redis_decorators/cache_element.py | 0.938166 | 0.394609 | cache_element.py | pypi |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Generic, List, Optional, TypeVar
from redis import Redis
StoreType = TypeVar('StoreType')
ListCacheType = List[str]
DictCacheType = Dict[str, str]
class Cacheable(Generic[StoreType], ABC):
"""Performs caching store an... | /redis-decorators-1.0.1.tar.gz/redis-decorators-1.0.1/redis_decorators/cacheable.py | 0.932791 | 0.428532 | cacheable.py | pypi |
# Redis-dict
[](https://travis-ci.com/Attumm/redis-dict)
[](https://pepy.tech/project/redis-dict)
RedisDict is a Python library that provides a convenient and familiar interface for interacting with ... | /redis%20dict-2.1.0.tar.gz/redis dict-2.1.0/README.md | 0.53437 | 0.991522 | README.md | pypi |
import json
from typing import Any, Callable, Dict, Iterator, Set, List, Tuple, Union, Optional
from redis import StrictRedis
from contextlib import contextmanager
SENTINEL = object()
transform_type = Dict[str, Callable[[str], Any]]
pre_transform_type = Dict[str, Callable[[Any], str]]
def _transform_tuple(val: st... | /redis%20dict-2.1.0.tar.gz/redis dict-2.1.0/redis_dict.py | 0.890687 | 0.551996 | redis_dict.py | pypi |
import argparse
import os
def create_parser(description, prog=None, prefix="", host="localhost", port=6379, db=0,
channel_in=None, channel_out=None, sleep_time=0.01):
"""
Configures a command-line parser with parameters for redis.
:param description: the description that the parser outp... | /redis-docker-harness-0.0.4.tar.gz/redis-docker-harness-0.0.4/src/rdh/_argparse.py | 0.706292 | 0.159708 | _argparse.py | pypi |
import argparse
import redis
from ._argparse import get_password
class Container(object):
"""
Ancestor for containers.
"""
pass
class ParameterContainer(Container):
"""
Simple container to store parameters.
"""
def __init__(self):
self.redis = None
""" The redis con... | /redis-docker-harness-0.0.4.tar.gz/redis-docker-harness-0.0.4/src/rdh/_redis.py | 0.698535 | 0.222996 | _redis.py | pypi |
import base64 as b64
import io
import json
from typing import Dict, Tuple, Union
import aioredis
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
PASS_HASH_SALT = b''
PASS_HASH_ITERATES = 8
async def dump_to_fi... | /redis_dumper-0.1.0-py3-none-any.whl/redis_dumper/dumper.py | 0.701406 | 0.309389 | dumper.py | pypi |
import pandas as pd
import psycopg2
import functools
import redis
import threading
import time
# Creamos un cliente de Redis
redis_client = redis.Redis(host='localhost', port=6379)
# Decorador para cachear resultados de la función en Redis
def cache_function_results(function):
@functools.wraps(function)
def... | /redis_elastic-1.0.2.tar.gz/redis_elastic-1.0.2/Develop/extract.py | 0.488039 | 0.213572 | extract.py | pypi |
# swagger-client
REST API Specifications[¶](#rest-api-specifications "Permalink to this headline")
=================================================================================
Key Concepts[¶](#key-concepts "Permalink to this headline")
-----------------------------------------------------------
### Cluste... | /redis-enterprise-python-1.0.3.tar.gz/redis-enterprise-python-1.0.3/README.md | 0.494873 | 0.798619 | README.md | pypi |
from .base_entity import BaseRedisEntity
from type_utils import require_string
class RedisHashmapEntity(BaseRedisEntity):
"""
This class represents a HashMap that is stored in Redis.
The HashMap is identified by a Prefix that specifies the name of the HashMap.
A HashMap entry is identified by the Pref... | /redis_entities-1.0.8-py3-none-any.whl/redis_entities/hashmap_entity.py | 0.862018 | 0.21766 | hashmap_entity.py | pypi |
import hashlib
import json
import time
import base64
from Crypto.Cipher import AES
from ..exceptions import DecryptionException
from .mixin_base import MixinBaseClass
from type_utils import timestamp2b, b2timestamp, require_bytes
from ..exceptions import DecryptionException
class AuthenticatedEncryptionMixin(MixinBas... | /redis_entities-1.0.8-py3-none-any.whl/redis_entities/mixins/authenticated_encryption_mixin.py | 0.534855 | 0.171027 | authenticated_encryption_mixin.py | pypi |
# redis-extensions-base
Redis-extensions-base is a base collection of custom extensions for Redis-py.
## Installation
```
pip install redis-extensions-base
```
## Usage
```python
In [1]: import redis_extensions as redis
In [2]: r = redis.RedisExtensions(host='localhost', port=6379, db=0)
In [3]: r.zaddwithstamps('s... | /redis-extensions-base-4.1.6.tar.gz/redis-extensions-base-4.1.6/README.md | 0.52756 | 0.765308 | README.md | pypi |
# redis-extensions
Redis-extensions is a collection of custom extensions for Redis-py.
## Installation
```
pip install redis-extensions
```
* for `base` use `pip install redis-extensions[base]`, default is `base`
* for `vcode` use `pip install redis-extensions[vcode]`
* for `gvcode` use `pip install redis-extensions[g... | /redis-extensions-4.1.5.tar.gz/redis-extensions-4.1.5/README.md | 0.52756 | 0.741861 | README.md | pypi |
from collections import defaultdict
import re
line_re = re.compile(r"""
^(?P<timestamp>[\d\.]+)\s(\(db\s(?P<db>\d+)\)\s)?"(?P<command>\w+)"(\s"(?P<key>[^(?<!\\)"]+)(?<!\\)")?(\s(?P<args>.+))?$
""", re.VERBOSE)
class StatCounter(object):
def __init__(self, prefix_delim=':'):
self.line_count = 0
... | /redis-faina-0.1.0.tar.gz/redis-faina-0.1.0/redis_faina/__init__.py | 0.455441 | 0.198666 | __init__.py | pypi |
import time
from functools import wraps
from threading import RLock
__all__ = ("Funnel", "qps")
class Funnel(object):
"""Local funnel based on memory.
"""
def __init__(self, capacity, operations, seconds, left_quota=0, leaking_ts=None):
"""
:param capacity: <int> max capacity of funnel
... | /redis-funnel-0.0.1.tar.gz/redis-funnel-0.0.1/redis_funnel/local.py | 0.643441 | 0.287765 | local.py | pypi |
from functools import wraps
import time
import os
import redis
__all__ = ("Funnel", "qps_factory")
class Funnel(object):
"""Distributed funnel based on redis.
"""
def __init__(self, group, key, capacity, operations, seconds,
redis_host="localhost",
redis_port=6379,
... | /redis-funnel-0.0.1.tar.gz/redis-funnel-0.0.1/redis_funnel/distributed.py | 0.7413 | 0.152001 | distributed.py | pypi |
==============
redis-hashring
==============
.. image:: https://circleci.com/gh/closeio/redis-hashring.svg?style=svg&circle-token=e9b81f0e4bc9a1a0b6150522e854ca0c9b1c2881
:target: https://circleci.com/gh/closeio/redis-hashring/tree/master
*redis-hashring* is a Python library that implements a consistent hash ring
... | /redis-hashring-0.3.3.tar.gz/redis-hashring-0.3.3/README.rst | 0.889217 | 0.726583 | README.rst | pypi |
import binascii
import collections
import socket
import time
import random
import operator
import os
import select
# Amount of points on the ring. Must not be higher than 2**32 because we're
# using CRC32 to compute the checksum.
RING_SIZE = 2 ** 32
# Default amount of replicas per node
RING_REPLICAS = 16
# How ofte... | /redis-hashring-0.3.3.tar.gz/redis-hashring-0.3.3/redis_hashring/__init__.py | 0.745213 | 0.628707 | __init__.py | pypi |
import typing as t
from abc import ABC, abstractmethod
import inflection as inflection
from hot_redis import HotClient, Set
from statsd import StatsClient
__all__ = ("BaseFilter", "RedisFiltering", "RedisIndex")
def cast_to_str(lst: t.List) -> t.Set[str]:
"""
Returns a set of strings, that can be compared w... | /redis_index-0.7.0.tar.gz/redis_index-0.7.0/redis_index/redis_index.py | 0.842572 | 0.186132 | redis_index.py | pypi |
# redis-handler
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs... | /redis-job-controller-1.0.0.tar.gz/redis-job-controller-1.0.0/README.md | 0.532668 | 0.808899 | README.md | pypi |
import json
import logging
import traceback as tb
class JSONFormatter(logging.Formatter):
required_fields = '__all__'
exclude_fields = None
def __init__(self, required_fields=None, exclude_fields=None, datefmt=None):
if required_fields:
self.required_fields = required_fields
... | /redis_json_logger-0.3.0-py3-none-any.whl/redis_json_logger/formatter.py | 0.588534 | 0.271023 | formatter.py | pypi |
from typing import Tuple, List, Optional
from redis import Redis
class RedisKeyTagging(Redis):
"""
A Redis client with key tagging and invalidation by tag features.
"""
TAG_KEY_PREFIX = "tag:"
def get_tag_key(self, tag: str) -> str:
"""
Get the key for a given ``tag`` by prexing... | /redis_key_tagging-0.0.5.tar.gz/redis_key_tagging-0.0.5/redis_key_tagging/client.py | 0.927831 | 0.341747 | client.py | pypi |
from __future__ import unicode_literals
from future.builtins import zip
from limpyd import model, fields
# RelatedModel imported to let users import limpyd_extensions.related with
# all stuff existing or redefined from limpyd.contrib.related
from limpyd.contrib.related import (RelatedCollection, RelatedModel,
... | /redis-limpyd-extensions-2.1.tar.gz/redis-limpyd-extensions-2.1/limpyd_extensions/related.py | 0.55435 | 0.342847 | related.py | pypi |
from __future__ import unicode_literals
from future.builtins import object
from limpyd.contrib.related import re_identifier
from ..related import (FKStringField, FKInstanceHashField,
M2MSetField, M2MListField, M2MSortedSetField,
RelatedCollectionForString, RelatedCollecti... | /redis-limpyd-extensions-2.1.tar.gz/redis-limpyd-extensions-2.1/limpyd_extensions/dynamic/related.py | 0.781497 | 0.189296 | related.py | pypi |
from __future__ import unicode_literals
from future.builtins import object
from copy import copy
import re
from limpyd import fields as limpyd_fields
from limpyd.exceptions import ImplementationError
from .model import ModelWithDynamicFieldMixin
class DynamicFieldMixin(object):
"""
This mixin adds a main f... | /redis-limpyd-extensions-2.1.tar.gz/redis-limpyd-extensions-2.1/limpyd_extensions/dynamic/fields.py | 0.808786 | 0.313288 | fields.py | pypi |
from __future__ import unicode_literals
from future.builtins import str, bytes, object
import uuid
from logging import getLogger
log = getLogger(__name__)
def make_key(*args):
"""Create the key concatenating all args with `:`.
Parameters
----------
args : str
List of parts of the key that ... | /redis-limpyd-2.1.2.tar.gz/redis-limpyd-2.1.2/limpyd/utils.py | 0.900882 | 0.259755 | utils.py | pypi |
from __future__ import unicode_literals
from future.utils import iteritems, iterkeys
from future.utils import with_metaclass
from collections import defaultdict
from logging import getLogger
from copy import copy
import inspect
import threading
from limpyd.fields import *
from limpyd.utils import make_key
from limpy... | /redis-limpyd-2.1.2.tar.gz/redis-limpyd-2.1.2/limpyd/model.py | 0.611962 | 0.151969 | model.py | pypi |
import logging
import pickle
import json
import redis
DEFAULT_FIELDS = [
"msg", # the log message
"levelname", # the log level
"created" # the log timestamp
]
class RedisLogHandler(logging.Handler):
"""Default class for Redis log handlers.
Attributes
----------
redis :... | /redis_logs-1.2.0-py3-none-any.whl/rlh/handlers.py | 0.836955 | 0.357596 | handlers.py | pypi |
try: # pragma: no cover
from ujson import dumps as jdumps
from ujson import loads as jloads
except ImportError:
from functools import partial
from json import dumps
from json import loads as jloads
jdumps = partial(dumps, separators=(',', ':'))
import six
from collections import namedtuple
fr... | /redis-lua-2.0.8.zip/redis-lua-2.0.8/redis_lua/script.py | 0.685844 | 0.186447 | script.py | pypi |
import os
import six
from functools import partial
from .exceptions import (
CyclicDependencyError,
ScriptNotFoundError,
)
from .regions import ScriptParser
from .script import Script
def load_all_scripts(path, cache=None):
"""
Load all the LUA scripts found at the specified location.
:param pa... | /redis-lua-2.0.8.zip/redis-lua-2.0.8/redis_lua/__init__.py | 0.761184 | 0.24556 | __init__.py | pypi |
import argparse
from . import TextProcessor, CsvProcessor, JsonProcessor, TextProcessor, RedisQuery
def print_result(answer: str, verbose: bool, action: str, word: str):
if answer:
print(answer)
elif verbose:
print(f"Could not {action} '{word}'.")
def main():
parser = argparse.ArgumentPa... | /redis-mass-get-0.0.11.tar.gz/redis-mass-get-0.0.11/redis_mass_get/__main__.py | 0.541894 | 0.224066 | __main__.py | pypi |
""" slider.py - Gradually lower redis maxmemory. """
import redis
import time
import argparse
class TimeIt(object):
def __init__(self, name):
self.name = name
def __enter__(self, *args, **kwargs):
self.start_t = time.time()
def __exit__(self, *args, **kwargs):
self.end_t = time.... | /redis-memslider-0.1.2.tar.gz/redis-memslider-0.1.2/slider.py | 0.651466 | 0.249402 | slider.py | pypi |
import itertools
from datetime import datetime
from . import conf
from .base import _key, Base, BaseHour, BaseDay, BaseWeek, BaseMonth, BaseYear
from .collections import BaseSequence
from .lua import msetbit
__all__ = ['EVENT_NAMESPACE', 'EVENT_ALIASES', 'SEQUENCE_NAMESPACE',
'record_events', 'delete_temp... | /redis-moment-0.0.6.tar.gz/redis-moment-0.0.6/moment/bitevents.py | 0.57081 | 0.150309 | bitevents.py | pypi |
import time
from . import conf
from .base import (
_key, Base, MixinSerializable, BaseHour, BaseDay, BaseWeek, BaseMonth,
BaseYear
)
from .timelines import _totimerange
__all__ = ['TIME_INDEX_KEY_NAMESAPCE', 'TimeIndexedKey', 'HourIndexedKey',
'DayIndexedKey', 'WeekIndexedKey', 'MonthIndexedKey',
... | /redis-moment-0.0.6.tar.gz/redis-moment-0.0.6/moment/keys.py | 0.663996 | 0.23444 | keys.py | pypi |
import time
from . import conf
from .base import Base, BaseHour, BaseDay, BaseWeek, BaseMonth, BaseYear
from .collections import MixinSerializable
__all__ = ['TIMELINE_NAMESPACE', 'TIMELINE_ALIASES', 'Timeline',
'HourTimeline', 'DayTimeline', 'WeekTimeline',
'MonthTimeline', 'YearTimeline']
TI... | /redis-moment-0.0.6.tar.gz/redis-moment-0.0.6/moment/timelines.py | 0.581065 | 0.196229 | timelines.py | pypi |
import itertools
from datetime import datetime
from . import conf
from .collections import BaseCounter
from .base import BaseHour, BaseDay, BaseWeek, BaseMonth, BaseYear
__all__ = ['COUNTER_NAMESPACE', 'COUNTER_ALIASES', 'update_counters',
'Counter', 'HourCounter', 'DayCounter', 'WeekCounter',
'... | /redis-moment-0.0.6.tar.gz/redis-moment-0.0.6/moment/counters.py | 0.458106 | 0.170888 | counters.py | pypi |
from __future__ import unicode_literals
from redis import __version__ as redis_version
from ._version import __version__ as current_version
if not redis_version.startswith('.'.join(current_version.split('.')[:-1])):
raise Exception('Version mismatch! redis version: %s, redis-namespace version: %s' % (redis_versi... | /redis_namespace-3.0.1.1.tar.gz/redis_namespace-3.0.1.1/redis_namespace/__init__.py | 0.41561 | 0.516717 | __init__.py | pypi |
# Getting Started With Redis OM
## Introduction
This tutorial will walk you through installing Redis OM, creating your first model, and using it to save and validate data.
## Prerequisites
Redis OM requires Python version 3.7 or above and a Redis instance to connect to.
## Python
Make sure you are running **Pytho... | /redis_om-0.2.1-py3-none-any.whl/docs/getting_started.md | 0.813238 | 0.991652 | getting_started.md | pypi |
# Models and Fields
The heart of Redis OM's object mapping, validation, and querying features is a
pair of declarative models: `HashModel` and `JsonModel`. Both models work
provide roughly the same API, but they store data in Redis differently.
This page will explain how to create your Redis OM model by subclassing o... | /redis_om-0.2.1-py3-none-any.whl/docs/models.md | 0.704567 | 0.900661 | models.md | pypi |
# FastAPI Integration
## Introduction
Good news: Redis OM was specifically designed to integrate with FastAPI!
This section includes a complete example showing how to integrate Redis OM with FastAPI.
## Concepts
### Every Redis OM Model is also a Pydantic model
Every Redis OM model is also a Pydantic model, so yo... | /redis_om-0.2.1-py3-none-any.whl/docs/fastapi_integration.md | 0.772101 | 0.875521 | fastapi_integration.md | pypi |
from typing import List, Mapping
from redis_om.model.model import Expression
class LogicalOperatorForListOfExpressions(Expression):
operator: str = ""
def __init__(self, *expressions: Expression):
self.expressions = list(expressions)
@property
def query(self) -> Mapping[str, List[Expression... | /redis_om-0.2.1-py3-none-any.whl/redis_om/model/query_resolver.py | 0.856332 | 0.858303 | query_resolver.py | pypi |
from typing import List, Mapping
from aredis_om.model.model import Expression
class LogicalOperatorForListOfExpressions(Expression):
operator: str = ""
def __init__(self, *expressions: Expression):
self.expressions = list(expressions)
@property
def query(self) -> Mapping[str, List[Expressio... | /redis_om-0.2.1-py3-none-any.whl/aredis_om/model/query_resolver.py | 0.850841 | 0.866019 | query_resolver.py | pypi |
__all__ = ["RedisPal"]
import pickle
from time import time
from typing import Union
import dill
import redis
from redis_pal.exceptions import SerializationError, DeserializationError
class RedisPal(redis.Redis):
"""
RedisPal helps you store data on Redis
without worrying about serialization
stuff. Be... | /redis_pal-1.0.0-py3-none-any.whl/redis_pal/RedisPal.py | 0.821438 | 0.21103 | RedisPal.py | pypi |
import pickle
from collections import defaultdict
from copy import deepcopy
from typing import Any, DefaultDict, Dict, Optional, Tuple
from redis import Redis
from telegram.ext import BasePersistence
from telegram.utils.types import ConversationDict
class RedisPersistence(BasePersistence):
'''Using Redis to make th... | /redis-persistence-0.0.4.tar.gz/redis-persistence-0.0.4/redispersistence/persistence.py | 0.642657 | 0.214321 | persistence.py | pypi |
# redis-py
The Python interface to the Redis key-value store.
[](https://github.com/redis/redis-py/actions?query=workflow%3ACI+branch%3Amaster)
[](https://redis-... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/README.md | 0.830834 | 0.964389 | README.md | pypi |
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Any, Awaitable, Iterable, TypeVar, Union
from redis.compat import Protocol
if TYPE_CHECKING:
from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool
from redis.asyncio.connection import Encoder as AsyncEncoder
f... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/typing.py | 0.824179 | 0.2126 | typing.py | pypi |
import random
from abc import ABC, abstractmethod
class AbstractBackoff(ABC):
"""Backoff interface"""
def reset(self):
"""
Reset internal state before an operation.
`reset` is called once at the beginning of
every call to `Retry.call_with_retry`
"""
pass
@... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/backoff.py | 0.826817 | 0.322646 | backoff.py | pypi |
import base64
import datetime
import ssl
from urllib.parse import urljoin, urlparse
import cryptography.hazmat.primitives.hashes
import requests
from cryptography import hazmat, x509
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymme... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/ocsp.py | 0.630116 | 0.239105 | ocsp.py | pypi |
"Core exceptions raised by the Redis client"
class RedisError(Exception):
pass
class ConnectionError(RedisError):
pass
class TimeoutError(RedisError):
pass
class AuthenticationError(ConnectionError):
pass
class AuthorizationError(ConnectionError):
pass
class BusyLoadingError(ConnectionEr... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/exceptions.py | 0.880058 | 0.206434 | exceptions.py | pypi |
from asyncio import sleep
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Tuple, Type, TypeVar
from redis.exceptions import ConnectionError, RedisError, TimeoutError
if TYPE_CHECKING:
from redis.backoff import AbstractBackoff
T = TypeVar("T")
class Retry:
"""Retry a specific number of times af... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/asyncio/retry.py | 0.874413 | 0.24599 | retry.py | pypi |
import warnings
class SentinelCommands:
"""
A class containing the commands specific to redis sentinel. This class is
to be used as a mixin.
"""
def sentinel(self, *args):
"""Redis Sentinel's SENTINEL command."""
warnings.warn(DeprecationWarning("Use the individual sentinel_* meth... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/sentinel.py | 0.85931 | 0.45302 | sentinel.py | pypi |
from json import JSONDecoder, JSONEncoder
class RedisModuleCommands:
"""This class contains the wrapper functions to bring supported redis
modules into the command namespace.
"""
def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()):
"""Access the json namespace, providing support for ... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/redismodules.py | 0.834508 | 0.337613 | redismodules.py | pypi |
from ..helpers import nativestr
from .utils import list_to_dict
class TSInfo:
"""
Hold information and statistics on the time-series.
Can be created using ``tsinfo`` command
https://oss.redis.com/redistimeseries/commands/#tsinfo.
"""
rules = []
labels = []
sourceKey = None
chunk_c... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/timeseries/info.py | 0.740268 | 0.517571 | info.py | pypi |
from typing import Dict, List, Optional, Tuple, Union
from redis.exceptions import DataError
from redis.typing import KeyT, Number
ADD_CMD = "TS.ADD"
ALTER_CMD = "TS.ALTER"
CREATERULE_CMD = "TS.CREATERULE"
CREATE_CMD = "TS.CREATE"
DECRBY_CMD = "TS.DECRBY"
DELETERULE_CMD = "TS.DELETERULE"
DEL_CMD = "TS.DEL"
GET_CMD = ... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/timeseries/commands.py | 0.94453 | 0.326835 | commands.py | pypi |
from ..helpers import quote_string
class Node:
"""
A node within the graph.
"""
def __init__(self, node_id=None, alias=None, label=None, properties=None):
"""
Create a new node.
"""
self.id = node_id
self.alias = alias
if isinstance(label, list):
... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/graph/node.py | 0.742982 | 0.178938 | node.py | pypi |
from redis import DataError
from redis.exceptions import ResponseError
from .exceptions import VersionMismatchException
from .execution_plan import ExecutionPlan
from .query_result import AsyncQueryResult, QueryResult
PROFILE_CMD = "GRAPH.PROFILE"
RO_QUERY_CMD = "GRAPH.RO_QUERY"
QUERY_CMD = "GRAPH.QUERY"
DELETE_CMD =... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/graph/commands.py | 0.84228 | 0.240462 | commands.py | pypi |
from ..helpers import quote_string
from .node import Node
class Edge:
"""
An edge connecting two nodes.
"""
def __init__(self, src_node, relation, dest_node, edge_id=None, properties=None):
"""
Create a new edge.
"""
if src_node is None or dest_node is None:
... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/graph/edge.py | 0.727201 | 0.204302 | edge.py | pypi |
from ..helpers import quote_string, random_string, stringify_param_value
from .commands import AsyncGraphCommands, GraphCommands
from .edge import Edge # noqa
from .node import Node # noqa
from .path import Path # noqa
DB_LABELS = "DB.LABELS"
DB_RAELATIONSHIPTYPES = "DB.RELATIONSHIPTYPES"
DB_PROPERTYKEYS = "DB.PROP... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/graph/__init__.py | 0.696784 | 0.168053 | __init__.py | pypi |
from typing import List
from redis import DataError
class Field:
NUMERIC = "NUMERIC"
TEXT = "TEXT"
WEIGHT = "WEIGHT"
GEO = "GEO"
TAG = "TAG"
VECTOR = "VECTOR"
SORTABLE = "SORTABLE"
NOINDEX = "NOINDEX"
AS = "AS"
def __init__(
self,
name: str,
args: Lis... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/field.py | 0.806853 | 0.255239 | field.py | pypi |
FIELDNAME = object()
class Limit:
def __init__(self, offset=0, count=0):
self.offset = offset
self.count = count
def build_args(self):
if self.count:
return ["LIMIT", str(self.offset), str(self.count)]
else:
return []
class Reducer:
"""
Base r... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/aggregation.py | 0.936749 | 0.703791 | aggregation.py | pypi |
from enum import Enum
class IndexType(Enum):
"""Enum of the currently supported index types."""
HASH = 1
JSON = 2
class IndexDefinition:
"""IndexDefinition is used to define a index definition for automatic
indexing on Hash or Json update."""
def __init__(
self,
prefix=[],
... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/indexDefinition.py | 0.767646 | 0.175715 | indexDefinition.py | pypi |
def tags(*t):
"""
Indicate that the values should be matched to a tag field
### Parameters
- **t**: Tags to search for
"""
if not t:
raise ValueError("At least one tag must be specified")
return TagValue(*t)
def between(a, b, inclusive_min=True, inclusive_max=True):
"""
I... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/querystring.py | 0.920236 | 0.830834 | querystring.py | pypi |
from .aggregation import Reducer, SortDirection
class FieldOnlyReducer(Reducer):
def __init__(self, field):
super().__init__(field)
self._field = field
class count(Reducer):
"""
Counts the number of results in the group
"""
NAME = "COUNT"
def __init__(self):
super()... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/reducers.py | 0.89593 | 0.493775 | reducers.py | pypi |
class Query:
"""
Query is used to build complex queries that have more parameters than just
the query string. The query string is set in the constructor, and other
options have setter functions.
The setter functions return the query object, so they can be chained,
i.e. `Query("foo").verbatim().... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/query.py | 0.873066 | 0.451568 | query.py | pypi |
from ._util import to_string
from .document import Document
class Result:
"""
Represents the result of a search query, and has an array of Document
objects
"""
def __init__(
self, res, hascontent, duration=0, has_payload=False, with_scores=False
):
"""
- **snippets**: ... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/search/result.py | 0.646906 | 0.440108 | result.py | pypi |
from ..helpers import nativestr
class BFInfo(object):
capacity = None
size = None
filterNum = None
insertedNum = None
expansionRate = None
def __init__(self, args):
response = dict(zip(map(nativestr, args[::2]), args[1::2]))
self.capacity = response["Capacity"]
self.si... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/bf/info.py | 0.55929 | 0.170957 | info.py | pypi |
from deprecated import deprecated
from redis.client import NEVER_DECODE
from redis.exceptions import ModuleError
from redis.utils import HIREDIS_AVAILABLE
BF_RESERVE = "BF.RESERVE"
BF_ADD = "BF.ADD"
BF_MADD = "BF.MADD"
BF_INSERT = "BF.INSERT"
BF_EXISTS = "BF.EXISTS"
BF_MEXISTS = "BF.MEXISTS"
BF_SCANDUMP = "BF.SCANDUM... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/bf/commands.py | 0.653127 | 0.236549 | commands.py | pypi |
import os
from json import JSONDecodeError, loads
from typing import Dict, List, Optional, Union
from deprecated import deprecated
from redis.exceptions import DataError
from ._util import JsonType
from .decoders import decode_dict_keys
from .path import Path
class JSONCommands:
"""json commands."""
def a... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/json/commands.py | 0.885483 | 0.59249 | commands.py | pypi |
from json import JSONDecodeError, JSONDecoder, JSONEncoder
import redis
from ..helpers import nativestr
from .commands import JSONCommands
from .decoders import bulk_of_jsons, decode_list
class JSON(JSONCommands):
"""
Create a client for talking to json.
:param decoder:
:type json.JSONDecoder: An i... | /redis:popper-4.4.9.tar.gz/redis:popper-4.4.9/redis/commands/json/__init__.py | 0.76454 | 0.199756 | __init__.py | pypi |
from __future__ import annotations
import asyncio
import json
from datetime import timedelta
from redis.asyncio import Redis
from typing import Any, Dict, Type, Union, Tuple, Iterable, List
from typing import TypeVar, Generic
from collections.abc import Mapping, AsyncIterator
from pydantic import BaseModel
from uui... | /redis_purse-2.0.0.tar.gz/redis_purse-2.0.0/src/purse/collections.py | 0.85753 | 0.251435 | collections.py | pypi |
# python std lib
import random
# rediscluster imports
from .crc import crc16
from .exceptions import RedisClusterException
# 3rd party imports
from redis import StrictRedis
from redis._compat import b, unicode, bytes, long, basestring
from redis import ConnectionError, TimeoutError, ResponseError
class NodeManager... | /redis-py-cloud-1.3.8.zip/redis-py-cloud-1.3.8/rediscluster/nodemanager.py | 0.617513 | 0.238395 | nodemanager.py | pypi |
from socket import gethostbyaddr
from functools import wraps
# rediscluster imports
from .exceptions import (
RedisClusterException, ClusterDownError
)
# 3rd party imports
from redis._compat import basestring, nativestr
def bool_ok(response, *args, **kwargs):
"""
Borrowed from redis._compat becuase that... | /redis-py-cloud-1.3.8.zip/redis-py-cloud-1.3.8/rediscluster/utils.py | 0.747247 | 0.281288 | utils.py | pypi |
# python std lib
import random
# rediscluster imports
from .crc import crc16
from .exceptions import RedisClusterException
# 3rd party imports
from redis import StrictRedis
from redis._compat import unicode
from redis import ConnectionError
class NodeManager(object):
"""
"""
RedisClusterHashSlots = 163... | /redis-py-cluster-custom-1.3.0.tar.gz/redis-py-cluster-custom-1.3.0/rediscluster/nodemanager.py | 0.551091 | 0.178992 | nodemanager.py | pypi |
from socket import gethostbyaddr
from functools import wraps
# rediscluster imports
from .exceptions import (
RedisClusterException, ClusterDownError
)
# 3rd party imports
from redis._compat import basestring
def string_keys_to_dict(key_strings, callback):
"""
Maps each string in `key_strings` to `callb... | /redis-py-cluster-custom-1.3.0.tar.gz/redis-py-cluster-custom-1.3.0/rediscluster/utils.py | 0.735071 | 0.329055 | utils.py | pypi |
# python std lib
import random
# rediscluster imports
from .crc import crc16
from .exceptions import RedisClusterException
# 3rd party imports
from redis import StrictRedis
from redis._compat import b, unicode, bytes, long, basestring
from redis import ConnectionError
class NodeManager(object):
"""
"""
... | /redis-py-cluster-gcom-1.3.4.tar.gz/redis-py-cluster-gcom-1.3.4/rediscluster/nodemanager.py | 0.603815 | 0.23105 | nodemanager.py | pypi |
from socket import gethostbyaddr
from functools import wraps
# rediscluster imports
from .exceptions import (
RedisClusterException, ClusterDownError
)
# 3rd party imports
from redis._compat import basestring, nativestr
def bool_ok(response, *args, **kwargs):
"""
Borrowed from redis._compat becuase that... | /redis-py-cluster-gcom-1.3.4.tar.gz/redis-py-cluster-gcom-1.3.4/rediscluster/utils.py | 0.726037 | 0.326513 | utils.py | pypi |
from socket import gethostbyaddr
from functools import wraps
# rediscluster imports
from .exceptions import (
RedisClusterException, ClusterDownError
)
# 3rd party imports
from redis._compat import basestring, nativestr
def bool_ok(response, *args, **kwargs):
"""
Borrowed from redis._compat becuase that... | /redis-py-cluster-meiqia-1.3.2a0.tar.gz/redis-py-cluster-meiqia-1.3.2a0/rediscluster/utils.py | 0.743168 | 0.334141 | utils.py | pypi |
from socket import gethostbyaddr
from functools import wraps
# rediscluster imports
from .exceptions import (
RedisClusterException, ClusterDownError
)
# 3rd party imports
from redis._compat import basestring, nativestr
def bool_ok(response, *args, **kwargs):
"""
Borrowed from redis._compat becuase that... | /redis-py-cluster-patched-2.1.0.999.25.tar.gz/redis-py-cluster-patched-2.1.0.999.25/rediscluster/utils.py | 0.749454 | 0.358353 | utils.py | pypi |
from socket import gethostbyaddr
# rediscluster imports
from .exceptions import RedisClusterException
# 3rd party imports
from redis._compat import basestring, nativestr
def bool_ok(response, *args, **kwargs):
"""
Borrowed from redis._compat becuase that method to not support extra arguments
when used i... | /redis-py-cluster-2.1.3.tar.gz/redis-py-cluster-2.1.3/rediscluster/utils.py | 0.753194 | 0.395835 | utils.py | pypi |
try:
import ketama
except ImportError:
raise ImportError('libketama is not installed.')
import redis
import re
import logging
class Router(object):
SERVERS = {}
METHOD_BLACKLIST = [
'smove', # it's hard to shard with atomic approach.
'move',
]
def __init__(self, ketama_... | /redis-router-0.2.tar.gz/redis-router-0.2/redis_router/router.py | 0.481454 | 0.160595 | router.py | pypi |
from __future__ import absolute_import
import uuid
import json
from schematics import models, types
from redis_schematics.exceptions import (
NotFound,
MultipleFound,
StrictPerformanceException,
)
from redis_schematics.utils import group_filters_by_suffix, match_filters
class BaseRedisMixin(object):
... | /redis_schematics-0.3.1.tar.gz/redis_schematics-0.3.1/redis_schematics/__init__.py | 0.921816 | 0.242772 | __init__.py | pypi |
from collections import defaultdict
from dataclasses import dataclass
from typing import TYPE_CHECKING, Dict, List, Set, Type, Union
from django.conf import settings
from django.db import models
if TYPE_CHECKING:
from .documents import Document
@dataclass
class DocumentRegistry:
"""Registry for Document cla... | /redis_search_django-0.1.0-py3-none-any.whl/redis_search_django/registry.py | 0.893269 | 0.160661 | registry.py | pypi |
import datetime
import uuid
from decimal import Decimal
from typing import Any, Dict, Type
from django.db import models
# A mapping for Django model fields and Redis OM fields data
model_field_class_config: Dict[Type[models.Field], Dict[str, Any]] = {
models.AutoField: {
"type": int,
"full_text_se... | /redis_search_django-0.1.0-py3-none-any.whl/redis_search_django/config.py | 0.697609 | 0.3415 | config.py | pypi |
import operator
from abc import ABC
from dataclasses import dataclass
from functools import reduce
from typing import Any, Dict, List, Type, Union
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from pydantic.fields import ModelField
from redis.commands.search.aggregation import Ag... | /redis_search_django-0.1.0-py3-none-any.whl/redis_search_django/documents.py | 0.909018 | 0.209146 | documents.py | pypi |
import zlib
import bisect
from hashlib import md5, sha1
from ._compat import xrange, b, long
hash_methods = {
'crc32': lambda x: zlib.crc32(x) & 0xffffffff,
'md5': lambda x: long(md5(x).hexdigest(), 16),
'sha1': lambda x: long(sha1(x).hexdigest(), 16),
}
class HashRing(object):
"""Consistent hash ... | /redis-shard-0.3.7.tar.gz/redis-shard-0.3.7/redis_shard/hashring.py | 0.760117 | 0.448366 | hashring.py | pypi |
import functools
import logging
from .commands import SHARD_METHODS
from ._compat import basestring, dictvalues
class Pipeline(object):
def __init__(self, shard_api):
self.shard_api = shard_api
self.pipelines = {}
self.__counter = 0
self.__indexes = {}
self.__watching = N... | /redis-shard-0.3.7.tar.gz/redis-shard-0.3.7/redis_shard/pipeline.py | 0.438545 | 0.167866 | pipeline.py | pypi |
import secrets
import string
from typing import Iterable, List, Optional
from redis import Redis
class SimpleMQ:
"""A simple FIFO message queue using Redis."""
REDIS_KEY_PREFIX = "REDIS_SIMPLE_MQ"
RANDOM_NAME_LENGTH = 16
def __init__(self, conn: Redis, name: str = "") -> None:
"""Connect t... | /redis_simple_mq-1.0.0.tar.gz/redis_simple_mq-1.0.0/src/simple_mq/core.py | 0.925844 | 0.292368 | core.py | pypi |
from typing import List, Optional, Union
from redis.client import Pipeline, Redis
from RSO.base import BaseModel
class Model(BaseModel):
def is_exists(self, redis: Redis):
return bool(redis.exists(self.redis_key))
def save(self, redis: Union[Pipeline, Redis]):
if isinstance(redis, Pipeline)... | /redis_simple_orm-2.1.2.tar.gz/redis_simple_orm-2.1.2/RSO/model.py | 0.833596 | 0.250887 | model.py | pypi |
from typing import Any, List, Optional, TypeVar, Union
from redis.client import Pipeline, Redis
from .base import BaseModel, BaseHashIndex, BaseListIndex, BaseSetIndex
T = TypeVar('T')
class HashIndex(BaseHashIndex):
@classmethod
def save(
cls, redis: Union[Pipeline, Redis], model_obj: T
) -> N... | /redis_simple_orm-2.1.2.tar.gz/redis_simple_orm-2.1.2/RSO/index.py | 0.875701 | 0.314675 | index.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.