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 |
|---|---|---|---|---|---|---|---|---|---|---|
recognition/arcface_paddle/static/validation.py | Intsigstephon/insightface | 12,377 | 1672855 | # Copyright (c) 2021 PaddlePaddle 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
train_wasserstein_gan.py | yvesdeboeck66/Masterproef-Yves-De-Boeck | 403 | 1672861 | from __future__ import print_function
import argparse
import os
import random
import chainer
import numpy as np
from chainer import training, Variable
from chainer.training import extensions
from dataset import H5pyDataset
from model import DCGAN_G, DCGAN_D, init_bn, init_conv
from sampler import sampler
from update... | 0 | 1 | 0 | 0 | 1 | 0 |
print_activations.py | akash13singh/thesis | 215 | 1672915 | from __future__ import annotations
from glob import glob
def get_activations(model, model_inputs, print_shape_only: bool=False, layer_name: object | None=None) -> object:
import keras.backend as K
print('----- activations -----')
activations = []
inp = model.input
model_multi_inputs_cond = True
... | 2 | 1 | 0 | 0 | 3 | 0 |
src/sage/rings/padics/padic_extension_leaves.py | dimpase/sagetrac-mirror | 1,742 | 1672920 | <filename>src/sage/rings/padics/padic_extension_leaves.py
"""
p-Adic Extension Leaves
The final classes for extensions of Zp and Qp (ie classes that are not
just designed to be inherited from).
AUTHORS:
- <NAME>
"""
#*****************************************************************************
# Copyright (C)... | 0 | 0 | 0 | 0 | 0 | 0 |
sonnet/src/conformance/goldens_test.py | ScriptBox99/deepmind-sonnet | 10,287 | 1672922 | <gh_stars>1000+
# Copyright 2019 The Sonnet 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... | 0 | 0 | 0 | 0 | 0 | 0 |
torchbenchmark/models/BERT_pytorch/bert_pytorch/model/attention/single.py | Chillee/benchmark | 384 | 1672938 | <filename>torchbenchmark/models/BERT_pytorch/bert_pytorch/model/attention/single.py<gh_stars>100-1000
import torch.nn as nn
import torch.nn.functional as F
import torch
import math
from ..utils.tensor2tensor import TensorToTensor
from typing import Optional
class Attention(nn.Module):
"""
Compute 'Scaled Dot ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_something.py | CompGeoInc/traces | 502 | 1672940 | <filename>tests/test_something.py
import traces
def test_compact():
# make a v. simple time series
ts = traces.TimeSeries()
ts[0] = 42
# set a future time to the same value, with compact=True
ts.set(1, 42, compact=True)
# should still only keep the t=0 measurement
assert ts.n_measuremen... | 0 | 0 | 0 | 0 | 0 | 0 |
nipy/modalities/fmri/fmristat/tests/test_model.py | bpinsard/nipy | 236 | 1672959 | <gh_stars>100-1000
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import with_statement
from __future__ import absolute_import
import numpy as np
from nipy.io.api import load_image
from nipy.core.image.image import rollimg
from .. im... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/mixture_lib.py | vipavlovic/pyprobml | 4,895 | 1672961 | <reponame>vipavlovic/pyprobml
# Mixture distributions
# Author <NAME>(@karalleyna)
import superimport
#!pip install distrax
import distrax
import jax
import jax.numpy as jnp
class MixtureSameFamily(distrax.MixtureSameFamily):
def _per_mixture_component_log_prob(self, value):
'''Per mixture component log ... | 0 | 0 | 0 | 0 | 0 | 0 |
common/src/stack/report-system/command/report/system/tests/test_backend_link.py | kmcm0/stacki | 123 | 1672987 | <reponame>kmcm0/stacki
import pytest
import testinfra
import paramiko
import socket
from stack import api
from collections import namedtuple
testinfra_hosts = [host['host'] for host in api.Call('list host', args=['a:backend'])]
class TestLinkUp:
""" See if the interfaces stacki configures are actually up on the host... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/client/multipart.py | mnxzyw/vibora | 6,238 | 1673014 | from vibora import Vibora, Request
from vibora.tests import TestSuite
from vibora.responses import JsonResponse
from vibora.multipart import FileUpload
class FormsTestCase(TestSuite):
async def test_simple_post__expects_correctly_interpreted(self) -> object:
app = Vibora()
@app.route('/', method... | 2 | 4 | 0 | 0 | 6 | 0 |
ml-ops-on-mars/model3.py | ianrussellsoftwarepark/exercises | 404 | 1673024 | #!/usr/bin/env python
import sys
import time
import json
import math
def model_predict(data) -> object:
if 'data' not in data:
raise ValueError("data should have 'data' field")
data = data['data']
print("Start calculations")
started = time.time()
# perform the computations
time.slee... | 0 | 1 | 0 | 0 | 1 | 0 |
plot/plot_E.py | lawsuisum/fedavgpy | 122 | 1673025 | import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from scipy.ndimage.filters import gaussian_filter1d
plt.rc('font', family='serif')
plt.rc('font', serif='Times New Roman')
plt.rcParams["mathtext.fontset"] = "stix"
def smooth(y) -> object:
return gaussian_filter1... | 0 | 1 | 0 | 0 | 1 | 0 |
net.py | fn2s/MXNet-Gluon-Style-Transfer | 111 | 1673047 | <gh_stars>100-1000
import numpy as np
import mxnet as mx
from mxnet import autograd, gluon
from mxnet.gluon import nn, Block, HybridBlock, Parameter
from mxnet.base import numeric_types
import mxnet.ndarray as F
class InstanceNorm(HybridBlock):
def __init__(self, axis=1, momentum=0.9, epsilon=1e-5, center=True, sc... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/fontTools/pens/statisticsPen.py | twardoch/fonttools-py27 | 240 | 1673071 | <reponame>twardoch/fonttools-py27
"""Pen calculating area, center of mass, variance and standard-deviation,
covariance and correlation, and slant, of glyph shapes."""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import math
from fontTools.pens.momentsPen import Mome... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/common/config/test_external_config.py | andrewsu/cellxgene | 403 | 1673074 | <gh_stars>100-1000
import os
import requests
from server.common.config.app_config import AppConfig
from server.common.errors import ConfigurationError
from server.common.utils.type_conversion_utils import convert_string_to_value
from test import FIXTURES_ROOT
from test.unit import test_server
from test.unit.common.c... | 0 | 0 | 0 | 0 | 0 | 0 |
compressible_sr/problems/test.py | zooechiu/pyro2 | 151 | 1673078 | <filename>compressible_sr/problems/test.py<gh_stars>100-1000
from __future__ import print_function
import sys
import mesh.patch as patch
import compressible_sr.eos as eos
def init_data(my_data, rp):
""" an init routine for unit testing """
# make sure that we are passed a valid patch object
if not isin... | 0 | 0 | 0 | 0 | 0 | 0 |
sporco/admm/cmod.py | vishalbelsare/sporco | 217 | 1673081 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 by <NAME> <<EMAIL>>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""ADMM algorithm for the C... | 0 | 0 | 0 | 0 | 0 | 0 |
milking_cowmask/data_sources/small_image_data_source.py | deepneuralmachine/google-research | 23,901 | 1673103 | <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... | 0 | 0 | 0 | 0 | 0 | 0 |
apex/contrib/bottleneck/bottleneck.py | dhas/apex | 210 | 1673111 | <gh_stars>100-1000
import torch
from torch import nn
import fast_bottleneck
def kaiming_uniform_(tensor, a=0, mode='fan_in', nonlinearity='leaky_relu'):
weight_tensor_nchw = tensor
nn.init.kaiming_uniform_(weight_tensor_nchw, a=a, mode=mode, nonlinearity=nonlinearity)
class FrozenBatchNorm2d(torch.nn.Module):... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/Windows/Markup/Primitives.py | htlcnn/ironpython-stubs | 182 | 1673129 | <gh_stars>100-1000
# encoding: utf-8
# module System.Windows.Markup.Primitives calls itself Primitives
# from PresentationFramework,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
c... | 0 | 0 | 0 | 0 | 0 | 0 |
weixin/config.py | wdw139130/wechat-mall | 108 | 1673143 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
AUTO_REPLY_CONTENT = '''
欢迎关注在行!
「在行」是一个知识服务的平台。我们为想要解决问题的人找到行家,一对一面对面答疑解惑、出谋划策;我们为愿意分享知识和经验的人找到学员,让头脑中的资源发挥更大的价值。
期待你的加入!
www.zaih.com
'''
| 0 | 0 | 0 | 0 | 0 | 0 |
px/environments/bidaf_server_test.py | cclauss/active-qa | 327 | 1673146 | <gh_stars>100-1000
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 0 | 0 | 0 | 0 | 0 | 0 |
GANs/reenactgan/data.py | saulocatharino/nnabla-examples | 228 | 1673148 | <filename>GANs/reenactgan/data.py
# Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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.or... | 0 | 0 | 0 | 0 | 0 | 0 |
airmozilla/manage/models.py | anurag90x/airmozilla | 115 | 1673181 | <filename>airmozilla/manage/models.py
from django.core.cache import cache
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.db import models
@receiver(models.signals.post_save, sender=User)
@receiver(models.signals.m2m_changed, sender=User.groups.through)
def invalidate_user... | 0 | 0 | 0 | 0 | 0 | 0 |
part-2/mayhem_1.py | Jason-Liu-Dream/mayhem | 239 | 1673184 | <filename>part-2/mayhem_1.py
#!/usr/bin/env python3.7
# Copyright (c) 2018-2019 <NAME>
"""
Define a shutdown coroutine and attach to the loop via signal handlers.
Notice! This requires:
- attrs==19.1.0
To run:
$ python part-2/mayhem_1.py
Follow along: https://roguelynn.com/words/asyncio-graceful-shutdowns/
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
vel/commands/train_command.py | galatolofederico/vel | 273 | 1673188 | from __future__ import annotations
import typing
import vel.api as api
from vel.callbacks.time_tracker import TimeTracker
class SimpleTrainCommand:
""" Very simple training command - just run the supplied generators """
def __init__(self, epochs: int, model_config: api.ModelConfig, model_factory: api.Model... | 12 | 4 | 0 | 0 | 16 | 0 |
tests/terraform/checks/resource/azure/test_AppServiceIdentityProviderEnabled.py | jamesholland-uk/checkov | 4,013 | 1673227 | import unittest
import hcl2
from checkov.terraform.checks.resource.azure.AppServiceIdentityProviderEnabled import check
from checkov.common.models.enums import CheckResult
class TestAppServiceIdentityProviderEnabled(unittest.TestCase):
def test_failure(self):
hcl_res = hcl2.loads("""
resour... | 0 | 0 | 0 | 0 | 0 | 0 |
trakt/version.py | meisnate12/trakt.py | 147 | 1673235 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
__version__ = '4.4.0'
| 0 | 0 | 0 | 0 | 0 | 0 |
pywick/optimizers/lookaheadsgd.py | achaiah/pywick | 408 | 1673239 | <reponame>achaiah/pywick
from pywick.optimizers.lookahead import *
from torch.optim import SGD
class LookaheadSGD(Lookahead):
def __init__(self, params, lr, alpha=0.5, k=6, momentum=0.9, dampening=0, weight_decay=0.0001, nesterov=False):
"""
Combination of SGD + LookAhead
:param params:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/benchmarks/jetstream.py | zipated/src | 2,151 | 1673270 | # Copyright 2014 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.
"""Runs Apple's JetStream benchmark.
JetStream combines a variety of JavaScript benchmarks, covering a variety of
advanced workloads and programming techniq... | 0 | 2 | 0 | 0 | 2 | 0 |
st2common/st2common/metrics/drivers/echo_driver.py | momokuri-3/st2 | 4,920 | 1673283 | <reponame>momokuri-3/st2
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme 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/license... | 0 | 0 | 0 | 0 | 0 | 0 |
pyvista/examples/hdr.py | eino/pyvista | 1,107 | 1673287 | <reponame>eino/pyvista
"""HDR texture examples."""
from .downloads import _download_and_read
def download_dikhololo_night(): # pragma: no cover
"""Download and read the dikholo night hdr texture example.
Files hosted at https://polyhaven.com/
Returns
-------
pyvista.texture
HDR Texture... | 0 | 0 | 0 | 0 | 0 | 0 |
abcnn/graph.py | DeepQuantitative/text_matching | 621 | 1673291 | import tensorflow as tf
from abcnn import args
class Graph:
def __init__(self, abcnn1: bool=False, abcnn2: bool=False):
self.p = tf.placeholder(dtype=tf.int32, shape=(None, args.seq_length), name='p')
self.h = tf.placeholder(dtype=tf.int32, shape=(None, args.seq_length), name='h')
self.y ... | 2 | 2 | 0 | 0 | 4 | 0 |
core/bin/capture_runner.py | near-feign/pcapdb | 244 | 1673300 | # This script watches for whether capture should be running and makes sure it's running when
# appropriate.
# Separating out this functionality into and independent script allows us to keep this script,
# and therefore capture, running with supervisord. It also makes it vastly easier to start the
# capture process as a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/utils/test_minions.py | tomdoherty/salt | 9,425 | 1673307 | <filename>tests/pytests/unit/utils/test_minions.py
import salt.utils.minions
import salt.utils.network
from tests.support.mock import patch
def test_connected_ids():
"""
test ckminion connected_ids when
local_port_tcp returns 127.0.0.1
"""
opts = {
"publish_port": 4505,
"detect_rem... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/WebKit/Source/devtools/scripts/convert_svg_images_to_png.py | google-ar/chromium | 777 | 1673310 | <reponame>google-ar/chromium
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. 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 c... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_blade/examples/Inference/CUDA/BERT/bert_inference_opt.py | JamesTheZ/BladeDISC | 328 | 1673335 | # Copyright 2022 The BladeDISC 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 law or ... | 0 | 3 | 0 | 0 | 3 | 0 |
pyglmnet/externals/sklearn/utils/validation.py | zmarkan/pyglmnet | 225 | 1673345 | <gh_stars>100-1000
"""Utilities for input validation"""
# adapt from scikit-learn
# Authors: <NAME>
# <NAME>
# <NAME>
# <NAME>
# <NAME>
# <NAME>
# <NAME>
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from insp... | 0 | 0 | 0 | 0 | 0 | 0 |
bindgen/raze/crates.bzl | yesudeep/rules_rust | 349 | 1673347 | """
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load
load("@bazel_tools//too... | 0 | 0 | 0 | 0 | 0 | 0 |
flask_cache/backends.py | Viruzzz-kun/flask-cache | 674 | 1673366 | from __future__ import annotations
import pickle
from werkzeug.contrib.cache import (BaseCache, NullCache, SimpleCache, MemcachedCache,
GAEMemcachedCache, FileSystemCache)
from ._compat import range_type
class SASLMemcachedCache(MemcachedCache):
def __init__(self, servers: obj... | 9 | 12 | 0 | 0 | 21 | 0 |
questions/find-peak-element/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 1673412 | """
A peak element is an element that is greater than its neighbors.
Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that nums[-1] = nums[n] = -∞.
Exam... | 1 | 1 | 0 | 0 | 2 | 0 |
venv/Lib/site-packages/statsmodels/stats/tests/test_contrast.py | EkremBayar/bayar | 6,931 | 1673438 | <reponame>EkremBayar/bayar<filename>venv/Lib/site-packages/statsmodels/stats/tests/test_contrast.py
import numpy as np
import numpy.random
from numpy.testing import assert_almost_equal, assert_equal
from statsmodels.stats.contrast import Contrast
import statsmodels.stats.contrast as smc
class TestContrast(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
util/update_library_files.py | creativemindplus/skybison | 278 | 1673450 | <gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#!/usr/bin/env python3
import glob
import os
from glob import glob
SCRIPT_NAME = os.path.basename(__file__)
PYRO_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
library_files = set()
os.chdir(f"{PYRO_... | 0 | 0 | 0 | 0 | 0 | 0 |
hail/python/hail/plot/__init__.py | 3vivekb/hail | 789 | 1673469 | <gh_stars>100-1000
from .plots import output_notebook, show, histogram, cumulative_histogram, histogram2d, scatter, joint_plot, qq, manhattan, smoothed_pdf, pdf, cdf, set_font_size, visualize_missingness
__all__ = ['output_notebook',
'show',
'histogram',
'cumulative_histogram',
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/samplingDistributionGaussianShrinkage.py | vipavlovic/pyprobml | 4,895 | 1673491 | <gh_stars>1000+
import superimport
import numpy as np
import matplotlib.pyplot as plt
def gaussProb(X, mu, Sigma):
d = 1
X = np.reshape(X, newshape=(-1, d), order='F')
X = X - mu.T
logp = -0.5 * np.sum(X*X/Sigma, axis=1)
logZ = 0.5 * d * np.log(2*np.pi) + 0.5 * np.log(Sigma)
logp = logp - log... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/benchmarks/bench_float.py | psydox/Pyjion | 1,137 | 1673492 | """
Artificial, floating point-heavy benchmark originally used by Factor.
"""
from math import sin, cos, sqrt
import timeit
import pyjion
POINTS = 100000
class Point(object):
__slots__: tuple[str, str, str] = ('x', 'y', 'z')
def __init__(self, i):
self.x = x = sin(i)
self.y = cos(i) * 3
... | 0 | 4 | 1 | 0 | 5 | 0 |
dqn/dqn_utils.py | DanielTakeshi/rl_algorithms | 150 | 1673499 | <gh_stars>100-1000
"""This file includes a collection of utility functions that are useful for
implementing DQN."""
import gym
import tensorflow as tf
import numpy as np
import random
def huber_loss(x, delta=1.0):
# https://en.wikipedia.org/wiki/Huber_loss
return tf.select(
tf.abs(x) < delta,
t... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/led2.py | nickpascucci/fanshim-python | 272 | 1673510 | #!/usr/bin/env python3
from fanshim import FanShim
import time
import colorsys
fanshim = FanShim()
fanshim.set_fan(False)
try:
for i in range(-10, 21):
print("Temp index %d" % i)
# Normal temperature range 0 to 1, cold < 0, hot > 1
temp = i/10.0
if temp < 0.0:
# hue of ... | 0 | 0 | 0 | 0 | 0 | 0 |
som_vae/somvae_model.py | zutotonno/SOM-VAE | 171 | 1673513 | """
SOM-VAE model as described in https://arxiv.org/abs/1806.02199
Copyright (c) 2018
Author: <NAME>
Institution: Biomedical Informatics group, ETH Zurich
License: MIT License
"""
import functools
import numpy as np
import tensorflow as tf
def weight_variable(shape, name) -> object:
"""Creates a TensorFlow Varia... | 15 | 28 | 0 | 0 | 43 | 0 |
source/bin/codebuild_scripts/merge_manifest.py | faraazkhan/aws-control-tower-customizations | 155 | 1673525 | <reponame>faraazkhan/aws-control-tower-customizations
##############################################################################
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/imitation/scripts/config/train_adversarial.py | dolphonie/imitation | 438 | 1673631 | """Configuration for imitation.scripts.train_adversarial."""
import sacred
from imitation.rewards import reward_nets
from imitation.scripts.common import common, demonstrations, reward, rl, train
train_adversarial_ex = sacred.Experiment(
"train_adversarial",
ingredients=[
common.common_ingredient,
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fixtures/example-code/inline-ignores/E731.py | jmcgill298/flake8 | 2,013 | 1673634 | example = lambda: 'example' # noqa: E731
| 0 | 0 | 0 | 0 | 0 | 0 |
monitor/portal/wechatapi.py | zbonce/PromAnsible | 210 | 1673637 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# from __future__ import unicode_literals
import requests, json, memcache
from models import *
############################################################
# Basic API
############################################################
def get_user_list():
rec = mn_Enterprise_w... | 0 | 0 | 0 | 0 | 0 | 0 |
test/net/integration/websocket/test.py | jaeh/IncludeOS | 3,673 | 1673660 | <filename>test/net/integration/websocket/test.py
#!/usr/bin/env python3
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
import os
import sys
import subprocess
import _thread
import time
from ws4py.client.threadedclient import WebSock... | 0 | 0 | 0 | 0 | 0 | 0 |
electroncash_plugins/shuffle_deprecated/crypto.py | christroutner/Electron-Cash | 208 | 1673674 | <filename>electroncash_plugins/shuffle_deprecated/crypto.py
import ecdsa
from ecdsa.util import number_to_string, string_to_number
from electroncash.bitcoin import (generator_secp256k1, point_to_ser, EC_KEY,
Hash, InvalidPassword)
class CryptoError(Exception):
''' base class of a... | 0 | 0 | 0 | 0 | 0 | 0 |
regtests/bench/webclgl_array_mult.py | ahakingdom/Rusthon | 622 | 1673684 | """big array mult"""
from time import time
from random import random
ARRAY_SIZE = 1024*1024*4
@returns( array=ARRAY_SIZE )
@gpu.main
def myfunc(A, B, C, D):
float* A
float* B
float* C
float* D
vec2 n = get_global_id() ## WebCL API
return A[n] * B[n] * C[n] * D[n]
def main():
a = [ random() for i in range(AR... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_blocking.py | SharpBit/brawlstars | 101 | 1673708 | <filename>tests/test_blocking.py
import os
import unittest
import brawlstats
from dotenv import load_dotenv
load_dotenv()
class TestBlockingClient(unittest.TestCase):
PLAYER_TAG = '#V2LQY9UY'
CLUB_TAG = '#UL0GCC8'
def setUp(self):
self.client = brawlstats.Client(
os.getenv('token'... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonAPI/carissma_project/lib/python3.5/site-packages/pandas/tests/scalar/interval/test_ops.py | AbdulHoffmann/carla_carissma | 6,989 | 1673720 | """Tests for Interval-Interval operations, such as overlaps, contains, etc."""
import pytest
from pandas import Interval, Timedelta, Timestamp
@pytest.fixture(params=[
(Timedelta('0 days'), Timedelta('1 day')),
(Timestamp('2018-01-01'), Timedelta('1 day')),
(0, 1)], ids=lambda x: type(x[0]).__name__)
def... | 0 | 1 | 0 | 0 | 1 | 0 |
env/lib/python3.8/site-packages/pandas/tests/extension/test_string.py | acrucetta/Chicago_COVI_WebApp | 1,738 | 1673742 | <reponame>acrucetta/Chicago_COVI_WebApp<filename>env/lib/python3.8/site-packages/pandas/tests/extension/test_string.py
import string
import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.string_ import StringArray, StringDtype
from pandas.tests.extension import base
@pytest.fixture
def dtype(... | 0 | 0 | 0 | 0 | 0 | 0 |
great_expectations/profile/columns_exist.py | vanderGoes/great_expectations | 6,451 | 1673744 | <filename>great_expectations/profile/columns_exist.py
import warnings
from ..dataset.util import create_multiple_expectations
from .base import DatasetProfiler
# This particular file should be immune to the new changes
class ColumnsExistProfiler(DatasetProfiler):
@classmethod
def _profile(cls, dataset, confi... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/reverseLookup.py | TiagoDanin-Forks/ReconDog | 1,070 | 1673746 | import sys
from requests import get
from core.colors import bad
def reverseLookup(inp):
lookup = 'https://api.hackertarget.com/reverseiplookup/?q=%s' % inp
try:
result = get(lookup).text
sys.stdout.write(result)
except:
sys.stdout.write('%s Invalid IP address' % bad)
| 0 | 0 | 0 | 0 | 0 | 0 |
paddlex/paddleseg/transforms/functional.py | cheneyveron/PaddleX | 3,655 | 1673779 | <filename>paddlex/paddleseg/transforms/functional.py<gh_stars>1000+
# Copyright (c) 2020 PaddlePaddle 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/deploy.py | fengjixuchui/src | 1,160 | 1673784 | from __future__ import annotations
"""
Deploy code snips into swig interface files
(c) Hex-Rays
"""
from __future__ import print_function
import sys, re, os, glob
major, minor, micro, _, _ = sys.version_info
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade ... | 0 | 4 | 0 | 0 | 4 | 0 |
grr/server/grr_response_server/worker_lib.py | khanhgithead/grr | 4,238 | 1673795 | <filename>grr/server/grr_response_server/worker_lib.py
#!/usr/bin/env python
# Lint as: python3
"""Module with GRRWorker implementation."""
import logging
import time
from typing import Sequence
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import registry
from grr_response_core.lib.rdfvalues ... | 0 | 0 | 0 | 0 | 0 | 0 |
synthtiger/components/layout/flow_layout.py | KoryakovDmitry/synthtiger | 153 | 1673815 | from __future__ import annotations
"""
SynthTIGER
Copyright (c) 2021-present NAVER Corp.
MIT license
"""
import numpy as np
from synthtiger.components.component import Component
class FlowLayout(Component):
def __init__(self, space: tuple[int, int]=(0, 0), vertical: bool=False):
super().__init__()
... | 4 | 2 | 0 | 0 | 6 | 0 |
script/cnn_lstm.py | pl8787/textnet-release | 114 | 1673827 | #-*-coding:utf8-*-
import copy, os
from gen_conf_file import *
from dataset_cfg import *
def gen_conv_lstm(d_mem, init) -> object:
net = {}
# dataset = 'tb_fine'
dataset = 'mr'
if dataset == 'mr':
net['cross_validation'] = 10
ds = DatasetCfg(dataset)
g_filler = gen_uniform_filter_set... | 0 | 1 | 0 | 0 | 1 | 0 |
docs/stardoc.bzl | layus/rules_nixpkgs | 131 | 1673831 | <gh_stars>100-1000
load("@io_bazel_stardoc//stardoc:stardoc.bzl", _stardoc = "stardoc")
def stardoc(
name,
out,
input,
aspect_template = "@io_tweag_rules_nixpkgs//docs:templates/aspect.vm",
func_template = "@io_tweag_rules_nixpkgs//docs:templates/func.vm",
header_templat... | 0 | 0 | 0 | 0 | 0 | 0 |
Nepali_nlp/stemmer.py | potamides/Nepali_nlp | 123 | 1673833 | <reponame>potamides/Nepali_nlp<filename>Nepali_nlp/stemmer.py
import snowballstemmer
class Stem:
"""Stem the words to its root eg 'गरेका' to 'गर'.
Credit: https://github.com/snowballstem/snowball
"""
def __init__(self) -> None:
self.stemmer = snowballstemmer.NepaliStemmer()
de... | 0 | 0 | 0 | 0 | 0 | 0 |
warehouse/admin/views/includes.py | fairhopeweb/warehouse | 3,103 | 1673840 | # 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, software
# distributed under the Li... | 0 | 1 | 0 | 0 | 1 | 0 |
zinnia/views/channels.py | Boondockers-Welcome/django-blog-zinnia | 1,522 | 1673861 | <reponame>Boondockers-Welcome/django-blog-zinnia
"""Views for Zinnia channels"""
from django.views.generic.list import ListView
from zinnia.models.entry import Entry
from zinnia.settings import PAGINATION
from zinnia.views.mixins.prefetch_related import PrefetchCategoriesAuthorsMixin
class BaseEntryChannel(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
rpcore/stage_manager.py | bluekyu/RenderPipeline | 1,031 | 1673868 | <reponame>bluekyu/RenderPipeline
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <<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... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/detection/center_net/fit_center_net.py | RafLit/gluon-cv | 5,447 | 1673899 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import CenterNetEstimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.object_detection import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'dataset': 'sheep... | 0 | 0 | 0 | 0 | 0 | 0 |
parlai/tasks/light_dialog/agents.py | twstewart42/ParlAI | 9,228 | 1673908 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from typing import Optional
from parlai.core.params import ParlaiParser
from parlai.c... | 9 | 4 | 0 | 0 | 13 | 0 |
wechat_django/models/constants.py | UltraVacuum/wechat-django | 166 | 1673909 | <filename>wechat_django/models/constants.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
class MsgType(object):
TEXT = "text"
IMAGE = "image"
VOICE = "voice"
VIDEO = "video"
class MsgLogFlag(object):
LOG_MESSAGE = 0x01
LOG_REPLY = 0x02
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/messages/test_video_message.py | TeamCodeCreator/ViberBot | 169 | 1673911 | <reponame>TeamCodeCreator/ViberBot
from viberbot.api.messages import MessageType
from viberbot.api.messages import VideoMessage
SAMPLE_TRACKING_DATA = "some tracking data"
SAMPLE_KEYBOARD = """{
"Type": "keyboard",
"DefaultHeight": true,
"BgColor": "#FFFFFF",
"Buttons": [
{
"Columns": 6,
"Rows": 1... | 0 | 0 | 0 | 0 | 0 | 0 |
mava/wrappers/env_wrappers.py | sash-a/Mava | 337 | 1673935 | # python3
# Copyright 2021 InstaDeep Ltd. 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 applic... | 1 | 5 | 0 | 0 | 6 | 0 |
Tools/python37/Lib/test/test_xmlrpc.py | xxroot/android_universal | 207 | 1673976 | <filename>Tools/python37/Lib/test/test_xmlrpc.py
import base64
import datetime
import decimal
import sys
import time
import unittest
from unittest import mock
import xmlrpc.client as xmlrpclib
import xmlrpc.server
import http.client
import http, http.server
import socket
import threading
import re
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/acoular_demo.py | ishine/acoular | 294 | 1673979 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#pylint: disable-msg=E0611, E1101, C0103, R0901, R0902, R0903, R0904, W0232
#------------------------------------------------------------------------------
# Copyright (c) 2007-2019, Acoular Development Team.
#---------------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
QuickWall/setter.py | deepjyoti30/QuickWall | 191 | 1673980 | <reponame>deepjyoti30/QuickWall
"""Setter related functions."""
from QuickWall.nitrogen import nitrogen
from QuickWall.feh import feh
from QuickWall.kde import KDEsetpaper
from QuickWall.xfce import XFCESetter
from QuickWall.gnome import GNOMESetter
from simber import Logger
from QuickWall.utility import get_desktop_e... | 0 | 0 | 0 | 0 | 0 | 0 |
vendor/paypalapi/interface.py | Paul3MK/NewsBlur | 3,073 | 1673992 | # coding=utf-8
"""
The end developer will do most of their work with the PayPalInterface class found
in this module. Configuration, querying, and manipulation can all be done
with it.
"""
import logging
from pprint import pformat
import warnings
import requests
from vendor.paypalapi.settings import PayPalConfig
from... | 0 | 0 | 0 | 0 | 0 | 0 |
projects/PartialReID/train_net.py | NTU-ROSE/fast-reid | 2,194 | 1673997 | <gh_stars>1000+
#!/usr/bin/env python
# encoding: utf-8
"""
@author: sherlock
@contact: <EMAIL>
"""
import logging
import os
import sys
sys.path.append('.')
from fastreid.config import get_cfg
from fastreid.engine import DefaultTrainer, default_argument_parser, default_setup, launch
from fastreid.utils.checkpoint i... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/simulations/gas.py | hadivafaii/vedo | 836 | 1674003 | <reponame>hadivafaii/vedo
"""A model of an ideal gas with hard-sphere collisions"""
## Based on gas.py by <NAME> for a cube as a container
## Slightly modified by <NAME> for a torus.
## Adapted by <NAME> for vedo
## relevant points in the code are marked with '### <--'
from random import random
from vedo import P... | 0 | 0 | 0 | 0 | 0 | 0 |
utils.py | ankitshah009/VGGSound | 153 | 1674005 | import csv
import os
import torch
from torch.optim import *
import torchvision
from torchvision.transforms import *
from scipy import stats
from sklearn import metrics
import numpy as np
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset(... | 2 | 4 | 0 | 0 | 6 | 0 |
blaze/blaze/test/utest_data/operator/op/dice/dice_net.py | Ru-Xiang/x-deeplearning | 4,071 | 1674066 | import numpy as np
a = np.ones([2, 3], np.float32)
a = [[0.1, 0.1, 0.1],
[0.1, 0.2, 0.3]]
gamma = np.ones([1, 3], np.float32)
gamma = [[0.01, 0.02, 0.03]]
mean = np.ones([1, 3], np.float32)
mean = [[0.09, 0.08, 0.07]]
var = np.ones([1, 3], np.float32)
var = [[0.0001, 0.0003, 0.0004]]
z = np.subtract(a, mean)
... | 0 | 0 | 0 | 0 | 0 | 0 |
saas/views/roles.py | kaiserho/djaodjin-saas | 383 | 1674074 | # Copyright (c) 2021, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 1 | 5 | 2 | 0 | 8 | 0 |
test/writer/test_elasticsearch_writer.py | jvdvegt/pytablewriter | 510 | 1674080 | <gh_stars>100-1000
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import collections
import datetime
import json
from decimal import Decimal
import elasticsearch
import pytest
import pytablewriter as ptw
from .._common import print_test_result
from ..data import headers, value_matrix
inf = Decimal("Infinity")
nan = Non... | 0 | 0 | 0 | 0 | 0 | 0 |
caffe2/python/device_checker.py | Hacky-DH/pytorch | 60,067 | 1674088 | ## @package device_checker
# Module caffe2.python.device_checker
from __future__ import annotations
import numpy as np
import copy
from caffe2.python import workspace
from caffe2.python.core import InferOpBlobDevicesAsDict
from future.utils import viewitems
class DeviceChecker(object):
"""A device checker in Pyth... | 4 | 2 | 0 | 0 | 6 | 0 |
llvmlite/tests/test_refprune.py | efeslab/llvmlite | 1,384 | 1674101 | <gh_stars>1000+
import unittest
from llvmlite import ir
from llvmlite import binding as llvm
from llvmlite.tests import TestCase
from . import refprune_proto as proto
def _iterate_cases(generate_test):
def wrap(fn):
def wrapped(self):
return generate_test(self, fn)
wrapped.__doc__ = f... | 0 | 0 | 0 | 0 | 0 | 0 |
python/federatedml/param/stepwise_param.py | QuantumA/FATE | 715 | 1674103 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | 6 | 0 | 0 | 0 | 6 | 0 |
uliweb/lib/werkzeug/debug/__init__.py | timgates42/uliweb | 202 | 1674117 | # -*- coding: utf-8 -*-
"""
werkzeug.debug
~~~~~~~~~~~~~~
WSGI application traceback debugger.
:copyright: 2007 by <NAME>, <NAME>.
:license: BSD, see LICENSE for more details.
"""
import sys
import inspect
import traceback
import code
from werkzeug.debug.render import debug_page, load_resource
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
pwnypack/shellcode/arm/thumb_mixed.py | iksteen/dpf | 133 | 1674119 | from pwnypack.shellcode.arm.thumb import ARMThumb
__all__ = ['ARMThumbMixed']
class ARMThumbMixed(ARMThumb):
"""
Environment that targets a generic, unrestricted ARM architecture that
switches to the Thumb instruction set.
"""
PREAMBLE: list[str] = [
'.global _start',
'.arm',
... | 0 | 0 | 1 | 0 | 1 | 0 |
vispy/visuals/graphs/tests/__init__.py | hmaarrfk/vispy | 2,617 | 1674126 | __author__ = 'lucas'
| 0 | 0 | 0 | 0 | 0 | 0 |
AiStuff/dqn/test.py | Sam-Si/TekkenBot | 211 | 1674148 | import sys
import random
from dqn import Agent
import numpy as np
class MockEnv:
def __init__(self, env_name):
self.action_space = MockActionSpace(10)
self.observation_space = MockObservationSpace((1, 1, 1))
def reset(self) -> object:
return self.random_observation()
... | 0 | 3 | 0 | 0 | 3 | 0 |
pygaggle/qa/dpr_reader.py | Elfsong/pygaggle | 166 | 1674152 | <reponame>Elfsong/pygaggle<gh_stars>100-1000
from typing import List, Optional, Dict
from transformers import DPRReader, DPRReaderTokenizer
from pygaggle.qa.base import Reader, Answer, Question, Context
from pygaggle.qa.span_selection import DprSelection
class DprReader(Reader):
"""Class containing the DPR Read... | 0 | 0 | 0 | 0 | 0 | 0 |
REST/python/DeploymentProcesses/get-steps-using-role.py | gdesai1234/OctopusDeploy-Api | 199 | 1674157 | <filename>REST/python/DeploymentProcesses/get-steps-using-role.py
import json
import requests
octopus_server_uri = 'https://your.octopus.app/api'
octopus_api_key = 'API-YOURAPIKEY'
headers = {'X-Octopus-ApiKey': octopus_api_key}
def get_octopus_resource(uri):
response = requests.get(uri, headers=headers)
respon... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/converter/test_tf_io.py | msakai/blueoil | 248 | 1674189 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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/LI... | 0 | 0 | 0 | 0 | 0 | 0 |
test/cprofile_rust_cython.py | utapyngo/simplification | 113 | 1674192 | <reponame>utapyngo/simplification
# this tests numpy array simplification using VW
from simplification.cutil import simplify_coords_vw
import json
import numpy as np
with open("test/coords.json", "r") as f:
coords = np.array(json.load(f))
for x in range(50):
simplify_coords_vw(coords, 0.0000075)
| 0 | 0 | 0 | 0 | 0 | 0 |
muddery/libs/evennia/evennia/server/inputfuncs.py | dongwudanci/muddery | 127 | 1674216 | from __future__ import annotations
"""
Functions for processing input commands.
All global functions in this module whose name does not start with "_"
is considered an inputfunc. Each function must have the following
callsign (where inputfunc name is always lower-case, no matter what the
OOB input name looked like):
... | 0 | 7 | 0 | 0 | 7 | 0 |
lib/utils/PrefetchingIter.py | CharlesTousignant/Deep-Feature-Flow | 1,378 | 1674220 | <filename>lib/utils/PrefetchingIter.py
# --------------------------------------------------------
# Deep Feature Flow
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Modified by <NAME>
# --------------------------------------------------------
# Based on:
# MX-RCNN
# Copyrigh... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.