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 __future__ import annotations
import sys
from typing import Final
if sys.version_info >= (3, 11):
from enum import StrEnum
else:
from backports.strenum import StrEnum
LIVE_SESSION_PROPERTIES: Final[set[str]] = {
"chargerId",
"current",
"currentCurrency",
"currentMiles",
"currentPrice... | /rivian_python_client-1.0.4.tar.gz/rivian_python_client-1.0.4/src/rivian/const.py | 0.527803 | 0.230238 | const.py | pypi |
from __future__ import annotations
import asyncio
import logging
from collections.abc import Awaitable, Callable
from datetime import datetime, timezone
from json import loads
from random import uniform
from typing import TYPE_CHECKING, Any
from uuid import uuid4
import async_timeout
from aiohttp import ClientWebSock... | /rivian_python_client-1.0.4.tar.gz/rivian_python_client-1.0.4/src/rivian/ws_monitor.py | 0.812942 | 0.153296 | ws_monitor.py | pypi |
from __future__ import annotations
import hashlib
import hmac
from base64 import b64decode, b64encode
from typing import cast
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
def base64_... | /rivian_python_client-1.0.4.tar.gz/rivian_python_client-1.0.4/src/rivian/utils.py | 0.931392 | 0.193967 | utils.py | pypi |
import re
from rivr.http import Http404
from rivr_rest.resource import Resource
EXTRACT_VARIABLE_REGEX = re.compile(r'\{([\w]+)\}')
def extract(uri_template, uri):
"""
Reverse URI Template implementation.
Note, only simple variable templates are currently supported.
"""
if uri == uri_template:
... | /rivr-rest-0.1.0.tar.gz/rivr-rest-0.1.0/rivr_rest/router.py | 0.514644 | 0.248956 | router.py | pypi |
<!--
Copyright (c) 2016, RivuletStudio, The University of Sydney, AU
All rights reserved.
This file is part of Rivuletpy <https://github.com/RivuletStudio/rivuletpy>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
... | /rivuletpy-0.3.0.tar.gz/rivuletpy-0.3.0/README.md | 0.620852 | 0.650384 | README.md | pypi |
from dataclasses import dataclass
@dataclass(frozen=True)
class Interval:
start:int
end:int
def __post_init__(self):
"""Assures correct ordering of start and end"""
a,b = self.start,self.end
object.__setattr__(self,"start",min(a,b))
object.__setattr__(self,"end",max(a,b... | /rizoma_utils-0.0.1-py3-none-any.whl/rizomath/interval.py | 0.775817 | 0.293759 | interval.py | pypi |
**This project is still under construction**
# Table of Contents
- [Motivation](#motivation)
- [Requirements](#requirements)
- [Installation](#installation)
* [Installation through PyPi (Recommended)](#installation-through-pypi-recommended)
* [Installation through Github](#installation-through-github)
* [But I r... | /rizpass-0.0.5.tar.gz/rizpass-0.0.5/README.md | 0.577019 | 0.831006 | README.md | pypi |
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of... | /rizpass-0.0.5.tar.gz/rizpass-0.0.5/CODE_OF_CONDUCT.md | 0.57344 | 0.683964 | CODE_OF_CONDUCT.md | pypi |
from collections import namedtuple
modes_prompt = ('Mode options:\n'
' (Ionian)\n'
' (Dorian)\n'
' (Phrygian)\n'
' (Lydian)\n'
' (Mixolydian)\n'
' (Aeolian)\n'
' (Locrian)\n'
'\n'
... | /rizzless_guitar_guide-1.0.1a0-py3-none-any.whl/rizzless_guitar_guide/modestuff.py | 0.46223 | 0.292576 | modestuff.py | pypi |
from collections import namedtuple
scales_prompt = ('Scale options:\n'
' (Major)\n'
' (Major Pentatonic)\n'
' (Minor)\n'
' (Melodic Minor)\n'
' (Harmonic Minor)\n'
' (Minor Pentatonic)\n'
'\n'
... | /rizzless_guitar_guide-1.0.1a0-py3-none-any.whl/rizzless_guitar_guide/scalestuff.py | 0.704058 | 0.286281 | scalestuff.py | pypi |
interval_menu = ('Interval options:\n'
' (Interval Basics) Lists interval basics.\n'
' (Chord Basics) Shows the basics of how chords are created.\n'
' (Chord Progressions) Shows how to build progressions and shows\n'
'some popular chord progressions... | /rizzless_guitar_guide-1.0.1a0-py3-none-any.whl/rizzless_guitar_guide/intervalstuff.py | 0.537284 | 0.301955 | intervalstuff.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /rj_distributions-0.0.1.tar.gz/rj_distributions-0.0.1/rj_distributions/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
Part of a subless definition\"""
def _arg_name(self, p):
p.add_argument(
'--name',
type=str,
help="Name of person to greet",
default=self.DEFAULT_NAME)
)
The method is called for its side-effect on the parser object passed... | /rjgtoys_cli-0.0.3-py3-none-any.whl/rjgtoys/cli/_base.py | 0.787196 | 0.527377 | _base.py | pypi |
import os
from typing import List
from rjgtoys.xc import Error, Title
from rjgtoys.yaml import yaml_load_path
class ConfigSearchFailed(Error):
"""Raised when no configuration file could be found"""
paths: List[str] = Title('List of paths that were searched')
detail = "Configuration search failed, trie... | /rjgtoys_config-0.0.2-py3-none-any.whl/rjgtoys/config/_source.py | 0.802865 | 0.365145 | _source.py | pypi |
import collections.abc
from rjgtoys.thing import Thing
from copy import deepcopy
def config_normalise(raw):
"""Normalise a config object to make it easier to process later.
Ensure it has both 'defaults' and '__view__' entries, that
'defaults' is a single map, and '__view__' represents a merge
of an... | /rjgtoys_config-0.0.2-py3-none-any.whl/rjgtoys/config/_ops.py | 0.545286 | 0.34183 | _ops.py | pypi |
import collections.abc
class Thing(dict):
"""
A :class:`dict`-like thing that behaves like a JavaScript object;
attribute access and item access are equivalent. This makes writing
code that operates on things read from JSON or YAML much simpler
because there's no need to use lots of square bracke... | /rjgtoys_thing-0.0.1-py3-none-any.whl/rjgtoys/thing/__init__.py | 0.817064 | 0.387111 | __init__.py | pypi |
import os
import queue
import threading
import tkinter as tk
import logging
log = logging.getLogger(__name__)
class EventQueue(queue.Queue):
"""This is a subclass of the standard library :class:`queue.Queue`.
An :class:`~rjgtoys.tkthread.EventQueue` feeds any objects sent to it into a
handler function... | /rjgtoys_tkthread-0.0.1-py3-none-any.whl/rjgtoys/tkthread/__init__.py | 0.669529 | 0.337013 | __init__.py | pypi |
import collections
class Thing(dict):
"""
A :class:`dict`-like thing that behaves like a JavaScript object;
attribute access and item access are equivalent. This makes writing
code that operates on things read from JSON or YAML much simpler
because there's no need to use lots of square brackets a... | /rjgtoys_xc-0.0.3-py3-none-any.whl/rjgtoys/xc/_thing.py | 0.814459 | 0.323353 | _thing.py | pypi |
import urllib
import json
import string
from typing import Any
from pydantic import BaseModel, Field
from pydantic.fields import FieldInfo
from rjgtoys.xc._json import json_loads, json_dumps
def Title(t):
"""Simplifies model declarations a little."""
return Field(..., title=t)
class ImpliedFieldInfo(Fi... | /rjgtoys_xc-0.0.3-py3-none-any.whl/rjgtoys/xc/_xc.py | 0.80765 | 0.218649 | _xc.py | pypi |
import urllib
from ._xc import _XCBase, _XCType, _XCFormatter, Title, Implied
from ._raises import raises, may_raise, raises_exception
from ._json import json_loads, json_dumps
__all__ = (
'XC',
'Error',
'Title',
'Implied',
'raises',
'may_raise',
'raises_exception',
'BadExceptionBug'... | /rjgtoys_xc-0.0.3-py3-none-any.whl/rjgtoys/xc/__init__.py | 0.83901 | 0.306566 | __init__.py | pypi |
from typing import Union
from pydantic import BaseModel
from starlette.requests import Request
from starlette.responses import Response, JSONResponse
from starlette.routing import BaseRoute
from starlette.types import ASGIApp
from fastapi import routing, params
from fastapi.encoders import DictIntStrAny, SetIntStr
... | /rjgtoys_xc-0.0.3-py3-none-any.whl/rjgtoys/xc/fastapi.py | 0.891661 | 0.210178 | fastapi.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /rjh_distributions-0.1.tar.gz/rjh_distributions-0.1/rjh_distributions/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
u"""
=====================
Javascript Minifier
=====================
rJSmin is a javascript minifier written in python.
The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\\.
:Copyright:
Copyright 2011 - 2022
Andr\xe9 Malo or his licensors, as applicable
:License:
Licensed under the Apac... | /rjsmin-1.2.1.tar.gz/rjsmin-1.2.1/rjsmin.py | 0.827932 | 0.422445 | rjsmin.py | pypi |
u"""
=================================
Benchmark jsmin implementations
=================================
Benchmark jsmin implementations.
:Copyright:
Copyright 2011 - 2022
Andr\xe9 Malo or his licensors, as applicable
:License:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use th... | /rjsmin-1.2.1.tar.gz/rjsmin-1.2.1/bench/main.py | 0.603581 | 0.176849 | main.py | pypi |
u"""
=========================
Write benchmark results
=========================
Write benchmark results.
:Copyright:
Copyright 2014 - 2022
Andr\xe9 Malo or his licensors, as applicable
:License:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance wit... | /rjsmin-1.2.1.tar.gz/rjsmin-1.2.1/bench/write.py | 0.604049 | 0.242733 | write.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /rk_distributions-0.1.tar.gz/rk_distributions-0.1/rk_distributions/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
import numpy
import zfit
import matplotlib.pyplot as plt
import utils_noroot as utnr
from logzero import logger as log
from zutils.plot import plot as zfp
#--------------------------------
class extractor:
def __init__(self):
self._d_eff = None
self._cov = None
sel... | /rk_extractor-0.0.3-py3-none-any.whl/extractor.py | 0.571886 | 0.222204 | extractor.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /rk_udacity_distributions_package-1.0.tar.gz/rk_udacity_distributions_package-1.0/rk_udacity_distributions_package/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
def reverse_num(num):
"""Returns an integer
Reverse of a number passed as argument
"""
rev = 0
while num > 0:
rev = (rev * 10) + (num % 10)
num //= 10
return rev
def sum_of_digits(num):
"""Returns an integer
Sum of the digits of a number passed as argument
"""
s... | /rk_utility-0.0.1-py3-none-any.whl/rk_utility.py | 0.732783 | 0.792986 | rk_utility.py | pypi |
import math
import matplotlib.pyplot as plt
from .Generaldistribution import Distribution
class Gaussian(Distribution):
""" Gaussian distribution class for calculating and
visualizing a Gaussian distribution.
Attributes:
mean (float) representing the mean value of the distribution
stdev (float) representing ... | /rkb_probability-1.6-py3-none-any.whl/rkb_probability/Gaussiandistribution.py | 0.688364 | 0.853058 | Gaussiandistribution.py | pypi |
import os
from typing import List
from typing import Optional
from typing import Dict
from traceback import format_exc
from rkd.api.inputoutput import IO
from .expressions import safe_eval
from .exception import ProfileNotFoundException
from .exception import ServiceNotFoundInYaml
from .exception import ServiceNotFound... | /rkd_harbor-2.0.3-py3-none-any.whl/rkd_harbor/service.py | 0.74826 | 0.163646 | service.py | pypi |
import subprocess
from argparse import ArgumentParser
from typing import Dict
from rkd.api.contract import ExecutionContext
from .base import HarborBaseTask
from ..formatting import prod_formatting
class GatewayBaseTask(HarborBaseTask):
def configure_argparse(self, parser: ArgumentParser):
super().configu... | /rkd_harbor-2.0.3-py3-none-any.whl/rkd_harbor/tasks/gateway.py | 0.639173 | 0.150216 | gateway.py | pypi |
import subprocess
from typing import Dict
from argparse import ArgumentParser
from rkd.api.contract import ExecutionContext
from ...formatting import development_formatting
from .base import BaseDeploymentTask
class EditVaultTask(BaseDeploymentTask):
"""Edits an encrypted file
Example usage:
# edit ".env-pro... | /rkd_harbor-2.0.3-py3-none-any.whl/rkd_harbor/tasks/deployment/vault.py | 0.800302 | 0.178902 | vault.py | pypi |
from typing import List
from jsonschema import ValidationError
from .argparsing.model import TaskArguments
class ContextException(Exception):
pass
class TaskNotFoundException(ContextException):
pass
class TaskExecutionException(Exception):
pass
class InterruptExecution(TaskExecutionException):
p... | /rkd.core-0.0.0.tar.gz/rkd.core-0.0.0/rkd/core/exception.py | 0.903033 | 0.202778 | exception.py | pypi |
import os
import sys
from typing import Union
from subprocess import check_output, Popen, DEVNULL, CalledProcessError
from tempfile import NamedTemporaryFile
from abc import ABC as AbstractClass, abstractmethod
from copy import deepcopy
from rkd.process import check_call
from .api.inputoutput import IO
from . import en... | /rkd.core-0.0.0.tar.gz/rkd.core-0.0.0/rkd/core/taskutil.py | 0.553023 | 0.160727 | taskutil.py | pypi |
from typing import List, Dict, Optional
from copy import deepcopy
from .contract import TaskDeclarationInterface
from .contract import GroupDeclarationInterface
from .contract import TaskInterface
from .inputoutput import get_environment_copy
from ..argparsing.model import ArgumentBlock
from ..exception import Declarat... | /rkd.core-0.0.0.tar.gz/rkd.core-0.0.0/rkd/core/api/syntax.py | 0.837603 | 0.242183 | syntax.py | pypi |
from copy import deepcopy
from typing import List, Dict
class TaskArguments(object):
"""
Task name + commandline switches model
"""
_name: str
_args: list
def __init__(self, task_name: str, args: list):
self._name = task_name
self._args = args
def __repr__(self):
... | /rkd.core-0.0.0.tar.gz/rkd.core-0.0.0/rkd/core/argparsing/model.py | 0.790369 | 0.324342 | model.py | pypi |
from typing import Union, Dict
from ..api.syntax import TaskDeclaration
from ..api.syntax import GroupDeclaration
from ..argparsing.model import ArgumentBlock
from ..inputoutput import SystemIO
STATUS_STARTED = 'started'
STATUS_ERRORED = 'errored'
STATUS_FAILURE = 'failure'
STATUS_SUCCEED = 'succeed'
"""
Can be trea... | /rkd.core-0.0.0.tar.gz/rkd.core-0.0.0/rkd/core/execution/results.py | 0.818374 | 0.188082 | results.py | pypi |
from rkgb.utils import *
from rkgb import Btools
from rkgb import Dtools
from rkgb import Stools
from rkgb import Ktools
from rkgb import Atools
import inspect
# ==========================
# ====== OUTPUT CLASS ======
# ==========================
class all_graphs():
def __init__(self,bg,dg,sg,kg,list_sg,list_kg,... | /rkgb-1.0.1.tar.gz/rkgb-1.0.1/src/main.py | 0.502441 | 0.163813 | main.py | pypi |
# A way to recognize similar blocks
# e.g. for GPT2 -> Transformer blocks
from rkgb.utils import *
from rkgb import Stools
from rkgb import Ktools
# Note : to handle parameters anonymization :
# 1) I need to check "info" equality, -> I need the model
# 2) It's impossible to run inspection with anonymized params
# ... | /rkgb-1.0.1.tar.gz/rkgb-1.0.1/src/Atools.py | 0.544317 | 0.344885 | Atools.py | pypi |
from rkgb.utils.imports import torch, sys
time_min_duration = 0
time_min_repeat = 5
# -> print debug messages
ref_verbose = [False]
def print_debug(*args, **kwargs):
if ref_verbose[0]:
print(*args, **kwargs)
# -> acceptance rate for two time measures to be declared equal
ref_reasonable_rate = [0.4]
... | /rkgb-1.0.1.tar.gz/rkgb-1.0.1/src/utils/global_vars.py | 0.471223 | 0.640158 | global_vars.py | pypi |
import json
import csv
import io
import datetime
import aiohttp
from typing import Dict
from rki_covid_parser.const import (
DISTRICTS_URL,
DISTRICTS_URL_RECOVERED,
DISTRICTS_URL_NEW_CASES,
DISTRICTS_URL_NEW_RECOVERED,
DISTRICTS_URL_NEW_DEATHS,
VACCINATIONS_URL,
HOSPITALIZATION_URL
)... | /rki-covid-parser-1.3.3.tar.gz/rki-covid-parser-1.3.3/src/rki_covid_parser/parser.py | 0.568536 | 0.257567 | parser.py | pypi |
#Import required modules
import csv
import numpy as np
import datetime
import dateutil.parser as parser
import os
#Constanst
_AGE_GROUPS = {'A00-A04': 0, 'A05-A14': 1, 'A15-A34': 2, 'A35-A59': 3, 'A60-A79': 4, 'A80+': 5, 'unbekannt': 6}
_GENDERS = {'M': 0, 'W': 1, 'unbekannt': 2}
_DAT... | /rki-covid19csv-parser-1.2.0.tar.gz/rki-covid19csv-parser-1.2.0/src/rki_covid19csv_parser/csv_parser.py | 0.63477 | 0.463566 | csv_parser.py | pypi |
# rkpython
## Description
This is a general use Python module.
For now, it only contains some functions to make reading and **writing to text files** easier, as well as a function that returns information for reading csv files**.
## Installation
Use
```
pip install rkpython
```
Then import it in Python with
`... | /rkpython-0.0.21.tar.gz/rkpython-0.0.21/README.md | 0.464659 | 0.840783 | README.md | pypi |
[![PyPI Version][pypi-image]][pypi-url]
[![Build Status][build-image]][build-url]
[![Code Coverage][coverage-image]][coverage-url]
<!-- Badges -->
[pypi-image]: https://img.shields.io/pypi/v/rkstiff
[pypi-url]: https://pypi.org/project/rkstiff/
[build-image]: https://github.com/whalenpt/rkstiff/actions/workflows/build... | /rkstiff-0.3.0.tar.gz/rkstiff-0.3.0/README.md | 0.519765 | 0.977926 | README.md | pypi |
# Burgers equation
* Physical space
\begin{align}
u_t + uu_x = \mu u_{xx}
\end{align}
* Spectral space: $\hat{u} = \mathscr{F}\{u\}$
\begin{align}
\hat{u_t} = -\mu k_x^{2}\hat{u}
- \mathscr{F}\{ {\mathscr{F}^{-1}\{ \hat{u} \} \mathscr{F}^{-1} \{ i k_x \hat{u} \} } \}
\end{alig... | /rkstiff-0.3.0.tar.gz/rkstiff-0.3.0/demos/burgers.ipynb | 0.568536 | 0.947672 | burgers.ipynb | pypi |
from ._interface import ABC, abstractmethod
class IModel(ABC):
"""Interface for model"""
@abstractmethod
def search(self, search_string: str, **kwargs):
"""Search item"""
@abstractmethod
def select(self, selection: int, **kwargs):
"""Select item"""
class IQueue(ABC):
"""Int... | /interfaces/models.py | 0.814864 | 0.323273 | models.py | pypi |
from typing import List, Optional
import numpy as np
import pandas as pd
from pandas import DataFrame
from rkt_lib_toolkit.logger import Logger
from rkt_lib_toolkit.config import Config
class QLearning:
"""
Exploration vs. Exploitation Tradeoff:
The agent initially has none or limited knowledge abou... | /rkt_ai_lib-1.1.1.tar.gz/rkt_ai_lib-1.1.1/rkt_lib_toolkit/ai/AI.py | 0.930844 | 0.561335 | AI.py | pypi |
from typing import List, Optional
import numpy as np
import pandas as pd
from pandas import DataFrame
from rkt_lib_toolkit.logger import Logger
from rkt_lib_toolkit.config import Config
class QLearning:
"""
Exploration vs. Exploitation Tradeoff:
The agent initially has none or limited knowledge abou... | /rkt_lib_toolkit-1.6.2.tar.gz/rkt_lib_toolkit-1.6.2/rkt_lib_toolkit/ai/AI.py | 0.930844 | 0.561335 | AI.py | pypi |
import re
from argparse import ArgumentParser
from abc import ABC
from typing import Callable
from subprocess import CalledProcessError
from rkd.api.contract import TaskInterface, ExecutionContext
from rkd.api.syntax import TaskDeclaration
class DockerBaseTask(TaskInterface, ABC):
def calculate_images(self, image... | /rkt_utils-3.0.4-py3-none-any.whl/rkt_utils/docker.py | 0.799755 | 0.171061 | docker.py | pypi |
from copy import deepcopy
from logging import getLogger
from typing import TYPE_CHECKING, Any, Generator
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
if TYPE_CHECKING:
from .archivist import Archivist
from .assets import Asset
from .constants import (
ACCESS_POLICIES_LABEL... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/access_policies.py | 0.892454 | 0.153517 | access_policies.py | pypi |
from base64 import b64decode
from json import loads as json_loads
from logging import getLogger
from typing import TYPE_CHECKING, Any
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from . import subjects_confirmer
from .constants import (
SUBJECTS_LABEL,
SUBJECTS_SELF_ID,
... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/subjects.py | 0.872075 | 0.185062 | subjects.py | pypi |
from contextlib import suppress
from copy import deepcopy
from logging import getLogger
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from .archivist import Archivist
from .constants import LOCATIONS_LABEL, LOCATIONS_SU... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/locations.py | 0.909501 | 0.225715 | locations.py | pypi |
from copy import deepcopy
from logging import getLogger
from typing import TYPE_CHECKING, Any, Union
if TYPE_CHECKING:
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from .archivist import Archivist
from .compliance_policy_requests import (
CompliancePolicyCurrentO... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/compliance_policies.py | 0.928595 | 0.184529 | compliance_policies.py | pypi |
from copy import deepcopy
from io import BytesIO
from logging import getLogger
from os import path
from typing import TYPE_CHECKING, Any, BinaryIO
if TYPE_CHECKING:
from requests.models import Response
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from .archivist impor... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/attachments.py | 0.873363 | 0.189203 | attachments.py | pypi |
from dataclasses import asdict, dataclass
from .compliance_policy_type import CompliancePolicyType
from .or_dict import and_list
# NB: the order of the fields is important. Fields with default values must
# appear after fields without. This is why the compliance_type is last
# in every case.
@dataclass(frozen... | /rkvst-archivist-0.25.2.tar.gz/rkvst-archivist-0.25.2/archivist/compliance_policy_requests.py | 0.839273 | 0.339882 | compliance_policy_requests.py | pypi |
from hexbytes import HexBytes
ELEMENT_ID_SLOTARRAY = "eip1186sp:1:sa"
ELEMENT_ID_FIELDVALUES = "eip1186sp:2:fv"
ELEMENT_ID_BYTESLIST = (
"eip1186sp:3:loba" # TODO change all these suffixes to sensibly literate values
)
class MetadataError(Exception):
"""
Raised when there is an unexpected formatting or ... | /rkvst-receipt-scitt-0.2.0a0.tar.gz/rkvst-receipt-scitt-0.2.0a0/rkvst_receipt_scitt/elementmetadata.py | 0.501709 | 0.736697 | elementmetadata.py | pypi |
from eth_utils import decode_hex
from . import trie_alg
from . import ethproofs
from . import elementmetadata
class NamedProofsMissingPayloadKey(KeyError):
"""An expected payload key was missing from the receipt contents"""
class NamedProofsMissingProof(KeyError):
"""An expected payload key was missing from... | /rkvst-receipt-scitt-0.2.0a0.tar.gz/rkvst-receipt-scitt-0.2.0a0/rkvst_receipt_scitt/namedproofs.py | 0.883481 | 0.514095 | namedproofs.py | pypi |
import uuid
from datetime import datetime
import rfc3339
from eth_utils import to_checksum_address
from . import trie_alg
from .namedproofs import NamedProofs
from .attribute_decoder import (
decode_attribute_key,
decode_attribute_value,
AttributeType,
)
class KhipuReceiptMalformedAttributes(ValueError):... | /rkvst-receipt-scitt-0.2.0a0.tar.gz/rkvst-receipt-scitt-0.2.0a0/rkvst_receipt_scitt/khipureceipt.py | 0.614857 | 0.314781 | khipureceipt.py | pypi |
from eth_utils import keccak, to_checksum_address
import rlp
from rlp.sedes import (
Binary,
big_endian_int,
)
from trie import HexaryTrie
from trie.exceptions import BadTrieProof
from hexbytes import HexBytes
class VerifyFailed(Exception):
"""raised if a proof verification operation fails"""
def verif... | /rkvst-receipt-scitt-0.2.0a0.tar.gz/rkvst-receipt-scitt-0.2.0a0/rkvst_receipt_scitt/ethproofs.py | 0.820362 | 0.555375 | ethproofs.py | pypi |
from importlib import resources
import logging
from copy import copy
# pylint:disable=unused-import # To prevent cyclical import errors forward referencing is used
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from typing import TYPE_CHECKING
from . import document_files
fr... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/document/document.py | 0.745213 | 0.205396 | document.py | pypi |
from typing import Optional
# pylint:disable=unused-import # To prevent cyclical import errors forward referencing is used
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from archivist import archivist as type_helper
from .software_package import sboms_creator
class SoftwareD... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/software_bill_of_materials/software_deployment.py | 0.88565 | 0.225054 | software_deployment.py | pypi |
from importlib import resources
import logging
from sys import exit as sys_exit
from typing import List, Optional
from archivist import archivist as type_helper
from ..testing.assets import make_assets_create, AttachmentDescription
from . import sbom_files
LOGGER = logging.getLogger(__name__)
def attachment_cr... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/software_bill_of_materials/software_package.py | 0.696062 | 0.232931 | software_package.py | pypi |
from importlib import resources
import logging
from sys import exit as sys_exit
from typing import List, Optional
from archivist import archivist as type_helper
from ..testing.assets import make_assets_create, AttachmentDescription
from . import sbom_files
LOGGER = logging.getLogger(__name__)
def attachment_cr... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/sbom_document/software_package.py | 0.673406 | 0.229557 | software_package.py | pypi |
# pylint: disable=missing-docstring
import logging
from ..testing.assets import assets_create_if_not_exists
from .util import asset_attachment_upload_from_file
LOGGER = logging.getLogger(__name__)
def initialise_asset_types(ac):
type_map = {}
newattachment = asset_attachment_upload_from_file(
ac... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/synsation/synsation_smartcity.py | 0.557604 | 0.276776 | synsation_smartcity.py | pypi |
# pylint: disable=missing-docstring
import logging
import random
import string
from ..testing.assets import assets_create_if_not_exists
from .util import asset_attachment_upload_from_file
LOGGER = logging.getLogger(__name__)
def initialise_asset_types(ac):
type_map = {}
newattachment = asset_attachment_... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/synsation/synsation_industries.py | 0.485112 | 0.216663 | synsation_industries.py | pypi |
# pylint: disable=missing-docstring
# pylint: disable=too-many-arguments
import string
import random
from ..testing.assets import make_assets_create, AttachmentDescription
from .util import asset_attachment_upload_from_file
def attachment_create(arch, attachment_description: AttachmentDescription):
attachment... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/synsation/synsation_manufacturing.py | 0.696475 | 0.328583 | synsation_manufacturing.py | pypi |
# pylint: disable=missing-docstring
# pylint: disable=logging-fstring-interpolation
from datetime import datetime, timezone
import logging
from sys import exit as sys_exit
from sys import stdout as sys_stdout
from archivist import about
from archivist.timestamp import parse_timestamp
from ..testing.archivist_pars... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/synsation/analyze.py | 0.412175 | 0.245209 | analyze.py | pypi |
# pylint: disable=missing-docstring
import logging
import random
import time
from ..testing.assets import make_assets_create, AttachmentDescription
from .util import (
asset_attachment_upload_from_file,
locations_from_yaml_file,
)
LOGGER = logging.getLogger(__name__)
def attachment_create(arch, attachmen... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/synsation/synsation_corporation.py | 0.454714 | 0.222806 | synsation_corporation.py | pypi |
from importlib import resources
import logging
from copy import copy
from typing import Optional
# pylint:disable=unused-import # To prevent cyclical import errors forward referencing is used
# pylint:disable=cyclic-import # but pylint doesn't understand this feature
from archivist import archivist as ty... | /rkvst-samples-0.12.1.tar.gz/rkvst-samples-0.12.1/archivist_samples/wipp/wipp.py | 0.888221 | 0.202423 | wipp.py | pypi |
from abc import ABC, abstractmethod
import numpy as np
class BasePolicy(ABC):
"""
A basic policy for tabular agents.
The policy is a function that maps a state to an action.
"""
@abstractmethod
def __call__(self, q_values):
"""Select an action for the current timestep.
Thi... | /rl-agents-0.1.1.tar.gz/rl-agents-0.1.1/src/rl_agents/agents/policies/tabular_policies.py | 0.952253 | 0.802013 | tabular_policies.py | pypi |
import numpy as np
from rl_agents.agents.mab.base import BaseMAB
class UCB(BaseMAB):
r"""MAB Agent following a Upper Confidence Bound policy.
The UCB selects the action that maximizes the function given by:
.. math:: f(i) = \mu_i + U_i,
where :math:`\mu_i` is the average reward of arm :math:`i`, ... | /rl-agents-0.1.1.tar.gz/rl-agents-0.1.1/src/rl_agents/agents/mab/ucbs.py | 0.931416 | 0.621225 | ucbs.py | pypi |
import numpy as np
from rl_agents.agents.mab.base import BaseMAB
class EpsilonGreedy(BaseMAB):
r"""Epsilon-Greedy agent.
The agent uses the epsilon-greedy approach to solve the Multi-Armed
bandit problem.
The parameter :math:`\epsilon` is used for the
exploration-exploitation trade-off. With pr... | /rl-agents-0.1.1.tar.gz/rl-agents-0.1.1/src/rl_agents/agents/mab/egreedy.py | 0.939865 | 0.851212 | egreedy.py | pypi |
import numpy as np
from rl_agents.agents.core import BaseAgent
from rl_agents.agents.functions import QMatrixFunction
from rl_agents.agents.policies import EGreedyPolicy
class TDAgent(BaseAgent):
"""A base Temporal-Difference Agent.
This agent is used to build the basic TD algorithms:
* Q-Learning
... | /rl-agents-0.1.1.tar.gz/rl-agents-0.1.1/src/rl_agents/agents/tabular/td_learning.py | 0.893193 | 0.597872 | td_learning.py | pypi |
# rl-algo-impls
Implementations of reinforcement learning algorithms.
- [WandB benchmark reports](https://wandb.ai/sgoodfriend/rl-algo-impls-benchmarks/reportlist)
- [Basic, PyBullet, and Atari games
(v0.0.9)](https://api.wandb.ai/links/sgoodfriend/fdp5mg6h)
- [v0.0.8](https://api.wandb.ai/links/sgoodfriend... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/README.md | 0.52342 | 0.886076 | README.md | pypi |
import dataclasses
import gc
import inspect
import logging
import os
from dataclasses import asdict, dataclass
from typing import Callable, List, NamedTuple, Optional, Sequence, Union
import numpy as np
import optuna
import torch
from optuna.pruners import HyperbandPruner
from optuna.samplers import TPESampler
from op... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/optimize.py | 0.828939 | 0.184308 | optimize.py | pypi |
import argparse
import itertools
import numpy as np
import pandas as pd
import wandb
import wandb.apis.public
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, Iterable, List, TypeVar
from rl_algo_impls.benchmark_publish import RunGroup
@dataclass
class Comparison:
c... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/compare_runs.py | 0.741768 | 0.356615 | compare_runs.py | pypi |
import os
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
import argparse
import shutil
import subprocess
import tempfile
from typing import List, Optional
import requests
import wandb.apis.public
from huggingface_hub.hf_api import HfApi, upload_folder
from huggingface_hub.repocard import metadata_save
from pyvirtua... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/huggingface_publish.py | 0.57344 | 0.162679 | huggingface_publish.py | pypi |
import dataclasses
from dataclasses import dataclass
from typing import List, Optional
import numpy as np
import wandb
from rl_algo_impls.runner.config import Config, EnvHyperparams, RunArgs
from rl_algo_impls.runner.evaluate import Evaluation
from rl_algo_impls.runner.running_utils import (
get_device,
load_... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/runner/selfplay_evaluate.py | 0.726134 | 0.21566 | selfplay_evaluate.py | pypi |
import os
import shutil
from dataclasses import dataclass
from typing import NamedTuple, Optional
from rl_algo_impls.runner.config import Config, EnvHyperparams, Hyperparams, RunArgs
from rl_algo_impls.runner.running_utils import (
get_device,
load_hyperparams,
make_policy,
set_seeds,
)
from rl_algo_im... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/runner/evaluate.py | 0.680666 | 0.183832 | evaluate.py | pypi |
import dataclasses
import inspect
import itertools
import os
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Dict, List, Optional, Type, TypeVar, Union
RunArgsSelf = TypeVar("RunArgsSelf", bound="RunArgs")
@dataclass
class RunArgs:
algo: str
env: str
seed: Optional... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/runner/config.py | 0.856362 | 0.219066 | config.py | pypi |
import argparse
import json
import logging
import os
import random
from dataclasses import asdict
from pathlib import Path
from typing import Dict, Optional, Type, Union
import gym
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.backends.cudnn
import yaml
from gym.spaces import Box, Discre... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/runner/running_utils.py | 0.751922 | 0.202502 | running_utils.py | pypi |
import copy
import logging
import random
from collections import deque
from typing import List, NamedTuple, Optional, TypeVar
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.tensorboard.writer import SummaryWriter
from rl_algo_impls.d... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/dqn/dqn.py | 0.90714 | 0.445771 | dqn.py | pypi |
import numpy as np
from gym.wrappers.monitoring.video_recorder import VideoRecorder
from rl_algo_impls.wrappers.vectorable_wrapper import (
VecEnvObs,
VecEnvStepReturn,
VectorableWrapper,
)
class VecEpisodeRecorder(VectorableWrapper):
def __init__(
self, env, base_path: str, max_video_length:... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/vec_episode_recorder.py | 0.712632 | 0.302893 | vec_episode_recorder.py | pypi |
from typing import Tuple, TypeVar
import gym
import numpy as np
from numpy.typing import NDArray
from rl_algo_impls.wrappers.vectorable_wrapper import (
VectorableWrapper,
single_observation_space,
)
RunningMeanStdSelf = TypeVar("RunningMeanStdSelf", bound="RunningMeanStd")
class RunningMeanStd:
def __... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/normalize.py | 0.957048 | 0.429071 | normalize.py | pypi |
from typing import Tuple, Union
import gym
import numpy as np
from gym.wrappers.monitoring.video_recorder import VideoRecorder
from rl_algo_impls.wrappers.vectorable_wrapper import VectorableWrapper
ObsType = Union[np.ndarray, dict]
ActType = Union[int, float, np.ndarray, dict]
class EpisodeRecordVideo(VectorableW... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/episode_record_video.py | 0.862018 | 0.28961 | episode_record_video.py | pypi |
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Type, TypeVar
import numpy as np
from gym import Wrapper
from gym.spaces import Box, MultiDiscrete
from gym.spaces import Tuple as TupleSpace
from gym.vector.utils import batch_space
from luxai_s2.env import LuxAI_S2
from luxai_s2.state import Observatio... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/lux_env_gridnet.py | 0.932638 | 0.449755 | lux_env_gridnet.py | pypi |
from typing import Optional, Tuple, Union
import gym
import numpy as np
from rl_algo_impls.wrappers.vectorable_wrapper import VectorableWrapper
ObsType = Union[np.ndarray, dict]
ActType = Union[int, float, np.ndarray, dict]
class NoRewardTimeout(VectorableWrapper):
def __init__(
self, env: gym.Env, n_t... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/no_reward_timeout.py | 0.917242 | 0.369201 | no_reward_timeout.py | pypi |
from typing import Any, Dict, List, Optional
import numpy as np
from rl_algo_impls.wrappers.vectorable_wrapper import (
VecEnvObs,
VecEnvStepReturn,
VectorableWrapper,
)
class MicrortsStatsRecorder(VectorableWrapper):
def __init__(
self, env, gamma: float, bots: Optional[Dict[str, int]] = No... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/microrts_stats_recorder.py | 0.860852 | 0.428891 | microrts_stats_recorder.py | pypi |
from collections import deque
from typing import Any, Dict, List, Optional
import numpy as np
from torch.utils.tensorboard.writer import SummaryWriter
from rl_algo_impls.shared.stats import Episode, EpisodesStats
from rl_algo_impls.wrappers.vectorable_wrapper import (
VecEnvObs,
VecEnvStepReturn,
Vectorab... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/episode_stats_writer.py | 0.844168 | 0.349449 | episode_stats_writer.py | pypi |
from typing import Any, Dict, Tuple, Union
import gym
import numpy as np
from rl_algo_impls.wrappers.vectorable_wrapper import VectorableWrapper
ObsType = Union[np.ndarray, dict]
ActType = Union[int, float, np.ndarray, dict]
class EpisodicLifeEnv(VectorableWrapper):
def __init__(self, env: gym.Env, training: b... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/atari_wrappers.py | 0.852736 | 0.473536 | atari_wrappers.py | pypi |
import random
from collections import deque
from typing import Any, Deque, Dict, List, Optional
import numpy as np
from rl_algo_impls.runner.config import Config
from rl_algo_impls.shared.policy.policy import Policy
from rl_algo_impls.wrappers.action_mask_wrapper import find_action_masker
from rl_algo_impls.wrappers.... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/self_play_wrapper.py | 0.761538 | 0.342737 | self_play_wrapper.py | pypi |
import random
from collections import deque
from typing import Any, Deque, Dict, List, Optional, Tuple
import numpy as np
from rl_algo_impls.runner.config import Config
from rl_algo_impls.shared.policy.policy import Policy
from rl_algo_impls.wrappers.action_mask_wrapper import find_action_masker
from rl_algo_impls.wr... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/wrappers/self_play_eval_wrapper.py | 0.771585 | 0.330714 | self_play_eval_wrapper.py | pypi |
import logging
from dataclasses import asdict, dataclass
from time import perf_counter
from typing import List, NamedTuple, Optional, TypeVar
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Adam
from torch.utils.tensorboard.writer import SummaryWriter
from rl_algo_impls.shared.algorithm ... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/ppo/ppo.py | 0.922748 | 0.408336 | ppo.py | pypi |
import logging
import os
import os.path
from pathlib import Path
from typing import Any, Dict
import numpy as np
from gym.spaces import MultiDiscrete
from luxai_s2.state import ObservationStateDict
from rl_algo_impls.lux.kit.config import EnvConfig
from rl_algo_impls.lux.kit.kit import obs_to_game_state
from rl_algo_... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/lux/agent.py | 0.773858 | 0.233171 | agent.py | pypi |
from dataclasses import dataclass, field
from typing import Dict
import numpy as np
from rl_algo_impls.lux.kit.cargo import UnitCargo
from rl_algo_impls.lux.kit.config import EnvConfig
from rl_algo_impls.lux.kit.factory import Factory
from rl_algo_impls.lux.kit.team import FactionTypes, Team
from rl_algo_impls.lux.ki... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/lux/kit/kit.py | 0.767167 | 0.249402 | kit.py | pypi |
import math
from dataclasses import dataclass
from typing import List
import numpy as np
from rl_algo_impls.lux.kit.cargo import UnitCargo
from rl_algo_impls.lux.kit.config import EnvConfig, UnitConfig
# a[1] = direction (0 = center, 1 = up, 2 = right, 3 = down, 4 = left)
move_deltas = np.array([[0, 0], [0, -1], [1,... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/lux/kit/unit.py | 0.621885 | 0.462959 | unit.py | pypi |
import math
from dataclasses import dataclass
from sys import stderr
import numpy as np
from rl_algo_impls.lux.kit.cargo import UnitCargo
from rl_algo_impls.lux.kit.config import EnvConfig
@dataclass
class Factory:
team_id: int
unit_id: str
strain_id: int
power: int
cargo: UnitCargo
pos: np.... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/lux/kit/factory.py | 0.524638 | 0.269981 | factory.py | pypi |
import logging
from time import perf_counter
from typing import List, Optional, TypeVar
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard.writer import SummaryWriter
from rl_algo_impls.shared.algorithm import Algorithm
from rl_algo_impls.shared.callback... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/a2c/a2c.py | 0.906751 | 0.3089 | a2c.py | pypi |
from copy import deepcopy
import optuna
from rl_algo_impls.runner.config import Config, EnvHyperparams, Hyperparams
from rl_algo_impls.shared.policy.optimize_on_policy import sample_on_policy_hyperparams
from rl_algo_impls.shared.vec_env import make_eval_env
from rl_algo_impls.tuning.optimize_env import sample_env_hy... | /rl_algo_impls-0.0.13.tar.gz/rl_algo_impls-0.0.13/rl_algo_impls/a2c/optimize.py | 0.592784 | 0.262669 | optimize.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.