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 |
|---|---|---|---|---|---|
from typing import Any, List, Optional, Union, TypeVar
from txredisapi import BaseRedisProtocol, ConnectionHandler
from twisted.internet.defer import inlineCallbacks, returnValue
from RSO.base import BaseModel, BaseHashIndex, BaseListIndex, BaseSetIndex
T = TypeVar('T')
class HashIndex(BaseHashIndex):
@classme... | /redis_simple_orm-2.1.2.tar.gz/redis_simple_orm-2.1.2/RSO/txredisapi/index.py | 0.880643 | 0.17989 | index.py | pypi |
from typing import List, Optional, Union
from redis.asyncio.client import Redis as Redis2, Pipeline as Pipeline2
try:
from aioredis.client import Redis, Pipeline
except (ImportError, ModuleNotFoundError):
T_REDIS = Union[Redis2]
T_REDIS_PIPE = Union[Redis2, Pipeline2]
PIPE_CLS = (Pipeline2,)
else:
... | /redis_simple_orm-2.1.2.tar.gz/redis_simple_orm-2.1.2/RSO/asyncio/model.py | 0.776199 | 0.330931 | model.py | pypi |
from typing import Any, Optional, TypeVar, Union
from redis.asyncio.client import Redis as Redis2, Pipeline as Pipeline2
try:
from aioredis.client import Redis, Pipeline
except (ImportError, ModuleNotFoundError):
T_PIPE = Pipeline2
T_REDIS = Redis2
T_REDIS_PIPE = Union[Redis2, Pipeline2]
PIPE_CLS =... | /redis_simple_orm-2.1.2.tar.gz/redis_simple_orm-2.1.2/RSO/asyncio/index.py | 0.792946 | 0.348285 | index.py | pypi |
from redis import StrictRedis
import time
from datetime import datetime
class RedisQueue:
def __init__(self, key,**kwargs):
self.key = key
self.redis = StrictRedis(**kwargs)
def push(self, *args):
"""
Set any number of score, element-name pairs to the queue. Pairs
can ... | /redis-sort-queue-1.3.3.tar.gz/redis-sort-queue-1.3.3/redis_sort_queue/redis_queue.py | 0.769514 | 0.420243 | redis_queue.py | pypi |
import logging
from typing import List
from redis import Redis
from redis.exceptions import ResponseError
from redis_streams import PACKAGE
class BaseRedisClass:
def __init__(self, redis_conn: Redis, stream: str, consumer_group: str):
self.redis_conn = redis_conn
self.stream = stream
sel... | /redis-streams-0.2.0.tar.gz/redis-streams-0.2.0/redis_streams/common.py | 0.747247 | 0.15785 | common.py | pypi |
import redis_tasks
from .conf import connection, construct_redis_key, settings
from .exceptions import WorkerDoesNotExist
from .utils import LazyObject, atomic_pipeline, decode_list
class ExpiringRegistry:
def __init__(self, name):
self.key = construct_redis_key(name + '_tasks')
@atomic_pipeline
... | /redis_tasks-0.0.11-py3-none-any.whl/redis_tasks/registries.py | 0.473657 | 0.154919 | registries.py | pypi |
from .conf import connection, construct_redis_key
from .exceptions import TaskDoesNotExist
from .registries import queue_registry
from .task import Task
from .utils import atomic_pipeline, decode_list
class Queue(object):
def __init__(self, name='default'):
self.name = name
self.key = construct_re... | /redis_tasks-0.0.11-py3-none-any.whl/redis_tasks/queue.py | 0.794943 | 0.195364 | queue.py | pypi |
import bisect
import datetime
from collections import namedtuple
import pytz
from pytz.tzinfo import DstTzInfo
Transition = namedtuple('Transition', [
'start', 'end',
'utc_start', 'utc_end',
'old_utcoffset', 'new_utcoffset'])
class DstSmearingTz:
def __init__(self, name):
self._transition_ti... | /redis_tasks-0.0.11-py3-none-any.whl/redis_tasks/smear_dst.py | 0.528047 | 0.162247 | smear_dst.py | pypi |
import uuid
from redis_tasks import Queue
from redis_tasks.conf import connection, construct_redis_key
from redis_tasks.utils import atomic_pipeline, deserialize, serialize
def chain(members):
graph = TaskGraph()
tail = None
for member in members:
node = graph.add_task(member)
if tail:
... | /redis_tasks-0.0.11-py3-none-any.whl/redis_tasks/contrib/graph.py | 0.519034 | 0.166981 | graph.py | pypi |
import hashlib
from functools import partial
from itertools import imap
from .query import Query, sexpr
class Taxon(object):
"""
A wrapper for Redis objects that allows data to be organized and queried
by tag.
"""
def __init__(self, redis, key_prefix='txn'):
self._r = redis
make_k... | /redis-taxon-0.3.0.tar.gz/redis-taxon-0.3.0/taxon/core.py | 0.782704 | 0.150528 | core.py | pypi |
__all__ = ['Query', 'Tag', 'And', 'Or', 'Not', 'sexpr']
def sexpr(val):
"Returns the query dict as an S-expression."
if isinstance(val, dict):
return sexpr(val.items()[0])
elif isinstance(val, tuple):
return "(" + ' '.join([val[0]] + [sexpr(x) for x in sorted(val[1])]) + ")"
else:
... | /redis-taxon-0.3.0.tar.gz/redis-taxon-0.3.0/taxon/query.py | 0.900048 | 0.502991 | query.py | pypi |
from enum import IntEnum
from logging import getLogger
from pathlib import Path
from time import time
from typing import Union
from packaging.version import Version
from redis.asyncio import StrictRedis as AsyncStrictRedis
from redis.client import StrictRedis
__version__ = '1.0.0'
__file_as_path__ = Path(__file__)
l... | /redis-throttled-queue-1.0.0.tar.gz/redis-throttled-queue-1.0.0/src/redis_throttled_queue/__init__.py | 0.920066 | 0.176778 | __init__.py | pypi |
__author__ = 'Ryan Anguiano'
__email__ = 'ryan.anguiano@gmail.com'
__version__ = '0.1.9'
import calendar
import functools
import operator
from collections import OrderedDict
from datetime import datetime
try:
import pytz
except ImportError: # pragma: no cover
pytz = None
__all__ = ['TimeSeries', 'seconds... | /redis_timeseries-0.1.9.tar.gz/redis_timeseries-0.1.9/redis_timeseries.py | 0.669745 | 0.249105 | redis_timeseries.py | pypi |
__version__ = "0.0.1"
import json
import functools
from environs import Env
import redis
from redis.lock import LockError
from redis.sentinel import Sentinel, MasterNotFoundError
from urllib.parse import urlparse, parse_qs
import logging
logger = logging.getLogger()
class MySentinel(Sentinel):
"""Class to avoid... | /redis-tools-0.0.1.tar.gz/redis-tools-0.0.1/src/redistools/__init__.py | 0.669313 | 0.241948 | __init__.py | pypi |
from werkzeug.utils import cached_property
from .connection import Connection
class ClusterNode(object):
def __init__(self, node_id, latest_know_ip_address_and_port, flags,
master_id, last_ping_sent_time, last_pong_received_time,
node_index, link_status, *assigned_slots):
... | /redis-trib-0.6.2.tar.gz/redis-trib-0.6.2/redistrib/clusternode.py | 0.606615 | 0.201106 | clusternode.py | pypi |
import logging
import click
from six.moves import range
from . import __version__, command
def _parse_host_port(addr):
host, port = addr.split(':')
return host, int(port)
@click.group(help='Note: each `--xxxx-addr` argument in the following commands'
' is in the form of HOST:PORT')
def cli():... | /redis-trib-0.6.2.tar.gz/redis-trib-0.6.2/redistrib/console.py | 0.436262 | 0.170335 | console.py | pypi |
from collections import namedtuple
from functools import lru_cache
from logging import getLogger
import pyproj
__all__ = ["GeoCommandsMixin"]
logger = getLogger(__name__)
BoundingBox = namedtuple("BoundingBox", ["left", "bottom", "right", "top"])
@lru_cache(maxsize=128)
def get_projection(value):
return pypro... | /redis_websocket_api-0.4.4-py3-none-any.whl/redis_websocket_api/geo_protocol.py | 0.781247 | 0.296043 | geo_protocol.py | pypi |
from collections import namedtuple
from logging import getLogger
logger = getLogger(__name__)
Message = namedtuple("Message", ["source", "content"])
class CommandsMixin:
"""Provide command handlers for instructions sent by the client.
Command handlers accept any number of positional and no keyword argument... | /redis_websocket_api-0.4.4-py3-none-any.whl/redis_websocket_api/protocol.py | 0.900188 | 0.153581 | protocol.py | pypi |
import warnings
import redis
from .lib.tool import Tool
__all__ = ['RedisDB']
class RedisDB(object):
"""
因为之后可能 根据业务需求,对一些方法进行代理,所以才写了这个包。
为了拓展性,和组件化思想(对于我写的Helper这个包,
借鉴了flask的组件化思想,进行组件化开发) 会有一个 init_db函数
"""
def __init__(self, helper=None, is_debug=True, **kwargs):
"""
构... | /redis_yy-0.0.8-py3-none-any.whl/redis_yy/redis.py | 0.40392 | 0.16099 | redis.py | pypi |
MBLENGTH = {
8: 1,
33: 3,
88: 2,
91: 2
}
class Charset(object):
def __init__(self, id, name, collation, is_default):
self.id, self.name, self.collation = id, name, collation
self.is_default = is_default == 'Yes'
def __repr__(self):
return "Charset(id=%s, name=%r, colla... | /redis_yy-0.0.8-py3-none-any.whl/redis_yy/lib/charset.py | 0.550607 | 0.176494 | charset.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-5.0.0.tar.gz/redis-5.0.0/README.md | 0.8119 | 0.96157 | README.md | pypi |
ur"""
redisbayes
~~~~~~~~~~
Naïve Bayesian Text Classifier on Redis.
I wrote this to filter spammy comments from a high traffic forum website
and it worked pretty well. It can work for you too :)
For example::
>>> import redis
>>> import redisbayes
>>> rb = redisbay... | /redisbayes-0.1.3.tar.gz/redisbayes-0.1.3/redisbayes.py | 0.543106 | 0.377369 | redisbayes.py | pypi |
import logging
from python_terraform import Terraform, IsNotFlagged
from redisbench_admin.run.common import BENCHMARK_REPETITIONS
from redisbench_admin.utils.remote import (
fetch_remote_setup_from_config,
extract_git_vars,
tf_output_or_none,
retrieve_tf_connection_vars,
setup_remote_environment,
... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run_async/terraform.py | 0.572723 | 0.160463 | terraform.py | pypi |
redis_benchmark_metrics_definition = [
{
"step": "benchmark",
"metric-family": "throughput",
"metric-csv-col": "rps",
"metric-name": "Overall commands per second",
"unit": "commands/sec",
"metric-type": "numeric",
"comparison": "higher-better",
"per-... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/export/redis_benchmark/metrics_definition.py | 0.712432 | 0.290756 | metrics_definition.py | pypi |
from redisbench_admin.export.common.common import (
get_or_none,
get_kv_tags,
prepare_tags,
get_timeserie_name,
add_datapoint,
get_metric_detail,
)
from redisbench_admin.export.redis_benchmark.metrics_definition import (
redis_benchmark_metrics_definition,
)
def warn_if_tag_none(tag_name... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/export/redis_benchmark/redis_benchmark_csv_format.py | 0.503662 | 0.156008 | redis_benchmark_csv_format.py | pypi |
def get_timeserie_name(labels_kv_array):
name = ""
for label_kv in labels_kv_array:
k = list(label_kv.keys())[0]
v = list(label_kv.values())[0]
k = prepare_tags(k)
v = prepare_tags(v)
if name != "":
name += ":"
name += "{k}={v}".format(k=k, v=v)
... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/export/common/common.py | 0.475362 | 0.316647 | common.py | pypi |
import logging
from redisbench_admin.run.common import extract_test_feasible_setups
from redisbench_admin.run_remote.consts import min_recommended_benchmark_duration
from redisbench_admin.utils.benchmark_config import (
extract_benchmark_type_from_config,
extract_redis_dbconfig_parameters,
)
def calculate_cl... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run/run.py | 0.599602 | 0.152821 | run.py | pypi |
import logging
from redisbench_admin.utils.remote import extract_git_vars
def git_vars_crosscheck(
tf_github_actor, tf_github_branch, tf_github_org, tf_github_repo, tf_github_sha
):
if tf_github_org is None:
(
github_org_name,
github_repo_name,
github_sha,
... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run/git.py | 0.541651 | 0.251292 | git.py | pypi |
import csv
import re
def prepare_ycsb_benchmark_command(
executable_path: str,
server_private_ip: object,
server_plaintext_port: object,
benchmark_config: object,
current_workdir,
):
"""
Prepares ycsb command parameters
:param executable_path:
:param server_private_ip:
:param s... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run/ycsb/ycsb.py | 0.562657 | 0.158337 | ycsb.py | pypi |
from redisbench_admin.utils.local import check_if_needs_remote_fetch
def prepare_tsbs_benchmark_command(
executable_path: str,
server_private_ip: object,
server_plaintext_port: object,
benchmark_config: object,
current_workdir,
result_file: str,
remote_queries_file,
is_remote: bool,
... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run/tsbs_run_queries_redistimeseries/tsbs_run_queries_redistimeseries.py | 0.600188 | 0.152001 | tsbs_run_queries_redistimeseries.py | pypi |
import logging
def prepare_redisgraph_benchmark_go_command(
executable_path: str,
server_private_ip: object,
server_plaintext_port: object,
benchmark_config: object,
results_file: object,
is_remote: bool = False,
):
"""
Prepares redisgraph-benchmark-go command parameters
:param ex... | /redisbench_admin-0.10.0.tar.gz/redisbench_admin-0.10.0/redisbench_admin/run/redisgraph_benchmark_go/redisgraph_benchmark_go.py | 0.578924 | 0.185025 | redisgraph_benchmark_go.py | pypi |
# RedisCache
## Presentation
There are already quite a few Python decorators to cache functions in a Redis database:
- [redis-cache](https://pypi.org/project/redis-cache/)
- [redis_cache_decorator](https://pypi.org/project/redis_cache_decorator/)
- [redis-simple-cache](https://pypi.org/project/redis-simple-cache/)
- ... | /rediscache-0.1.2.tar.gz/rediscache-0.1.2/README.md | 0.492188 | 0.956675 | README.md | pypi |
rediscluster-py
===============
a Python interface to a Cluster of Redis key-value stores.
Project Goals
-------------
The goal of ``rediscluster-py``, together with `rediscluster-php <https://github.com/salimane/rediscluster-php.git>`_,
is to have a consistent, compatible client libraries accross programming langu... | /rediscluster-0.5.3.tar.gz/rediscluster-0.5.3/README.rst | 0.801198 | 0.657882 | README.rst | pypi |
## Provides decorators to cache/update/delete results to/from Redis.
Created to be used in a project, this package is published to github
for ease of management and installation across different modules.
### Features
For function decorated with `@cache`, the result will be serialized and
stored in Redis. If the fun... | /redisdecor-0.1.10.4.tar.gz/redisdecor-0.1.10.4/README.md | 0.719482 | 0.94625 | README.md | pypi |
# Package redisearch Documentation
## Overview
`redisearch-py` is a python search engine library that utilizes the RediSearch Redis Module API.
It is the "official" client of redisearch, and should be regarded as its canonical client implementation.
The source code can be found at [http://github.com/RedisLabs/re... | /redisearch-2.0.0.tar.gz/redisearch-2.0.0/API.md | 0.601242 | 0.901401 | API.md | pypi |
from pathos.pools import ThreadPool as Pool
def run(client, graphname, args):
result = client.execute_command("GRAPH.BULK", graphname, *args)
stats = result.split(", ".encode())
return stats
class QueryBuffer:
def __init__(self, graphname, client, config):
self.nodes = None
self.top_... | /redisgraph_bulk_loader-0.12.3-py3-none-any.whl/redisgraph_bulk_loader/query_buffer.py | 0.792464 | 0.277605 | query_buffer.py | pypi |
from __future__ import print_function
from functools import wraps
try:
import cPickle as pickle
except ImportError: # pragma: no cover
import pickle
try:
from redislite import Redis
except ImportError: # pragma: no cover
from redis import Redis
def key_for_name(name):
"""Return the key name use... | /redislite-hotqueue-1.3.83.tar.gz/redislite-hotqueue-1.3.83/hotqueue/hotqueue.py | 0.90064 | 0.173218 | hotqueue.py | pypi |
# Redislite
[](https://screwdriver.cd/)
[](https://cd.screwdriver.cd/pipelines/2880)
[](https://www.python.org/dev/peps/pe... | /redislite-6.2.859089.tar.gz/redislite-6.2.859089/README.md | 0.49048 | 0.893774 | README.md | pypi |
This README is just a fast *quick start* document. You can find more detailed documentation at [redis.io](https://redis.io).
What is Redis?
--------------
Redis is often referred to as a *data structures* server. What this means is that Redis provides access to mutable data structures via a set of commands, which are... | /redislite-6.2.859089.tar.gz/redislite-6.2.859089/redis.submodule/README.md | 0.448668 | 0.740456 | README.md | pypi |
[](https://travis-ci.org/redis/hiredis)
**This Readme reflects the latest changed in the master branch. See [v1.0.0](https://github.com/redis/hiredis/tree/v1.0.0) for the Readme and documentation for the latest release ([API/ABI history](https://abi-laboratory.pr... | /redislite-6.2.859089.tar.gz/redislite-6.2.859089/redis.submodule/deps/hiredis/README.md | 0.599133 | 0.930962 | README.md | pypi |
## [1.0.0](https://github.com/redis/hiredis/tree/v1.0.0) - (2020-08-03)
Announcing Hiredis v1.0.0, which adds support for RESP3, SSL connections, allocator injection, and better Windows support! :tada:
_A big thanks to everyone who helped with this release. The following list includes everyone who contributed at lea... | /redislite-6.2.859089.tar.gz/redislite-6.2.859089/redis.submodule/deps/hiredis/CHANGELOG.md | 0.614857 | 0.730073 | CHANGELOG.md | pypi |
import marshmallow
import marshmallow_dataclass
from sample_data_generator.models import CapacityReport
from sample_data_generator.models import MeterReading
from sample_data_generator.models import Plot
from sample_data_generator.models import Site
from sample_data_generator.models import SiteStats
from sample_data_g... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/schema.py | 0.708616 | 0.299048 | schema.py | pypi |
import abc
import datetime
from typing import Deque
from typing import List
from typing import Set
from sample_data_generator.models import CapacityReport
from sample_data_generator.models import GeoQuery
from sample_data_generator.models import Measurement
from sample_data_generator.models import MeterReading
from sa... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/dao/base.py | 0.772273 | 0.259955 | base.py | pypi |
import datetime
import redis.client
from sample_data_generator.dao.base import SiteStatsDaoBase
from sample_data_generator.dao.redis import key_schema
from sample_data_generator.dao.redis.base import RedisDaoBase
from sample_data_generator.models import MeterReading
from sample_data_generator.models import SiteStats
... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/dao/redis/site_stats.py | 0.674587 | 0.177241 | site_stats.py | pypi |
from typing import Set
from sample_data_generator.dao.base import SiteGeoDaoBase
from sample_data_generator.dao.redis import key_schema
from sample_data_generator.dao.redis.base import RedisDaoBase
from sample_data_generator.models import GeoQuery
from sample_data_generator.models import Site
from sample_data_generato... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/dao/redis/site_geo.py | 0.911952 | 0.40928 | site_geo.py | pypi |
import datetime
from collections import deque
from typing import Deque
from typing import List
import redis.client
from sample_data_generator.dao.base import MetricDaoBase
from sample_data_generator.dao.redis import key_schema
from sample_data_generator.dao.redis.base import RedisDaoBase
from sample_data_generator.mo... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/dao/redis/metric.py | 0.918215 | 0.337326 | metric.py | pypi |
import datetime
from enum import Enum
from typing import List
from typing import Union
import marshmallow
from dataclasses import dataclass
from marshmallow_dataclass import NewType
def deserialize_timestamp(v: str) -> datetime.datetime:
"""
Convert a timestamp, stored either as a str or float, into a dateti... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/models/models.py | 0.933862 | 0.499268 | models.py | pypi |
import datetime
import random
from typing import List
import redis.client
from sample_data_generator.models import MeterReading
from sample_data_generator.dao.redis import MeterReadingDaoRedis
class SampleDataGenerator:
"""
Generates historical data for all sites starting from the
current time and going... | /redisolar_sample_data_generator-1.0.5-py3-none-any.whl/sample_data_generator/core/sample_data_generator.py | 0.869452 | 0.332405 | sample_data_generator.py | pypi |
def getRedis(host="localhost",
port=6379,
db=0,
password=None, **kwargs):
"""
获取redis对象
:param host: 地址
:param port: 端口
:param db: 数据库
:param password: 密码
:param kwargs: 其他属性
:return:
"""
import redis
redis_conn = redis.Redis(host=host, ... | /redisplus-0.0.1.tar.gz/redisplus-0.0.1/redisplus.py | 0.527317 | 0.167355 | redisplus.py | pypi |
import os
import time
import base64
import json
import uuid
import platform
import itertools
import datetime
import traceback
from urllib.parse import urlparse
from redisrpc.version import VERSION
try:
import redis
except:
pass
class BasePubSub(object):
"""
Base publish–subscribe is a
mes... | /redispubsub-0.0.6.tar.gz/redispubsub-0.0.6/redisrpc/base.py | 0.455683 | 0.19789 | base.py | pypi |
from typing import List, Optional, Union
from redis.commands.search.field import VectorField
from redisvl.index import SearchIndex
from redisvl.llmcache.base import BaseLLMCache
from redisvl.query import VectorQuery
from redisvl.utils.utils import array_to_buffer
from redisvl.vectorize.base import BaseVectorizer
from... | /llmcache/semantic.py | 0.86075 | 0.533154 | semantic.py | pypi |
from redis import Redis
from pydantic import BaseModel
from typing import Any, Optional, Type, List, Dict, TypeVar, Generic
T = TypeVar('T', BaseModel, str)
ContainerSubtype = TypeVar('ContainerSubtype', bound='RedisContainer')
StrBytes = str | bytes
class RedisContainer(Generic[T]):
def __init__(
self,... | /reditio-0.3.1.tar.gz/reditio-0.3.1/reditio.py | 0.925819 | 0.266805 | reditio.py | pypi |
import requests
from requests.exceptions import HTTPError
from urllib.parse import urljoin
import logging
import time
from redkyn.canvas.exceptions import (
raiseAuthenticationFailed,
raiseCourseNotFound,
raiseStudentNotFound,
raiseNameResolutionFailed,
)
from typing import Tuple
# Transparently us... | /redkyn-common-1.1.0.tar.gz/redkyn-common-1.1.0/redkyn/canvas/__init__.py | 0.568296 | 0.184951 | __init__.py | pypi |
import docker
import itertools
import json
import logging
import os
import shutil
import tempfile
from .gradesheet import GradeSheet
from .mixins import DockerClientMixin
from .submission import Submission
logger = logging.getLogger(__name__)
class AssignmentError(Exception):
"""A general-purpose exception thro... | /redkyn-grader-0.1.1.tar.gz/redkyn-grader-0.1.1/grader/models/assignment.py | 0.656218 | 0.318399 | assignment.py | pypi |
import logging
import os
import shutil
from .assignment import Assignment
from .config import GraderConfig
logger = logging.getLogger(__name__)
class GraderError(Exception):
"""A general-purpose exception thrown by the Assignment class.
"""
pass
class AssignmentNotFoundError(GraderError):
"""An ex... | /redkyn-grader-0.1.1.tar.gz/redkyn-grader-0.1.1/grader/models/grader.py | 0.756987 | 0.325427 | grader.py | pypi |
import jsonschema
import logging
import os
import yaml
logger = logging.getLogger(__name__)
class ConfigValidationError(Exception):
"""An exception thrown when a config file cannot be validated
"""
pass
class Config(object):
"""A base class for configuration objects. Provides two vaguely-useful
... | /redkyn-grader-0.1.1.tar.gz/redkyn-grader-0.1.1/grader/models/config.py | 0.808105 | 0.294301 | config.py | pypi |
import git
import glob
import logging
import os
from .config import AssignmentConfig
logger = logging.getLogger(__name__)
class GradeSheetError(Exception):
"""A general-purpose exception thrown by the Assignment class.
"""
pass
class GradeSheet(object):
"""A gradesheet for an assignment. Gradeshee... | /redkyn-grader-0.1.1.tar.gz/redkyn-grader-0.1.1/grader/models/gradesheet.py | 0.642769 | 0.337176 | gradesheet.py | pypi |
import itertools
import logging
from collections import OrderedDict
from functools import reduce
from prettytable import PrettyTable
from grader.models import Grader
from grader.utils.config import require_grader_config
logger = logging.getLogger(__name__)
help = "List student submission(s)"
def setup_parser(pars... | /redkyn-grader-0.1.1.tar.gz/redkyn-grader-0.1.1/grader/commands/list.py | 0.493897 | 0.178168 | list.py | pypi |
import numpy as np
import scipy.signal as signal
import multiprocessing
class FroCorr:
"""An implementation the Frobenius-norm-of-correlation-matricies metric.
This is not a class to be instantiated, but rather a way to organize and separate the
parameterization and comparison steps of the metric calcula... | /redlemur_offbrand-0.06.tar.gz/redlemur_offbrand-0.06/lemur/metrics.py | 0.955889 | 0.890151 | metrics.py | pypi |
from sklearn.manifold import TSNE, MDS
import pandas as pd
import numpy as np
import lemur.datasets as lds
class BaseEmbedder:
"""A generic embedder object to be extended.
Parameters
----------
num_components : int
The number of dimensions the embedding should have.
Attributes
----------
... | /redlemur_offbrand-0.06.tar.gz/redlemur_offbrand-0.06/lemur/embedders.py | 0.962027 | 0.64526 | embedders.py | pypi |
import os
import boto3
import pandas as pd
import numpy as np
import pickle as pkl
import logging
import json
import glob
from nilearn import image as nimage
from nilearn import plotting as nilplot
import nibabel as nib
class DataSet:
def __init__(self, D, name="default"):
self.D = D
self.n, self.... | /redlemur_offbrand-0.06.tar.gz/redlemur_offbrand-0.06/lemur/datasets.py | 0.643553 | 0.245746 | datasets.py | pypi |
from abc import ABCMeta, abstractmethod
import numpy as np
from sklearn.mixture import GaussianMixture
from scipy.spatial import distance
import sklearn.cluster as skcl
import sklearn.metrics as skmetrics
class Clustering(metaclass=ABCMeta):
def __init__(self, DS, levels=1, random_state=None):
self.DS = D... | /redlemur-1.1.tar.gz/redlemur-1.1/lemur/clustering.py | 0.857887 | 0.286431 | clustering.py | pypi |
import numpy as np
import scipy.signal as signal
import multiprocessing
class FroCorr:
"""An implementation the Frobenius-norm-of-correlation-matricies metric.
This is not a class to be instantiated, but rather a way to organize and separate the
parameterization and comparison steps of the metric calcula... | /redlemur-1.1.tar.gz/redlemur-1.1/lemur/metrics.py | 0.955889 | 0.890151 | metrics.py | pypi |
from sklearn.manifold import TSNE, MDS
import pandas as pd
import numpy as np
import lemur.datasets as lds
class BaseEmbedder:
"""A generic embedder object to be extended.
Parameters
----------
num_components : int
The number of dimensions the embedding should have.
Attributes
----------
... | /redlemur-1.1.tar.gz/redlemur-1.1/lemur/embedders.py | 0.962027 | 0.64526 | embedders.py | pypi |
import os
import boto3
import pandas as pd
import numpy as np
import pickle as pkl
import logging
import json
import glob
import statistics
from nilearn import image as nimage
from nilearn import plotting as nilplot
import nibabel as nib
import networkx as nx
class DataSet:
def __init__(self, D, name="default"):... | /redlemur-1.1.tar.gz/redlemur-1.1/lemur/datasets.py | 0.478773 | 0.212753 | datasets.py | pypi |
import numpy as np
from scipy.stats import gaussian_kde
from itertools import product
from plotly.graph_objs import *
from plotly import tools
def plot_heatmap(dats, name=None, ylab=None, xlab=None, scale=False,
scaletit=''):
data = [
Heatmap(
z=dats,
... | /redlemur-1.1.tar.gz/redlemur-1.1/lemur/utils/plotly_helper.py | 0.492432 | 0.296132 | plotly_helper.py | pypi |
# redmage
[](https://github.com/redmage-labs/redmage/actions/workflows/main.yaml)
Redmage is component based library for building [htmx](https://htmx.org/) powered web applications.
It is built on top of the [starlette](https:... | /redmage-0.3.1.tar.gz/redmage-0.3.1/README.md | 0.532182 | 0.918114 | README.md | pypi |
import logging
import yaml
log = logging.getLogger(__name__)
user_dict = None
# Utils
def load_user_dict(path):
global user_dict
with open(path, 'r') as stream:
user_dict = yaml.load(stream, Loader=yaml.SafeLoader)
def redmine_username_to_gitlab_username(redmine_username):
if user_dict is not No... | /redmine-gitlab-migrator-1.0.3.tar.gz/redmine-gitlab-migrator-1.0.3/redmine_gitlab_migrator/converters.py | 0.525856 | 0.195978 | converters.py | pypi |
import pyredner_tensorflow as pyredner
import tensorflow as tf
from typing import Union, Optional
class Material:
"""
redner currently employs a two-layer diffuse-specular material model.
More specifically, it is a linear blend between a Lambertian model and
a microfacet model with Phong di... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/material.py | 0.921247 | 0.808105 | material.py | pypi |
import pyredner_tensorflow as pyredner
from typing import Union
import os
def save_obj(shape: Union[pyredner.Object, pyredner.Shape],
filename: str,
flip_tex_coords = True):
"""
Save to a Wavefront obj file from an Object or a Shape.
Args
====
shape: Union... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/save_obj.py | 0.749179 | 0.37379 | save_obj.py | pypi |
import pyredner_tensorflow as pyredner
import tensorflow as tf
import math
import numpy as np
from typing import Optional
import redner
def compute_vertex_normal(vertices: tf.Tensor,
indices: tf.Tensor,
weighting_scheme: str = 'max'):
"""
Compute vertex n... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/shape.py | 0.923308 | 0.648592 | shape.py | pypi |
import tensorflow as tf
import re
import pyredner_tensorflow as pyredner
import os
class WavefrontMaterial:
def __init__(self):
self.name = ""
self.Kd = (0.0, 0.0, 0.0)
self.Ks = (0.0, 0.0, 0.0)
self.Ns = 0.0
self.Ke = (0.0, 0.0, 0.0)
self.map_Kd = None
self.... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/load_obj.py | 0.708112 | 0.255042 | load_obj.py | pypi |
import pyredner_tensorflow as pyredner
class Scene:
"""
A scene is a collection of camera, geometry, materials, and light.
Currently there are two ways to construct a scene: one is through
lists of Shape, Material, and AreaLight. The other one is through
a list of Object. It is more... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/scene.py | 0.803791 | 0.437343 | scene.py | pypi |
import math
import numpy as np
import tensorflow as tf
def radians(deg):
return (math.pi / 180.0) * deg
def normalize(v):
"""
NOTE: torch.norm() uses Frobineus norm which is Euclidean and L2
"""
return v / tf.norm(v)
def gen_look_at_matrix(pos, look, up):
d = normalize(look - pos)
right ... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/transform.py | 0.909131 | 0.610337 | transform.py | pypi |
import tensorflow as tf
import redner
class RednerCameraType:
__cameratypes = [
redner.CameraType.perspective,
redner.CameraType.orthographic,
redner.CameraType.fisheye,
redner.CameraType.panorama,
]
@staticmethod
def asTensor(cameratype: redner.CameraType) -> tf.Tensor... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/redner_enum_wrapper.py | 0.433862 | 0.433322 | redner_enum_wrapper.py | pypi |
import pyredner_tensorflow as pyredner
import tensorflow as tf
from typing import Optional
class Object:
"""
Object combines geometry, material, and lighting information
and aggregate them in a single class. This is a convinent class
for constructing redner scenes.
redner supports ... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/object.py | 0.962568 | 0.81119 | object.py | pypi |
import tensorflow as tf
import pyredner_tensorflow as pyredner
import math
class Texture:
"""
Representing a texture and its mipmap.
Args
====
texels: torch.Tensor
a float32 tensor with size C or [height, width, C]
uv_scale: Optional[torch.Tensor]
sc... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/texture.py | 0.938308 | 0.678207 | texture.py | pypi |
import pyredner_tensorflow as pyredner
import random
import redner
import tensorflow as tf
import math
from typing import Union, Tuple, Optional, List
class DeferredLight:
pass
class AmbientLight(DeferredLight):
"""
Ambient light for deferred rendering.
"""
def __init__(self,
... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/render_utils.py | 0.959856 | 0.405302 | render_utils.py | pypi |
import pyredner_tensorflow as pyredner
import numpy as np
import tensorflow as tf
import math
import pdb
class EnvironmentMap:
"""
A class representing light sources infinitely far away using an image.
Args
----------
values: Union[tf.Tensor, pyredner.Texture]
a float32... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/envmap.py | 0.929584 | 0.702725 | envmap.py | pypi |
import numpy as np
import tensorflow as tf
import math
import pyredner_tensorflow as pyredner
def generate_geometry_image(size: int):
"""
Generate an spherical geometry image [Gu et al. 2002 and Praun and Hoppe 2003]
of size [2 * size + 1, 2 * size + 1]. This can be used for encoding a genus-0
... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/geometry_images.py | 0.813942 | 0.658472 | geometry_images.py | pypi |
import tensorflow as tf
import numpy as np
import redner
import pyredner_tensorflow as pyredner
import time
import weakref
import os
from typing import List, Union, Tuple, Optional
from .redner_enum_wrapper import RednerCameraType, RednerSamplerType, RednerChannels
__EMPTY_TENSOR = tf.constant([])
use_correlated_rando... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/render_tensorflow.py | 0.86501 | 0.390098 | render_tensorflow.py | pypi |
import tensorflow as tf
import pyredner_tensorflow.transform as transform
import redner
import pyredner_tensorflow as pyredner
import math
from typing import Tuple, Optional, List
class Camera:
"""
redner supports four types of cameras: perspective, orthographic, fisheye, and panorama.
The camera t... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner_tensorflow/camera.py | 0.950215 | 0.714068 | camera.py | pypi |
import pyredner
import torch
from typing import Union, Optional
class Material:
"""
redner currently employs a two-layer diffuse-specular material model.
More specifically, it is a linear blend between a Lambertian model and
a microfacet model with Phong distribution, with Schilick's Fresne... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/material.py | 0.909184 | 0.789396 | material.py | pypi |
import pyredner
from typing import Union
import os
import torch
def save_obj(shape: Union[pyredner.Object, pyredner.Shape],
filename: str,
flip_tex_coords = True):
"""
Save to a Wavefront obj file from an Object or a Shape.
Args
====
shape: Union[pyredner.O... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/save_obj.py | 0.727395 | 0.302224 | save_obj.py | pypi |
import torch
import numpy as np
import redner
import pyredner
import time
import skimage.io
from typing import List, Union, Tuple, Optional
import warnings
use_correlated_random_number = False
def set_use_correlated_random_number(v: bool):
"""
| There is a bias-variance trade off in the backward pass.
... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/render_pytorch.py | 0.950726 | 0.52543 | render_pytorch.py | pypi |
import pyredner
import torch
import math
import redner
from typing import Optional
def compute_vertex_normal(vertices: torch.Tensor,
indices: torch.Tensor,
weighting_scheme: str = 'max'):
"""
Compute vertex normal by weighted average of nearby face normal... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/shape.py | 0.938003 | 0.681061 | shape.py | pypi |
import torch
import re
import pyredner
import os
from typing import Optional
class WavefrontMaterial:
def __init__(self):
self.name = ""
self.Kd = (0.0, 0.0, 0.0)
self.Ks = (0.0, 0.0, 0.0)
self.Ns = 0.0
self.Ke = (0.0, 0.0, 0.0)
self.map_Kd = None
self.map_Ks... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/load_obj.py | 0.853379 | 0.299824 | load_obj.py | pypi |
import pyredner
import torch
from typing import Optional, List
class Scene:
"""
A scene is a collection of camera, geometry, materials, and light.
Currently there are two ways to construct a scene: one is through
lists of Shape, Material, and AreaLight. The other one is through
a li... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/scene.py | 0.902953 | 0.453746 | scene.py | pypi |
import math
import numpy as np
import torch
def radians(deg):
return (math.pi / 180.0) * deg
def normalize(v):
return v / torch.norm(v)
def gen_look_at_matrix(pos, look, up):
d = normalize(look - pos)
right = normalize(torch.cross(d, normalize(up)))
new_up = normalize(torch.cross(right, d))
z... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/transform.py | 0.908038 | 0.642671 | transform.py | pypi |
import pyredner
import torch
from typing import Optional
class Object:
"""
Object combines geometry, material, and lighting information
and aggregate them in a single class. This is a convinent class
for constructing redner scenes.
redner supports only triangle meshes for now. It s... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/object.py | 0.958265 | 0.814127 | object.py | pypi |
import torch
import numpy as np
import pyredner
import torch
import enum
import math
from typing import Optional
class Texture:
"""
Representing a texture and its mipmap.
Args
====
texels: torch.Tensor
a float32 tensor with size C or [height, width, C]
uv_scale:... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/texture.py | 0.93847 | 0.740444 | texture.py | pypi |
import pyredner
import random
import redner
import torch
import math
from typing import Union, Tuple, Optional, List
class DeferredLight:
pass
class AmbientLight(DeferredLight):
"""
Ambient light for deferred rendering.
"""
def __init__(self,
intensity: torch.Tensor):
... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/render_utils.py | 0.954764 | 0.517205 | render_utils.py | pypi |
import pyredner
import torch
import math
from typing import Union
class EnvironmentMap:
"""
A class representing light sources infinitely far away using an image.
Args
----------
values: Union[torch.Tensor, pyredner.Texture]
a float32 tensor with size 3 or [height, widt... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/envmap.py | 0.942414 | 0.779301 | envmap.py | pypi |
import numpy as np
import torch
import math
import pyredner
from typing import Optional
def generate_geometry_image(size: int,
device: Optional[torch.device] = None):
"""
Generate an spherical geometry image [Gu et al. 2002 and Praun and Hoppe 2003]
of size [2 * size + 1... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/geometry_images.py | 0.866239 | 0.720651 | geometry_images.py | pypi |
import torch
import pyredner.transform as transform
import redner
import math
import pyredner
from typing import Tuple, Optional, List
class Camera:
"""
Redner supports four types of cameras\: perspective, orthographic, fisheye, and panorama.
The camera takes a look at transform or a cam_to_world m... | /redner_gpu-0.4.28-cp38-cp38-manylinux1_x86_64.whl/pyredner/camera.py | 0.944536 | 0.775435 | camera.py | pypi |
import pyredner_tensorflow as pyredner
import tensorflow as tf
from typing import Union, Optional
class Material:
"""
redner currently employs a two-layer diffuse-specular material model.
More specifically, it is a linear blend between a Lambertian model and
a microfacet model with Phong di... | /redner-0.4.28-cp38-cp38-macosx_10_14_x86_64.whl/pyredner_tensorflow/material.py | 0.921247 | 0.808105 | material.py | pypi |
import pyredner_tensorflow as pyredner
from typing import Union
import os
def save_obj(shape: Union[pyredner.Object, pyredner.Shape],
filename: str,
flip_tex_coords = True):
"""
Save to a Wavefront obj file from an Object or a Shape.
Args
====
shape: Union... | /redner-0.4.28-cp38-cp38-macosx_10_14_x86_64.whl/pyredner_tensorflow/save_obj.py | 0.749179 | 0.37379 | save_obj.py | pypi |
import pyredner_tensorflow as pyredner
import tensorflow as tf
import math
import numpy as np
from typing import Optional
import redner
def compute_vertex_normal(vertices: tf.Tensor,
indices: tf.Tensor,
weighting_scheme: str = 'max'):
"""
Compute vertex n... | /redner-0.4.28-cp38-cp38-macosx_10_14_x86_64.whl/pyredner_tensorflow/shape.py | 0.923308 | 0.648592 | shape.py | pypi |
import tensorflow as tf
import re
import pyredner_tensorflow as pyredner
import os
class WavefrontMaterial:
def __init__(self):
self.name = ""
self.Kd = (0.0, 0.0, 0.0)
self.Ks = (0.0, 0.0, 0.0)
self.Ns = 0.0
self.Ke = (0.0, 0.0, 0.0)
self.map_Kd = None
self.... | /redner-0.4.28-cp38-cp38-macosx_10_14_x86_64.whl/pyredner_tensorflow/load_obj.py | 0.708112 | 0.255042 | load_obj.py | pypi |
import pyredner_tensorflow as pyredner
class Scene:
"""
A scene is a collection of camera, geometry, materials, and light.
Currently there are two ways to construct a scene: one is through
lists of Shape, Material, and AreaLight. The other one is through
a list of Object. It is more... | /redner-0.4.28-cp38-cp38-macosx_10_14_x86_64.whl/pyredner_tensorflow/scene.py | 0.803791 | 0.437343 | scene.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.