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 sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import isspmatrix_csr
if sys.version_info[0] >= 3:
from sparse_dot_topn import sparse_dot_topn as ct
from sparse_dot_topn import sparse_dot_topn_threaded as ct_thread
else:
import sparse_dot_topn as ct
import sparse_dot... | /red_string_grouper-0.1.0.post3.tar.gz/red_string_grouper-0.1.0.post3/red_string_grouper/sparse_dot_topn/awesome_cossim_topn.py | 0.441191 | 0.421195 | awesome_cossim_topn.py | pypi |
import shlex
from pathlib import PosixPath
import llvmlite.ir as ir
from itertools import cycle
from types import SimpleNamespace
from rtl.parser.transform import Transform
from rtl.parser.helpers import helper_generate_id
class Executable:
LINE_TRIGGER = "executable"
EXECUTABLES = {}
RTL_PROTOCOL_SHELL... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/parser/executable.py | 0.513668 | 0.405684 | executable.py | pypi |
from types import SimpleNamespace
from rtl.parser.transform import Transform
from rtl.parser.helpers import helper_generate_id
from rtl.parser.helpers import helper_create_global_char_array
from rtl.parser.transform import Transform
import llvmlite.ir as ir
from abc import abstractmethod, abstractclassmethod
class KV... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/parser/kvstore.py | 0.461259 | 0.247441 | kvstore.py | pypi |
import llvmlite.ir as ir
import llvmlite.binding as llvm
from rtl.lib.protocol.common import COMMON_LLVM_O
from rtl.lib.protocol.shell import SHELL_LLVM_O, RTL_PROTOCOL_SHELL_EXECUTION_METHODS # recompile things...every import...so dirty...
from rtl.parser.executable import Executable
from rtl.parser.helpers import h... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/parser/protocol/shell.py | 0.425128 | 0.205416 | shell.py | pypi |
import binascii
import re
from typing import Dict
STR_TRANS_REMOVE_BLANKS = str.maketrans('', '', ' \t\n\r')
def unhexlify(text: str) -> bytes:
return binascii.unhexlify(text.translate(STR_TRANS_REMOVE_BLANKS))
def construct_asymmetric_key_data(src) -> Dict[str, Dict[int, bytes]]:
"""Split key pairs into se... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/lib/protocol/ssh/mbedtls/scripts/mbedtls_dev/asymmetric_key_data.py | 0.474388 | 0.228737 | asymmetric_key_data.py | pypi |
import os
import platform
import subprocess
import sys
import tempfile
def remove_file_if_exists(filename):
"""Remove the specified file, ignoring errors."""
if not filename:
return
try:
os.remove(filename)
except OSError:
pass
def create_c_file(file_label):
"""Create a te... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/lib/protocol/ssh/mbedtls/scripts/mbedtls_dev/c_build_helper.py | 0.466603 | 0.379206 | c_build_helper.py | pypi |
import re
import struct
from typing import Dict, List, Optional, Set, Union
import unittest
from . import c_build_helper
class Expr:
"""Representation of a C expression with a known or knowable numerical value."""
def __init__(self, content: Union[int, str]):
if isinstance(content, int):
... | /red_team_language-0.2.0.tar.gz/red_team_language-0.2.0/rtl/lib/protocol/ssh/mbedtls/scripts/mbedtls_dev/psa_storage.py | 0.920571 | 0.508727 | psa_storage.py | pypi |
from __future__ import annotations
import inspect
import json
class ListProtect:
"""Protect a list during modification by modifying a copy instead of the original.
Description:
ListProtect creates a copy of a list before running operations like .append(), and prevents
errors on the original ... | /red_utils-0.1.5-py3-none-any.whl/red_utils/context_managers/object_managers/protect.py | 0.830937 | 0.327507 | protect.py | pypi |
from __future__ import annotations
from pathlib import Path
from typing import Union
from uuid import uuid4
from . import default_serialize_dir
import msgpack
def ensure_path(dir: Union[str, Path] = None) -> bool:
"""Ensure a directory path exists.
Returns a bool
"""
if not dir:
raise Valu... | /red_utils-0.1.5-py3-none-any.whl/red_utils/msgpack_utils/src/operations.py | 0.829561 | 0.273659 | operations.py | pypi |
from __future__ import annotations
from dataclasses import dataclass, field
import sys
from typing import Callable, Union
_ts: str = "[{time:YYYY-MM-DD_HH:mm:ss}]"
_level: str = "[{level}]"
_module: str = "[{module}]"
_function: str = "[{function}]"
_name: str = "[{name}]"
_line: str = "[{line}]"
_name_line: str = "... | /red_utils-0.1.5-py3-none-any.whl/red_utils/loguru_utils/src/constants.py | 0.585694 | 0.231723 | constants.py | pypi |
from __future__ import annotations
from pathlib import Path
from typing import Optional, Type, Union
from . import (
default_cache_dir,
default_timeout_dict,
valid_key_types,
valid_tag_types,
valid_val_types,
)
from .validators import (
validate_cache,
validate_expire,
validate_key,
... | /red_utils-0.1.5-py3-none-any.whl/red_utils/diskcache_utils/src/operations.py | 0.882453 | 0.236902 | operations.py | pypi |
from __future__ import annotations
from pathlib import Path
from typing import Optional, Type, Union
from . import valid_key_types, valid_tag_types, valid_val_types
import diskcache
from diskcache import Cache
def validate_key(key: valid_key_types = None, none_ok: bool = False) -> Union[str, int]:
"""Validate... | /red_utils-0.1.5-py3-none-any.whl/red_utils/diskcache_utils/src/validators.py | 0.857231 | 0.243204 | validators.py | pypi |
from __future__ import annotations
from .constants import (
default_headers,
valid_methods,
)
from .validators import validate_client, validate_headers, validate_method
import httpx
from httpx import Client
def merge_headers(
original_headers: dict[str, str] = default_headers,
update_vals: dict[str... | /red_utils-0.1.5-py3-none-any.whl/red_utils/httpx_utils/src/operations.py | 0.74512 | 0.174938 | operations.py | pypi |
from red_val.parsing import split_into_parts, ParsingError
VARIABLE_SEPARATOR_START = '{{'
VARIABLE_SEPARATOR_END = '}}'
PRIVATE_KEYS = {'access', 'auth'}
DEFAULT_PROTECTED_KEYS = {'password', 'privateKey'}
class VariableKey:
def __init__(self, key, protected):
"""
Creates a new VariableKey
... | /red_val-9.1.1-py3-none-any.whl/red_val/red_variables.py | 0.807574 | 0.358325 | red_variables.py | pypi |
from enum import Enum
from red_val.exceptions import RedSpecificationError
class InputType:
class InputCategory(Enum):
File = 0
Directory = 1
string = 2
int = 3
long = 4
float = 5
double = 6
boolean = 7
def __init__(self, input_category, is_arr... | /red_val-9.1.1-py3-none-any.whl/red_val/red_types.py | 0.748812 | 0.363308 | red_types.py | pypi |
from functools import partial
from aioredis import create_redis_pool
def decode(value, _encoding='utf-8'):
try:
if isinstance(value, bytes):
return value.hex().upper() if _encoding == 'hex' else value.decode(_encoding)
elif isinstance(value, list):
return [decode(o, _encod... | /red-velvet-0.0.4.tar.gz/red-velvet-0.0.4/redvelvet/util.py | 0.524395 | 0.2349 | util.py | pypi |
import json
import requests
import time
from datetime import datetime
class RedashAPIClient:
def __init__(self, api_key: str, host: str="http://localhost:5000"):
self.api_key = api_key
self.host = host
self.s = requests.Session()
self.s.headers.update({"Authorization": f"Key {api_k... | /redash_api_client-0.3.0-py3-none-any.whl/redashAPI/client.py | 0.40251 | 0.155719 | client.py | pypi |
from typing import Dict, List, NoReturn, Optional, final
from .base import BaseService
class PrintMixin:
"""Mixin class for printing data"""
@final
def __repr__(self) -> str:
object_methods = [
method_name
for method_name in dir(self)
if callable(getattr(self,... | /redash_python_modification-0.0.3-py3-none-any.whl/redash_python_modification/services/mixins.py | 0.91116 | 0.210381 | mixins.py | pypi |
import json
import logging
import requests
from redash.query_runner import (TYPE_INTEGER, TYPE_STRING, TYPE_FLOAT,
BaseSQLQueryRunner, register)
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
TYPES_MAP = {
bool: TYPE_INTEGER,
str: TYPE_STRING,
... | /redash-stmo-swathi-2018.24.8.tar.gz/redash-stmo-swathi-2018.24.8/src/redash_stmo/query_runner/activedata.py | 0.547464 | 0.188604 | activedata.py | pypi |
import json
import logging
from redash.handlers.base import BaseResource, get_object_or_404
from redash.models import DataSource
from redash.permissions import require_access, view_only
from redash_stmo.resources import add_resource
DATASOURCE_URLS = {
"bigquery": "https://cloud.google.com/bigquery/docs/reference... | /redash_stmo-2020.5.1-py3-none-any.whl/redash_stmo/data_sources/details/extension.py | 0.53048 | 0.319612 | extension.py | pypi |
import json
import logging
import requests
from redash.query_runner import (
TYPE_FLOAT,
TYPE_INTEGER,
TYPE_STRING,
BaseSQLQueryRunner,
register,
)
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
TYPES_MAP = {
bool: TYPE_INTEGER,
int: TYPE_INTEGER,
bytes: TYP... | /redash_stmo-2020.5.1-py3-none-any.whl/redash_stmo/query_runner/activedata.py | 0.548553 | 0.217171 | activedata.py | pypi |
from datetime import datetime, timedelta
from collections import namedtuple
def get_frontend_vals():
'''Returns a named tuple of dynamic date ranges that match Redash's front-end
'''
ranges = calculate_ranges()
singles = calculate_singletons()
valkeys = [k for k in ranges.keys()] + [k for k in singles.keys()]
... | /redash_toolbelt-0.1.9.tar.gz/redash_toolbelt-0.1.9/redash_toolbelt/date_ranges.py | 0.520496 | 0.257135 | date_ranges.py | pypi |
redash-migrate - Move data from one instance of Redash to another
- [INSTALLATION](#installation)
- [DESCRIPTION](#description)
- [METAFILE](#meta.json)
- [SETTINGS](#settings)
- [READING THE METAFILE](#reading-the-metafile)
- [FIRST USER](#first-user)
- [DATA SOURCES](#data-sources)
- [COMMANDS](#commands)
... | /redash_toolbelt-0.1.9.tar.gz/redash_toolbelt-0.1.9/redash_toolbelt/docs/redash-migrate/README.md | 0.692018 | 0.845049 | README.md | pypi |
import click
from redash_toolbelt import Redash, get_frontend_vals
def refresh_dashboard(baseurl, apikey, slug):
client = Redash(baseurl, apikey)
todays_dates = get_frontend_vals()
queries_dict = get_queries_on_dashboard(client, slug)
# loop through each query and its JSON data
for idx, qry in q... | /redash_toolbelt-0.1.9.tar.gz/redash_toolbelt-0.1.9/redash_toolbelt/examples/refresh_dashboard.py | 0.552057 | 0.227856 | refresh_dashboard.py | pypi |
import itertools
import json
import re
import click
import pytest
from redash_toolbelt import Redash
def find_table_names(url, key, data_source_id):
client = Redash(url, key)
schema_tables = [
token.get("name")
for token in client._get(f"api/data_sources/{data_source_id}/schema")
.... | /redash_toolbelt-0.1.9.tar.gz/redash_toolbelt-0.1.9/redash_toolbelt/examples/find_table_names.py | 0.526586 | 0.324276 | find_table_names.py | pypi |
import click
from redash_toolbelt import Redash
def duplicate(client, slug, prefix=None):
"""Creates a blank dashboard, duplicates the original's queries,
and populates it with fresh widgets that mirror the original widgets.
"""
# Copped this logic directly from Redash.duplicate_dashboard
curren... | /redash_toolbelt-0.1.9.tar.gz/redash_toolbelt-0.1.9/redash_toolbelt/examples/clone_dashboard_and_queries.py | 0.621311 | 0.186854 | clone_dashboard_and_queries.py | pypi |
# Redasher-ja
This project was forked from [Redasher](https://github.com/Som-Energia/redasher), designed for Japanese-titled redash objects.
This tool manages Redash objects as files,
enabling version control and having development environments.
The purpose of this tool is to serialize [Redash](http://redash.io) obj... | /redasher-ja-1.0.0.tar.gz/redasher-ja-1.0.0/README.md | 0.425009 | 0.9455 | README.md | pypi |
from yamlns import namespace as ns
from pathlib import Path
import cutlet
katsu = cutlet.Cutlet()
class Mapper(object):
"""Keeps track of the binding of server objects
with file paths.
"""
def __init__(self, repopath, servername):
self.repopath = repopath
self.servername = servername
... | /redasher-ja-1.0.0.tar.gz/redasher-ja-1.0.0/redasher_ja/mapper.py | 0.70619 | 0.176033 | mapper.py | pypi |
# Redasher
This tool manages Redash objects as files,
enabling version control and having development environments.
The purpose of this tool is to serialize [Redash](http://redash.io) objects
(dashboards, queries, visualizations...)
into the filesystem so that they can be maintained using tools like Git.
You might us... | /redasher-1.0.3.tar.gz/redasher-1.0.3/README.md | 0.510741 | 0.924858 | README.md | pypi |
from typing import Any, Iterator, Type, TypeVar
from pymongo.collection import Collection as PymongoCollection
from redb.core import Document
from redb.interface.collection import Collection, Json, OptionalJson, ReturnType
from redb.interface.errors import DocumentNotFound
from redb.interface.fields import CompoundIn... | /redb_odm-1.3.3-py3-none-any.whl/redb/mongo_system/collection.py | 0.867668 | 0.186724 | collection.py | pypi |
import json
import sys
from pathlib import Path
from typing import Any, Type
from redb.core import BaseDocument, Document
from redb.interface.errors import DocumentNotFound
from redb.interface.collection import Collection, Json, OptionalJson, ReturnType
from redb.interface.fields import CompoundIndex, PyMongoOperation... | /redb_odm-1.3.3-py3-none-any.whl/redb/json_system/collection.py | 0.698227 | 0.169337 | collection.py | pypi |
from functools import lru_cache
from typing import Any, Type, TypeVar
from migo.collection import BatchDocument
from migo.collection import Collection as MigoDriverCollection
from migo.collection import Document as MigoDocument
from migo.collection import Field as MigoField
from migo.collection import Filter as MigoFi... | /redb_odm-1.3.3-py3-none-any.whl/redb/migo_system/collection.py | 0.730963 | 0.170335 | collection.py | pypi |
import types
from enum import Enum
from typing import Any, Type, TypeVar
from pydantic import BaseModel
from pydantic.fields import ModelField
T = TypeVar("T", bound=BaseModel)
DEFAULT_CONTAINER_VALUES = {"list": [], "tuple": (), "set": set()}
DEFAULT_PRIMITIVE_VALUES = {
"str": "string",
"float": 0.0,
"... | /redb_odm-1.3.3-py3-none-any.whl/redb/core/utils.py | 0.584983 | 0.196479 | utils.py | pypi |
from abc import ABC, abstractmethod
from typing import Any, Type, TypeAlias
from redb.core import BaseDocument
from .fields import CompoundIndex, PyMongoOperations
from .results import (
BulkWriteResult,
DeleteManyResult,
DeleteOneResult,
InsertManyResult,
InsertOneResult,
ReplaceOneResult,
... | /redb_odm-1.3.3-py3-none-any.whl/redb/interface/collection.py | 0.888348 | 0.184584 | collection.py | pypi |
from dataclasses import dataclass
from enum import Enum
from types import UnionType
from typing import Any, ForwardRef, Literal, TypeVar, Union, _UnionGenericAlias
import pymongo
from bson import DBRef as BsonDBRef
from bson import ObjectId as BsonObjectId
from pydantic import BaseModel
from pydantic.fields import Fie... | /redb_odm-1.3.3-py3-none-any.whl/redb/interface/fields.py | 0.862424 | 0.160233 | fields.py | pypi |
import numpy as np
import kilonovanet as knnet
from collections import namedtuple
from redback_surrogates.utils import citation_wrapper, convert_to_observer_frame
import os
dirname = os.path.dirname(__file__)
@citation_wrapper('https://ui.adsabs.harvard.edu/abs/2022MNRAS.516.1137L/abstract')
def bulla_bns_kilonovanet_... | /redback_surrogates-0.1-py3-none-any.whl/redback_surrogates/kilonovamodels.py | 0.744471 | 0.388212 | kilonovamodels.py | pypi |
# 
# What is this?
Redbiom is a cache service for sample metadata and sample data. It allows for rapidly:
* finding samples by the features they contain
* finding samples by arbitrary metadata searches
* summarizing samples over metadata
* ... | /redbiom-0.3.9.tar.gz/redbiom-0.3.9/README.md | 0.893123 | 0.927626 | README.md | pypi |
from enum import Enum
from .apiresponses import RedBirdObject
from .rb_utils import *
class LoginTraderReq(RedBirdObject):
"""
登录交易软件的请求对象
"""
def __init__(self, brokerages, accountNo,tradePasswd, CommPasswd):
"""
初始化函数
:param brokerages: 开户券商
:param accountNo: 登录客户号/... | /redbird-sdk-python-1.0.1.tar.gz/redbird-sdk-python-1.0.1/redbird_sdk/apirequests.py | 0.475849 | 0.302558 | apirequests.py | pypi |
try: import simplejson as json
except ImportError: import json
class RedBirdObject(object):
"""Base RedBird Response Object."""
def __repr__(self):
return "{clazz}::{obj}".format(clazz=self.__class__.__name__, obj=self.to_json())
def __eq__(self, other):
try:
return self.__d... | /redbird-sdk-python-1.0.1.tar.gz/redbird-sdk-python-1.0.1/redbird_sdk/apiresponses.py | 0.694095 | 0.348839 | apiresponses.py | pypi |
import re
import email
import imaplib
from datetime import datetime
from email import message
from email.policy import default as default_policy
from typing import Dict, List, Optional, Union
from pydantic import BaseModel, Field, PrivateAttr, validator
from redbox.utils.inspector import Inspector
# https://datatracke... | /redbox2-0.2.3-py3-none-any.whl/redbox/models/message.py | 0.799599 | 0.157622 | message.py | pypi |
from copy import copy
from typing import Dict
class BaseQuery:
def __and__(self, other):
return ALL(self, other)
def __or__(self, other):
return OR(self, other)
def __invert__(self):
return NOT(self)
class BaseField(BaseQuery):
_fields = {}
def __init__(self, name):
... | /redbox2-0.2.3-py3-none-any.whl/redbox/query/query.py | 0.839701 | 0.21984 | query.py | pypi |
# Robin's python utilities
<img src="https://github.com/binnev/redbreast/raw/main/logo.png"/>
### Installation
```
pip install redbreast
```
## QueryList
Do you want that sweet Django QuerySet filtering, but your objects aren't in a database, and you also don't want to
write a filter / list comprehension? The Quer... | /redbreast-1.1.5.tar.gz/redbreast-1.1.5/README.md | 0.466603 | 0.780579 | README.md | pypi |
import os
import json
from typing import Dict, Tuple
import numpy as np
import tqdm
import imageio
from redbrick_sagemaker.utils.redbrick import create_taxonomy_map
from .im2rec import run_im2rec
def convert_sagemaker_rbai_bbox( # pylint: disable=too-many-locals
prediction_dir: str,
tasks: Dict,
taxon... | /redbrick_sagemaker-0.0.4-py3-none-any.whl/redbrick_sagemaker/utils/bbox.py | 0.747063 | 0.497253 | bbox.py | pypi |
from typing import Any, Optional
def construct_training_job(
training_image: Any,
train_uri: str,
validation_uri: str,
bucket: str,
num_classes: int,
num_training_samples: int,
sagemaker_role: str,
max_epochs: Optional[int] = 200,
instance_type: Optional[str] = "ml.p2.xlarge",
):
... | /redbrick_sagemaker-0.0.4-py3-none-any.whl/redbrick_sagemaker/utils/sagemaker.py | 0.902884 | 0.601418 | sagemaker.py | pypi |
import json
import os
from typing import Any, Dict, Optional, Tuple
import boto3
import boto3.session
import sagemaker
import sagemaker.transformer
from sagemaker import get_execution_role
from sagemaker.amazon.amazon_estimator import get_image_uri
from redbrick_sagemaker.utils.sagemaker import (
construct_train... | /redbrick_sagemaker-0.0.4-py3-none-any.whl/redbrick_sagemaker/sagemaker_client/public.py | 0.80329 | 0.161519 | public.py | pypi |
from typing import Dict
from datetime import datetime
from dateutil import parser # type: ignore
import tenacity
from tenacity.retry import retry_if_not_exception_type
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_exponential
from redbrick.common.constants import PEERLESS_ERRORS
from re... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/workspace.py | 0.88251 | 0.202305 | workspace.py | pypi |
from typing import Dict, List, Optional, Tuple
from datetime import datetime
from dateutil import parser # type: ignore
import tenacity
from tenacity.retry import retry_if_not_exception_type
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_exponential
from redbrick.common.constants import P... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/project.py | 0.894179 | 0.23156 | project.py | pypi |
import asyncio
import re
import shutil
from typing import Iterator, List, Dict, Optional, Set, Tuple, Any
from functools import partial
import os
import json
import copy
from datetime import datetime, timezone
import aiohttp
import tqdm # type: ignore
from redbrick.common.constants import MAX_CONCURRENCY
from redbri... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/export/public.py | 0.777342 | 0.175432 | public.py | pypi |
import os
from typing import Optional
from rich.console import Console
from redbrick import _populate_context
from redbrick.common.context import RBContext
from redbrick.organization import RBOrganization
from redbrick.project import RBProject
from redbrick.cli.entity import CLICache, CLIConfiguration, CLICredentials... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/project.py | 0.79166 | 0.189671 | project.py | pypi |
from abc import ABC, abstractmethod
from typing import Optional
from argparse import Namespace
from redbrick.cli.project import CLIProject
from redbrick.utils.logging import logger
class CLIInputParams(ABC):
"""CLI Input params handler."""
entity: Optional[str]
error_message: str
@abstractmethod
... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/cli_base.py | 0.962616 | 0.244543 | cli_base.py | pypi |
import os
from typing import Dict, List
from configparser import ConfigParser
from redbrick.common.context import RBContext
class CLICredentials:
"""CLICredentials entity."""
_creds_file: str
_creds: ConfigParser
ENV_VAR: str = "REDBRICK_PROFILE"
DEFAULT_PROFILE: str = "default"
def __init... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/entity/creds.py | 0.843283 | 0.164785 | creds.py | pypi |
import os
import re
from argparse import ArgumentParser, Namespace
from rich.console import Console
from redbrick.cli.input.select import CLIInputSelect
from redbrick.cli.project import CLIProject
from redbrick.cli.cli_base import CLICloneInterface
from redbrick.organization import RBOrganization
from redbrick.projec... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/command/clone.py | 0.524395 | 0.158565 | clone.py | pypi |
from argparse import ArgumentParser, Namespace
from typing import List, Tuple
from rich.console import Console
from rich.table import Table
from rich.box import ROUNDED
import shtab
from redbrick.cli.input.text import CLIInputText
from redbrick.cli.input.uuid import CLIInputUUID
from redbrick.cli.project import CLIPr... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/command/info.py | 0.717705 | 0.198161 | info.py | pypi |
import os
import re
import json
import asyncio
from argparse import ArgumentError, ArgumentParser, Namespace
from typing import List, Dict, Optional, Union
from redbrick.cli.input.select import CLIInputSelect
from redbrick.cli.project import CLIProject
from redbrick.cli.cli_base import CLIUploadInterface
from redbrick... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/command/upload.py | 0.73659 | 0.16896 | upload.py | pypi |
import os
from argparse import ArgumentParser, Namespace
from typing import List
from rich.console import Console
from redbrick.cli.input import CLIInputNumber, CLIInputSelect, CLIInputText
from redbrick.cli.project import CLIProject
from redbrick.cli.cli_base import CLIInitInterface
from redbrick.organization import... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/cli/command/init.py | 0.658198 | 0.154983 | init.py | pypi |
from typing import Optional, List, Dict
import aiohttp
from redbrick.common.client import RBClient
from redbrick.common.labeling import LabelingControllerInterface
class LabelingRepo(LabelingControllerInterface):
"""Implementation of manual labeling apis."""
def __init__(self, client: RBClient) -> None:
... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/repo/labeling.py | 0.862496 | 0.189071 | labeling.py | pypi |
from typing import Dict
from redbrick.common.client import RBClient
from redbrick.common.workspace import WorkspaceRepoInterface
class WorkspaceRepo(WorkspaceRepoInterface):
"""Class to manage interaction with workspace APIs."""
def __init__(self, client: RBClient) -> None:
"""Construct WorkspaceRep... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/repo/workspace.py | 0.819965 | 0.258002 | workspace.py | pypi |
from typing import Optional, List, Dict, Sequence, Tuple
from datetime import datetime
from dateutil import parser # type: ignore
import aiohttp
from redbrick.common.export import ExportControllerInterface, TaskFilterParams
from redbrick.common.client import RBClient
from redbrick.repo.shards import datapoint_shard,... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/repo/export.py | 0.902369 | 0.218357 | export.py | pypi |
import json
from typing import List, Dict, Optional, Any
import aiohttp
from redbrick.common.client import RBClient
from redbrick.common.upload import UploadControllerInterface
class UploadRepo(UploadControllerInterface):
"""Handle communication with backend relating to uploads."""
def __init__(self, clien... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/repo/upload.py | 0.837885 | 0.212845 | upload.py | pypi |
import json
from typing import List, Dict, Tuple, Optional
from datetime import datetime
from redbrick.common.client import RBClient
from redbrick.common.project import ProjectRepoInterface
from redbrick.repo.shards import PROJECT_SHARD, TAXONOMY_SHARD
class ProjectRepo(ProjectRepoInterface):
"""Class to manage ... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/repo/project.py | 0.803328 | 0.161353 | project.py | pypi |
from datetime import datetime
from functools import partial
from typing import List, Optional, Dict, Union
from tqdm import tqdm # type: ignore
from redbrick.common.context import RBContext
from redbrick.project import RBProject
from redbrick.workspace import RBWorkspace
from redbrick.utils.logging import logger
from... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/organization/__init__.py | 0.91985 | 0.295497 | __init__.py | pypi |
from typing import Dict, List, Optional
def format_taxonomy(taxonomy: Dict) -> Dict:
"""Parse taxonomy object."""
keys = ["orgId", "name", "createdAt", "archived", "isNew"]
if taxonomy["isNew"]:
keys.extend(
[
"taxId",
"studyClassify",
"s... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/rb_tax_utils.py | 0.882092 | 0.412885 | rb_tax_utils.py | pypi |
from typing import List, Dict
from redbrick.common.enums import TaskEventTypes
from redbrick.utils.rb_label_utils import user_format
def comment_format(comment: Dict, users: Dict[str, str]) -> Dict:
"""Comment format."""
return {
"commentId": comment["commentId"],
"commentText": comment["text... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/rb_event_utils.py | 0.552178 | 0.153613 | rb_event_utils.py | pypi |
import asyncio
from typing import Any, Awaitable, Coroutine, List, Tuple, TypeVar, Optional, Iterable
import tqdm.asyncio # type: ignore
from redbrick.common.constants import MAX_CONCURRENCY
ReturnType = TypeVar("ReturnType") # pylint: disable=invalid-name
async def gather_with_concurrency(
max_concurrency: i... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/async_utils.py | 0.713232 | 0.236362 | async_utils.py | pypi |
import os
import gzip
from typing import Dict, List, Optional, Tuple, Set
import asyncio
import aiohttp
from yarl import URL
from tenacity import Retrying, RetryError
from tenacity.retry import retry_if_not_exception_type
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_random_exponential
fr... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/files.py | 0.63861 | 0.21099 | files.py | pypi |
import os
import json
import asyncio
from uuid import uuid4
from typing import List, Dict, Union, Optional, Sequence
import aiohttp
from redbrick.common.context import RBContext
from redbrick.utils.common_utils import config_path
from redbrick.utils.files import NIFTI_FILE_TYPES, download_files, upload_files
from red... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/upload.py | 0.741861 | 0.201617 | upload.py | pypi |
import os
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from asyncio import BoundedSemaphore
import shutil
from redbrick.utils.common_utils import config_path
from redbrick.utils.files import uniquify_path
from redbrick.utils.logging import log_error
semaphore = BoundedSemaphore(1)
async def proc... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/dicom.py | 0.644337 | 0.287743 | dicom.py | pypi |
from typing import Any, Dict, List, Optional
import json
def clean_rb_label(label: Dict) -> Dict:
"""Clean any None fields."""
for key, val in label.copy().items():
if val is None:
del label[key]
return label
def user_format(user: Optional[str], users: Dict[str, str]) -> Optional[str... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/rb_label_utils.py | 0.833934 | 0.238839 | rb_label_utils.py | pypi |
from typing import Any, Dict, List, Optional, Callable, Tuple
class PaginationIterator:
"""Construct Labelset Iterator."""
def __init__(
self,
func: Callable[[int, Optional[str]], Tuple[List[Dict], Optional[str]]],
concurrency: int = 10,
limit: Optional[int] = None,
) -> ... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/utils/pagination.py | 0.927798 | 0.357764 | pagination.py | pypi |
import functools
from inspect import signature
import json
import asyncio
from typing import Callable, List, Dict, Optional, Any, TypeVar, cast
from copy import deepcopy
import aiohttp
from redbrick.common.context import RBContext
from redbrick.common.enums import StorageMethod
from redbrick.utils.upload import proce... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/labeling/public.py | 0.827863 | 0.240741 | public.py | pypi |
import shutil
import asyncio
import os
import sys
from copy import deepcopy
from typing import List, Dict, Optional, Set
import json
import aiohttp
import tenacity
from tenacity.stop import stop_after_attempt
import tqdm # type: ignore
from redbrick.common.context import RBContext
from redbrick.common.constants impo... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/upload/public.py | 0.590425 | 0.226987 | public.py | pypi |
from typing import Optional, List, Dict
from abc import ABC, abstractmethod
import aiohttp
class LabelingControllerInterface(ABC):
"""Abstract interface to Labeling APIs."""
@abstractmethod
def get_labeling_tasks(
self, org_id: str, project_id: str, stage_name: str, count: int = 5
) -> List[D... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/labeling.py | 0.959535 | 0.272445 | labeling.py | pypi |
import time
import json
import base64
import gzip
from typing import Dict
import requests # type: ignore
import aiohttp
import tenacity
from tenacity.retry import retry_if_not_exception_type
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_exponential
from redbrick import __version__ as sd... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/client.py | 0.792946 | 0.15876 | client.py | pypi |
from typing import Optional, List, Dict, Sequence, Tuple, TypedDict
from abc import ABC, abstractmethod
from datetime import datetime
import aiohttp
from redbrick.common.enums import ReviewStates, TaskStates
class TaskFilterParams(TypedDict, total=False):
"""Task filter query."""
status: TaskStates
ta... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/export.py | 0.971252 | 0.401277 | export.py | pypi |
from typing import List, Dict, Optional, Any
from abc import ABC, abstractmethod
import aiohttp
class UploadControllerInterface(ABC):
"""Abstract interface to define methods for Upload."""
@abstractmethod
async def create_datapoint_async(
self,
aio_client: aiohttp.ClientSession,
... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/upload.py | 0.964102 | 0.314471 | upload.py | pypi |
from enum import Enum
class StorageMethod:
"""Built-in Storage Method ID's that can be used to import data.
- ``PUBLIC`` - Access files from a public cloud storage service or local storage.
- ``REDBRICK`` - Access files from the RedBrickAI servers.
"""
PUBLIC = "11111111-1111-1111-1111-111111111... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/enums.py | 0.827759 | 0.349588 | enums.py | pypi |
from datetime import datetime
from typing import Dict, List, Tuple, Optional
from abc import ABC, abstractmethod
class ProjectRepoInterface(ABC):
"""Abstract interface to Project APIs."""
@abstractmethod
def get_project(self, org_id: str, project_id: str) -> Dict:
"""
Get project name and... | /redbrick_sdk-2.13.8-py3-none-any.whl/redbrick/common/project.py | 0.963874 | 0.368235 | project.py | pypi |
import math
import os
import json
import re
import gzip
import random
from typing import Dict, List, no_type_check
from uuid import uuid4
import asyncio
import qt # type: ignore
import slicer # type: ignore
from DICOMLib import DICOMUtils # type: ignore
from redbrick_slicer.common.context import RBContext
from red... | /redbrick-slicer-0.1.3.tar.gz/redbrick-slicer-0.1.3/redbrick_slicer/slicer.py | 0.669637 | 0.195172 | slicer.py | pypi |
from typing import Dict
import tenacity
from redbrick_slicer.common.context import RBContext
class RBProject:
"""
Interact with a RedBrick project.
Attributes
-----------
export: redbrick_slicer.export.Export
Interface for managing exporting data and
labels from your redbrick_sl... | /redbrick-slicer-0.1.3.tar.gz/redbrick-slicer-0.1.3/redbrick_slicer/project.py | 0.894689 | 0.279139 | project.py | pypi |
import json
from typing import Dict, Tuple, List, Optional
from redbrick_slicer.common.context import RBContext
def _clean_rb_label(label: Dict) -> Dict:
"""Clean any None fields."""
for key, val in label.copy().items():
if val is None:
del label[key]
return label
def _flat_rb_forma... | /redbrick-slicer-0.1.3.tar.gz/redbrick-slicer-0.1.3/redbrick_slicer/export/public.py | 0.770162 | 0.218659 | public.py | pypi |
from typing import Optional, Dict
from redbrick_slicer.common.client import RBClient
from redbrick_slicer.common.labeling import LabelingControllerInterface
class LabelingRepo(LabelingControllerInterface):
"""Implementation of manual labeling apis."""
def __init__(self, client: RBClient) -> None:
""... | /redbrick-slicer-0.1.3.tar.gz/redbrick-slicer-0.1.3/redbrick_slicer/repo/labeling.py | 0.882269 | 0.170197 | labeling.py | pypi |
import json
from typing import Dict, Optional
import gzip
import requests
from redbrick_slicer.common.context import RBContext
class Labeling:
"""
Perform programmatic labeling and review tasks.
The Labeling class allows you to programmatically submit tasks.
This can be useful for times when you wan... | /redbrick-slicer-0.1.3.tar.gz/redbrick-slicer-0.1.3/redbrick_slicer/labeling/public.py | 0.847558 | 0.266366 | public.py | pypi |
from typing import Any, Sequence, Union
def format_doc(**kwargs):
"""
Decorator which calls :method:`str.format_map` with *kwargs* to interpolate
variables into the docstring of the decorated function.
This should be used sparingly, but it can be useful, for example, to
incorporate shared constan... | /redcap_client-0.1.2-py3-none-any.whl/redcap_client/utils.py | 0.957804 | 0.393618 | utils.py | pypi |
import json
from datetime import datetime
from typing import Iterable
from uuid import UUID
from .utils import contextualize_char, shorten_left
def as_json(value):
"""
Converts *value* to a JSON string using our custom :class:`JsonEncoder`.
"""
return json.dumps(value, allow_nan = False, cls = JsonEnc... | /redcap_client-0.1.2-py3-none-any.whl/redcap_client/json.py | 0.874084 | 0.366958 | json.py | pypi |
import io
from .errors import DiscordException
from .errors import InvalidArgument
from . import utils
VALID_STATIC_FORMATS = frozenset({"jpeg", "jpg", "webp", "png"})
VALID_AVATAR_FORMATS = VALID_STATIC_FORMATS | {"gif"}
class Asset:
"""Represents a CDN asset on Discord.
.. container:: operations
.... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/asset.py | 0.751466 | 0.232082 | asset.py | pypi |
import datetime
from .asset import Asset
from .enums import ActivityType, try_enum
from .colour import Colour
from .partial_emoji import PartialEmoji
from .utils import _get_as_snowflake
__all__ = (
'BaseActivity',
'Activity',
'Streaming',
'Game',
'Spotify',
'CustomActivity',
)
"""If curious,... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/activity.py | 0.797557 | 0.292978 | activity.py | pypi |
"""Some documentation to refer to:
- Our main web socket (mWS) sends opcode 4 with a guild ID and channel ID.
- The mWS receives VOICE_STATE_UPDATE and VOICE_SERVER_UPDATE.
- We pull the session_id from VOICE_STATE_UPDATE.
- We pull the token, endpoint and server_id from VOICE_SERVER_UPDATE.
- Then we initiate the voi... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/voice_client.py | 0.891031 | 0.424531 | voice_client.py | pypi |
from .asset import Asset
from . import utils
from .partial_emoji import _EmojiTag
from .user import User
class Emoji(_EmojiTag):
"""Represents a custom emoji.
Depending on the way this object was created, some of the attributes can
have a value of ``None``.
.. container:: operations
.. descr... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/emoji.py | 0.875853 | 0.275076 | emoji.py | pypi |
import time
import random
class ExponentialBackoff:
"""An implementation of the exponential backoff algorithm
Provides a convenient interface to implement an exponential backoff
for reconnecting or retrying transmissions in a distributed network.
Once instantiated, the delay method will return the ne... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/backoff.py | 0.895882 | 0.486088 | backoff.py | pypi |
from . import utils, enums
from .object import Object
from .permissions import PermissionOverwrite, Permissions
from .colour import Colour
from .invite import Invite
from .mixins import Hashable
def _transform_verification_level(entry, data):
return enums.try_enum(enums.VerificationLevel, data)
def _transform_def... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/audit_logs.py | 0.601945 | 0.192824 | audit_logs.py | pypi |
from .asset import Asset
from .utils import parse_time, snowflake_time, _get_as_snowflake
from .object import Object
from .mixins import Hashable
from .enums import ChannelType, VerificationLevel, try_enum
class PartialInviteChannel:
"""Represents a "partial" invite channel.
This model will be given when the ... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/invite.py | 0.903399 | 0.481759 | invite.py | pypi |
import time
import asyncio
import discord.abc
from .permissions import Permissions
from .enums import ChannelType, try_enum, VoiceRegion
from .mixins import Hashable
from . import utils
from .asset import Asset
from .errors import ClientException, NoMoreItems, InvalidArgument
__all__ = (
'TextChannel',
'Voice... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/channel.py | 0.845783 | 0.285391 | channel.py | pypi |
from .utils import snowflake_time, _get_as_snowflake, resolve_invite
from .user import BaseUser
from .activity import create_activity
from .invite import Invite
from .enums import Status, try_enum
class WidgetChannel:
"""Represents a "partial" widget channel.
.. container:: operations
.. describe:: x... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/widget.py | 0.882225 | 0.35973 | widget.py | pypi |
import datetime
from .utils import _get_as_snowflake, get, parse_time
from .user import User
from .errors import InvalidArgument
from .enums import try_enum, ExpireBehaviour
class IntegrationAccount:
"""Represents an integration account.
.. versionadded:: 1.4
Attributes
-----------
id: :class:`in... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/integrations.py | 0.747708 | 0.29197 | integrations.py | pypi |
from .permissions import Permissions
from .errors import InvalidArgument
from .colour import Colour
from .mixins import Hashable
from .utils import snowflake_time, _get_as_snowflake
class RoleTags:
"""Represents tags on a role.
A role tag is a piece of extra information attached to a managed role
that giv... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/role.py | 0.9202 | 0.423875 | role.py | pypi |
class DiscordException(Exception):
"""Base exception class for redcord.py
Ideally speaking, this could be caught to handle any exceptions thrown from this library.
"""
pass
class ClientException(DiscordException):
"""Exception that's thrown when an operation in the :class:`Client` fails.
Thes... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/errors.py | 0.856992 | 0.171234 | errors.py | pypi |
class _RawReprMixin:
def __repr__(self):
value = ' '.join('%s=%r' % (attr, getattr(self, attr)) for attr in self.__slots__)
return '<%s %s>' % (self.__class__.__name__, value)
class RawMessageDeleteEvent(_RawReprMixin):
"""Represents the event payload for a :func:`on_raw_message_delete` event.
... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/raw_models.py | 0.803135 | 0.156201 | raw_models.py | pypi |
class _FakeBool:
def __repr__(self):
return 'True'
def __eq__(self, other):
return other is True
def __bool__(self):
return True
default = _FakeBool()
class AllowedMentions:
"""A class that represents what mentions are allowed in a message.
This class can be set during :... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/mentions.py | 0.915879 | 0.397646 | mentions.py | pypi |
from collections import namedtuple
import discord.abc
from .flags import PublicUserFlags
from .utils import snowflake_time, _bytes_to_base64_data, parse_time
from .enums import DefaultAvatar, RelationshipType, UserFlags, HypeSquadHouse, PremiumType, try_enum
from .errors import ClientException
from .colour import Colo... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/user.py | 0.870941 | 0.165458 | user.py | pypi |
from .iterators import ReactionIterator
class Reaction:
"""Represents a reaction to a message.
Depending on the way this object was created, some of the attributes can
have a value of ``None``.
.. container:: operations
.. describe:: x == y
Checks if two reactions are equal. Thi... | /redcord.py-1.7.3.tar.gz/redcord.py-1.7.3/discord/reaction.py | 0.94323 | 0.519034 | reaction.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.