max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
util/debug.py | RaphaelWag/YOLOS | 486 | 73807 | <gh_stars>100-1000
import torch
import numpy
import cv2
import copy
def get_img_array(imgtensor, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]):
"""imgtensor: ([C,H,W],device=cuda)
"""
denormimg = imgtensor.cpu().permute(1,2,0).mul_(torch.tensor(std)).add_(torch.tensor(mean))
imgarray = denormi... |
tool_validate_packages.py | amerkel2/azure-storage-python | 348 | 73813 | <reponame>amerkel2/azure-storage-python<filename>tool_validate_packages.py
#!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license in... |
cpu_ver/hypergrad/slurm_job_watcher.py | bigaidream-projects/drmad | 119 | 73823 | import time
from glob import glob
import subprocess
import os
from odyssey import run_signal_stem, slurm_fname, temp_dir, jobdir
if __name__ == "__main__":
print "Monitoring slurm jobs in {0}".format(os.getcwd())
while True:
for fname in glob(run_signal_stem + "*"):
jobname = fname[len(run_... |
deepsleep/model.py | learning310/deepsleepnet | 266 | 73826 | import tensorflow as tf
from deepsleep.nn import *
class DeepFeatureNet(object):
def __init__(
self,
batch_size,
input_dims,
n_classes,
is_train,
reuse_params,
use_dropout,
name="deepfeaturenet"
):
self.batch_size ... |
gitlint-core/gitlint/tests/config/test_config_builder.py | carlsmedstad/gitlint | 559 | 73831 | # -*- coding: utf-8 -*-
import copy
from gitlint.tests.base import BaseTestCase
from gitlint.config import LintConfig, LintConfigBuilder, LintConfigError
from gitlint import rules
class LintConfigBuilderTests(BaseTestCase):
def test_set_option(self):
config_builder = LintConfigBuilder()
config ... |
autoimpute/imputations/series/norm_unit_variance_imputation.py | gjdv/autoimpute | 191 | 73837 | <filename>autoimpute/imputations/series/norm_unit_variance_imputation.py
"""This module implements normal imputation with constant unit variance single imputation
via the NormUnitVarianceImputer.
The NormUnitVarianceImputer imputes missing data assuming that the
single column is normally distributed with a-priori kno... |
lib/carbon/tests/util.py | hessu/carbon | 961 | 73846 | <reponame>hessu/carbon<filename>lib/carbon/tests/util.py<gh_stars>100-1000
from carbon.conf import Settings
class TestSettings(Settings):
def readFrom(*args, **kwargs):
pass
|
testcases/ch2o_tests/syntax/Range.py | vermashresth/chainer-compiler | 116 | 73850 | # coding: utf-8
import chainer
class Range(chainer.Chain):
def forward(self, x):
return range(x)
class RangeStop(chainer.Chain):
def forward(self, x, y):
return range(x, y)
class RangeStep(chainer.Chain):
def forward(self, x, y, z):
return range(x, y, z)
class RangeListComp(... |
solo/helpers.py | stevenwdv/solo-python | 156 | 73875 | # -*- coding: utf-8 -*-
#
# Copyright 2019 SoloKeys Developers
#
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distribute... |
tests/task/nlp/test_text_classification.py | mariomeissner/lightning-transformers | 451 | 73910 | import sys
from unittest.mock import MagicMock
import pytest
from lightning_transformers.core.nlp import HFBackboneConfig, HFTransformerDataConfig
from lightning_transformers.task.nlp.text_classification import (
TextClassificationDataModule,
TextClassificationTransformer,
)
@pytest.mark.skipif(sys.platform... |
Algo and DSA/LeetCode-Solutions-master/Python/lowest-common-ancestor-of-a-binary-search-tree.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 73934 | # Time: O(n)
# Space: O(1)
class Solution(object):
# @param {TreeNode} root
# @param {TreeNode} p
# @param {TreeNode} q
# @return {TreeNode}
def lowestCommonAncestor(self, root, p, q):
s, b = sorted([p.val, q.val])
while not s <= root.val <= b:
# Keep searching since ro... |
corehq/blobs/migrate_metadata.py | akashkj/commcare-hq | 471 | 73949 | from functools import partial
from itertools import groupby
from couchdbkit import ResourceNotFound
from corehq.apps.domain import SHARED_DOMAIN, UNKNOWN_DOMAIN
from corehq.blobs import CODES
from corehq.blobs.mixin import BlobHelper, BlobMetaRef
from corehq.blobs.models import BlobMigrationState, BlobMeta
from coreh... |
legacy/backends/orchestrator/aws/orchestrator_aws_backend.py | ParikhKadam/zenml | 1,275 | 73969 | <reponame>ParikhKadam/zenml
# Copyright (c) ZenML GmbH 2021. 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
#
#... |
tests/utils.py | yezz123/authx | 141 | 74001 | import contextlib
from datetime import datetime, timedelta
from typing import Iterable, Optional, Tuple, Union
import jwt
with open("tests/key/private_key", "rb") as f:
private_key = f.read()
with open("tests/key/public_key", "rb") as f:
public_key = f.read()
ACCESS_COOKIE_NAME = "access"
REFRESH_COOKIE_NAM... |
indra/assemblers/cx/hub_layout.py | johnbachman/belpy | 136 | 74002 | """This module allows adding a semantic hub layout to NDEx CX networkx. This
is useful when a network is centered around a single hub node. The
layout generated here allocates different classes of nodes into segments
around the hub and then gives them random coordinates within that segment."""
import json
import math
... |
setup.py | saurabh1002/vdbfusion | 119 | 74005 | <reponame>saurabh1002/vdbfusion
# -*- coding: utf-8 -*-
import ctypes
import multiprocessing
import os
import subprocess
import sys
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
class CMakeExtension(Extension):
def __init__(self, name, sourcedir=""):
... |
lib/device.py | keke185321/webcam-pulse-detector | 1,411 | 74046 | import cv2, time
#TODO: fix ipcam
#import urllib2, base64
import numpy as np
class ipCamera(object):
def __init__(self,url, user = None, password = None):
self.url = url
auth_encoded = base64.encodestring('%s:%s' % (user, password))[:-1]
self.req = urllib2.Request(self.url)
self.r... |
12.一键导出微信读书的书籍和笔记/pyqt_gui.py | shengqiangzhang/examples-of-web-crawlers | 12,023 | 74052 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@project: PyCharm
@file: pyqt_gui.py
@author: <NAME>
@time: 2020/4/11 21:14
@mail: <EMAIL>
"""
from wereader import *
from excel_func import *
import sys
import os
import time
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QApplica... |
alipay/aop/api/response/AlipayFundTransGroupfundsFundbillsQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 74061 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.GroupFundBill import GroupFundBill
from alipay.aop.api.domain.GroupFundBill import GroupFundBill
class AlipayFundTransGroupfundsFundbillsQueryResponse(AlipayResponse)... |
insomniac/globals.py | shifenis/Insomniac | 533 | 74075 | # These constants can be set by the external UI-layer process, don't change them manually
is_ui_process = False
execution_id = ''
task_id = ''
executable_name = 'insomniac'
do_location_permission_dialog_checks = True # no need in these checks if location permission is denied beforehand
def callback(profile_name):
... |
examples/shapes_from_glsl/defaults.py | szabolcsdombi/zengl | 116 | 74080 | defaults = '''
const vec4 light = vec4(4.0, 3.0, 10.0, 0.0);
const vec4 eye = vec4(4.0, 3.0, 2.0, 0.0);
const mat4 mvp = mat4(
-0.8147971034049988, -0.7172931432723999, -0.7429299354553223, -0.7427813410758972,
1.0863960981369019, -0.5379698276519775, -0.5571974515914917, -0.5570859909057617... |
scripts/new/math_util.py | TensorSwarm/TensorSwarm | 116 | 74083 | # Copyright (c) 2017 OpenAI (http://openai.com)
#
# 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 without restriction, including without limitation the rights
# to use, copy, modify, merge, p... |
locations/spiders/bayshore_healthcare.py | davidchiles/alltheplaces | 297 | 74100 | <filename>locations/spiders/bayshore_healthcare.py
# -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class BayshoreHealthcareSpider(scrapy.Spider):
name = "bayshore_healthcare"
item_attributes = {'brand': "Baysho... |
mne/datasets/hf_sef/__init__.py | fmamashli/mne-python | 1,953 | 74116 | """HF-SEF dataset."""
from .hf_sef import data_path
|
contrib/dash_app/chat_res.py | wakafengfan/CDial-GPT | 906 | 74149 | from interact import *
def eva_model():
parser = ArgumentParser()
parser.add_argument('--gpt2', action='store_true', help="use gpt2")
parser.add_argument("--model_checkpoint", type=str, default="./models/", help="Path, url or short name of the model")
parser.add_argument("--max_history", type=int, defa... |
tests/models/DeepFM_test.py | HCMY/DeepCTR | 6,192 | 74154 | <reponame>HCMY/DeepCTR
import pytest
import tensorflow as tf
from deepctr.estimator import DeepFMEstimator
from deepctr.models import DeepFM
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \
Estimator_TEST_TF1
@pytest.mark.parametrize(
'hidden_size,spars... |
venv/lib/python3.9/site-packages/pendulum/interval.py | qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | 224 | 74164 | <filename>venv/lib/python3.9/site-packages/pendulum/interval.py
# -*- coding: utf-8 -*-
from datetime import timedelta
from .mixins.interval import (
WordableIntervalMixin
)
from .constants import (
SECONDS_PER_DAY, SECONDS_PER_HOUR,
SECONDS_PER_MINUTE
)
def _divide_and_round(a, b):
"""divide a by ... |
setup.py | IntheGrass/citeomatic_learning | 162 | 74167 | <filename>setup.py
#!/usr/bin/python
import setuptools
setuptools.setup(
name='citeomatic',
version='0.01',
url='http://github.com/allenai/s2-research',
packages=setuptools.find_packages(),
install_requires=[
],
tests_require=[
],
zip_safe=False,
test_suite='py.test',
entry_... |
tests/python/test_mpm88.py | mzmzm/taichi | 11,699 | 74173 | import os
import pytest
import taichi as ti
from taichi import approx
def run_mpm88_test():
dim = 2
N = 64
n_particles = N * N
n_grid = 128
dx = 1 / n_grid
inv_dx = 1 / dx
dt = 2.0e-4
p_vol = (dx * 0.5)**2
p_rho = 1
p_mass = p_vol * p_rho
E = 400
x = ti.Vector.field(... |
tensorflow/python/debug/lib/debug_events_writer_test.py | EricRemmerswaal/tensorflow | 190,993 | 74182 | <reponame>EricRemmerswaal/tensorflow<filename>tensorflow/python/debug/lib/debug_events_writer_test.py
# Copyright 2019 The TensorFlow Authors. 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 co... |
tests/hooks/test_itl.py | KevinMusgrave/pytorch-adapt | 131 | 74196 | <gh_stars>100-1000
import unittest
import torch
from pytorch_adapt.hooks import ISTLossHook
from pytorch_adapt.layers import ISTLoss
from .utils import assertRequiresGrad, get_models_and_data
class TestITL(unittest.TestCase):
def test_ist_loss_hook(self):
torch.manual_seed(334)
h = ISTLossHook(... |
scripts/deployment/deploy_multisig_keyholders.py | JohnAllerdyce/Sovryn-smart-contracts | 108 | 74200 | from brownie import *
import json
def main():
thisNetwork = network.show_active()
if thisNetwork == "development":
acct = accounts[0]
# configFile = open('./scripts/contractInteraction/testnet_contracts.json')
elif thisNetwork == "testnet" or thisNetwork == "rsk-mainnet":
acct = a... |
djangosaml2/cache.py | chander/djangosaml2 | 5,079 | 74202 | # Copyright (C) 2011-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2010 <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/license... |
datasets/gutenberg_time/gutenberg_time.py | WojciechKusa/datasets | 10,608 | 74205 | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... |
tensorflow_io/python/experimental/numpy_dataset_ops.py | lgeiger/io | 558 | 74208 | <reponame>lgeiger/io
# Copyright 2018 The TensorFlow Authors. 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
#
# Unles... |
www/test/0.9.2/test/commands/fetch/server.py | reedspool/_hyperscript | 684 | 74230 | <filename>www/test/0.9.2/test/commands/fetch/server.py<gh_stars>100-1000
#!/usr/bin/env python3
from flask import Flask, request, make_response
from time import sleep
app = Flask(__name__)
@app.route('/respond')
def hello_world():
time_to_sleep = int(request.args.get('time')) / 1000
sleep(time_to_sleep)
... |
5_RemoteDesktop/server.py | fuliyuan/kivy- | 301 | 74236 | #!/usr/bin/env python
import ctypes
from flask import Flask, request, send_file
from PIL import ImageGrab
from StringIO import StringIO
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms646260%28v=vs.85%29.aspx
MOUSEEVENTF_LEFTDOWN = 2
MOUSEEVENTF_LEFTUP = 4
app = Flask(__name__)
@app.route('/')
def index... |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/viewport_array.py | ShujaKhalid/deep-rl | 210 | 74238 | <filename>deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/viewport_array.py
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL... |
RecoTracker/SiTrackerMRHTools/python/SiTrackerMultiRecHitUpdator_cfi.py | ckamtsikis/cmssw | 852 | 74261 | import FWCore.ParameterSet.Config as cms
siTrackerMultiRecHitUpdator = cms.ESProducer("SiTrackerMultiRecHitUpdatorESProducer",
ComponentName = cms.string('SiTrackerMultiRecHitUpdator'),
TTRHBuilder = cms.string('WithAngleAndTemplate'),
HitPropagator = cms.string('trackingRecHitPropagator'),
#AnnealingP... |
topicnet/cooking_machine/models/blei_lafferty_score.py | bt2901/TopicNet | 123 | 74268 | import numpy as np
from typing import Callable
from .base_score import BaseScore
class BleiLaffertyScore(BaseScore):
"""
This score implements method described in 2009 paper
Blei, <NAME>., and <NAME>erty. "Topic models." Text Mining.
Chapman and Hall/CRC, 2009. 101-124.
At the core this score he... |
es/ch15/cortadora.py | MohammedMajidKhadim/GeneticAlgorithmsWithPython | 1,008 | 74295 | <reponame>MohammedMajidKhadim/GeneticAlgorithmsWithPython<filename>es/ch15/cortadora.py
# File: cortadora.py
# Del capítulo 15 de _Algoritmos Genéticos con Python_
#
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file ... |
indra/tests/test_obo_clients/test_efo_client.py | zebulon2/indra | 136 | 74300 | <filename>indra/tests/test_obo_clients/test_efo_client.py<gh_stars>100-1000
from indra.databases import efo_client
from indra.databases.efo_client import _client as client
def test_efo_client_loaded():
assert 'efo' == client.prefix
assert client.entries
assert client.name_to_id
def test_efo_id_to_name()... |
ClemBot.Bot/bot/cogs/define_cog.py | Iapetus-11/ClemBot | 121 | 74304 | # This contribution was made by: <NAME>
# Date: 12/15/2020
import logging
import re
import aiohttp
import discord
import discord.ext.commands as commands
import bot.bot_secrets as bot_secrets
import bot.extensions as ext
from bot.consts import Colors
from bot.messaging.events import Events
log = logging.getLogger(_... |
py_v2/WeiboSession.py | SykieChen/WeiboBlackList | 394 | 74306 | <reponame>SykieChen/WeiboBlackList
import requests
class WeiboSession(requests.Session):
def __init__(self, username, password):
super(WeiboSession, self).__init__()
self.__username = username
self.__password = password
def __del__(self):
self.close()
def login(self):
... |
vilya/libs/mail.py | mubashshirjamal/code | 1,582 | 74313 | # coding: utf-8
import smtplib
from vilya.config import SMTP_SERVER
def send_mail(msg):
fromaddr = msg["From"]
toaddrs = []
if msg['To']:
toaddrs += [addr.strip() for addr in msg["To"].split(',')]
if msg["Cc"]:
toaddrs += [addr.strip() for addr in msg["Cc"].split(',')]
smtp = smt... |
leetcode_problems.py | kld123509945/iScript | 5,267 | 74318 | <reponame>kld123509945/iScript
#!/usr/bin/env python
# -*- coding=utf-8 -*-
import sys
import re
import os
import argparse
import requests
from lxml import html as lxml_html
try:
import html
except ImportError:
import HTMLParser
html = HTMLParser.HTMLParser()
try:
import cPickle as pk
except ImportEr... |
2019/08/08/Flask REST API Example With Pluggable Views and MethodView/api_demo/app.py | kenjitagawa/youtube_video_code | 492 | 74319 | from flask import Flask, jsonify, request
from flask.views import MethodView
app = Flask(__name__)
languages = [{'name' : 'JavaScript'}, {'name' : 'Python'}, {'name' : 'Ruby'}]
def get_language(name):
return [language for language in languages if language['name'] == name][0]
class Language(MethodView)... |
scripts/TreeLSTM_IM/data_iterator.py | jabalazs/nli | 299 | 74329 | import cPickle as pkl
import gzip
import os
import re
import sys
import numpy
import math
import random
from binary_tree import BinaryTree
def convert_ptb_to_tree(line):
index = 0
tree = None
line = line.rstrip()
stack = []
parts = line.split()
for p_i, p in enumerate(parts):
# openin... |
src/mcedit2/worldview/viewaction.py | elcarrion06/mcedit2 | 673 | 74331 | <filename>src/mcedit2/worldview/viewaction.py<gh_stars>100-1000
"""
viewaction
"""
from __future__ import absolute_import, division, print_function
import logging
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
from mceditlib.util.lazyprop import weakrefprop
from mcedit2.util.settings import Setting... |
train_quantizedTF.py | aalikadic/transformer-location-prediction | 214 | 74343 | import argparse
import baselineUtils
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import os
import time
from transformer.batch import subsequent_mask
from torch.optim import Adam,SGD,RMSprop,Adagrad
from transformer.noam_opt import NoamOpt
import numpy as np
import scipy.io... |
tests/test_screener.py | ericwbzhang/yahooquery | 417 | 74361 | import pytest
from yahooquery import Screener
def test_screener():
s = Screener()
assert s.get_screeners("most_actives") is not None
def test_available_screeners():
s = Screener()
assert s.available_screeners is not None
def test_bad_screener():
with pytest.raises(ValueError):
s = Scr... |
src/probnum/diffeq/odefilter/approx_strategies/_approx_strategy.py | fxbriol/probnum | 226 | 74378 | """Approximate information operators."""
import abc
from probnum.diffeq.odefilter import information_operators
class ApproximationStrategy(abc.ABC):
"""Interface for approximation strategies.
Turn an information operator into an approximate information operator that converts
into a :class:`ODEFilter` c... |
tcod/tileset.py | hirnimeshrampuresoftware/python-tcod | 231 | 74392 | <reponame>hirnimeshrampuresoftware/python-tcod
"""Tileset and font related functions.
Tilesets can be loaded as a whole from tile-sheets or True-Type fonts, or they
can be put together from multiple tile images by loading them separately
using :any:`Tileset.set_tile`.
A major restriction with libtcod is that all tile... |
tests/experimental_tests/links_tests/model_tests/pspnet_tests/test_convolution_crop.py | souravsingh/chainercv | 1,600 | 74399 | import numpy as np
import unittest
from chainer import testing
from chainercv.experimental.links.model.pspnet import convolution_crop
class TestConvolutionCrop(unittest.TestCase):
def test_convolution_crop(self):
size = (8, 6)
stride = (8, 6)
n_channel = 3
img = np.random.uniform... |
xonsh/diff_history.py | danielballan/xonsh | 7,986 | 74417 | <reponame>danielballan/xonsh<filename>xonsh/diff_history.py
# -*- coding: utf-8 -*-
"""Tools for diff'ing two xonsh history files in a meaningful fashion."""
import difflib
import datetime
import itertools
import argparse
from xonsh.lazyjson import LazyJSON
from xonsh.tools import print_color
NO_COLOR_S = "{NO_COLOR}... |
baselines/EMNLP2019/uri_features.py | ParikhKadam/knowledge-net | 240 | 74422 | import itertools
import numpy as np
import networkx as nx
import vocab
def coref_score(instance, property_id):
return [ instance.subject_entity["coref_score"], instance.object_entity["coref_score"] ]
def el_score(instance, property_id):
return [ instance.subject_entity["el_score"], instance.object_entity["el_scor... |
tests/conftest.py | wsgfz/zmail | 317 | 74428 | import json
import os
from typing import List, Tuple
import pytest
@pytest.fixture(scope='module')
def here():
return os.path.abspath(os.path.dirname(__file__))
@pytest.fixture(scope='module')
def accounts(here) -> List[Tuple] or None:
"""Return account list"""
accounts_path = os.path.join(here, 'confi... |
beagle/datasources/win_evtx.py | limkokhian/beagle | 1,139 | 74429 | import datetime
from typing import TYPE_CHECKING, Generator
import Evtx.Evtx as evtx
from lxml import etree
from beagle.common.logging import logger
from beagle.datasources.base_datasource import DataSource
from beagle.transformers.evtx_transformer import WinEVTXTransformer
if TYPE_CHECKING:
from beagle.transfor... |
python/dgl/_dataloading/__init__.py | ketyi/dgl | 9,516 | 74438 | """The ``dgl.dataloading`` package contains:
* Data loader classes for iterating over a set of nodes or edges in a graph and generates
computation dependency via neighborhood sampling methods.
* Various sampler classes that perform neighborhood sampling for multi-layer GNNs.
* Negative samplers for link prediction... |
plenum/test/script/test_bootstrap_test_node.py | jandayanan/indy-plenum | 148 | 74449 | <filename>plenum/test/script/test_bootstrap_test_node.py
import os
from argparse import ArgumentTypeError
import pytest
from common.serializers.json_serializer import JsonSerializer
from ledger.genesis_txn.genesis_txn_file_util import genesis_txn_file
from plenum.bls.bls_key_manager_file import BlsKeyManagerFile
from... |
texar/tf/losses/adv_losses.py | dyoshioka-555/texar | 2,325 | 74485 | # Copyright 2018 The Texar Authors. 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 required by applicable ... |
samples/rtl/pipeline.py | jnice-81/dace | 227 | 74494 | <filename>samples/rtl/pipeline.py<gh_stars>100-1000
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
#
# This sample shows a DEPTH deep pipeline, where each stage adds 1 to the
# integer input stream.
#
# It is intended for running hardware_emulation or hardware xilinx targets.
import dace
i... |
DeepBrainSeg/tumor/models/__init__.py | JasperHG90/DeepBrainSeg | 130 | 74521 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__license__ = 'MIT'
__maintainer__ = ['<NAME>']
__email__ = ['<EMAIL>']
|
summarize_from_feedback/eval_rm.py | lumaway/summarize-from-feedback | 365 | 74527 | <gh_stars>100-1000
import json
import os
from dataclasses import dataclass, field
import blobfile as bf
import numpy as np
import torch
from summarize_from_feedback.datasets import jsonl_encoding
from summarize_from_feedback.query_response_model import ModelSpec
from summarize_from_feedback.reward_model import Reward... |
third_party/websockify/tests/load.py | albertobarri/idk | 6,541 | 74530 | #!/usr/bin/env python
'''
WebSocket server-side load test program. Sends and receives traffic
that has a random payload (length and content) that is checksummed and
given a sequence number. Any errors are reported and counted.
'''
import sys, os, select, random, time, optparse, logging
sys.path.insert(0,os.path.join(... |
pretrain/data_preprocess/megadepth/undistort_reconstructions.py | kudo1026/Pri3D | 103 | 74576 | import argparse
import imagesize
import os
import subprocess
parser = argparse.ArgumentParser(description='MegaDepth Undistortion')
parser.add_argument(
'--colmap_path', type=str, required=True,
help='path to colmap executable'
)
parser.add_argument(
'--base_path', type=str, required=True,
help='pa... |
tests/r/test_cholera.py | hajime9652/observations | 199 | 74584 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.cholera import cholera
def test_cholera():
"""Test module cholera.py by downloading
cholera.csv and testing shape of
ex... |
lightning/types/decorators.py | lightning-viz/lightning-python | 176 | 74613 | from lightning import Lightning
from lightning.types.base import Base
from functools import wraps
import inspect
def viztype(VizType):
# wrapper that passes inputs to cleaning function and creates viz
@wraps(VizType.clean)
def plotter(self, *args, **kwargs):
if kwargs['height'] is None and kwarg... |
ciphey/basemods/Checkers/format.py | AlexandruValeanu/Ciphey | 9,908 | 74659 | <gh_stars>1000+
import json
from typing import Dict, Optional
import logging
from rich.logging import RichHandler
from ciphey.iface import Checker, Config, ParamSpec, T, registry
@registry.register
class JsonChecker(Checker[str]):
"""
This object is effectively a prebuilt quorum (with requirement 1) of com... |
virtual/lib/python3.6/site-packages/rest_framework/utils/html.py | Ruterana/clone_instagram | 17,395 | 74688 | """
Helpers for dealing with HTML input.
"""
import re
from django.utils.datastructures import MultiValueDict
def is_html_input(dictionary):
# MultiDict type datastructures are used to represent HTML form input,
# which may have more than one value for each key.
return hasattr(dictionary, 'getlist')
de... |
litex/tools/litex_json2renode.py | osterwood/litex | 1,501 | 74692 | #!/usr/bin/env python3
"""
Copyright (c) 2019-2021 Antmicro <www.antmicro.com>
Renode platform definition (repl) and script (resc) generator for LiteX SoC.
This script parses LiteX 'csr.json' file and generates scripts for Renode
necessary to emulate the given configuration of the LiteX SoC.
"""
import os
import sys... |
topaz/modules/ffi/variadic_invoker.py | ruby-compiler-survey/topaz | 241 | 74696 | from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
from topaz.modules.ffi.function import W_FFIFunctionObject
from rpython.rlib import jit
class W_VariadicInvokerObject(W_Object):
classdef = ClassDef('VariadicInvoker', W_Object.classdef)
def __init__(self, space):
W_Ob... |
tests/model_setup/test__models__.py | wankata/tortoise-orm | 2,847 | 74721 | <reponame>wankata/tortoise-orm
"""
Tests for __models__
"""
import re
from asynctest.mock import CoroutineMock, patch
from tortoise import Tortoise
from tortoise.contrib import test
from tortoise.exceptions import ConfigurationError
from tortoise.utils import get_schema_sql
class TestGenerateSchema(test.SimpleTest... |
src/stepfunctions/workflow/widgets/events_table.py | ParidelPooya/aws-step-functions-data-science-sdk-python | 211 | 74728 | <reponame>ParidelPooya/aws-step-functions-data-science-sdk-python
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# ... |
RawArchiver/TimedTriggers/TriggerManage.py | fake-name/ReadableWebProxy | 193 | 74736 | <gh_stars>100-1000
import logging
import abc
import datetime
import traceback
import urllib.parse
import sqlalchemy.exc
import common.database as db
# import RawArchiver.TimedTriggers.RawRollingRewalkTrigger
# def exposed_raw_rewalk_old():
# '''
# Trigger the rewalking system on the rawarchiver
# '''
# run =... |
applications/ParticleMechanicsApplication/tests/test_generate_mpm_particle_condition.py | lkusch/Kratos | 778 | 74757 | <filename>applications/ParticleMechanicsApplication/tests/test_generate_mpm_particle_condition.py
from __future__ import print_function, absolute_import, division
import KratosMultiphysics
import KratosMultiphysics.ParticleMechanicsApplication as KratosParticle
import KratosMultiphysics.KratosUnittest as KratosUnittes... |
libcloud/compute/drivers/hostvirtual.py | Matir/libcloud | 1,435 | 74801 | <reponame>Matir/libcloud
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... |
overholt/users/__init__.py | prdonahue/overholt | 1,152 | 74826 | # -*- coding: utf-8 -*-
"""
overholt.users
~~~~~~~~~~~~~~
overholt users package
"""
from ..core import Service
from .models import User
class UsersService(Service):
__model__ = User
|
parsl/monitoring/visualization/plots/default/task_plots.py | cylondata/parsl | 323 | 74828 | <reponame>cylondata/parsl<filename>parsl/monitoring/visualization/plots/default/task_plots.py
import plotly.graph_objs as go
from plotly.offline import plot
def time_series_cpu_per_task_plot(df_resources, resource_type, label):
if resource_type == "psutil_process_cpu_percent":
yaxis = dict(title="CPU util... |
tests/oracle_test.py | sh0nk/simple-db-migrate | 120 | 74833 | <reponame>sh0nk/simple-db-migrate
#-*- coding:utf-8 -*-
import unittest
import sys
import simple_db_migrate.core
from mock import patch, Mock, MagicMock, call, sentinel
from simple_db_migrate.oracle import Oracle
from tests import BaseTest
class OracleTest(BaseTest):
def setUp(self):
super(OracleTest, sel... |
f5/bigip/tm/transaction/__init__.py | nghia-tran/f5-common-python | 272 | 74839 | # coding=utf-8
#
# Copyright 2014 F5 Networks Inc.
#
# 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 by applicable law or a... |
genetic-algorithm-tutorial/implementation.py | fimoziq/tutorials | 670 | 74850 | <filename>genetic-algorithm-tutorial/implementation.py
# -*- coding: utf-8 -*-
"""genetic-algorithm-python-tutorial.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/161ijkvn8wG_seVtQexm-p3fW3r5p8s_x
# Genetic Algorithm Implementation with Python
... |
autobahntestsuite/autobahntestsuite/echo.py | rishabh-bector/autobahn-testsuite | 595 | 74854 | ###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... |
test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py | samotarnik/grpc | 2,151 | 74855 | <filename>test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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
... |
test/execution/gen_random_tpl.py | weijietong/noisepage | 971 | 74890 | # http://pastie.org/pastes/10943132/text
# Copyright (c) 2016 1wd
#
# 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 without restriction, including without limitation the rights to use, copy, modi... |
calvin/runtime/south/storage/twistedimpl/securedht/service_discovery_ssdp.py | gabrielcercel/calvin-base | 334 | 74905 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 requ... |
third_party/WebKit/Source/modules/bluetooth/testing/clusterfuzz/fuzz_integration_test.py | google-ar/chromium | 2,151 | 74910 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test that the fuzzer works the way ClusterFuzz invokes it."""
import glob
import os
import shutil
import sys
import tempfile
import unittest
import setu... |
terrascript/data/cloudsmith_io/cloudsmith.py | mjuenema/python-terrascript | 507 | 74930 | # terrascript/data/cloudsmith-io/cloudsmith.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:14:19 UTC)
import terrascript
class cloudsmith_namespace(terrascript.Data):
pass
class cloudsmith_package_list(terrascript.Data):
pass
class cloudsmith_repository(terrascript.Data):
pass
__a... |
cloudbaseinit/tests/utils/windows/test_netlbfo.py | aleskxyz/cloudbase-init | 160 | 74932 | <reponame>aleskxyz/cloudbase-init
# Copyright (c) 2017 Cloudbase Solutions Srl
#
# 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
... |
test/integration/epacems_test.py | catalyst-cooperative/pudl | 285 | 74945 | """tests for pudl/output/epacems.py loading functions."""
from pathlib import Path
import dask.dataframe as dd
import pytest
from pudl.output.epacems import epacems
@pytest.fixture(scope='module')
def epacems_year_and_state(etl_params):
"""Find the year and state defined in pudl/package_data/settings/etl_*.yml.... |
examples/pxScene2d/external/libnode-v0.12.7/deps/v8/tools/ll_prof.py | madanagopaltcomcast/pxCore | 2,494 | 74950 | #!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... |
data_collection/gazette/spiders/sc_curitibanos.py | kaiocp/querido-diario | 454 | 74951 | from gazette.spiders.base.fecam import FecamGazetteSpider
class ScCuritibanosSpider(FecamGazetteSpider):
name = "sc_curitibanos"
FECAM_QUERY = "cod_entidade:82"
TERRITORY_ID = "4204806"
|
desktop/core/ext-py/nose-1.3.7/functional_tests/support/package3/src/b.py | kokosing/hue | 5,079 | 74964 | def b():
pass
|
ple/games/pong.py | ArnthorDadi/FlappyBirdAI | 959 | 74978 | <gh_stars>100-1000
import math
import sys
import pygame
from pygame.constants import K_w, K_s
from ple.games.utils.vec2d import vec2d
from ple.games.utils import percent_round_int
#import base
from ple.games.base.pygamewrapper import PyGameWrapper
class Ball(pygame.sprite.Sprite):
def __init__(self, radius, spe... |
exercises/pt/test_03_14_03.py | Jette16/spacy-course | 2,085 | 75022 | <gh_stars>1000+
def test():
assert (
"patterns = list(nlp.pipe(people))" in __solution__
), "Você está usando nlp.pipe envolvido em uma lista (list)?"
__msg__.good(
"Bom trabalho! Vamos seguir agora com um exemplo prático que "
"usa nlp.pipe para processar documentos com metadados a... |
tests/test_opq.py | matsui528/nanopq | 217 | 75025 | import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent))
import unittest
import nanopq
import numpy as np
class TestSuite(unittest.TestCase):
def setUp(self):
np.random.seed(123)
def test_property(self):
opq = nanopq.OPQ(M=4, Ks=256)
self.assertEqual... |
backend/op/add_followers_op.py | sleepingAnt/viewfinder | 645 | 75064 | # Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Viewfinder AddFollowersOperation.
This operation adds a set of contacts to an existing viewpoint as followers of that viewpoint.
If a contact is not yet a Viewfinder user, we create a prospective user and link the contact
to that.
"""
__authors__ = ['<EMAIL> (... |
src/python/pants/backend/shell/lint/shfmt/rules_integration_test.py | yoav-orca/pants | 1,806 | 75077 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from textwrap import dedent
import pytest
from pants.backend.shell.lint.shfmt.rules import ShfmtFieldSet, ShfmtRequest
from pants.backend.shell.lint.s... |
equip/bytecode/decl.py | neuroo/equip | 102 | 75085 | <reponame>neuroo/equip<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
equip.bytecode.decl
~~~~~~~~~~~~~~~~~~~
Structured representation of Module, Types, Method, Imports.
:copyright: (c) 2014 by <NAME> (@rgaucher)
:license: Apache 2, see LICENSE for more details.
"""
import dis
from operator import attrgette... |
eventsourcing/tests/test_system.py | johnbywater/eventsourcing | 972 | 75105 | from typing import List
from unittest.case import TestCase
from uuid import uuid4
from eventsourcing.application import Application
from eventsourcing.persistence import Notification
from eventsourcing.system import (
AlwaysPull,
Follower,
Leader,
NeverPull,
ProcessApplication,
Promptable,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.