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 |
|---|---|---|---|---|
flake8_eradicate.py | sobolevn/flake8-eradicate | 169 | 11173196 | import tokenize
from typing import Iterable, Iterator, List, Sequence, Tuple, Type
import pkg_resources
from eradicate import Eradicator
from flake8.options.manager import OptionManager
#: This is a name that we use to install this library:
pkg_name = 'flake8-eradicate'
#: We store the version number inside the `pyp... |
models/modules/discriminators.py | NguyenHoangAn0511/gan-compression | 1,005 | 11173202 | import argparse
import functools
import numpy as np
from torch import nn
from torch.nn import functional as F
from models.modules.munit_architecture.munit_generator import Conv2dBlock
from models.modules.spade_architecture.normalization import get_nonspade_norm_layer
from models.networks import BaseNetwork
class Ms... |
nndet/evaluator/__init__.py | joeranbosma/nnDetection | 242 | 11173213 | from nndet.evaluator.abstract import AbstractMetric, AbstractEvaluator, DetectionMetric
|
interleaving/interleaving_method.py | mpkato/interleaving | 107 | 11173255 | <filename>interleaving/interleaving_method.py
from collections import defaultdict
import json
import numpy as np
class InterleavingMethod(object):
'''
Abstract class for interleaving methods
Args:
lists: lists of document IDs
max_length: the maximum length of resultant interleaving.
... |
python/run_format.py | SuperBigHui/stm32-bootloader | 681 | 11173261 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import subprocess
from common import collect_source_files
def run_format(source, style="file", executable="clang-format"):
# Normalize executable path
executable = os.path.normpath(executable)
for s in source:
... |
static/paddlex/cv/nets/detection/ops.py | cheneyveron/PaddleX | 3,655 | 11173370 | # Copyright (c) 2019 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 by appli... |
tests/unit/confidant/authnz/rbac_test.py | chadwhitacre/confidant | 1,820 | 11173421 | <gh_stars>1000+
from confidant.app import create_app
from confidant.authnz import rbac
def test_default_acl(mocker):
mocker.patch('confidant.settings.USE_AUTH', True)
app = create_app()
with app.test_request_context('/fake'):
g_mock = mocker.patch('confidant.authnz.g')
# Test for user typ... |
test/low_rank_data.py | iskandr/matrix-completion | 840 | 11173440 | <gh_stars>100-1000
import numpy as np
def create_rank_k_dataset(
n_rows=5,
n_cols=5,
k=3,
fraction_missing=0.1,
symmetric=False,
random_seed=0):
np.random.seed(random_seed)
x = np.random.randn(n_rows, k)
y = np.random.randn(k, n_cols)
XY = np.dot(x, y)
... |
src/torchphysics/problem/samplers/plot_samplers.py | uwe-iben/torchphysics | 203 | 11173462 | """Samplers for plotting and animations of model outputs.
"""
import numpy as np
import torch
from ..domains.domain import BoundaryDomain
from ..domains import Interval
from .sampler_base import PointSampler
from .grid_samplers import GridSampler
from ..spaces.points import Points
class PlotSampler(PointSampler):
... |
examples/structured/setup/setup.py | flupke/py2app | 193 | 11173471 | <gh_stars>100-1000
"""
Script for building the example.
Usage:
python setup.py py2app
"""
from setuptools import setup
setup(
app = ['../python/myapp.py'],
data_files = ['../data'],
setup_requires=["py2app"],
)
|
metadrive/component/vehicle_module/mini_map.py | liuzuxin/metadrive | 125 | 11173497 | from panda3d.core import Vec3
from metadrive.component.vehicle_module.base_camera import BaseCamera
from metadrive.constants import CamMask
from metadrive.engine.engine_utils import get_global_config, engine_initialized
class MiniMap(BaseCamera):
CAM_MASK = CamMask.MiniMap
display_region_size = [0., 1 / 3, B... |
models/sklearn_OCSVM_explicit_model.py | chihyunsong/oc-nn | 203 | 11173546 | <reponame>chihyunsong/oc-nn
import numpy as np
import pandas as pd
from sklearn import utils
import matplotlib
from scipy.optimize import minimize
dataPath = './data/'
# Create empty dataframe with given column names.
df_usps_scores = {}
df_fake_news_scores = {}
df_spam_vs_ham_scores = {}
df_cifar_10_scores = {}
n... |
test/sagemaker_tests/mxnet/inference/resources/default_handlers/model/code/eia_module.py | Yixiao99/deep-learning-containers | 383 | 11173750 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "l... |
blender-spritesheets/panels/spritePanel.py | geoffsutcliffe/blender-spritesheets | 140 | 11173756 | import bpy
from properties.SpriteSheetPropertyGroup import SpriteSheetPropertyGroup
from properties.ProgressPropertyGroup import ProgressPropertyGroup
class UI_PT_SpritePanel(bpy.types.Panel):
"""Panel for configuring and rendering sprite sheets"""
bl_idname = "UI_PT_SpritePanel"
bl_label = "Create Sprite... |
src/main/python/smart/smartdata_run.py | cday97/beam | 123 | 11173822 | import smartdata_setup
def createUrl(foldername):
return "https://beam-outputs.s3.amazonaws.com/output/sfbay/"+foldername
# Main
baseline_2010 = (1, 2010, 15, "base", "Base", "baseline", createUrl("sfbay-smart-base-2010__2019-10-28_20-14-32"))
base_2030lt_2025 = (2, 2025, 15, "base", "2030 Low Tech", "base_fleet... |
downstream/votenet_det_new/lib/train.py | mbanani/PointContrast | 244 | 11173840 | # 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.
""" Training routine for 3D object detection with SUN RGB-D or ScanNet.
Sample usage:
python train.py --dataset sunrgbd --log_dir log_sunrgb... |
hex2str/hex2str.py | DazEB2/SimplePyScripts | 117 | 11173855 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def hex2str(hex_string: str, encoding='utf-8') -> str:
data = bytes.fromhex(hex_string)
return str(data, encoding)
def str2hex(text: str, encoding='utf-8', upper=True) -> str:
hex_text = bytes(text, ... |
alipay/aop/api/domain/AlipayDataDataserviceAdDataQueryModel.py | antopen/alipay-sdk-python-all | 213 | 11173903 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayDataDataserviceAdDataQueryModel(object):
def __init__(self):
self._ad_level = None
self._biz_token = None
self._charge_type = None
self._e... |
moto/awslambda/utils.py | oakbramble/moto | 5,460 | 11173919 | <reponame>oakbramble/moto
from collections import namedtuple
from functools import partial
ARN = namedtuple("ARN", ["region", "account", "function_name", "version"])
LAYER_ARN = namedtuple("LAYER_ARN", ["region", "account", "layer_name", "version"])
def make_arn(resource_type, region, account, name):
return "arn... |
safety_gym/random_agent.py | zhangdongkun98/safety-gym | 327 | 11173926 | <reponame>zhangdongkun98/safety-gym
#!/usr/bin/env python
import argparse
import gym
import safety_gym # noqa
import numpy as np # noqa
def run_random(env_name):
env = gym.make(env_name)
obs = env.reset()
done = False
ep_ret = 0
ep_cost = 0
while True:
if done:
print('Epi... |
tests/apps/courses/test_templatetags_extra_tags_get_placeholder_plugins.py | leduong/richie | 174 | 11173997 | """Test suite for the GetPlaceholderPlugins template tag."""
from django.contrib.auth.models import AnonymousUser
from django.db import transaction
from django.template.exceptions import TemplateSyntaxError
from django.test import RequestFactory
from cms.api import add_plugin, create_page
from cms.test_utils.testcases... |
Chapter05/Custom_Modules/library/custom_module_2.py | stavsta/Mastering-Python-Networking-Second-Edition | 107 | 11174018 | #!/usr/bin/env python2
import requests
import json
def main():
module = AnsibleModule(
argument_spec = dict(
host = dict(required=True),
username = dict(required=True),
password = dict(required=True)
)
)
device = module.params.get('host')
username = module.para... |
tests/sparseml/tensorflow_v1/utils/test_variable.py | clementpoiret/sparseml | 922 | 11174045 | <reponame>clementpoiret/sparseml<filename>tests/sparseml/tensorflow_v1/utils/test_variable.py
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a ... |
django_th/urls.py | Leopere/django-th | 1,069 | 11174057 | from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path
from django_th.forms.wizard import DummyForm, ProviderForm, ConsumerForm, ServicesDescriptionForm
from django_th.views import Tri... |
lib/util.py | Rehzende/project-dev-kpis | 113 | 11174175 | <filename>lib/util.py<gh_stars>100-1000
import logging
import sys
import time
import urllib
import json
from itertools import islice
from dateutil.rrule import *
from datetime import tzinfo, timedelta, datetime
from dateutil.parser import parse as parse_date
from dateutil import tz
import pytz
import re
##
# logging
... |
scratch/test.py | potassco/gringo | 423 | 11174178 | <filename>scratch/test.py
# {{{ Val
class FunVal:
def __init__(self, name, args):
self.name = name
self.args = args
def match(self, node, other, subst):
node.matchFun(self, other, subst)
def sig(self):
return (self.name, len(self.args))
def __eq__(self, other):
... |
test/test_clai_plugins_howdoi.py | cohmoti/clai | 391 | 11174184 | #
# Copyright (C) 2020 IBM. All Rights Reserved.
#
# See LICENSE.txt file in the root directory
# of this source tree for licensing information.
#
import os
import unittest
from builtins import classmethod
from clai.server.command_message import State
from clai.server.plugins.howdoi.howdoi import HowDoIAgent
OS_NAM... |
dev_nb/nb_004a.py | discdiver/fastai_docs | 3,266 | 11174200 | <gh_stars>1000+
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: dev_nb/004a_discriminative_lr.ipynb
from nb_004 import *
ModuleList = Collection[nn.Module]
ParamList =... |
tools/ops/script_runner/lib/url_util.py | yetsun/hue | 5,079 | 11174267 | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... |
george/solvers/basic.py | rychallener/george | 379 | 11174326 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["BasicSolver"]
import numpy as np
from scipy.linalg import cholesky, cho_solve
class BasicSolver(object):
"""
This is the most basic solver built using :func:`scipy.linalg.cholesky`.
kernel (george.kernels.Kernel): A su... |
rls/algorithms/single/offline/__init__.py | StepNeverStop/RLs | 371 | 11174328 | <reponame>StepNeverStop/RLs
#!/usr/bin/env python3
# encoding: utf-8
from rls.algorithms.register import register
# logo: font-size: 12, foreground character: 'O', font: 幼圆
# http://life.chacuo.net/convertfont2char
register(
name='cql_dqn',
path='single.offline.cql_dqn',
is_multi=False,
class_name='C... |
src/bepasty/bepasty_xstatic.py | Emojigit/bepasty-server | 123 | 11174420 | <gh_stars>100-1000
from xstatic.main import XStatic
# names below must be package names
mod_names = [
'asciinema_player',
'bootbox',
'bootstrap',
'font_awesome',
'jquery',
'jquery_ui',
'jquery_file_upload',
'pygments',
]
pkg = __import__('xstatic.pkg', fromlist=mod_names)
serve_files =... |
mountaincar/maxent/train.py | amy12xx/lets-do-irl | 408 | 11174438 | <gh_stars>100-1000
import gym
import pylab
import numpy as np
from maxent import *
n_states = 400 # position - 20, velocity - 20
n_actions = 3
one_feature = 20 # number of state per one feature
q_table = np.zeros((n_states, n_actions)) # (400, 3)
feature_matrix = np.eye((n_states)) # (400, 400)
gamma = 0.99
q_learni... |
demo/cookie/ops/hello.py | marco-souza/falsy | 127 | 11174468 | <gh_stars>100-1000
def get_it(name, id):
return {
'get1': name,
'get2': id
}
|
sdk/python/kfp_tekton/_client.py | jppgks/kfp-tekton | 102 | 11174474 | # Copyright 2020 kubeflow.org
#
# 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... |
mmhuman3d/utils/path_utils.py | ykk648/mmhuman3d | 472 | 11174482 | import os
import warnings
from enum import Enum
from pathlib import Path
from typing import List, Union
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
def check_path_suffix(path_str: str,
allowed_suffix: Union[str, List[str]] = '') -> bool:
... |
mpld3/test_plots/test_nan.py | odidev/mpld3 | 1,101 | 11174502 | """Plot to test line styles"""
import matplotlib.pyplot as plt
import numpy as np
import mpld3
def create_plot():
fig, ax = plt.subplots()
np.random.seed(0)
numPoints = 10
xx = np.arange(numPoints, dtype=float)
xx[6] = np.nan
yy = np.random.normal(size=numPoints)
yy[3] = np.nan
ax.... |
ctpn/utils/text_proposal_connector.py | tainenko/keras-ctpn | 118 | 11174515 | <reponame>tainenko/keras-ctpn<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
File Name: text_proposal_connector
Description : 文本框连接,构建文本行
Author : mick.yi
date: 2019/3/13
"""
import numpy as np
from .text_proposal_graph_builder import TextProposalGraphBuilder
from .np_utils impo... |
main.py | logicguy1/The-all-in-one-discord-tool | 105 | 11174601 | LICENCE = """
Copyright © 2021 Drillenissen#4268
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, publish,... |
third_party/blink/tools/run_webgpu_cts.py | zealoussnow/chromium | 14,668 | 11174620 | #!/usr/bin/env vpython
# Copyright 2021 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.
from blinkpy.common import multiprocessing_bootstrap
multiprocessing_bootstrap.run('..', '..', 'webgpu-cts', 'scripts',
... |
src/blockdiag/noderenderer/__init__.py | flying-foozy/blockdiag | 155 | 11174624 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2011 <NAME>
#
# 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... |
test/modulepath.py | mhils/HoneyProxy | 116 | 11174633 | <reponame>mhils/HoneyProxy
import inspect, os
print __file__
print os.path.abspath(__file__)
print os.path.abspath(inspect.getfile(inspect.currentframe()))
print "==="
print inspect.getfile(inspect.currentframe())
print os.path.split(inspect.getfile( inspect.currentframe() ))[0]
print os.path.split(inspect.getfile( i... |
hack/lib/images.py | fabianofranz/release | 185 | 11174646 | <reponame>fabianofranz/release
import json, sys, yaml, os;
base = sys.argv[1]
target_branch = sys.argv[2] if len(sys.argv) > 2 else "master"
for root, dirs, files in os.walk(base):
rel = root[len(base):]
parts = rel.split("/")
repo_prefix = "-".join(parts[:len(parts)]) + "-"
if len(parts) > 1:
org, repo =... |
chapter-13-out-of-memory/vcf2sqlite.py | cjvillar/Greenbook | 486 | 11174647 | import sys
import gzip
from collections import OrderedDict
import sqlite3
import pdb
pops = "EAS SAS AFR EUR AMR".split()
pop_freqs = [p + "_AF" for p in pops]
cols = "CHROM POS RSID REF ALT QUAL FILTER INFO FORMAT".lower().split()
db_filename = sys.argv[1]
db_tablename = sys.argv[2]
vcf_filename = sys.argv[3]
read... |
protobuf_inspector/__main__.py | jmendeth/protobuf-parser | 355 | 11174654 | <filename>protobuf_inspector/__main__.py
from sys import stdin, argv
from os.path import ismount, exists, join
from runpy import run_path
from .types import StandardParser
def main():
# Parse arguments
root_type = "root"
if len(argv) >= 2: root_type = argv[1]
# Load the config
config = {}
dire... |
data_structures/binary_indexed_tree/Python/FenwickTree.py | avi-pal/al-go-rithms | 1,253 | 11174753 | <reponame>avi-pal/al-go-rithms
# Binary indexed tree or fenwick tree
# Space Complexity: O(N) for declaring another array of N=size num_of_elements
# Time Complexity: O(logN) for each operation(update and query as well)
# original array for storing values for later lookup
# Part of Cosmos by OpenGenus Foundation
array=... |
tests/test_db/test_backends/test_exceptions.py | Jyrno42/django-test-migrations | 294 | 11174774 | from django_test_migrations.db.backends import exceptions
def test_database_configuration_not_found():
"""Ensure exception returns proper string representation."""
vendor = 'ms_sql'
exception = exceptions.DatabaseConfigurationNotFound(vendor)
assert vendor in str(exception)
def test_database_configu... |
pybrain/rl/agents/optimization.py | sveilleux1/pybrain | 2,208 | 11174778 | <reponame>sveilleux1/pybrain<filename>pybrain/rl/agents/optimization.py<gh_stars>1000+
__author__ = '<NAME>, <EMAIL>'
from pybrain.rl.agents.agent import Agent
class OptimizationAgent(Agent):
""" A simple wrapper to allow optimizers to conform to the RL interface.
Works only in conjunction with EpisodicEx... |
stylegan_runner.py | markriedl/dragnet | 171 | 11174789 | <reponame>markriedl/dragnet
import os
import pdb
import sys
import pickle
import random
import math
import argparse
import numpy as np
from PIL import Image
from tqdm import tqdm_notebook as tqdm
def easygen_train(model_path, images_path, dataset_path, start_kimg=7000, max_kimg=25000, schedule='', seed=1000):
#impor... |
qa/rpc-tests/electrum_shutdownonerror.py | MONIMAKER365/BitcoinUnlimited | 535 | 11174797 | <reponame>MONIMAKER365/BitcoinUnlimited
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Unlimited developers
"""
Tests for shutting down Bitcoin Unlimited on electrum server failure
"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import waitFor, is_bitcoind_running
im... |
find_cube_root.py | nicetone/Python | 28,321 | 11174798 |
# This method is called exhaustive numeration!
# I am checking every possible value
# that can be root of given x systematically
# Kinda brute forcing
def cubeRoot():
x = int(input("Enter an integer: "))
for ans in range(0, abs(x) + 1):
if ans ** 3 == abs(x):
break
if ans ** 3 != abs(... |
tools/deep_memory_profiler/visualizer/app_unittest.py | kjthegod/chromium | 231 | 11174801 | # Copyright 2013 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.
# This file is expected to be used under another directory to use,
# so we disable checking import path of GAE tools from this directory.
# pylint: disable=F... |
modules/dbnd-airflow-monitor/test_dbnd_airflow_monitor/test_integration/conftest.py | busunkim96/dbnd | 224 | 11174806 | # conftest.py
import pytest
try:
from dbnd_web.utils.testing.utils import WebAppTest
pytest_plugins = [
"dbnd.testing.pytest_dbnd_plugin",
"dbnd.testing.pytest_dbnd_markers_plugin",
"dbnd.testing.pytest_dbnd_home_plugin",
"dbnd_web.utils.testing.pytest_web_plugin",
]
excep... |
sty/lib.py | technikian/sty | 170 | 11174893 | <filename>sty/lib.py
from .primitive import Register
def mute(*objects: Register) -> None:
"""
Use this function to mute multiple register-objects at once.
:param objects: Pass multiple register-objects to the function.
"""
err = ValueError(
"The mute() method can only be used with object... |
script/common.py | Henny20/skija | 2,466 | 11174904 | <filename>script/common.py
#! /usr/bin/env python3
import argparse, contextlib, os, pathlib, platform, re, shutil, subprocess, sys, time, urllib.request, zipfile
arch = {'AMD64': 'x64', 'x86_64': 'x64', 'arm64': 'arm64'}[platform.machine()]
parser = argparse.ArgumentParser()
parser.add_argument('--arch', default=arch... |
py/rest_tests/test_html.py | ahmedengu/h2o-3 | 6,098 | 11174920 | <filename>py/rest_tests/test_html.py
import requests
import h2o
import h2o_test_utils
def test(a_node, pp):
####################################
# test HTML pages GET
url_prefix = 'http://' + a_node.http_addr + ':' + str(a_node.port)
urls = {
'': 'Analytics',
'/': 'Analytics',
... |
tools/perf/benchmarks/power_mobile.py | zealoussnow/chromium | 14,668 | 11174959 | # Copyright 2020 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.
from core import perf_benchmark
from core import platforms
import page_sets
from page_sets.system_health import story_tags
from telemetry import benchmark
f... |
oslo/torch/nn/parallel/tensor_parallel/_parallel_1d/_ops.py | lipovsek/oslo | 249 | 11174960 | <reponame>lipovsek/oslo<gh_stars>100-1000
import torch
from oslo.torch.distributed import ParallelMode
from oslo.torch.distributed.nn.functional import all_gather, all_reduce, scatter
class _Broadcast1D(torch.autograd.Function):
def forward(ctx, inputs, parallel_context):
ctx.parallel_context = parallel_... |
external/mask-rcnn-detection/detection.py | vision4j/vision4j-collection | 154 | 11174978 | <reponame>vision4j/vision4j-collection<gh_stars>100-1000
import detection_pb2
import cv2
import numpy as np
from PIL import Image
from io import BytesIO
import tensorflow as tf
import keras
import mrcnn.model as modellib
from mrcnn.config import Config
# source: https://github.com/matterport/Mask_RCNN/commit/cbff80f3... |
snippod_boilerplate/settings/dev.py | Musbell/snippod-boilerplate | 140 | 11174986 | """
Django settings for snippod boilerplate project.
This is a base starter for snippod.
For more information on this file, see
https://github.com/shalomeir/snippod-boilerplate
"""
from snippod_boilerplate.settings.common import *
# from snippod_boilerplate.settings.config_dev import *
# SECURITY WARNING: keep the... |
FeatureFlagsCo.Experiments/redismq/redis_foo_sender.py | ZhenhangTung/feature-flags-co | 681 | 11175021 | import logging
from redismq.send_consume import RedisSender
TOPIC_NAME = 'ds'
Q1_START = {
"ExptId": 'FF__38__48__103__PayButton_exp1',
"IterationId": "2",
"EnvId": "103",
"FlagId": "FF__38__48__103__PayButton",
"BaselineVariation": "1",
"Variations": ["1", "2", "3"],
"EventName": "ButtonPa... |
local/tf/ze_utils.py | Alicegaz/x-vector-kaldi-tf | 117 | 11175040 | <filename>local/tf/ze_utils.py<gh_stars>100-1000
import argparse
import inspect
import logging
import math
import os
import re
import shutil
import subprocess
import threading
import thread
import traceback
import datetime
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
cuda_command = '... |
spafe/__init__.py | SuperKogito/cautious-palm-tree | 205 | 11175041 | <reponame>SuperKogito/cautious-palm-tree<filename>spafe/__init__.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Top-level module for spafe
"""
__version__ = '0.1.0'
import sys
import warnings
# Throw a deprecation warning if we're on legacy python
if sys.version_info < (3,):
warnings.warn(... |
mmrazor/models/mutators/base.py | hunto/mmrazor | 553 | 11175057 | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta
from mmcv.runner import BaseModule
from mmrazor.models.architectures import Placeholder
from mmrazor.models.builder import MUTABLES, MUTATORS
from mmrazor.models.mutables import MutableModule
@MUTATORS.register_module()
class BaseMutator(BaseMo... |
base/site-packages/news/signals.py | edisonlz/fastor | 285 | 11175076 | <filename>base/site-packages/news/signals.py
from django.contrib.comments.signals import comment_will_be_posted
from django.contrib.comments.models import Comment
from django.http import HttpResponseRedirect
def unapprove_comment(sender, **kwargs):
the_comment = kwargs['comment']
the_comment.is_public = False
retur... |
javascript.py | aronwoost/sublime-expand-region | 205 | 11175091 | try:
import expand_to_word
import expand_to_subword
import expand_to_word_with_dots
import expand_to_symbols
import expand_to_quotes
import expand_to_semantic_unit
import utils
except:
from . import expand_to_word
from . import expand_to_subword
from . import expand_to_word_with_dots
from . import... |
gammapy/modeling/covariance.py | JohannesBuchner/gammapy | 155 | 11175114 | <filename>gammapy/modeling/covariance.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Covariance class"""
import numpy as np
import scipy
from .parameter import Parameters
__all__ = ["Covariance"]
class Covariance:
"""Parameter covariance class
Parameters
----------
parameters ... |
tests/providers/telegram/hooks/test_telegram.py | ChaseKnowlden/airflow | 15,947 | 11175117 | #
# 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
# "License"); you may not... |
mayan/apps/cabinets/migrations/0006_auto_20210525_0604.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11175139 | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cabinets', '0005_auto_20210525_0500'),
]
operations = [
migrations.AlterModelOptions(
name='cabinet',
options={
'verbose_name': 'Cabinet', 'verbose_name_plura... |
tests/becy/design1_proof_of_concepts.py | thautwarm/restrain-jit | 116 | 11175154 | <gh_stars>100-1000
from restrain_jit.becython.cy_loader import setup_pyx_for_cpp
from pyximport import pyximport
setup_pyx_for_cpp()
pyximport.install()
import restrain_jit.becython.cython_rts.hotspot
from restrain_jit.becython.cy_loader import compile_module
mod = """
cimport restrain_jit.becython.cython_rts.RestrainJ... |
tests/test_shap.py | paultimothymooney/docker-python-2 | 2,030 | 11175173 | <reponame>paultimothymooney/docker-python-2<filename>tests/test_shap.py
import unittest
import shap
class TestShap(unittest.TestCase):
def test_init(self):
shap.initjs()
|
atlas/foundations_authentication/src/test/__init__.py | DeepLearnI/atlas | 296 | 11175200 | from test.test_authentication_client import TestAuthenticationClient |
pic_locate.py | circlestarzero/GenshinMapAutoMarkTools | 167 | 11175242 | import numpy
import cv2 as cv
from matplotlib import pyplot as plt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QImage
import win32gui
import sys
import time
import win32api
import win32print
import win32con
import os
import keyboard
import win32com.client
import pythoncom
base_dir = os.path.dirname... |
test-data/unit/plugins/method_in_decorator.py | cibinmathew/mypy | 12,496 | 11175247 | from mypy.types import CallableType, Type
from typing import Callable, Optional
from mypy.plugin import MethodContext, Plugin
class MethodDecoratorPlugin(Plugin):
def get_method_hook(self, fullname: str) -> Optional[Callable[[MethodContext], Type]]:
if 'Foo.a' in fullname:
return method_decora... |
tests/test_data/packages/small_fake_with_unpinned_deps/setup.py | m-mead/pip-tools | 4,085 | 11175254 | from setuptools import setup
setup(
name="small_fake_with_unpinned_deps",
version=0.1,
install_requires=["small-fake-a", "small-fake-b"],
)
|
data/transcoder_evaluation_gfg/python/CHECK_LINE_PASSES_ORIGIN.py | mxl1n/CodeGen | 241 | 11175264 | <reponame>mxl1n/CodeGen
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( x1 , y1 , x2 , y2 ) :
return ( x1 * ( y2 - y1 ) == y1 * ( x2 - x1 ) )
#TOFILL
if __n... |
scattertext/test/test_fourSquareAxes.py | shettyprithvi/scattertext | 1,823 | 11175332 | from unittest import TestCase
import pandas as pd
from scattertext.CorpusFromPandas import CorpusFromPandas
from scattertext.WhitespaceNLP import whitespace_nlp
from scattertext.semioticsquare.FourSquareAxis import FourSquareAxes
def get_docs_categories_four():
documents = [u"What art thou that usurp'st this time ... |
src/sage/tests/books/judson-abstract-algebra/crypt-sage.py | bopopescu/sage | 1,742 | 11175342 | <reponame>bopopescu/sage<gh_stars>1000+
## -*- coding: utf-8 -*- ##
## Sage Doctest File ##
#**************************************#
#* Generated from PreTeXt source *#
#* on 2017-08-24T11:43:34-07:00 *#
#* *#
#* http://mathbook.pugetsound.ed... |
autoremovetorrents/clientstatus.py | stargz/autoremove-torrents | 437 | 11175442 | <gh_stars>100-1000
from .util.convertbytes import convert_bytes
from .util.convertspeed import convert_speed
class ClientStatus(object):
def __init__(self):
# Proper attributes:
# free_space, total_download_speed, total_upload_speed, etc.
#
# Note:
# The type of free_space i... |
doc/conf.py | spatialaudio/jackclient-python | 120 | 11175443 | <reponame>spatialaudio/jackclient-python<filename>doc/conf.py
# Configuration file for Sphinx,
# see https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import os
from subprocess import check_output
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('.'))
# Fake imp... |
tests/file_io/data_range_io.py | dfjxs/dfvfs | 176 | 11175451 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the data range file-like object."""
import unittest
from dfvfs.file_io import data_range_io
from dfvfs.lib import definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from tests.file_io import test_lib
class Da... |
payment/apps.py | skyydq/GreaterWMS | 1,063 | 11175465 | <filename>payment/apps.py
from django.apps import AppConfig
from django.db.models.signals import post_migrate
class PaymentConfig(AppConfig):
name = 'payment'
# def ready(self):
# post_migrate.connect(do_init_data, sender=self)
#
# def do_init_data(sender, **kwargs):
# init_category()
#
# def init... |
examples/codes/mosn-extensions/plugin/filter/python/plugin.py | inkhare/mosn | 2,106 | 11175477 | <gh_stars>1000+
from concurrent import futures
import sys
import time
import argparse
import grpc
import logging
import json
import plugin_pb2
import plugin_pb2_grpc
class PluginServicer(plugin_pb2_grpc.PluginServicer):
def Call(self, request, context):
logging.info("begin do plugin something..")... |
datawig-js/server.py | tirkarthi/datawig | 374 | 11175668 | import os
from blueprints import datawig
from flask import Flask
app = Flask(__name__)
app.register_blueprint(datawig.datawig)
# same secret key causes sessions to carry over from one app execution to the next
app.secret_key = os.urandom(32)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8081, debug=Tr... |
inventory/admin.py | nathandarnell/sal | 215 | 11175676 | <reponame>nathandarnell/sal
from django.contrib import admin
from inventory.models import Application, Inventory, InventoryItem
class ApplicationAdmin(admin.ModelAdmin):
list_display = ('name', 'bundleid', 'bundlename')
search_fields = ('name', 'bundleid', 'bundlename')
class InventoryAdmin(admin.ModelAdmin... |
keep/commands/cmd_update.py | nfsergiu/keep | 533 | 11175681 | <gh_stars>100-1000
import click
from keep import cli, utils, about
@click.command('update', short_help='Check for an update of Keep.')
@cli.pass_context
def cli(ctx):
"""Check for an update of Keep."""
utils.check_update(ctx, forced=True)
click.secho("Keep is at its latest version v{}".format(about.__versi... |
examples/quickstart/first.py | romeojulietthotel/Flask-NotSuperAdmin | 414 | 11175700 | from flask import Flask
from flask.ext.superadmin import Admin
app = Flask(__name__)
admin = Admin(app)
app.run()
|
jirafs/ticketfolder.py | coddingtonbear/jirafs | 119 | 11175726 | <gh_stars>100-1000
import codecs
import fnmatch
import logging
import logging.handlers
import io
import json
import os
import re
import subprocess
from urllib import parse
from jira.resources import Issue
from . import constants
from . import exceptions
from . import migrations
from . import utils
from .jiralinkmanag... |
tests/unit/test_advanced_conf.py | edditler/archivy | 2,061 | 11175755 | <gh_stars>1000+
from textwrap import dedent
import pytest
from tinydb import Query
from archivy.helpers import get_db, load_hooks, load_scraper
from archivy import data
@pytest.fixture()
def hooks_cli_runner(test_app, cli_runner, click_cli):
"""
Saves hooks to user config directory for tests.
All of th... |
regtests/calling/keyword.py | bpmbank/PythonJS | 319 | 11175826 | <filename>regtests/calling/keyword.py
"""keywords"""
def f(a, b=None, c=None):
return (a+b) * c
def main():
TestError( f(1, b=2, c=3) == 9) ## inorder works in javascript mode
TestError( f(1, c=3, b=2) == 9) ## out of order fails in javascript mode
|
reddit_detective/karma.py | oleitao/reddit-detective | 173 | 11175839 | <gh_stars>100-1000
"""
Let's assume that you get the subreddits they belong for 2 comments
Terminology: "stuff like karma" includes
comment_karma, link_karma, score, upvote_ratio and subscribers
If those 2 comments belong to the same subreddit, the code will be like the following:
MERGE (:Subreddit ...)
MERGE... |
samr/data.py | yuntuowang/sentiment-analysis-on-movie-reviews | 129 | 11175861 | <filename>samr/data.py
from collections import namedtuple
Datapoint = namedtuple("Datapoint", "phraseid sentenceid phrase sentiment")
|
plugin.video.yatp/site-packages/hachoir_parser/program/__init__.py | mesabib/kodi.yatp | 194 | 11175874 | from hachoir_parser.program.elf import ElfFile
from hachoir_parser.program.exe import ExeFile
from hachoir_parser.program.macho import MachoFile, MachoFatFile
from hachoir_parser.program.python import PythonCompiledFile
from hachoir_parser.program.java import JavaCompiledClassFile
from hachoir_parser.program.prc import... |
examples/customer_churn/code/train/trainer.py | NunoEdgarGFlowHub/MLOps | 1,068 | 11175890 | import math
import numpy as np
import torch
import gpytorch
from torch.optim import SGD, Adam
from torch.optim.lr_scheduler import MultiStepLR
from sklearn.metrics import roc_auc_score,accuracy_score
from svdkl import (NeuralNetLayer,
GaussianProcessLayer,
DKLModel)
"""
Trainer c... |
Remoting/Application/Testing/Python/BackgroundColorBackwardsCompatibilityTest.py | xj361685640/ParaView | 815 | 11175916 | <reponame>xj361685640/ParaView<filename>Remoting/Application/Testing/Python/BackgroundColorBackwardsCompatibilityTest.py
# state file generated using paraview version 5.9.0-RC4
import paraview
from paraview.simple import *
renderView1 = CreateView('RenderView')
renderView1.ViewSize = [844, 539]
renderView1.Background2... |
tests/chainer_tests/functions_tests/array_tests/test_get_item.py | zaltoprofen/chainer | 3,705 | 11175934 | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
_backend_params = (
# CPU tests
testing.product({
'use_cuda': [False],
'use_ideep': ['ne... |
z3/eq10.py | Wikunia/hakank | 279 | 11176004 | #!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Eq 10 problem in Z3
#
# Standard benchmark problem.
#
# This Z3 model was written by <NAME> (<EMAIL>)
# See also my Z3 page: http://hakank.org/z3/
#
from __future__ import print_function
from z3_utils_hakank import *
def main():
solver = Solver()
#
# data... |
pwnypack/asm.py | iksteen/dpf | 133 | 11176033 | <filename>pwnypack/asm.py
"""
This module contains functions to assemble and disassemble code for a given
target platform. By default the keystone engine assembler will be used if it
is available. If it's not available (or if the ``WANT_KEYSTONE`` environment
variable is set and it's not ``1``, ``YES`` or ``TRUE`` (cas... |
examples/ogb_eff/ogbn_proteins/model_rev.py | mufeili/deep_gcns_torch | 937 | 11176071 | import __init__
import torch
import torch.nn as nn
from gcn_lib.sparse.torch_nn import norm_layer
import torch.nn.functional as F
import logging
import eff_gcn_modules.rev.memgcn as memgcn
from eff_gcn_modules.rev.rev_layer import GENBlock
import copy
class RevGCN(torch.nn.Module):
def __init__(self, args):
... |
Example/get_time.py | yangswei/Encrypt-python-code-License-control | 102 | 11176075 | # coding:utf-8
###############################
# python代码加密与License控制例子
# 这是需要License控制的脚本
###############################
import socket, fcntl, datetime, os, struct
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
import time
class Get_License(object):
def __init__(self):
super(Get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.