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 |
|---|---|---|---|---|
script/aaai_match_arci_qa_rank.py | pl8787/textnet-release | 114 | 12687287 | #-*-coding:utf8-*-
import copy, os
from gen_conf_file import *
from dataset_cfg import *
def gen_match_lstm(d_mem, init, lr, dataset, l2, lstm_norm2):
# print "ORC: left & right lstm share parameters"
net = {}
ds = DatasetCfg(dataset)
g_filler = gen_uniform_filler_setting(init)
zero_filler = g... |
cogan_pytorch/src/trainer_gan_mnist.py | sagardsaxena/CoGAN | 285 | 12687299 | from torch.autograd import Variable
from net_gan_mnist import *
import torch
import torch.nn as nn
import numpy as np
from init import *
class MNISTGanTrainer(object):
def __init__(self, batch_size=64, latent_dims=100):
super(MNISTGanTrainer, self).__init__()
self.dis = Dis28x28()
self.gen... |
galileo/tests/test_transforms.py | YaoPu2021/galileo | 115 | 12687315 | <gh_stars>100-1000
# Copyright 2020 JD.com, Inc. Galileo 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
#
# U... |
etl/parsers/etw/Microsoft_Windows_Wininit.py | IMULMUL/etl-parser | 104 | 12687331 | <filename>etl/parsers/etw/Microsoft_Windows_Wininit.py
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Wininit
GUID : 206f6dea-d3c5-4d10-bc72-989f03c8b84b
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString,... |
minemeld/ft/http.py | zul126/minemeld-core | 147 | 12687338 | # Copyright 2015 Palo Alto 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 agre... |
stingray/crosscorrelation.py | pierfra-ro/stingray | 133 | 12687343 | <gh_stars>100-1000
import warnings
import numpy as np
from scipy import signal
try:
from pyfftw.interfaces.scipy_fft import ifft, fftfreq
except ImportError:
warnings.warn("pyfftw not installed. Using standard scipy fft")
from scipy.fft import ifft, fftfreq
from stingray.lightcurve import Lightcurve
from ... |
src/pretix/base/migrations/0084_questionoption_position.py | pajowu/pretix | 1,248 | 12687347 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-03 16:41
from __future__ import unicode_literals
from django.db import migrations, models
def set_position(apps, schema_editor):
Question = apps.get_model('pretixbase', 'Question')
for q in Question.objects.all():
for i, option in enumer... |
lda2vec/Lda2vec.py | MatrixBlake/Lda2vec-Tensorflow | 119 | 12687354 | <filename>lda2vec/Lda2vec.py
import tensorflow as tf
import numpy as np
import lda2vec.word_embedding as W
import lda2vec.embedding_mixture as M
import lda2vec.dirichlet_likelihood as DL
from lda2vec import utils
from datetime import datetime
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning... |
tests/test_core.py | basnijholt/HASS-data-detective | 128 | 12687446 | from unittest.mock import patch
from detective.core import get_db_type, stripped_db_url
def test_get_db_type():
assert get_db_type("mysql://localhost") == "mysql"
assert get_db_type("mysql+pymysql://localhost") == "mysql"
def test_stripped_db_url():
assert stripped_db_url("mysql://localhost") == "mysql... |
utils/utils.py | BaoLocPham/hum2song | 108 | 12687481 | <filename>utils/utils.py<gh_stars>100-1000
import torch
import numpy as np
from torchvision import transforms as T
from sklearn.preprocessing import normalize
import os
def load_image(npy_path, input_shape=(630, 80)):
data = np.load(npy_path)
if data.shape[0] >= input_shape[0]:
result = data[:input_sh... |
daily/shanbay.py | androiddevnotesforks/2021 | 246 | 12687491 | <gh_stars>100-1000
import pendulum
import requests
from .config import MY_SHANBAY_USER_NAME, SHANBAY_CALENDAR_API
def _get_shanbay_streak(end_date=pendulum.now("Asia/Shanghai"), streak=0):
start_date = end_date.start_of("month")
r = requests.get(
SHANBAY_CALENDAR_API.format(
user_name=MY_... |
chainer_chemistry/utils/permutation.py | pfnet/chainerchem | 184 | 12687501 | import numpy
def permute_node(node, permutation_index, axis=-1):
"""Permute index of `node` array
Args:
node (numpy.ndarray): the array whose `axis` to be permuted.
permutation_index (numpy.ndarray): 1d numpy array whose size should be
same as permutation axis of `node`.
a... |
gcloud/utils/redis_lock.py | DomineCore/bk-sops | 881 | 12687518 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
tests/python/py3implicitnamespace/namespace/sibling/__init__.py | sammorley-short/sphinx-autoapi | 197 | 12687529 | def first_method():
"""First sibling package method."""
return 1
def second_method():
"""Second sibling package method."""
return 2
|
numba/testing/__main__.py | auderson/numba | 6,620 | 12687596 | import sys
from numba.testing import run_tests
sys.exit(0 if run_tests(sys.argv).wasSuccessful() else 1)
|
src/pretalx/submission/migrations/0045_extend_question_help_text_length.py | lili668668/pretalx | 418 | 12687597 | <reponame>lili668668/pretalx
# Generated by Django 3.0.3 on 2020-03-01 19:25
from django.db import migrations
import i18nfield.fields
class Migration(migrations.Migration):
dependencies = [
("submission", "0044_submission_anonymised_data"),
]
operations = [
migrations.AlterField(
... |
alipay/aop/api/domain/LawsuitPersonRecord.py | snowxmas/alipay-sdk-python-all | 213 | 12687620 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
class LawsuitP... |
models/baseline_config.py | SonjaAits/MTL-Bioinformatics-2016 | 171 | 12687628 | class Defaults(object):
window_size = 7
hidden_sizes = [300]
hidden_activation = 'relu'
max_vocab_size = 1000000
optimizer = 'sgd' # 'adam'
learning_rate = 0.1 # 1e-4
epochs = 20
iobes = True # Map tags to IOBES on input
max_tokens = None # Max dataset size in tokens
encodi... |
firefly/management/commands/reloadmodule.py | genghaolove/firefly | 675 | 12687642 | #coding:utf8
'''
Created on 2013-8-12
@author: lan (www.9miao.com)
'''
import urllib,sys
def execute(*args):
"""
"""
if not args:
masterport =9998
else:
masterport = int(args[0])
url = "http://localhost:%s/reloadmodule"%masterport
try:
response = urllib.urlopen(url)
... |
fastfold/model/nn/template.py | hpcaitech/FastFold | 303 | 12687654 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
buildman/build_token.py | giuseppe/quay | 2,027 | 12687670 | <filename>buildman/build_token.py
import jsonschema
import jwt
import logging
from app import instance_keys
from util.security import jwtutil
from util.security.registry_jwt import (
generate_bearer_token,
InvalidBearerTokenException,
ALGORITHM,
JWT_CLOCK_SKEW_SECONDS,
)
logger = logging.getLogger(__... |
examples/plot/plot_wine.py | adekunleba/dabl | 500 | 12687703 | """
Wine Classification Dataset Visualization
==========================================
"""
# sphinx_gallery_thumbnail_number = 4
import matplotlib.pyplot as plt
from sklearn.datasets import load_wine
from dabl import plot
from dabl.utils import data_df_from_bunch
wine_bunch = load_wine()
wine_df = data_df_from_bunch... |
data/4 - C4DPy/export_stdface.py | dot-by-dot-inc/KAMRA-Deja-Vu | 154 | 12687736 | from djv import *
#========================================
# config
faceObj = doc.SearchObject("face_original")
hullObj = doc.SearchObject("face_hull")
TRIANGLE = 0b0
QUAD = 0b1
FACE_UV = 0b100
FACE_VERTEX_UV = 0b1000
FACE_VERTEX_NORMAL = 0b100000
#========================================
def main():
... |
aws_lambda_powertools/metrics/__init__.py | Sordie/aws-lambda-powertools-python | 1,208 | 12687744 | <gh_stars>1000+
"""CloudWatch Embedded Metric Format utility
"""
from .base import MetricUnit
from .exceptions import MetricUnitError, MetricValueError, SchemaValidationError
from .metric import single_metric
from .metrics import Metrics
__all__ = [
"Metrics",
"single_metric",
"MetricUnit",
"MetricUnit... |
neural_guided_symbolic_regression/utils/arithmetic_grammar_test.py | deepneuralmachine/google-research | 23,901 | 12687748 | <reponame>deepneuralmachine/google-research
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# http://www.apache.org/licenses... |
ansible/roles/test/files/acstests/acl_port_range_traffic_test.py | shubav/sonic-mgmt | 132 | 12687749 | <reponame>shubav/sonic-mgmt
import sys
import ptf.packet as scapy
import ptf.dataplane as dataplane
import acs_base_test
from ptf.base_tests import BaseTest
import ptf.testutils as testutils
from ptf.testutils import *
import scapy.all as scapy2
class SendTCP(acs_base_test.ACSDataplaneTest):
def runTest(self):
... |
Src/StdLib/Lib/site-packages/win32comext/shell/demos/servers/folder_view.py | cwensley/ironpython2 | 1,078 | 12687759 | # This is a port of the Vista SDK "FolderView" sample, and associated
# notes at http://shellrevealed.com/blogs/shellblog/archive/2007/03/15/Shell-Namespace-Extension_3A00_-Creating-and-Using-the-System-Folder-View-Object.aspx
# A key difference to shell_view.py is that this version uses the default
# IShellView provi... |
cube/networks/tokenizer.py | AliOsamaHassan/NLP-Cube | 488 | 12687780 | <gh_stars>100-1000
import sys
from cube.networks.utils import unpack, mask_concat
sys.path.append('')
import os, argparse
os.environ["TOKENIZERS_PARALLELISM"] = "false"
import pytorch_lightning as pl
import torch.nn as nn
import torch.nn.functional as F
import torch
from cube.io_utils.objects import Document, Senten... |
scale/util/test/test_parse.py | kaydoh/scale | 121 | 12687788 | from __future__ import unicode_literals
import datetime
import django
import mock
from django.test import TestCase
from django.utils.timezone import utc
import util.parse as parse_util
class TestParse(TestCase):
def setUp(self):
django.setup()
def test_duration_to_string(self):
"""Tests co... |
discordbot/stocks/due_diligence/arktrades.py | elan17/GamestonkTerminal | 1,835 | 12687793 | import discord
import pandas as pd
from gamestonk_terminal.stocks.due_diligence import ark_model
import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import logger
from discordbot.helpers import pagination
async def arktrades_command(ctx, ticker="", num=""):
"""Displays trades made by ark [... |
examples/vgg/caffe2npz.py | souravsingh/chainercv | 1,600 | 12687802 | import argparse
import re
import chainer
from chainer import Link
import chainer.links.caffe.caffe_function as caffe
"""
Please download a weight from here.
http://www.robots.ox.ac.uk/%7Evgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel
"""
def rename(name):
m = re.match(r'conv(\d+)_(\d+)$', name)
... |
stattests/tests.py | marnikitta/stattests | 130 | 12687805 | <reponame>marnikitta/stattests
import numpy as np
import scipy.stats
def t_test(a, b):
"""
Calculates two-sided t-test p-values for multiple experiments
:param a: np.array shape (n_experiments, n_users), metric values in control group
:param b: np.array shape (n_experiments, n_users), metric values in... |
server/explorer/utils/yang.py | s-bauer/yang-explorer | 437 | 12687816 | """
Copyright 2015, Cisco Systems, 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 agreed t... |
model_card_toolkit/utils/testdata/testdata_utils.py | BrickFrog/model-card-toolkit | 267 | 12687825 | # Copyright 2020 Google LLC
#
# 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 agreed to in writing, ... |
test/test_ipython_magic.py | sandutsar/pyinstrument | 3,768 | 12687829 | from test.fake_time_util import fake_time
import pytest
# note: IPython should be imported within each test. Importing it in our tests
# seems to cause problems with subsequent tests.
cell_code = """
import time
def function_a():
function_b()
function_c()
def function_b():
function_d()
def function_c(... |
L1Trigger/DTTriggerPhase2/test/prod_Zmu_digis_segments_cfg.py | ckamtsikis/cmssw | 852 | 12687842 | import FWCore.ParameterSet.Config as cms
process = cms.Process("DigisSegments")
process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cff")
process.load("Geometry.DTGeometry.dtGeometry_cfi")
process.DTGeometryESModule.applyAlignment = False
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTa... |
robosuite/models/__init__.py | kyungjaelee/robosuite | 397 | 12687857 | import os
from .world import MujocoWorldBase
assets_root = os.path.join(os.path.dirname(__file__), "assets")
|
spaces/graph.py | JaniAnttonenp/ml-fairness | 268 | 12687869 | # coding=utf-8
# Copyright 2020 The ML Fairness Gym 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
Logistic-Regression/classifier_corrected.py | joao-r-santos/DataSciencePython | 5,070 | 12687873 | <reponame>joao-r-santos/DataSciencePython
#https://www.kaggle.com/c/amazon-employee-access-challenge/forums/t/4797/starter-code-in-python-with-scikit-learn-auc-885
""" Amazon Access Challenge Starter Code
These files provide some starter code using
the scikit-learn library. It provides some examples on how
to design... |
atlas/foundations_authentication/src/foundations_authentication/user_token.py | DeepLearnI/atlas | 296 | 12687875 |
def user_token():
from foundations_contrib.utils import foundations_home
from os.path import expanduser, join
import yaml
import os
token = os.getenv('FOUNDATIONS_TOKEN', None)
if not token:
credential_filepath = expanduser(join(foundations_home(), "credentials.yaml"))
if not ... |
examples/plot_representation.py | jiduque/scikit-fda | 147 | 12687900 | """
Representation of functional data
=================================
Explores the different representations of functional data.
"""
# Author: <NAME>
# License: MIT
import skfda
from skfda.representation.interpolation import SplineInterpolation
import skfda.representation.basis as basis
########################... |
model-optimizer/extensions/front/ChangePlaceholderTypes.py | monroid/openvino | 2,406 | 12687905 | <reponame>monroid/openvino
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
import numpy as np
from mo.front.common.replacement import FrontReplacementPattern
from mo.graph.graph import Graph, Node
class ChangePlaceholderTypes(FrontReplacementPattern):
ena... |
src/sage/rings/polynomial/binary_form_reduce.py | UCD4IDS/sage | 1,742 | 12687948 | # -*- coding: utf-8 -*-
r"""
Helper functions for reduction of binary forms.
The algorithm for reducing is from Stoll and Cremona's "On the Reduction Theory of
Binary Forms" [CS2003]_. This takes a two variable homogeneous polynomial and finds a
reduced form. This is an `SL(2,\ZZ)`-equivalent binary form whose covaria... |
examples/gallery/embellishments/inset.py | jbusecke/pygmt | 326 | 12687949 | <reponame>jbusecke/pygmt
"""
Inset
-----
The :meth:`pygmt.Figure.inset` method adds an inset figure inside a larger
figure. The function is called using a ``with`` statement, and its
``position``, ``box``, ``offset``, and ``margin`` parameters are set. Plotting
methods called within the ``with`` statement are applied ... |
sublime/config/sublime-text-3.symlink/Packages/mdpopups/st3/mdpopups/st_scheme_template.py | ch1bo/dotfiles-old | 182 | 12687964 | <filename>sublime/config/sublime-text-3.symlink/Packages/mdpopups/st3/mdpopups/st_scheme_template.py<gh_stars>100-1000
"""
Sublime Text Scheme template.
Converts scheme to css provides templating for
additonal so that they can access the colors.
Licensed under MIT
Copyright (c) 2015 - 2016 <NAME> <<EMAIL>>
---------... |
tests/api/v1/user/test_admin_access.py | omertuc/CTFd | 3,592 | 12687968 | <reponame>omertuc/CTFd<filename>tests/api/v1/user/test_admin_access.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tests.helpers import create_ctfd, destroy_ctfd, login_as_user, register_user
def test_api_hint_404():
"""Are admin protected resources accessible by admins/non-admins"""
app = create_ctfd... |
lib/TclUtil.py | aganders3/python-0.9.1 | 116 | 12687981 | # Utilities used by 'Tcl' emulator.
# Many functions in this file parse specific constructs from strings.
# In order to limit the number of slice operations (the strings can
# be very large), they always receive indices into the string that
# indicate the slice of the string that should be considered.
# The return va... |
recipes/Python/576837_Crop_PDF_File_with_pyPdf/recipe-576837.py | tdiprima/code | 2,023 | 12687989 | <filename>recipes/Python/576837_Crop_PDF_File_with_pyPdf/recipe-576837.py
#! /usr/bin/python
# Originally found on http://www.mobileread.com/forums/showthread.php?t=25565
import getopt, sys
from pyPdf import PdfFileWriter, PdfFileReader
def usage ():
print """sjvr767\'s PDF Cropping Script.
Example:
my_pdf_crop... |
pmdarima/preprocessing/endog/base.py | tuomijal/pmdarima | 736 | 12688013 | <reponame>tuomijal/pmdarima<filename>pmdarima/preprocessing/endog/base.py
# -*- coding: utf-8 -*-
import abc
from ..base import BaseTransformer
class BaseEndogTransformer(BaseTransformer, metaclass=abc.ABCMeta):
"""A base class for endogenous array transformers"""
def _check_y_X(self, y, X):
"""Che... |
virtex/utils/nucleus_sampling.py | Muflhi01/virtex | 523 | 12688032 | <reponame>Muflhi01/virtex
r"""
Nucleus Sampling was introduced in the paper
`The Curious Case of Neural Text Degeneration <https://arxiv.org/abs/1904.09751>`_.
If you take it from here, make sure to cite them:
.. code-block:: text
@inproceedings{,
title={The Curious Case of Neural Text Degeneration},
... |
scripts/irods/test/test_irule.py | JustinKyleJames/irods | 333 | 12688045 | from __future__ import print_function
import sys
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
from .. import lib
from .. import paths
from .. import test
from .resource_suite import ResourceBase
from ..configuration import IrodsConfig
class Test_Irule(ResourceBase, unitte... |
test/utils/run.py | dburkhardt/SingleCellOpenProblems | 134 | 12688047 | from . import streams
import logging
import subprocess
import sys
import time
log = logging.getLogger("openproblems")
def format_error_timeout(process, timeout, stream):
"""Format subprocess output on timeout."""
return "{}\nTimed out after {} s\n\n{}".format(
" ".join(process.args),
timeout... |
tasks.py | vtemian/django-registration | 925 | 12688064 | <reponame>vtemian/django-registration<gh_stars>100-1000
from invoke import run
from invoke import task
@task
def clean(all=False):
if all:
flag = "--all"
else:
flag = ""
run("python setup.py clean {}".format(flag))
@task
def build(docs=False):
run("python setup.py build")
if docs... |
src/custom_ops/custom_ops_factory.py | xiaoyuliu/AttentionalPoolingAction | 270 | 12688089 | import os
import json
from collections import OrderedDict
import numpy as np
import tensorflow as tf
cur_path = os.path.realpath(__file__)
ROOT_PATH = os.path.dirname(cur_path)
# add any new ops under the following
pose_to_heatmap_fn = tf.load_op_library(
os.path.join(ROOT_PATH, 'pose_to_heatmap.so')).pose_to_heatm... |
graphene_sqlalchemy/resolvers.py | adrianschneider94/graphene-sqlalchemy | 947 | 12688122 | <reponame>adrianschneider94/graphene-sqlalchemy
from graphene.utils.get_unbound_function import get_unbound_function
def get_custom_resolver(obj_type, orm_field_name):
"""
Since `graphene` will call `resolve_<field_name>` on a field only if it
does not have a `resolver`, we need to re-implement that logic... |
tests/clpy_tests/opencl_tests/headercvt_tests/test_headercvt_funcdecl.py | fixstars/clpy | 142 | 12688138 | import unittest
import headercvt_test_utils as util
class TestHeadercvtFuncDecl(unittest.TestCase):
def setUp(self):
util.check_existence_of_headercvt()
@util.with_temp_wd
def test_headercvt_funcdecl_accept_case(self, wd):
util.kick_headercvt_and_get_results(wd, """
void clSomeFu... |
tests/unit/ec2/test_blockdevicemapping.py | mariocesar/boto | 5,079 | 12688170 | from tests.compat import unittest
from boto.ec2.connection import EC2Connection
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from tests.compat import OrderedDict
from tests.unit import AWSMockServiceTestCase
class BlockDeviceTypeTests(unittest.TestCase):
def setUp(self):
s... |
alipay/aop/api/domain/AlipaySecurityProdMygetQueryModel.py | antopen/alipay-sdk-python-all | 213 | 12688188 | <filename>alipay/aop/api/domain/AlipaySecurityProdMygetQueryModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ExtendParams import ExtendParams
class AlipaySecurityProdMygetQueryModel(object):
def __init__(self):
... |
recipes/Python/572159_SPICE/recipe-572159.py | tdiprima/code | 2,023 | 12688189 | '''Module that implements SPICE.
This module provides access to a standardized implementation
of SPICE (Stephen's Power-Inspired, Computerized Encryption).'''
################################################################################
__version__ = '$Revision: 0 $'
__date__ = 'April 19, 2008'
__author__ = 'Step... |
laika_repo/tests/test_ephemerides.py | JoeOIVOV/ArnePilot | 116 | 12688245 | import numpy as np
import unittest
from laika.gps_time import GPSTime
from laika import AstroDog
gps_times_list = [[1950, 415621.0],
[1895, 455457.0],
[1885, 443787.0]]
svIds = ['G01', 'G31', 'R08']
gps_times = [GPSTime(*gps_time_list) for gps_time_list in gps_times_list]
class TestAstroDog(unittest.TestCa... |
MACS3/Utilities/Constants.py | bgruening/MACS | 357 | 12688257 | MACS_VERSION = "3.0.0a7"
MAX_PAIRNUM = 1000
MAX_LAMBDA = 100000
FESTEP = 20
BUFFER_SIZE = 100000 # np array will increase at step of 1 million items
READ_BUFFER_SIZE = 10000000 # 10M bytes for read buffer size
N_MP = 2 # Number of processers
|
Misc/Cleaner/Clean.py | awesome-archive/ReadableWebProxy | 193 | 12688275 |
import common.database as db
import common.util.urlFuncs as urlFuncs
import logging
import os.path
import settings
class Clean(object):
def __init__(self):
print("Clean __init__()")
self.log = logging.getLogger("Main.Cleaner")
super().__init__()
def clean_files(self):
with db.session_context() as sess:
... |
tests/integration/misc_test/test_host_maintenance.py | bopopescu/peloton | 617 | 12688278 | import logging
import pytest
import time
from tests.integration.host import (
get_host_in_state,
wait_for_host_state,
is_host_in_state,
draining_period_sec,
)
from peloton_client.pbgen.peloton.api.v0.host import host_pb2 as hpb
from peloton_client.pbgen.peloton.api.v0.task import task_pb2 as task
pyt... |
tests/test_tokenizer.py | legoktm/mwparserfromhell | 481 | 12688292 | # Copyright (C) 2012-2016 <NAME> <<EMAIL>>
#
# 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, publis... |
recognition/scripts/eval/eval_reid.py | aaramirezd/open_ptrack_v2 | 218 | 12688297 | #!/usr/bin/python
import csv
import rospy
import rospkg
import cv_bridge
import message_filters
from std_msgs.msg import *
from sensor_msgs.msg import *
from geometry_msgs.msg import *
from opt_msgs.msg import *
from dynamic_reconfigure.server import Server
from recognition.cfg import FaceFeatureExtractionConfig
from ... |
src/datashare/azext_datashare/manual/_params.py | Mannan2812/azure-cli-extensions | 207 | 12688310 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
src/core/model.py | yuanqidu/IDGL | 153 | 12688320 | <gh_stars>100-1000
import os
import random
import numpy as np
from collections import Counter
from sklearn.metrics import r2_score
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import ReduceLROnPlateau
import torch.nn.functional as F
from .models.graph_clf import GraphC... |
2021/CVE-2021-42567/poc/pocsploit/CVE-2021-42567.py | hjyuan/reapoc | 421 | 12688337 | <gh_stars>100-1000
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''Apereo CAS Reflected Cross-Site Scripting''',
"description": '''Apereo CAS through 6.4.1 allows cross-site scripting via POST requests sent to the REST API endpoints.''',
"se... |
malaya_speech/train/model/pix2pix/discriminator.py | ishine/malaya-speech | 111 | 12688345 | <filename>malaya_speech/train/model/pix2pix/discriminator.py<gh_stars>100-1000
import tensorflow as tf
from .layer import *
class Discriminator:
def __init__(self, inputs, targets, ndf=64):
n_layers = 3
layers = []
input = tf.concat([inputs, targets], axis=3)
with tf.variable_scope... |
ssim.py | ebartrum/NovelViewSynthesis-TensorFlow | 192 | 12688359 | import tensorflow as tf
import numpy as np
def _tf_fspecial_gauss(size, sigma, ch=1):
"""Function to mimic the 'fspecial' gaussian MATLAB function
"""
x_data, y_data = np.mgrid[-size//2 + 1:size//2 + 1, -size//2 + 1:size//2 + 1]
x_data = np.expand_dims(x_data, axis=-1)
x_data = np.expand_dims(x_d... |
test/test_slimta_edge.py | nanojob/python-slimta | 141 | 12688394 | import time
import unittest
from mox3.mox import MoxTestBase
from slimta.edge import Edge, EdgeServer
class TestEdge(MoxTestBase, unittest.TestCase):
def test_handoff(self):
self.mox.StubOutWithMock(time, 'time')
env = self.mox.CreateMockAnything()
queue = self.mox.CreateMockAnything()
... |
old_stuff/harold/tests/test_static_ctrl_design.py | weightan/quaternion_polynomials | 154 | 12688414 | <gh_stars>100-1000
from numpy import eye, array, sort, empty
from scipy.linalg import block_diag, eigvals
from scipy.signal.filter_design import _cplxpair
from numpy.testing import (assert_almost_equal, assert_array_almost_equal,
assert_array_equal)
from pytest import raises as assert_raises... |
python_modules/dagster/dagster/core/storage/schedules/sqlite/alembic/versions/8ccbed5060b8_0_10_0_create_new_schedule_tables.py | dbatten5/dagster | 4,606 | 12688418 | <reponame>dbatten5/dagster
"""0.10.0 create new schedule tables
Revision ID: 8ccbed5060b8
Revises: <PASSWORD>
Create Date: 2021-01-13 12:56:41.971500
"""
from dagster.core.storage.migration.utils import create_0_10_0_schedule_tables
# revision identifiers, used by Alembic.
revision = "8ccbed5060b8"
down_revision = "... |
pythonturtle/my_turtle.py | Cleverect/PythonTurtle | 114 | 12688438 | <reponame>Cleverect/PythonTurtle
import wx
from .misc.helpers import deg_to_rad, rad_to_deg
from .misc.vector import Vector
# Size of the turtle canvas. We assume no user will have a screen
# so big that the canvas will be bigger than this.
BITMAP_SIZE = Vector((2000, 1200))
# Center of the canvas.
origin = BITMAP_S... |
cam_lecture/scripts/edge_filter_compressed.py | yasutomo57jp/ros_lecture | 110 | 12688469 | <gh_stars>100-1000
#!/usr/bin/env python
import rospy
import sys
import cv2
from sensor_msgs.msg import Image, CompressedImage, CameraInfo
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class cvBridgeDemo:
def __init__(self):
self.node_name = "cv_bridge_demo_compressed"
rospy.init... |
examples/schedule/schedule_scripts.py | timgates42/plan | 553 | 12688502 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Use this file to easily define all of your cron jobs.
#
# It's helpful to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
#
# Learn more: http://github.com/fengsp/plan
from plan import Plan
cron = Plan("scripts", path='/web/yourproject/scripts',
... |
examples/jit/reduction_simple.py | prkhrsrvstv1/cupy | 6,180 | 12688507 | import cupy
from cupyx import jit
@jit.rawkernel()
def reduction(x, y, size):
tid = jit.threadIdx.x
ntid = jit.blockDim.x
value = cupy.float32(0)
for i in range(tid, size, ntid):
value += x[i]
smem = jit.shared_memory(cupy.float32, 1024)
smem[tid] = value
jit.syncthreads()
... |
dash-static-image-serve.py | oriolmirosa/dash-recipes | 932 | 12688509 | <reponame>oriolmirosa/dash-recipes
import dash
import dash_html_components as html
import os
import config
STATIC_PREFIX = '/{}/static/'.format(config.DASH_APP_NAME)
app = dash.Dash()
app.layout = html.Div([
html.Img(src='{}my-image.png'.format(STATIC_PREFIX))
])
# Static routes for on-premise are a little bi... |
kashgari/embeddings/abc_embedding.py | SharpKoi/Kashgari | 2,422 | 12688537 | # encoding: utf-8
# author: BrikerMan
# contact: <EMAIL>
# blog: https://eliyar.biz
# file: abc_embedding.py
# time: 2:43 下午
import json
from typing import Dict, List, Any, Optional, Union
import numpy as np
import tensorflow as tf
import tqdm
import kashgari
from kashgari.generators import CorpusGenerator
from ka... |
tensorflow/python/framework/kernels.py | abhaikollara/tensorflow | 848 | 12688545 | <filename>tensorflow/python/framework/kernels.py
# 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/li... |
gammapy/modeling/tests/test_fit.py | ischigal/gammapy | 155 | 12688567 | <reponame>ischigal/gammapy
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Unit tests for the Fit class"""
import pytest
from numpy.testing import assert_allclose
from astropy.table import Table
from gammapy.datasets import Dataset
from gammapy.modeling import Fit, Parameter
from gammapy.modeling.mod... |
alipay/aop/api/domain/AlipayMarketingCrowdDataSyncModel.py | snowxmas/alipay-sdk-python-all | 213 | 12688576 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMarketingCrowdDataSyncModel(object):
def __init__(self):
self._biz_from = None
self._create_id = None
self._crowd_id = None
self._crowd_na... |
Lib/test/test_strptime_jy.py | jeff5/jython-whinchat | 577 | 12688580 | # Java locale differences from JDK 9 onwards, and locale variation on
# developer machines, break test_strptime tests. This manifests more on Windows.
# Rather than diverge from the Python source, this overrides with extra locale
# setup.
# Merging back into CPython is desirable, but is a bigger discussion around
# lib... |
Dynamic Programming/Create Maximum Cost List/solution.py | iabhimanyu/Algorithms | 715 | 12688590 | '''
@author: <NAME>
Filling one cell: O(1)
Filling all cells: O(2xn) = O(n)
'''
def find_maximum_cost(Y):
values = [[0 for _ in range(2)] for _ in range(len(Y))]
# Go on with adding these 2 options
i = 1
while i < len(Y):
# Put these two options
values[i][0] = max(va... |
migration/migrator/migrations/course/20200402034200_overall_comments.py | zeez2030/Submitty | 411 | 12688624 | <reponame>zeez2030/Submitty
"""Migration for a given Submitty course database."""
def up(config, database, semester, course):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with ... |
flextensor/testing/others/test_conv2d_cuda_different_schedule.py | imxian/FlexTensor | 135 | 12688632 | <gh_stars>100-1000
"""
Test different schedule on conv2d_nchw
Target NVIDIA GPU
====================================
**Author**: `<NAME>`
"""
import tvm
import json
from flextensor.measure import _evaluate
from flextensor.nn import conv2d_nchw
from flextensor.configs.conv2d_config import yolo_shapes_b8
from flextenso... |
midi_ddsp/modules/expression_generator.py | magenta/midi-ddsp | 169 | 12688633 | # Copyright 2022 The MIDI-DDSP 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
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law... |
tests/core/middleware/test_gas_price_strategy.py | geofferyj/web3.py | 3,041 | 12688643 | import pytest
from unittest.mock import (
Mock,
)
from web3.middleware import (
gas_price_strategy_middleware,
)
@pytest.fixture
def the_gas_price_strategy_middleware(web3):
make_request, web3 = Mock(), Mock()
initialized = gas_price_strategy_middleware(make_request, web3)
initialized.web3 = web3... |
tests/test_linear_model.py | hugocool/explainerdashboard | 1,178 | 12688658 | import unittest
import pandas as pd
import numpy as np
import shap
import plotly.graph_objects as go
from sklearn.linear_model import LinearRegression, LogisticRegression
from explainerdashboard.explainers import RegressionExplainer, ClassifierExplainer
from explainerdashboard.datasets import titanic_fare, titanic_... |
test/test_formatter/test_asy.py | skirpichev/Mathics | 1,920 | 12688662 | import re
from mathics.core.expression import Symbol, Integer0, Integer1, Expression
from mathics.core.evaluation import Evaluation
from mathics.session import MathicsSession
from mathics.builtin.inout import MakeBoxes
session = MathicsSession(add_builtin=True, catch_interrupt=False)
evaluation = Evaluation(session.de... |
alipay/aop/api/domain/AlipayInsDataDsbRequestImageInfo.py | snowxmas/alipay-sdk-python-all | 213 | 12688667 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayInsDataDsbRequestImageInfo(object):
def __init__(self):
self._image_name = None
self._image_path = None
@property
def image_name(self):
return self._image_n... |
pattern/vector/svm/__init__.py | huihui7987/pattern | 6,201 | 12688681 | <reponame>huihui7987/pattern
from __future__ import absolute_import
from __future__ import division
LIBSVM = LIBLINEAR = True
try:
from . import libsvm
from . import libsvmutil
except ImportError as e:
LIBSVM = False
raise e
try:
from . import liblinear
from . import liblinearutil
except:
... |
lambeq/ansatz/tensor.py | CQCL/lambeq | 131 | 12688695 | # Copyright 2021, 2022 Cambridge Quantum Computing Ltd.
#
# 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 la... |
test/test_Tracker.py | rentainhe/glasses | 271 | 12688756 | <filename>test/test_Tracker.py
import torch
import torch.nn as nn
from glasses.utils.Tracker import Tracker
def test_tracker():
x = torch.rand(64, 1)
model = nn.Sequential(nn.Linear(1, 64), nn.ReLU(), nn.Linear(64,10), nn.ReLU())
tr = Tracker(model)
tr(x)
assert len(tr.traced) == 4
assert len(... |
videoanalyst/data/target/target_impl/utils/debug_compare_densebox_target.py | TragedyN/SiamFCpp | 737 | 12688760 | <reponame>TragedyN/SiamFCpp<gh_stars>100-1000
import numpy as np
# from IPython import embed;embed()
from make_densebox_target import \
make_densebox_target as make_densebox_target_old
from make_densebox_target_dev import \
make_densebox_target as make_densebox_target_new
gt_boxes = np.asarray([[150, 250, 130,... |
examples/undocumented/python/kernel_simple_locality_improved_string.py | tallamjr/shogun | 2,753 | 12688829 | <gh_stars>1000+
#!/usr/bin/env python
import shogun as sg
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,5,5,1],[traindat,testdat,5,3,2]]
def kernel_simple_locality_improved_strin... |
imodels/util/distillation.py | csinva/interpretability-implementations-demos | 102 | 12688841 | from sklearn.base import RegressorMixin, BaseEstimator, is_regressor
class DistilledRegressor(BaseEstimator, RegressorMixin):
"""
Class to implement distillation. Currently only supports regression.
Params
------
teacher: initial model to be trained
must be a regressor or a binary classifi... |
extrabacon-2.0/extrabacon_2.0.py | JS-Burns/CVE-2016-6366 | 171 | 12688860 | <gh_stars>100-1000
#!/usr/bin/env python2
"""
Our goal with version 2.0 of ExtraBacon is to support more ASA versions, as well
as simplify the Python and payload shellcode. This means stripping as much as
possible from the shellcode and Python to still be functional.
"""
import sys
import string
import subprocess
imp... |
odo/odo.py | farukht/odo | 844 | 12688872 | from .into import into
def odo(source, target, **kwargs):
""" Push one dataset into another
Parameters
----------
source: object or string
The source of your data. Either an object (e.g. DataFrame),
or a string ('filename.csv')
target: object or string or type
The target... |
scoreboard/bin/stress_test.py | aprilsanchez/ictf-framework | 110 | 12688882 | import unittest
from random import random
from funkload.FunkLoadTestCase import FunkLoadTestCase
from webunit.utility import Upload
from funkload.utils import Data
class Stress_Test(FunkLoadTestCase):
def setUp(self):
self.server_url = self.conf_get('main', 'url')
self.setBasicAuth('<EMAIL>', 'test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.