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 functools
import numpy as np
import torch
import torch.distributed as dist
_LOCAL_PROCESS_GROUP = None
"""
A torch process group which only includes processes that on the same machine as the current process.
This variable is set when processes are spawned by `launch()` in "engine/launch.py".
"""
def get_world... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/detectron2/utils/comm.py | 0.902876 | 0.495606 | comm.py | pypi |
import typing
from typing import Any, List
import fvcore
from fvcore.nn import activation_count, flop_count, parameter_count, parameter_count_table
from torch import nn
from detectron2.export import TracingAdapter
__all__ = [
"activation_count_operators",
"flop_count_operators",
"parameter_count_table",
... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/detectron2/utils/analysis.py | 0.840521 | 0.545104 | analysis.py | pypi |
import math
import numpy as np
import torch
import torch.nn as nn
from utils.downloads import attempt_download
class Sum(nn.Module):
# Weighted sum of 2 or more layers https://arxiv.org/abs/1911.09070
def __init__(self, n, weight=False): # n: number of inputs
super().__init__()
self.weight ... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/models/experimental.py | 0.942599 | 0.513242 | experimental.py | pypi |
import threading
class Callbacks:
""""
Handles all registered callbacks for YOLOv5 Hooks
"""
def __init__(self):
# Define the available callbacks
self._callbacks = {
'on_pretrain_routine_start': [],
'on_pretrain_routine_end': [],
'on_train_start': [... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/utils/callbacks.py | 0.760206 | 0.193662 | callbacks.py | pypi |
from copy import deepcopy
import numpy as np
import torch
from utils.general import LOGGER, colorstr
from utils.torch_utils import profile
def check_train_batch_size(model, imgsz=640, amp=True):
# Check YOLOv5 training batch size
with torch.cuda.amp.autocast(amp):
return autobatch(deepcopy(model).tr... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/utils/autobatch.py | 0.753829 | 0.471162 | autobatch.py | pypi |
import numpy as np
from ..metrics import ap_per_class
def fitness(x):
# Model fitness as a weighted combination of metrics
w = [0.0, 0.0, 0.1, 0.9, 0.0, 0.0, 0.1, 0.9]
return (x[:, :8] * w).sum(1)
def ap_per_class_box_and_mask(
tp_m,
tp_b,
conf,
pred_cls,
target_... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/utils/segment/metrics.py | 0.850562 | 0.376423 | metrics.py | pypi |
import cv2
import torch
import torch.nn.functional as F
def crop(masks, boxes):
"""
"Crop" predicted masks by zeroing out everything not in the predicted bbox.
Vectorized by Chong (thanks Chong).
Args:
- masks should be a size [h, w, n] tensor of masks
- boxes should be a size [n, 4] ... | /roof-mask-0.5.4.tar.gz/roof-mask-0.5.4/utils/segment/general.py | 0.807119 | 0.629461 | general.py | pypi |
# The Room environment - v1
[](https://badge.fury.io/py/room-env)
For the documentation of [RoomEnv-v0](./documents/README-v0.md), click the corresponding buttons.
This document, RoomEnv-v1, is the most up-to-date one.
We have released a challenging [Gymnasium](h... | /room_env-1.0.2.tar.gz/room_env-1.0.2/README.md | 0.533884 | 0.93744 | README.md | pypi |
import logging
import os
import random
from copy import deepcopy
from pprint import pformat
from typing import List, Tuple
from .utils import get_duplicate_dicts, list_duplicates_of
logging.basicConfig(
level=os.environ.get("LOGLEVEL", "INFO").upper(),
format="%(asctime)s.%(msecs)03d %(levelname)s %(module)s ... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/memory.py | 0.834744 | 0.431824 | memory.py | pypi |
import json
import logging
import os
import random
import subprocess
from copy import deepcopy
from typing import List, Tuple
import gymnasium as gym
import numpy as np
import torch
import yaml
import room_env
from .des import RoomDes
logging.basicConfig(
level=os.environ.get("LOGLEVEL", "INFO").upper(),
fo... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/utils.py | 0.763924 | 0.221182 | utils.py | pypi |
import json
import os
from copy import deepcopy
from pprint import pprint
def read_json(fname: str) -> dict:
"""Read json.
There is some path magic going on here. This is to account for both the production
and development mode. Don't use this function for a general purpose.
"""
fullpath = os.pat... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/des.py | 0.670069 | 0.316119 | des.py | pypi |
import random
from .memory import ShortMemory
def encode_observation(memory_systems: dict, policy: str, obs: dict) -> None:
"""Non RL policy of encoding an observation into a short-term memory.
Args
----
memory_systems: {"episodic": EpisodicMemory, "semantic": SemanticMemory,
"s... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/policy.py | 0.746231 | 0.521349 | policy.py | pypi |
import logging
import os
import random
from copy import deepcopy
from typing import Tuple
import gymnasium as gym
from ..des import RoomDes
from ..memory import EpisodicMemory, SemanticMemory, ShortMemory
from ..policy import answer_question, encode_observation, manage_memory
from ..utils import seed_everything
logg... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/envs/room1.py | 0.821617 | 0.524821 | room1.py | pypi |
import json
import logging
import os
import random
from copy import deepcopy
from itertools import cycle
from typing import Tuple
import gymnasium as gym
from ..utils import read_lines, remove_name, split_name_entity
CORRECT = 1
WRONG = 0
logging.basicConfig(
level=os.environ.get("LOGLEVEL", "INFO").upper(),
... | /room_env-1.0.2.tar.gz/room_env-1.0.2/room_env/envs/room0.py | 0.785761 | 0.318366 | room0.py | pypi |
MQTT_ERROR_MESSAGES = {
0: None,
1: "Bad protocol",
2: "Bad client id",
3: "Server unavailable",
4: "Bad username or password",
5: "Not authorised",
}
ROOMBA_ERROR_MESSAGES = {
0: "None",
1: "Left wheel off floor",
2: "Main brushes stuck",
3: "Right wheel off floor",
4: "Lef... | /roombasdk-1.7.10-py3-none-any.whl/roombapy/const.py | 0.637595 | 0.341665 | const.py | pypi |
import io
import os
from pathlib import Path
from typing import Union, Type, TypeVar
import dotenv
from environment_files import find_environment
from liblog import get_logger
import root_dir.data_dir as data_dir
logger = get_logger()
# Type hint help
DD = TypeVar("DD", bound=data_dir.DataDir)
class DataRoot:
... | /root_dir-0.1.0-py3-none-any.whl/root_dir/data_root.py | 0.496582 | 0.194827 | data_root.py | pypi |
import tldextract
import validators
import sys
import argparse
from typing import Any, Iterator, Optional
import logging
logger = logging.Logger(__name__)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"domain",
help="domain or file with domains to process. "
... | /root-domain-0.0.1.tar.gz/root-domain-0.0.1/root_domain/main.py | 0.518546 | 0.160233 | main.py | pypi |
from . import _librootnumpy
__all__ = [
'random_sample',
]
def random_sample(obj, n_samples, seed=None):
"""Create a random array by sampling a ROOT function or histogram.
Parameters
----------
obj : TH[1|2|3] or TF[1|2|3]
The ROOT function or histogram to sample.
n_samples : positi... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/_sample.py | 0.875361 | 0.541166 | _sample.py | pypi |
import numpy as np
from . import _librootnumpy
__all__ = [
'fill_hist',
'fill_profile',
'hist2array',
'array2hist',
]
DTYPE_ROOT2NUMPY = dict(C='i1', S='i2', I='i4', L='i8', F='f4', D='f8')
ARRAY_NUMPY2ROOT = dict(
[(ndim, dict([
(hist_type,
getattr(_librootnumpy, 'h{0}{1}_arr... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/_hist.py | 0.861305 | 0.62621 | _hist.py | pypi |
import warnings
from glob import glob
import numpy as np
from .extern.six import string_types
from . import _librootnumpy
__all__ = [
'root2array',
'root2rec',
'list_trees',
'list_branches',
'list_structures',
'list_directories',
'tree2array',
'tree2rec',
'array2tree',
'array2... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/_tree.py | 0.798894 | 0.366703 | _tree.py | pypi |
import uuid
import numpy as np
from .extern.six import string_types
from . import _librootnumpy
__all__ = [
'evaluate',
]
def evaluate(obj, array):
"""Evaluate a ROOT histogram, function, graph, or spline over an array.
Parameters
----------
obj : TH[1|2|3], TF[1|2|3], TFormula, TGraph, TSplin... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/_evaluate.py | 0.851089 | 0.619673 | _evaluate.py | pypi |
import numpy as np
import operator
from .extern.six import string_types
from ._librootnumpy import _blockwise_inner_join
__all__ = [
'rec2array',
'stack',
'stretch',
'dup_idx',
'blockwise_inner_join',
]
VLEN = np.vectorize(len)
def rec2array(rec, fields=None):
"""Convert a record/structur... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/_utils.py | 0.867191 | 0.615507 | _utils.py | pypi |
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/extern/ordereddict.py | 0.512937 | 0.222236 | ordereddict.py | pypi |
import numpy as np
import ROOT
from ROOT import TMVA
from . import _libtmvanumpy
__all__ = [
'evaluate_reader',
'evaluate_method',
]
def evaluate_reader(reader, name, events, aux=0.):
"""Evaluate a TMVA::Reader over a NumPy array.
Parameters
----------
reader : TMVA::Reader
A TMVA::... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/tmva/_evaluate.py | 0.916946 | 0.479747 | _evaluate.py | pypi |
import numpy as np
import ROOT
from ROOT import TMVA
from . import _libtmvanumpy
from .. import ROOT_VERSION
__all__ = [
'add_classification_events',
'add_regression_events',
]
NEW_TMVA_API = ROOT_VERSION >= '6.07/04'
def add_classification_events(obj, events, labels, signal_label=None,
... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/root_numpy/tmva/_data.py | 0.826537 | 0.417568 | _data.py | pypi |
from rootpy.extern.six.moves import range
from rootpy.tree import Tree, TreeModel, FloatCol
from rootpy.plotting import Canvas, Hist2D, set_style
from rootpy.io import root_open
from root_numpy import root2array, array2tree, rec2array, fill_hist
import ROOT
import numpy as np
from random import gauss
import random
impo... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/examples/core/plot_bootstrap.py | 0.584983 | 0.388212 | plot_bootstrap.py | pypi |
from array import array
import numpy as np
from numpy.random import RandomState
import matplotlib.pyplot as plt
from root_numpy.tmva import add_classification_events, evaluate_reader
from root_numpy import ROOT_VERSION
from ROOT import TMVA, TFile, TCut
plt.style.use('ggplot')
RNG = RandomState(42)
# Construct an exa... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/examples/tmva/plot_twoclass.py | 0.812161 | 0.525186 | plot_twoclass.py | pypi |
import numpy as np
import matplotlib.pyplot as plt
from root_numpy.tmva import add_regression_events, evaluate_reader
from root_numpy import ROOT_VERSION
from ROOT import TMVA, TFile, TCut
from array import array
plt.style.use('ggplot')
RNG = np.random.RandomState(1)
# Create an example regression dataset
X = np.lins... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/examples/tmva/plot_regression.py | 0.688678 | 0.50708 | plot_regression.py | pypi |
from array import array
import numpy as np
from numpy.random import RandomState
from root_numpy.tmva import add_classification_events, evaluate_reader
from root_numpy import ROOT_VERSION
import matplotlib.pyplot as plt
from ROOT import TMVA, TFile, TCut
plt.style.use('ggplot')
RNG = RandomState(42)
# Construct an exa... | /root_numpy-4.8.0.tar.gz/root_numpy-4.8.0/examples/tmva/plot_multiclass.py | 0.768733 | 0.53127 | plot_multiclass.py | pypi |
import torch.nn as nn
def get_valid_patch_sizes():
return list((572 - (16*i) for i in range(31)))
class DownBlock(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.pool = nn.MaxPool2d(2)
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels, in_channels*2,
... | /root_painter_trainer-0.2.27.0.tar.gz/root_painter_trainer-0.2.27.0/trainer/unet.py | 0.952783 | 0.374876 | unet.py | pypi |
import numpy as np
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
from skimage.transform import resize
import im_utils
def get_indices(im_shape, scale, sigma, padding=60):
""" based on cognitivemedium.com/assets/rmnist/Simard.pdf """
im_shape = [im_sha... | /root_painter_trainer-0.2.27.0.tar.gz/root_painter_trainer-0.2.27.0/trainer/elastic.py | 0.744378 | 0.461805 | elastic.py | pypi |
import numpy as np
VLEN = np.vectorize(len)
def stretch(arr, fields=None, return_indices=False):
"""Stretch an array.
Stretch an array by ``hstack()``-ing multiple array fields while
preserving column names and record array structure. If a scalar field is
specified, it will be stretched along with a... | /root_pandas-0.7.0.tar.gz/root_pandas-0.7.0/root_pandas/utils.py | 0.894225 | 0.757548 | utils.py | pypi |
from collections import Counter
import numpy as np
from numpy.lib.recfunctions import append_fields
from pandas import DataFrame, RangeIndex
import pandas as pd
from root_numpy import root2array, list_trees
import fnmatch
from root_numpy import list_branches
from root_numpy.extern.six import string_types
import iterto... | /root_pandas-0.7.0.tar.gz/root_pandas-0.7.0/root_pandas/readwrite.py | 0.788054 | 0.297486 | readwrite.py | pypi |
from numpy import (
array, sqrt, cbrt, sign, abs as np_abs, float64, power as np_pow, finfo,
concatenate, inf, around as np_round, isclose, isreal,
)
from ._quadratic import solve_quadratic
from ._tracking import RootTracker
from ._utils import get_shared_figs, check_pairwise
AFTER_1 = 1 + finfo(float64).eps
... | /root-solver-0.1.1.tar.gz/root-solver-0.1.1/src/root_solver/_cubic.py | 0.641422 | 0.488893 | _cubic.py | pypi |
import click
import glob
import numpy as np
import os
import pathlib
import sys
import tifffile as tiff
import torch
from rich import traceback, print
from rts_package.models.unet import U2NET
from torchvision.datasets.utils import download_url
from urllib.error import URLError
WD = os.path.dirname(__file__)
@click.... | /root-tissue-seg-package-1.0.7.tar.gz/root-tissue-seg-package-1.0.7/rts_package/cli_pred.py | 0.461259 | 0.345864 | cli_pred.py | pypi |
import click
import glob
import numpy as np
import os
import pathlib
import sys
import tifffile as tiff
import torch
from rich import traceback, print
from rts_package.models.unet import U2NET
from torchvision.datasets.utils import download_url
from urllib.error import URLError
from captum.attr import visualization as... | /root-tissue-seg-package-1.0.7.tar.gz/root-tissue-seg-package-1.0.7/rts_package/cli_feat_imp.py | 0.514644 | 0.307163 | cli_feat_imp.py | pypi |
import click
import glob
import numpy as np
import os
import pathlib
import sys
import tifffile as tiff
import torch
from rich import traceback, print
from rts_package.models.unet import U2NET
from torchvision.datasets.utils import download_url
from urllib.error import URLError
from rts_package.utils import monte_carl... | /root-tissue-seg-package-1.0.7.tar.gz/root-tissue-seg-package-1.0.7/rts_package/cli_uncert_pred.py | 0.439026 | 0.260272 | cli_uncert_pred.py | pypi |
from typing import Any, Optional
import torch
from torch import nn
__all__ = ['UNET', 'NESTEDUNET', 'U2NET']
# Originally contained own implementation of was changed because of weight init
# and adopted from https://github.com/ShawnBIT/UNet-family/blob/master/networks/UNet.py
from rts_package.models.unet_super impo... | /root-tissue-seg-package-1.0.7.tar.gz/root-tissue-seg-package-1.0.7/rts_package/models/unet.py | 0.939401 | 0.459137 | unet.py | pypi |
import math
import torch
from torch import nn
from torch.nn import init
def init_weights(net, init_type='normal'):
# print('initialization method [%s]' % init_type)
if init_type == 'kaiming':
net.apply(weights_init_kaiming)
else:
raise NotImplementedError('initialization method [%s] is no... | /root-tissue-seg-package-1.0.7.tar.gz/root-tissue-seg-package-1.0.7/rts_package/models/unet_utils.py | 0.731634 | 0.304584 | unet_utils.py | pypi |
import numpy as np
from cmath import exp, pi
from itertools import product
from typing import Union
import root_tomography.meas_statistics as stat
from root_tomography.entity import State, Process, part_trace, rand_unitary
from root_tomography.tools import kron3d, extend, base2povm, meas_matrix
rng = np.random.default_... | /root_tomography-0.7-py3-none-any.whl/root_tomography/experiment.py | 0.791378 | 0.233772 | experiment.py | pypi |
import numpy as np
from abc import ABC, abstractmethod
from typing import Callable
from root_tomography.tools import uprint
class Optimizer(ABC):
display = True
def set_options(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
return self
@abstractm... | /root_tomography-0.7-py3-none-any.whl/root_tomography/optimizer.py | 0.656108 | 0.336631 | optimizer.py | pypi |
import numpy as np
class State:
dim = None
_dm = None
_root = None
_rank = None
@classmethod
def from_root(cls, root: np.ndarray):
state = cls()
state.dim = root.shape[0]
state._root = root
state._rank = root.shape[1]
return state
@classmethod
... | /root_tomography-0.7-py3-none-any.whl/root_tomography/entity.py | 0.731922 | 0.436982 | entity.py | pypi |
import numpy as np
from typing import Union
from root_tomography.entity import State
from root_tomography.experiment import Experiment
from root_tomography.optimizer import FixedPoint, AutoRank
from root_tomography.tools import pinv, pval
def reconstruct_state(
ex: Experiment,
rank: Union[int, str] = ... | /root_tomography-0.7-py3-none-any.whl/root_tomography/estimator.py | 0.777258 | 0.482978 | estimator.py | pypi |
import numpy as np
from scipy.linalg import null_space
from typing import Union
from warnings import warn
from root_tomography.entity import State, Process
from root_tomography.experiment import Experiment, nshots_divide
from root_tomography.tools import extend
def infomatrix(entity: Union[State, Process], ex: Experi... | /root_tomography-0.7-py3-none-any.whl/root_tomography/bound.py | 0.816662 | 0.349255 | bound.py | pypi |
from abc import ABC, abstractmethod
import numpy as np
from typing import Tuple
rng = np.random.default_rng()
class Statistics(ABC):
@staticmethod
@abstractmethod
def sample(n: int, p: np.ndarray) -> np.ndarray:
pass
@staticmethod
@abstractmethod
def logL(n: np.ndarray, k: np.ndarray,... | /root_tomography-0.7-py3-none-any.whl/root_tomography/meas_statistics.py | 0.920603 | 0.696939 | meas_statistics.py | pypi |
class RootApproximator:
def regula_falsi(self, func, a, b, error, display_guesses=False):
"""
Approximate the root of a given function using the Regula Falsi method.
Parameters:
func (function): The function for which to find the root.
a (float): The lower bound of the inter... | /rootdescent-0.1.0.tar.gz/rootdescent-0.1.0/libname/approximators.py | 0.958972 | 0.863622 | approximators.py | pypi |
class Integration:
def trapezoidal_rule(self, func, a, b, n):
"""
Approximate the definite integral of a function using the trapezoidal rule.
Parameters:
func (function): The function to integrate.
a (float): The lower bound of the integration interval.
b (float): Th... | /rootdescent-0.1.0.tar.gz/rootdescent-0.1.0/libname/intergrators.py | 0.951986 | 0.83762 | intergrators.py | pypi |
from __future__ import division, absolute_import, print_function
__version__ = '1.0.3'
import itertools
class Result(object):
"""
Result from a succesful call to a function in this module.
Attributes
----------
root : float or None
Estimated root location. `None` if it is not known.
... | /rootfinding-1.0.3.tar.gz/rootfinding-1.0.3/rootfinding.py | 0.956553 | 0.537345 | rootfinding.py | pypi |
# RootMD 🩺 👩🏼⚕️
Scientific reports/literate programming tool for CERN ROOT and c++. RootMD is a markdown (and other format) processor for mark up with ROOT-flavored c++ code. RootMD can execute c++ code and inject the output (from stdout, stderr) and link or embed image outputs. Provides a format for producing co... | /rootmd-0.5.9.tar.gz/rootmd-0.5.9/README.md | 0.531453 | 0.818338 | README.md | pypi |
print(__doc__)
from rootpy.tree import Tree, TreeModel, FloatCol, IntCol
from rootpy.io import root_open
from rootpy.vector import LorentzVector
from rootpy import stl
from random import gauss, randint
f = root_open("test.root", "recreate")
# define the model
class Point(TreeModel):
x = FloatCol()
y = FloatC... | /rootpy-1.0.1.tar.gz/rootpy-1.0.1/examples/tree/model.py | 0.427755 | 0.422922 | model.py | pypi |
print(__doc__)
import ROOT
import numpy as np
from rootpy.plotting import Hist, HistStack, Legend, Canvas
from rootpy.plotting.style import get_style, set_style
from rootpy.plotting.utils import draw
from rootpy.interactive import wait
import rootpy.plotting.root2matplotlib as rplt
import matplotlib.pyplot as plt
from ... | /rootpy-1.0.1.tar.gz/rootpy-1.0.1/examples/plotting/plot_matplotlib_hist.py | 0.579876 | 0.439687 | plot_matplotlib_hist.py | pypi |
print(__doc__)
import ROOT
import numpy as np
from rootpy.plotting import Canvas, Graph
from rootpy.plotting.style import get_style, set_style
from rootpy.interactive import wait
import rootpy.plotting.root2matplotlib as rplt
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocato... | /rootpy-1.0.1.tar.gz/rootpy-1.0.1/examples/plotting/plot_matplotlib_graph.py | 0.482429 | 0.393822 | plot_matplotlib_graph.py | pypi |
print(__doc__)
from rootpy.extern.six.moves import range
from rootpy.plotting import Hist, Hist2D, Hist3D, HistStack, Legend, Canvas
from rootpy.interactive import wait
import random
# create a simple 1D histogram with 10 constant-width bins between 0 and 1
h_simple = Hist(10, 0, 1)
print(h_simple.name)
# If the name... | /rootpy-1.0.1.tar.gz/rootpy-1.0.1/examples/plotting/plot_hist.py | 0.487307 | 0.49762 | plot_hist.py | pypi |
import asyncio
import functools
import json
import logging
import math
import multiprocessing
import os
import shlex
import subprocess
import textwrap
from concurrent.futures import ThreadPoolExecutor
from typing import Tuple
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from pymediainfo import MediaI... | /rootsuja-1.9.2.tar.gz/rootsuja-1.9.2/kynaylibs/nan/utils/tools.py | 0.497803 | 0.167525 | tools.py | pypi |
class Weebify:
NORMIE_FONT = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",... | /rootsuja-1.9.2.tar.gz/rootsuja-1.9.2/kynaylibs/nan/utils/constants.py | 0.58059 | 0.522507 | constants.py | pypi |
from math import ceil
from pyrogram.types import InlineKeyboardButton
class EqInlineKeyboardButton(InlineKeyboardButton):
def __eq__(self, other):
return self.text == other.text
def __lt__(self, other):
return self.text < other.text
def __gt__(self, other):
return self.text > ot... | /rootsuja-1.9.2.tar.gz/rootsuja-1.9.2/kynaylibs/nan/utils/inline.py | 0.662141 | 0.153708 | inline.py | pypi |
import asyncio
import re
import traceback
from io import BytesIO
from typing import Dict
from PIL import Image
from pyrogram import Client, errors, types
META_COMMENTS = re.compile(r"^ *# *meta +(\S+) *: *(.*?)\s*$", re.MULTILINE)
interact_with_to_delete = []
def text(message: types.Message) -> str:
"""Find te... | /rootsuja-1.9.2.tar.gz/rootsuja-1.9.2/kynaylibs/nan/utils/function.py | 0.613468 | 0.233695 | function.py | pypi |
import requests
import json
import argparse
import argparse_actions
class Roomba(object):
"""
This class abstracts a roowifi and gives attributes for telemetry data,
as well as methods to command the robot
"""
def __init__(self, ip, user='admin', passwd='roombawifi'):
self.ip = ip
... | /roowifi-0.0.2.tar.gz/roowifi-0.0.2/roowifi.py | 0.620392 | 0.159675 | roowifi.py | pypi |
import unittest
from textwrap import dedent
import rope.base.taskhandle
import rope.refactor.introduce_parameter
import ropetest.refactor.extracttest
import ropetest.refactor.importutilstest
import ropetest.refactor.inlinetest
import ropetest.refactor.movetest
import ropetest.refactor.multiprojecttest
import ropetest.... | /rope-1.9.0.tar.gz/rope-1.9.0/ropetest/refactor/__init__.py | 0.528777 | 0.270333 | __init__.py | pypi |
import unittest
import rope.base.taskhandle
import rope.refactor.introduce_parameter
import ropetest.refactor.extracttest
import ropetest.refactor.importutilstest
import ropetest.refactor.inlinetest
import ropetest.refactor.movetest
import ropetest.refactor.multiprojecttest
import ropetest.refactor.patchedasttest
impo... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/ropetest/refactor/__init__.py | 0.557123 | 0.219986 | __init__.py | pypi |
import rope.base.codeanalyze
import rope.base.evaluate
from rope.base import worder, exceptions, utils
from rope.base.codeanalyze import ArrayLinesAdapter, LogicalLineFinder
class FixSyntax(object):
def __init__(self, pycore, code, resource, maxfixes=1):
self.pycore = pycore
self.code = code
... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/contrib/fixsyntax.py | 0.504394 | 0.151875 | fixsyntax.py | pypi |
from rope.base import ast, evaluate, pyobjects
def find_errors(project, resource):
"""Find possible bad name and attribute accesses
It returns a list of `Error`\s.
"""
pymodule = project.pycore.resource_to_pyobject(resource)
finder = _BadAccessFinder(pymodule)
ast.walk(pymodule.get_ast(), fin... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/contrib/finderrors.py | 0.712132 | 0.23445 | finderrors.py | pypi |
import re
from rope.base import (exceptions, pynames, resourceobserver,
taskhandle, pyobjects, builtins, resources)
from rope.refactor import importutils
class AutoImport(object):
"""A class for finding the module that provides a name
This class maintains a cache of global names in py... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/contrib/autoimport.py | 0.593491 | 0.159217 | autoimport.py | pypi |
import rope.base.codeanalyze
import rope.base.evaluate
import rope.base.pyobjects
from rope.base import taskhandle, exceptions, worder
from rope.contrib import fixsyntax
from rope.refactor import occurrences
def find_occurrences(project, resource, offset, unsure=False, resources=None,
in_hierarch... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/contrib/findit.py | 0.69368 | 0.265875 | findit.py | pypi |
import keyword
import sys
import warnings
import rope.base.codeanalyze
import rope.base.evaluate
from rope.base import pyobjects, pyobjectsdef, pynames, builtins, exceptions, worder
from rope.base.codeanalyze import SourceLinesAdapter
from rope.contrib import fixsyntax
from rope.refactor import functionutils
def cod... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/contrib/codeassist.py | 0.687945 | 0.272012 | codeassist.py | pypi |
from rope.base.fscommands import _decode_data
from rope.base import ast, exceptions, utils
class PyObject(object):
def __init__(self, type_):
if type_ is None:
type_ = self
self.type = type_
def get_attributes(self):
if self.type is self:
return {}
ret... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/pyobjects.py | 0.845863 | 0.173568 | pyobjects.py | pypi |
import rope.base.evaluate
from rope.base import ast
class Arguments(object):
"""A class for evaluating parameters passed to a function
You can use the `create_arguments` factory. It handles implicit
first arguments.
"""
def __init__(self, args, scope):
self.args = args
self.sco... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/arguments.py | 0.655777 | 0.286606 | arguments.py | pypi |
import datetime
import difflib
import os
import time
import warnings
import rope.base.fscommands
from rope.base import taskhandle, exceptions, utils
class Change(object):
"""The base class for changes
Rope refactorings return `Change` objects. They can be previewed,
committed or undone.
"""
de... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/change.py | 0.714329 | 0.166134 | change.py | pypi |
import bisect
import keyword
import rope.base.simplify
def get_name_at(resource, offset):
source_code = resource.read()
word_finder = Worder(source_code)
return word_finder.get_word_at(offset)
class Worder(object):
"""A class for finding boundaries of words and expressions
Note that in these m... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/worder.py | 0.596668 | 0.273196 | worder.py | pypi |
import warnings
def saveit(func):
"""A decorator that caches the return value of a function"""
name = '_' + func.__name__
def _wrapper(self, *args, **kwds):
if not hasattr(self, name):
setattr(self, name, func(self, *args, **kwds))
return getattr(self, name)
return _wrappe... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/utils.py | 0.648244 | 0.207155 | utils.py | pypi |
import warnings
from rope.base import exceptions
class TaskHandle(object):
def __init__(self, name='Task', interrupts=True):
"""Construct a TaskHandle
If `interrupts` is `False` the task won't be interrupted by
calling `TaskHandle.stop()`.
"""
self.name = name
s... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/taskhandle.py | 0.703346 | 0.165357 | taskhandle.py | pypi |
import rope.base.pyobjects
from rope.base import exceptions, utils
class PyName(object):
"""References to `PyObject`\s inside python programs"""
def get_object(self):
"""Return the `PyObject` object referenced by this `PyName`"""
def get_definition_location(self):
"""Return a (module, li... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/pynames.py | 0.759939 | 0.280419 | pynames.py | pypi |
import os
import re
import rope.base.builtins
from rope.base import exceptions
class PyObjectToTextual(object):
"""For transforming `PyObject` to textual form
This can be used for storing `PyObjects` in files. Use
`TextualToPyObject` for converting back.
"""
def __init__(self, project):
... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/oi/transform.py | 0.695131 | 0.319572 | transform.py | pypi |
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import evaluate, utils, arguments
_ignore_inferred = utils.ignore_exception(
rope.base.pyobjects.IsBeingInferredError)
@_ignore_inferred
def infer_returned_object(pyfunction, args):
"""Infer the `PyObject` this `PyF... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/base/oi/soi.py | 0.453988 | 0.187914 | soi.py | pypi |
from rope.base import (change, taskhandle, evaluate,
exceptions, pyobjects, pynames, ast)
from rope.refactor import restructure, sourceutils, similarfinder, importutils
class UseFunction(object):
"""Try to use a function wherever possible"""
def __init__(self, project, resource, offset... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/usefunction.py | 0.720958 | 0.200401 | usefunction.py | pypi |
import collections
import re
import warnings
from rope.base import ast, codeanalyze, exceptions
def get_patched_ast(source, sorted_children=False):
"""Adds ``region`` and ``sorted_children`` fields to nodes
Adds ``sorted_children`` field only if `sorted_children` is True.
"""
return patch_ast(ast.p... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/patchedast.py | 0.549761 | 0.296132 | patchedast.py | pypi |
from rope.base import pyobjects, codeanalyze, exceptions, pynames, taskhandle, evaluate, worder
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.refactor import importutils, rename, occurrences, sourceutils, functionutils
def create_move(project, resource, offset=None):
"""A factory ... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/move.py | 0.733643 | 0.231679 | move.py | pypi |
import copy
import rope.base.exceptions
from rope.base import pyobjects, taskhandle, evaluate, worder, codeanalyze, utils
from rope.base.change import ChangeContents, ChangeSet
from rope.refactor import occurrences, functionutils
class ChangeSignature(object):
def __init__(self, project, resource, offset):
... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/change_signature.py | 0.714528 | 0.169406 | change_signature.py | pypi |
import warnings
from rope.base import change, taskhandle, builtins, ast, codeanalyze
from rope.refactor import patchedast, similarfinder, sourceutils
from rope.refactor.importutils import module_imports
class Restructure(object):
"""A class to perform python restructurings
A restructuring transforms pieces ... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/restructure.py | 0.716219 | 0.243474 | restructure.py | pypi |
import re
import rope.base.pynames
from rope.base import pynames, pyobjects, codeanalyze, evaluate, exceptions, utils, worder
class Finder(object):
"""For finding occurrences of a name
The constructor takes a `filters` argument. It should be a list
of functions that take a single argument. For each po... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/occurrences.py | 0.71413 | 0.405714 | occurrences.py | pypi |
from rope.base import ast, codeanalyze
def get_indents(lines, lineno):
return codeanalyze.count_line_indents(lines.get_line(lineno))
def find_minimum_indents(source_code):
result = 80
lines = source_code.split('\n')
for line in lines:
if line.strip() == '':
continue
resul... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/sourceutils.py | 0.492188 | 0.205217 | sourceutils.py | pypi |
import warnings
from rope.base import exceptions, pyobjects, pynames, taskhandle, evaluate, worder, codeanalyze
from rope.base.change import ChangeSet, ChangeContents, MoveResource
from rope.refactor import occurrences, sourceutils
class Rename(object):
"""A class for performing rename refactoring
It can re... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/rename.py | 0.648132 | 0.214177 | rename.py | pypi |
import rope.base.change
from rope.base import exceptions, evaluate, worder, codeanalyze
from rope.refactor import functionutils, sourceutils, occurrences
class IntroduceParameter(object):
"""Introduce parameter refactoring
This refactoring adds a new parameter to a function and replaces
references to an ... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/introduce_parameter.py | 0.657098 | 0.376279 | introduce_parameter.py | pypi |
from rope.base import ast
def find_visible(node, lines):
"""Return the line which is visible from all `lines`"""
root = ast_suite_tree(node)
return find_visible_for_suite(root, lines)
def find_visible_for_suite(root, lines):
if len(lines) == 1:
return lines[0]
line1 = lines[0]
line2 ... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/suites.py | 0.651466 | 0.237786 | suites.py | pypi |
import re
import rope.refactor.wildcards
from rope.base import codeanalyze, evaluate, exceptions, ast, builtins
from rope.refactor import (patchedast, sourceutils, occurrences,
wildcards, importutils)
class BadNameInCheckError(exceptions.RefactoringError):
pass
class SimilarFinder(ob... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/similarfinder.py | 0.686055 | 0.244848 | similarfinder.py | pypi |
from rope.base import ast, evaluate, builtins, pyobjects
from rope.refactor import patchedast, occurrences
class Wildcard(object):
def get_name(self):
"""Return the name of this wildcard"""
def matches(self, suspect, arg):
"""Return `True` if `suspect` matches this wildcard"""
class Suspec... | /rope_py3k-0.9.4.tar.gz/rope_py3k-0.9.4/rope/refactor/wildcards.py | 0.796055 | 0.365796 | wildcards.py | pypi |
try:
import unittest2 as unittest
except ImportError:
import unittest
import rope.base.taskhandle
import rope.refactor.introduce_parameter
import ropetest.refactor.extracttest
import ropetest.refactor.importutilstest
import ropetest.refactor.inlinetest
import ropetest.refactor.movetest
import ropetest.refactor... | /ropee-0.13.3.tar.gz/ropee-0.13.3/ropetest/refactor/__init__.py | 0.586168 | 0.284123 | __init__.py | pypi |
from rope.base import ast, evaluate, pyobjects
def find_errors(project, resource):
"""Find possible bad name and attribute accesses
It returns a list of `Error`\s.
"""
pymodule = project.get_pymodule(resource)
finder = _BadAccessFinder(pymodule)
ast.walk(pymodule.get_ast(), finder)
return... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/contrib/finderrors.py | 0.711331 | 0.236109 | finderrors.py | pypi |
import rope.base.codeanalyze
import rope.base.evaluate
import rope.base.pyobjects
from rope.base import taskhandle, exceptions, worder
from rope.contrib import fixsyntax
from rope.refactor import occurrences
def find_occurrences(project, resource, offset, unsure=False, resources=None,
in_hierarch... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/contrib/findit.py | 0.695338 | 0.275672 | findit.py | pypi |
from rope.base.fscommands import _decode_data
from rope.base import ast, exceptions, utils
class PyObject(object):
def __init__(self, type_):
if type_ is None:
type_ = self
self.type = type_
def get_attributes(self):
if self.type is self:
return {}
ret... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/pyobjects.py | 0.845863 | 0.173358 | pyobjects.py | pypi |
import rope.base.evaluate
from rope.base import ast
class Arguments(object):
"""A class for evaluating parameters passed to a function
You can use the `create_arguments` factory. It handles implicit
first arguments.
"""
def __init__(self, args, scope):
self.args = args
self.sco... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/arguments.py | 0.658637 | 0.28703 | arguments.py | pypi |
import datetime
import difflib
import os
import time
import rope.base.fscommands
from rope.base import taskhandle, exceptions, utils
class Change(object):
"""The base class for changes
Rope refactorings return `Change` objects. They can be previewed,
committed or undone.
"""
def do(self, job_s... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/change.py | 0.755637 | 0.189859 | change.py | pypi |
import bisect
import keyword
import rope.base.simplify
def get_name_at(resource, offset):
source_code = resource.read()
word_finder = Worder(source_code)
return word_finder.get_word_at(offset)
class Worder(object):
"""A class for finding boundaries of words and expressions
Note that in these m... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/worder.py | 0.623835 | 0.239116 | worder.py | pypi |
import bisect
import re
import token
import tokenize
class ChangeCollector(object):
def __init__(self, text):
self.text = text
self.changes = []
def add_change(self, start, end, new_text=None):
if new_text is None:
new_text = self.text[start:end]
self.changes.appe... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/codeanalyze.py | 0.432063 | 0.161221 | codeanalyze.py | pypi |
from rope.base import exceptions
class TaskHandle(object):
def __init__(self, name='Task', interrupts=True):
"""Construct a TaskHandle
If `interrupts` is `False` the task won't be interrupted by
calling `TaskHandle.stop()`.
"""
self.name = name
self.interrupts = ... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/taskhandle.py | 0.794823 | 0.174094 | taskhandle.py | pypi |
import rope.base.pyobjects
from rope.base import exceptions, utils
class PyName(object):
"""References to `PyObject`\s inside python programs"""
def get_object(self):
"""Return the `PyObject` object referenced by this `PyName`"""
def get_definition_location(self):
"""Return a (module, li... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/pynames.py | 0.750095 | 0.271231 | pynames.py | pypi |
import os
import re
import rope.base.builtins
from rope.base import exceptions
class PyObjectToTextual(object):
"""For transforming `PyObject` to textual form
This can be used for storing `PyObjects` in files. Use
`TextualToPyObject` for converting back.
"""
def __init__(self, project):
... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/oi/transform.py | 0.595493 | 0.260419 | transform.py | pypi |
import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import evaluate, utils, arguments
from rope.base.oi.type_hinting.factory import get_type_hinting_factory
_ignore_inferred = utils.ignore_exception(
rope.base.pyobjects.IsBeingInferredError)
@_ignore_inferred
def infer_r... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/oi/soi.py | 0.519034 | 0.182863 | soi.py | pypi |
from rope.base.oi.type_hinting import interfaces
from rope.base.oi.type_hinting.providers import (
composite, inheritance, docstrings, numpydocstrings, pep0484_type_comments
)
from rope.base.oi.type_hinting.resolvers import composite as composite_resolvers, types
from rope.base import utils
class TypeHintingFacto... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/oi/type_hinting/factory.py | 0.732879 | 0.211682 | factory.py | pypi |
import re
from rope.base.oi.type_hinting import utils
from rope.base.oi.type_hinting.providers import interfaces
class ParamProvider(interfaces.IParamProvider):
def __init__(self, docstring_parser, resolver):
"""
:type docstring_parser: rope.base.oi.type_hinting.providers.docstrings.IParamParser... | /ropee-0.13.3.tar.gz/ropee-0.13.3/rope/base/oi/type_hinting/providers/docstrings.py | 0.673943 | 0.197793 | docstrings.py | pypi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.