max_stars_repo_path
string
max_stars_repo_name
string
max_stars_count
int64
id
string
content
string
add_param_types
int64
add_return_types
int64
add_class_field_types
int64
add_instance_field_types
int64
add_total
int64
add_error
int64
examples/grid_search_example.py
scikit-learn-contrib/categorical_encoding
1,178
1766930
""" Modified from https://scikit-learn.org/stable/auto_examples/model_selection/plot_grid_search_digits.html Tested to work with scikit-learn 0.20.2 """ from sklearn.model_selection import GridSearchCV from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from sklearn....
0
0
0
0
0
0
alipay/aop/api/response/AlipayPcreditLoanApplyQueryResponse.py
snowxmas/alipay-sdk-python-all
213
1766946
<reponame>snowxmas/alipay-sdk-python-all #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayPcreditLoanApplyQueryResponse(AlipayResponse): def __init__(self): super(AlipayPcreditLoanApplyQueryResponse, self).__init__() ...
0
0
0
0
0
0
kolibri/core/tasks/test/test_utils.py
MBKayro/kolibri
545
1766966
<filename>kolibri/core/tasks/test/test_utils.py import threading import time from mock import patch from kolibri.core.tasks.utils import InfiniteLoopThread class TestBaseCloseableThread(object): def test_handles_interpreter_shutting_down(self): """ For python interpreters older than 3.4, we know...
0
0
0
0
0
0
src/third_party/colorama/src/colorama/tests/ansi_test.py
rhencke/engine
2,151
1766980
# Copyright <NAME> 2013. BSD 3-Clause license, see LICENSE file. import sys try: from unittest2 import TestCase, main except ImportError: from unittest import TestCase, main from ..ansi import Fore, Back, Style from ..ansitowin32 import AnsiToWin32 stdout_orig = sys.stdout stderr_orig = sys.stderr class An...
0
0
0
0
0
0
cola/commands/master.py
leafgray/cola
1,061
1766985
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2013 <NAME> <<EMAIL>> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required...
0
0
0
0
0
0
test/python/quantum_info/xx_decompose/utilities.py
Roshan-Thomas/qiskit-terra
1,599
1767014
# This code is part of Qiskit. # # (C) Copyright IBM 2021 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wor...
3
1
0
0
4
0
projects/manipulathor_baselines/armpointnav_baselines/experiments/ithor/armpointnav_disjoint_depth.py
brandontrabucco/allenact
187
1767024
<filename>projects/manipulathor_baselines/armpointnav_baselines/experiments/ithor/armpointnav_disjoint_depth.py import gym import torch.nn as nn from allenact_plugins.manipulathor_plugin.manipulathor_constants import ENV_ARGS from allenact_plugins.manipulathor_plugin.manipulathor_task_samplers import ( ArmPointNav...
0
0
0
0
0
0
reactive-lab-gateway/validate.py
NiteshKant/ReactiveLab
190
1767043
#!/usr/bin/env python import argparse import json import requests import time import random def validateTestEndpointImplementation(baseUrl): try: seed = random.randint(10000, 99999) url = baseUrl + "/test?id=" + str(seed) print "Validating WsPerfLab Implementation at URL: " + url ...
0
0
0
0
0
0
art/estimators/certification/abstain.py
minaremeli/adversarial-robustness-toolbox
1,350
1767052
<reponame>minaremeli/adversarial-robustness-toolbox # MIT License # # Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020 # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated # documentation files (the "Software"), to deal in the Software witho...
0
0
0
0
0
0
python/test/unit/runtime/test_comm.py
ScriptBox99/triton
3,352
1767120
import torch import triton import pytest import subprocess import triton.language as tl import numpy as np def get_p2p_matrix() -> object: try: stdout = subprocess.check_output(["nvidia-smi", "topo", "-p2p", "n"]).decode("ascii") except subprocess.CalledProcessError: return pytest....
0
5
0
0
5
0
python/090_Subsets_II.py
dvlpsh/leetcode-1
4,416
1767124
class Solution(object): # def subsetsWithDup(self, nums): # """ # :type nums: List[int] # :rtype: List[List[int]] # """ # nums.sort() # res = [] # for i in range(1 << len(nums)): # res.append(self.get_subsets(nums, i)) # # remove duplicate ...
0
1
0
0
1
0
setup.py
phurwicz/CompressionVAE
139
1767141
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="cvae", version="0.0.3", author="<NAME>", author_email="<EMAIL>", description="CompressionVAE: General purpose dimensionality reduction and manifold learning tool based on " ...
0
0
0
0
0
0
priv/zstd/tests/test-license.py
byronpc/zstd-erlang
186
1767173
#!/usr/bin/env python3 # ################################################################ # Copyright (c) 2016-2020, Facebook, Inc. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the # LICENSE file in the root directory of this source tree) and the GPLv2 (found # in ...
0
4
4
0
8
0
stocklook/patterns/pattern.py
zbarge/stocklook
149
1767191
<filename>stocklook/patterns/pattern.py from pandas import DataFrame class Pattern: def __init__(self, data, time_frame=None, **kwargs): assert data and len(data) > 1 self.data = data self.time_frame = time_frame self.kwargs = kwargs @property def time_elapsed(self): ...
0
0
0
0
0
0
plugins/dbnd-docker/src/dbnd_docker/docker_ctrl.py
ipattarapong/dbnd
224
1767204
<reponame>ipattarapong/dbnd<filename>plugins/dbnd-docker/src/dbnd_docker/docker_ctrl.py from dbnd._core.task_run.task_run_ctrl import TaskRunCtrl class DockerRunCtrl(TaskRunCtrl): def docker_run(self): pass def on_kill(self): pass
0
0
0
0
0
0
onedrived/od_models/__init__.py
r-gorajski/onedrived-dev
869
1767206
from . import account_profile, bidict, drive_config, path_filter, pretty_api, webhook_notification __all__ = ['account_profile', 'bidict', 'drive_config', 'path_filter', 'pretty_api', 'webhook_notification']
0
0
0
0
0
0
src/models/spline.py
TECHENGINESSRL/audio-super-res
712
1767216
<gh_stars>100-1000 ## NOTE: THIS CURRENTLY DOES NOT WORK because there are no variables in the model--we would need to edit ## model.py to incorperate spline directly into the training workflow import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import numpy as np import tensorflow as tf from scipy import inte...
0
0
0
0
0
0
march/validate_lr.py
zygmuntz/numer.ai
163
1767260
#!/usr/bin/env python "Load data, create the validation split, optionally scale data, train a linear model, evaluate" "Code updated for march 2016 data" import pandas as pd from sklearn.cross_validation import train_test_split from sklearn.pipeline import Pipeline from sklearn.preprocessing import Normalizer, Polyno...
0
0
0
0
0
0
examples/cuda/vector_add_jinja2.py
cffbots/kernel_tuner
104
1767272
<gh_stars>100-1000 """ More advanced example of vector_add using a Jinja2 template. """ import json import numpy from jinja2 import Template from kernel_tuner import tune_kernel def tune(): with open('vector_add_jinja.cu', 'r') as template_file: template = Template(template_file.read()) size = 100...
0
0
0
0
0
0
nolearn/tests/test_grid_search.py
KEVINYZY/nolearn
968
1767286
from sklearn.linear_model import LogisticRegression from sklearn.grid_search import GridSearchCV from mock import Mock import numpy as np def test_grid_search(): from ..grid_search import grid_search dataset = Mock() dataset.data = np.array([[1, 2, 3], [3, 3, 3]] * 20) dataset.target = np.array([0, 1...
0
0
0
0
0
0
docs/tutorials/datasets/kinetics400.py
Kh4L/gluon-cv
5,447
1767310
"""Prepare the Kinetics400 dataset ================================== `Kinetics400 <https://deepmind.com/research/open-source/kinetics>`_ is an action recognition dataset of realistic action videos, collected from YouTube. With 306,245 short trimmed videos from 400 action categories, it is one of the largest and most...
0
0
0
0
0
0
tests/test_webhook_worker.py
r-gorajski/onedrived-dev
869
1767319
import json import threading import unittest import onedrivesdk from onedrived import get_resource, od_webhook from tests.test_repo import get_sample_repo class TestWebhookWorker(unittest.TestCase): def setUp(self): self.temp_config_dir, self.temp_repo_dir, self.drive_config, self.repo = get_sample_re...
0
0
0
0
0
0
setup.py
themiurgo/subsample
109
1767334
from setuptools import setup import subsample setup(name = 'subsample', version = subsample.__version__, description = 'Command-line interface for sampling lines from text files', url = 'https://github.com/paulgb/subsample', author = '<NAME>', author_email = '<EMAIL>', packages = ...
0
0
0
0
0
0
tests/psd_tools/api/test_shape.py
afrigon/psd-tools
644
1767343
from __future__ import absolute_import, unicode_literals import pytest import logging from psd_tools.api.psd_image import PSDImage from psd_tools.api.shape import ( Rectangle, RoundedRectangle, Ellipse, Line, Invalidated ) from ..utils import full_name logger = logging.getLogger(__name__) VECTOR_MASK2 = PSDImag...
0
2
0
0
2
0
postprocess/cross_cpu_voltage_graph.py
Reinazhard/freqbench
121
1767347
<gh_stars>100-1000 #!/usr/bin/env python3 import sys import matplotlib.pyplot as plt import re import collections CPU_LABELS = { 1: "Little", 4: "Big", 6: "Big", 7: "Prime" } flags = set() socs = {} freq_load = "active" col_name = None for i, arg in enumerate(sys.argv[1:]): if ":" in arg: ...
0
0
0
0
0
0
lib/utils/vgg_weights_helper.py
BarneyQiao/pcl.pytorch
233
1767352
<gh_stars>100-1000 """ Helper functions for converting resnet pretrained weights from other formats """ import os import pickle import torch import nn as mynn import utils.detectron_weight_helper as dwh from core.config import cfg def load_pretrained_imagenet_weights(model): """Load pretrained weights Args:...
0
0
0
0
0
0
fastfold/model/fastnn/msa.py
hpcaitech/FastFold
303
1767365
<filename>fastfold/model/fastnn/msa.py import math import torch import torch.nn as nn import torch.nn.functional as F from fastfold.model.fastnn.kernel import LayerNorm from fastfold.model.fastnn.ops import Transition, SelfAttention from fastfold.model.fastnn.kernel import bias_dropout_add from fastfold.distributed i...
0
0
0
0
0
0
Python/1-2/2.py
Xi-Plus/Codecademy
346
1767395
meal = 44.50 tax = 0.0675
0
0
0
0
0
0
insights/parsers/httpd_open_nfs.py
lhuett/insights-core
121
1767449
""" HttpdOnNFSFilesCount - datasource `httpd_on_nfs` ================================================ Shared parsers for parsing output of the datasource `httpd_on_nfs`. """ from insights import parser, JSONParser from insights.specs import Specs @parser(Specs.httpd_on_nfs) class HttpdOnNFSFilesCount(JSONParser): ...
0
0
0
0
0
0
extra/CI/integration/test_gpu_support.py
agaur-lbl/shifter
346
1767481
import unittest import subprocess import os import sys import re _container_image=None class TestGPUSupport(unittest.TestCase): """ These tests verify that the GPU resources and configurations (device files, libraries and value of LD_LIBRARY_PATH) are correctly set inside the container. """ _GPU...
0
8
8
0
16
0
src/tests/test_ValueIteration.py
davidshinn/pymdptoolbox
472
1767484
# -*- coding: utf-8 -*- """ Created on Sat Aug 24 15:07:01 2013 @author: steve """ import numpy as np import mdptoolbox from .utils import SMALLNUM, P_forest, R_forest, P_forest_sparse from .utils import R_forest_sparse, P_rand, R_rand, P_rand_sparse, R_rand_sparse from .utils import P_small, R_small, P_sparse def...
0
0
0
0
0
0
dash_docs/chapters/dash_core_components/Link/index.py
joelostblom/dash-docs
379
1767530
<filename>dash_docs/chapters/dash_core_components/Link/index.py<gh_stars>100-1000 # -*- coding: utf-8 -*- import dash_core_components as dcc import dash_html_components as html from dash_docs import styles from dash_docs import tools from dash_docs import reusable_components as rc examples = tools.load_examples(__fil...
0
0
0
0
0
0
trace_obj.py
MoserMichael/pyasmtool
274
1767549
#!/usr/bin/env python3 import pyasmtools class Complex(metaclass=pyasmtools.TraceClass): def __init__(self, re, im: float=0.0): self.real = re self.imag = im def __add__(self, other) -> object: return Complex(self.real + other.real, self.imag + other.imag) def __sub__(self, othe...
1
8
0
0
9
0
examples/uwsgi-connexion/endpoint.py
nervous-inhuman/prometheus_flask_exporter
451
1767577
from main import metrics @metrics.summary('test_by_status', 'Test Request latencies by status', labels={ 'code': lambda r: r.status_code }) def test() -> dict: return {'version': 'Test version'} @metrics.content_type('text/plain') @metrics.counter('test_plain', 'Counter for plain responses') def plain() -> ...
0
2
0
0
2
0
profiler/test_for_profiler.py
ofek/tomli
174
1767603
<reponame>ofek/tomli<gh_stars>100-1000 """Test for profiling. This test can be useful for profiling, as most of the execution time will be spent parsing and rendering instead of managing pytest execution environment. To get and read profiler results: - `tox -e profile` - `firefox .tox/prof/combined.svg` """ import...
0
0
0
0
0
0
buildroot/package/lmsmpris/src/metadata.py
mgrosso/hifiberry-os
637
1767615
<gh_stars>100-1000 import logging import datetime import time import pylast class Metadata: """ Class to start metadata of a song """ def __init__(self, artist=None, title=None, albumArtist=None, albumTitle=None, artUrl=None, discNumber=None, trackNumber=None, ...
0
0
0
0
0
0
Python/longestMountatinSubarray..py
josh-dp/LeetCode-Solutions
263
1767632
# QUESTION : LONGEST MOUNTAIN SUBARRAY. # DESCRIPTION: In this question we have to find the max length of subarray which is a mountain. # Approach : The basic condition for a subarray to be a mountain is that there should be a peak (a largest element). # We can find the peak , and then iterate to the left and to right...
0
1
0
0
1
0
tests/tests/solverwrapper/conftest.py
stevegolton/toppra
342
1767659
<reponame>stevegolton/toppra import pytest import numpy as np import toppra import toppra.constraint as constraint @pytest.fixture(params=[(0, 0)]) def vel_accel_robustaccel(request): "Velocity + Acceleration + Robust Acceleration constraint" dtype_a, dtype_ra = request.param vlims = np.array([[-1, 1], [...
0
0
0
0
0
0
third_party/leiningen/lein_repo.bzl
wcalandro/kythe
1,168
1767673
def _lein_repository(repository_ctx): java = _check_jdk(repository_ctx) url = "https://raw.githubusercontent.com/technomancy/leiningen/%s/bin/lein" % (repository_ctx.attr.version,) repository_ctx.download( url = url, output = "home/lein.sh.in", sha256 = repository_ctx.attr.sha256, ...
0
1
0
0
1
0
alipay/aop/api/domain/AlipayCommerceTransportParkingGoodsModifyModel.py
antopen/alipay-sdk-python-all
213
1767676
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayCommerceTransportParkingGoodsModifyModel(object): def __init__(self): self._arg_date_week = None self._arg_end_time = None self._arg_start_time = ...
0
0
0
0
0
0
GUI/Basic-train/QtPandas/qtpandas/ui/fallback/easygui/boxes/updatable_text_box.py
muyuuuu/PyQt-learn
132
1767693
<reponame>muyuuuu/PyQt-learn """ .. moduleauthor:: <NAME> and <NAME> (active) .. default-domain:: py .. highlight:: python Version |release| """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals from __future__ import absolute_import from builtins import st...
0
0
0
0
0
0
insights/parsers/tests/test_uptime.py
mglantz/insights-core
121
1767712
<reponame>mglantz/insights-core<filename>insights/parsers/tests/test_uptime.py from insights.parsers.uptime import Uptime from insights.parsers import ParseException from insights.tests import context_wrap import datetime import pytest UPTIME_TEST_DATA = [ { 'test_data': " 14:28:24 up 5:55, 4 users, lo...
0
0
0
0
0
0
scripts/coredump/gdbstubs/arch/xtensa.py
Trifunik/zephyr
6,224
1767716
<reponame>Trifunik/zephyr #!/usr/bin/env python3 # # Copyright (c) 2021 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 import binascii import logging import struct from enum import Enum from gdbstubs.gdbstub import GdbStub logger = logging.getLogger("gdbstub") class XtensaSoc(): UNKNOWN = 0 SAMP...
0
0
0
0
0
0
dmb/modeling/stereo/backbones/__init__.py
jiaw-z/DenseMatchingBenchmark
160
1767748
<gh_stars>100-1000 from .backbones import build_backbone
0
0
0
0
0
0
example/HTG9200/fpga_10g/rtl/si5341_i2c_init.py
fdarling/verilog-ethernet
395
1767764
#!/usr/bin/env python from __future__ import annotations """ Generates an I2C init module for an Si5341 PLL chip """ import argparse from jinja2 import Template def main(): parser = argparse.ArgumentParser(description=__doc__.strip()) parser.add_argument('-r', '--regs', type=str, help="register list") p...
3
0
0
0
3
0
python/mlstreaming/__init__.py
kartben/spark-ml-streaming
186
1767772
<gh_stars>100-1000 from mlstreaming.base import StreamingDemo __version__ = '0.1.0'
0
0
0
0
0
0
Python3/149.py
rakhi2001/ecom7
854
1767786
__________________________________________________________________________________________________ sample 40 ms submission class Solution: def maxPoints(self, points: List[List[int]]) -> int: if points == [[0,0],[94911151,94911150],[94911152,94911151]]: # HACK return 2 len_points = len(...
0
0
0
0
0
0
s3-angular-website/python/cdk/app.py
mttfarmer/serverless
1,627
1767822
<gh_stars>1000+ #!/usr/bin/env python3 from aws_cdk import core from s3_angular_website.s3_angular_website_stack import S3AngularWebsiteStack app = core.App() S3AngularWebsiteStack(app, "s3-angular-website") app.synth()
0
0
0
0
0
0
tests/test_readme_util.py
WojciechKusa/datasets
10,608
1767843
<filename>tests/test_readme_util.py import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): example_yaml_structure = yaml.safe_load( """\ name: "" allow_empty: false allow_empty_text: true subsection...
0
0
0
0
0
0
vbdiar/scoring/diarization.py
VarunSrivastava19/VBDiarization
101
1767849
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2018 Brno University of Technology FIT # Author: <NAME> <<EMAIL>> # All Rights Reserved from __future__ import annotations import os import re import pickle import logging from shutil import rmtree from subprocess import check_output from tempfile import ...
13
6
0
1
20
0
tools/vcluster/main.py
bopopescu/peloton
617
1767864
<reponame>bopopescu/peloton #!/usr/bin/env python from argparse import ArgumentParser from argparse import RawDescriptionHelpFormatter import os from config_generator import load_config from vcluster import VCluster DATE = "2017-09-13" AUTHOR = "<NAME>" LOGO = """ Created by %s on %s. Copyright Uber Compute Plat...
0
0
0
0
0
0
sample/__init__.py
seba-spoon/Checkout-Python-SDK
165
1767907
<reponame>seba-spoon/Checkout-Python-SDK from sample.paypal_client import *
0
0
0
0
0
0
supervisor/resolution/checks/dns_server_ipv6_error.py
janiversen/supervisor
597
1767910
<gh_stars>100-1000 """Helpers to check DNS servers for IPv6 errors.""" import asyncio from datetime import timedelta from typing import Optional from aiodns import DNSResolver from aiodns.error import DNSError from supervisor.jobs.const import JobCondition, JobExecutionLimit from supervisor.jobs.decorator import Job ...
0
0
0
0
0
0
SimpleCV/MachineLearning/ConfusionMatrix.py
M93Pragya/SimpleCV
1,686
1767911
<reponame>M93Pragya/SimpleCV from SimpleCV.base import * from SimpleCV.ImageClass import Image class ConfusionMatrix(): def __init__(self,classList): self.classList = classList self.classCount = len(classList) self.confusionMatrix = np.zeros([self.classCount,self.classCount]) self.c...
0
0
0
0
0
0
videos/077_metaclasses_in_python/overloading.py
matthewstidham/VideosSampleCode
285
1767926
<filename>videos/077_metaclasses_in_python/overloading.py import inspect import timeit def _type_hint_matches(obj, hint): # only works with concrete types, not things like Optional return hint is inspect.Parameter.empty or isinstance(obj, hint) def _signature_matches(sig: inspect.Signature, ...
0
0
0
0
0
0
docs/conf.py
peaceamongworlds/astor
636
1767954
# coding: utf-8 import os.path import sys import time extensions = [] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'astor' copyright = u'2013-%s, <NAME>' % time.strftime('%Y') version = release = '0.8.1' exclude_patterns = ['_build'] pygments_style = 'sphinx' try: ...
0
0
0
0
0
0
lib/hachoir/parser/image/psd.py
0x20Man/Watcher3
320
1767971
<filename>lib/hachoir/parser/image/psd.py """ Photoshop parser (.psd file). Creation date: 8 january 2006 Author: <NAME> """ from hachoir.parser import Parser from hachoir.field import (FieldSet, UInt16, UInt32, String, NullBytes, Enum, RawBytes) from hachoir.core.endian import BIG_ENDIAN f...
0
0
0
0
0
0
chemicalx/models/__init__.py
vishalbelsare/chemicalx
443
1767972
"""Models for ChemicalX.""" from class_resolver import Resolver from .base import Model, UnimplementedModel from .caster import CASTER from .deepddi import DeepDDI from .deepdds import DeepDDS from .deepdrug import DeepDrug from .deepsynergy import DeepSynergy from .epgcnds import EPGCNDS from .gcnbmp import GCNBMP f...
0
0
0
0
0
0
urizen/visualizers/__init__.py
vurmux/urizen
107
1767980
import urizen.visualizers.vg_pillow from urizen.visualizers.vg_pillow import vg_pillow_pixelated import urizen.visualizers.vg_tiled from urizen.visualizers.vg_tiled import vg_tiled
0
0
0
0
0
0
notebooks/common/params_inf.py
yuhonghong66/DeepLearningFrameworks
3,266
1767997
<reponame>yuhonghong66/DeepLearningFrameworks<gh_stars>1000+ BATCH_SIZE = 32 RESNET_FEATURES = 2048 BATCHES_GPU = 40
0
0
0
0
0
0
clearml_agent/backend_api/session/client/__init__.py
Honzys/clearml-agent
112
1768004
from .client import APIClient, StrictSession, APIError
0
0
0
0
0
0
rollbar/contrib/rq/__init__.py
arthurio/pyrollbar
177
1768026
""" Exception handler hook for RQ (http://python-rq.org/) How to use: 1. Instead of using the default "rqworker" script to run the worker, write your own short script as shown in this example: https://github.com/nvie/rq/blob/master/examples/run_worker.py 2. In this script, initialize rollbar with `handler='blockin...
0
1
0
0
1
0
src/ostorlab/cli/agent/search/__init__.py
bbhunter/ostorlab
113
1768036
"""Module for the agent search command.""" from ostorlab.cli.agent.search import search as search_cli
0
0
0
0
0
0
json_examples/load_with_replacing_value.py
DazEB2/SimplePyScripts
117
1768043
<reponame>DazEB2/SimplePyScripts<filename>json_examples/load_with_replacing_value.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' import json def dict_clean(items, default): return { k: default if v is None else v for k, v in items } text = """ { "Action-bar"...
0
0
0
0
0
0
uliweb/contrib/csrf/middleware.py
timgates42/uliweb
202
1768052
<gh_stars>100-1000 #! /usr/bin/env python #coding=utf-8 import re from uliweb import Middleware, functions _POST_FORM_RE = re.compile(r'(<form\W[^>]*\bmethod\s*=\s*(\'|"|)POST(\'|"|)\b[^>]*>)', re.IGNORECASE) _HTML_TYPES = ('text/html', 'application/xhtml+xml') class CSRFMiddleware(Middleware): ORDER = 150 ...
0
0
0
0
0
0
test.py
thunlp/HATT-Proto-for-Few-Shot-Relation-Classification
180
1768073
import models from fewshot_re_kit.data_loader import JSONFileDataLoader from fewshot_re_kit.framework import FewShotREFramework from fewshot_re_kit.sentence_encoder import CNNSentenceEncoder from models.proto import Proto from models.proto_hatt import ProtoHATT import sys model_name = 'proto_hatt' N = 5 K = 5 noise_r...
0
0
0
0
0
0
scene_seg/lib/paconv_lib/functional.py
JiazeWang/PAConv
183
1768093
<gh_stars>100-1000 from . import functions def assign_score_withk(score, feat, center_feat, grouped_idx, aggregate='sum'): return functions.assign_score_withk(score, feat, center_feat, grouped_idx, aggregate)
0
0
0
0
0
0
evaluation/bleu/__init__.py
daveredrum/meshed-memory-transformer
401
1768101
<filename>evaluation/bleu/__init__.py<gh_stars>100-1000 from .bleu import Bleu
0
0
0
0
0
0
docker_volume_watcher/cli.py
miksnu/docker-windows-volume-watcher
181
1768108
<reponame>miksnu/docker-windows-volume-watcher """ A tool to notify Docker contianers about changes in mounts on Windows. """ import argparse import logging import pywintypes from docker_volume_watcher.container_monitor import ContainerMonitor from docker_volume_watcher.container_notifier import NotifierOptions def ...
0
0
0
0
0
0
d4rl/pointmaze_bullet/bullet_maze.py
xfdywy/d4rl
552
1768109
from __future__ import annotations import os import hashlib import numpy as np from pybullet_envs import env_bases from pybullet_envs import scene_abstract from d4rl.pointmaze_bullet import bullet_robot from d4rl.pointmaze import maze_model from d4rl import offline_env class MazeRobot(bullet_robot.MJCFBasedRobot): ...
3
10
0
4
17
0
addons/osfstorage/admin.py
gaybro8777/osf.io
628
1768111
<reponame>gaybro8777/osf.io from django.contrib import admin from .models import Region class RegionAdmin(admin.ModelAdmin): list_display = ['name', '_id', 'waterbutler_url', 'mfr_url'] admin.site.register(Region, RegionAdmin)
0
0
0
0
0
0
src/admin/godmode/middlewares/teardown_appcontext.py
aimanow/sft
280
1768132
from flask import Flask def teardown_appcontext_middleware(app: Flask): app.teardown_appcontext_funcs = [ # add middleware functions here ]
1
0
0
0
1
0
migrations/versions/52bcea82b482_remove_patch_url.py
vault-the/changes
443
1768141
"""Remove Patch.url Revision ID: 52bcea82b482 Revises: 346c011ca77a Create Date: 2013-11-11 17:17:49.008228 """ # revision identifiers, used by Alembic. revision = '52bcea82b482' down_revision = '346c011ca77a' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic...
0
0
0
0
0
0
botfw/gmocoin/order.py
lzpel/btc_bot_framework
115
1768156
from __future__ import annotations from ..base import order as od from .websocket import GmocoinWebsocketPrivate from .api import GmocoinApi from ..etc.util import unix_time_from_ISO8601Z class GmocoinOrderManager(od.OrderManagerBase): WebsocketPrivate = GmocoinWebsocketPrivate def __init__(self, api, ws: ob...
2
1
0
0
3
0
tests/python-gpu/test_gpu_parse_tree.py
bclehmann/xgboost
23,866
1768160
<gh_stars>1000+ import sys import pytest import xgboost as xgb sys.path.append("tests/python") import testing as tm def test_tree_to_df_categorical(): X, y = tm.make_categorical(100, 10, 31, False) Xy = xgb.DMatrix(X, y, enable_categorical=True) booster = xgb.train({"tree_method": "gpu_hist"}, Xy, num_bo...
0
0
0
0
0
0
homemade/neural_network/__init__.py
gvvynplaine/homemade-machine-learning
19,413
1768176
<filename>homemade/neural_network/__init__.py<gh_stars>1000+ """Neural Network Module""" from .multilayer_perceptron import MultilayerPerceptron
0
0
0
0
0
0
loaner/web_app/backend/actions/request_shelf_audit_test.py
gng-demo/travisfix
175
1768182
<reponame>gng-demo/travisfix # Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
0
0
0
0
0
0
src/permission/utils/permissions.py
dkopitsa/django-permission
234
1768225
<gh_stars>100-1000 # coding=utf-8 """ Permission utility module. In this module, term *perm* indicate the identifier string permission written in 'app_label.codename' format. """ from __future__ import unicode_literals from permission.compat import six def get_perm_codename(perm, fail_silently=True): """ Get...
0
0
0
0
0
0
custom/up_nrhm/reports/__init__.py
dimagilg/commcare-hq
471
1768276
from django.utils.translation import ugettext_noop as _ class LangMixin(object): @property def lang(self) -> object: lang = self.request.GET.get('lang', 'en') return str(lang) if lang else 'en' from custom.up_nrhm.reports.asha_reports import ASHAReports CUSTOM_REPORTS = ( (_('Custom Rep...
0
1
0
0
1
0
examples/http_and_ssh/http_and_ssh/endpoints/__init__.py
Ovvovy/API-Hour
571
1768281
<reponame>Ovvovy/API-Hour<filename>examples/http_and_ssh/http_and_ssh/endpoints/__init__.py from . import http from . import ssh
0
0
0
0
0
0
basis_set_exchange/refconverters/common.py
ltalirz/basis_set_exchange
108
1768288
<gh_stars>100-1000 ''' Helper functions for writing out basis set references in various formats ''' from .. import api _lib_refs = ["pritchard2019a", "feller1996a", "schuchardt2007a"] _lib_refs_desc = 'If you downloaded data from the basis set\nexchange or used the basis set exchange python library, please cite:\n' ...
0
0
0
0
0
0
train.py
dumpmemory/state-spaces
513
1768293
from __future__ import annotations from typing import List, Optional, Callable import numpy as np import torch import torch.nn as nn import pytorch_lightning as pl from pytorch_lightning.loggers import WandbLogger from pytorch_lightning.utilities import rank_zero_only import hydra from omegaconf import OmegaConf, DictC...
8
16
1
2
27
0
recipes/Python/65441_Checking_string_contains_set/recipe-65441.py
tdiprima/code
2,023
1768295
def containsAny(str, set): """Check whether 'str' contains ANY of the chars in 'set'""" return 1 in [c in str for c in set] def containsAll(str, set): """Check whether 'str' contains ALL of the chars in 'set'""" return 0 not in [c in str for c in set] if __name__ == "__main__": # unit tests, must ...
0
0
0
0
0
0
tests/unit/transport/plugins/asynctelnet/test_asynctelnet_transport.py
verbosemode/scrapli
404
1768310
import asyncio from io import BytesIO import pytest from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout def test_handle_control_characters_response_empty_control_buf_iac(asynctelnet_transport): asynctelnet_transport.stdin = BytesIO() actual_control_buf = asynctelnet_transport._handle_c...
0
4
0
0
4
0
dataset.py
arjitkatare/ELEGANT
276
1768378
# -*- coding:utf-8 -*- # Created Time: 2017/12/14 18:38:56 # Author: <NAME> <<EMAIL>> import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import os,time from PIL import Image # from scipy import misc # import skimage.transform # import warnings # w...
0
9
10
0
19
0
protofuzz/gen.py
trailofbits/protofuzz
225
1768392
"""Define a set of value generators and permuters that create tuples of values.""" __all__ = ["IterValueGenerator", "DependentValueGenerator", "Zip", "Product"] class ValueGenerator(object): """Value generator..""" def __init__(self, name, limit=float("inf")): """Base class of a value generators."""...
0
14
0
3
17
0
tests/unit/test_tag_uservoice.py
qyl2021/project
454
1768448
<reponame>qyl2021/project<filename>tests/unit/test_tag_uservoice.py """ Tests for the UserVoice tags and filters. """ import pytest from django.template import Context from django.test.utils import override_settings from utils import TagTestCase from analytical.templatetags.uservoice import UserVoiceNode from analyti...
0
0
0
0
0
0
docs/plugintable.py
ROZBEH/rdflib
1,424
1768452
""" Crappy utility for generating Sphinx tables for rdflib plugins """ import sys from rdflib.plugin import _plugins cls = sys.argv[1] p = {} for (name, kind), plugin in _plugins.items(): if "/" in name: continue # skip duplicate entries for mimetypes if cls == kind.__name__: p[name] = "%s...
0
0
0
0
0
0
examples/NLPTutorials/language_model/language_model.py
5m477/samples-for-ai
443
1768457
<gh_stars>100-1000 # ====================================================================================================== # # The MIT License (MIT) # Copyright (c) Microsoft Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and # associated documentation fi...
0
0
0
0
0
0
Simple Calculator (Flask)/app.py
PaarthAgarwal/Web-dev-mini-projects
127
1768473
from flask import Flask, render_template, request #declare the app app = Flask(__name__) #start an app route @app.route('/') #declare the main function def main() -> object: return render_template('index.html') #form submission route @app.route('/send', methods=['POST']) def send() -> object: try: i...
0
2
0
0
2
0
cantoolz/modules/ecu_controls.py
The-Cracker-Technology/CANToolz
194
1768491
<reponame>The-Cracker-Technology/CANToolz import re from cantoolz.can import CANMessage from cantoolz.module import CANModule, Command class ecu_controls(CANModule): name = "Controls for ECU" help = """ This module read statues and send commands. Init parameters: AS Init parameters you can con...
0
0
0
0
0
0
dataframefeed/constant.py
01FinTech/pyalgotrade-cn
1,000
1768508
<filename>dataframefeed/constant.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Created on Sat Aug 01 17:28:29 2015 @author: lenovo """ from datetime import datetime import pandas as pd """ 时间常数 """ _START_ = '1994-01-01'; _MIDDLE_ = '2015-11-27'; _TODAY_ = datetime.now().strftime('%Y-%m-%d'); _RATE_FREE_ = 0.05 _s...
0
0
0
0
0
0
test_load_asc_bench.py
sharuzzaman/PGPy
248
1768510
#!/usr/bin/env python import asyncio import bisect import collections import itertools import os import sys from progressbar import ProgressBar, AnimatedMarker, Timer, Bar, Percentage, Widget import pgpy from pgpy.packet import Packet from pgpy.types import Exportable ascfiles = [ os.path.abspath(os.path.expanduser...
2
2
2
0
6
0
tests/patterns/test_SeedPattern.py
josiah-wolf-oberholtzer/supriya
191
1768536
<filename>tests/patterns/test_SeedPattern.py import pytest from supriya.patterns import ChoicePattern, SeedPattern, SequencePattern from supriya.patterns.testutils import run_pattern_test @pytest.mark.parametrize( "stop_at, pattern, expected, is_infinite", [ (None, SequencePattern([1, 2, 3, 4]), [1, ...
0
0
0
0
0
0
simple_rl/abstraction/action_abs/PolicyClass.py
david-abel/mdps
230
1768643
class Policy(object): def __init__(self, policy_lambda): self.policy_lambda = policy_lambda def get_action(self, state) -> object: return self.policy_lambda(state)
0
1
0
0
1
0
Python/1-2/3.py
Xi-Plus/Codecademy
346
1768675
# You're almost there! Assign the tip variable on line 5. meal = 44.50 tax = 0.0675 tip = 0.15
0
0
0
0
0
0
test/test_list_batcher.py
kinifwyne/vit
179
1768676
import unittest from pprint import pprint from vit.list_batcher import ListBatcher DEFAULT_BATCH_FROM = list('abcdefghijklmnopqrstuvwxyz') def default_batcher() -> tuple[object, object]: batch_to = [] return ListBatcher(DEFAULT_BATCH_FROM, batch_to), batch_to class TestListBatcher(unittest.TestCase): d...
0
3
0
0
3
0
static_precompiler/compilers/__init__.py
codexterous/django-static-precompiler
160
1768705
from .babel import * # noqa from .base import * # noqa from .coffeescript import * # noqa from .handlebars import * # noqa from .less import * # noqa from .livescript import * # noqa from .scss import * # noqa from .stylus import * # noqa
0
0
0
0
0
0
tests/test_types.py
akubera/batavia
1,256
1768719
<gh_stars>1000+ import unittest from . utils import TranspileTestCase class TestJs2Py(TranspileTestCase): def js2py_test(self, decl, check, result): self.assertJavaScriptExecution( """ from harness import testfunc val = testfunc() %s print("Don...
0
0
0
0
0
0
programming_fundamentals/python_part_3/data_library_exercises.py
tobaidullah/2
629
1768734
#! /usr/bin/env python """ Learning Series: Network Programmability Basics Module: Programming Fundamentals Lesson: Python Part 3 Author: <NAME> <<EMAIL>> data_library_exercises.py Illustrate the following concepts: - Commands from slides exploring data interactions """ # XML print("Treat XML like Python Dictionari...
0
0
0
0
0
0