max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/serve/test_metadata.py | outerbounds/tempo | 75 | 33100 | <reponame>outerbounds/tempo
import pytest
from tempo.serve.metadata import KubernetesRuntimeOptions
@pytest.mark.parametrize(
"runtime, replicas",
[
({"replicas": 2}, 2),
({}, 1),
],
)
def test_runtime_options(runtime, replicas):
r = KubernetesRuntimeOptions(**runtime)
assert r.re... | 1.976563 | 2 |
referral/faker_factories.py | exolever/django-earlyparrot | 0 | 33101 | <filename>referral/faker_factories.py<gh_stars>0
import factory
from faker import Faker
from referral.models import Campaign
faker = Faker()
class FakeCampaignFactory(factory.django.DjangoModelFactory):
class Meta:
model = Campaign
campaign_id = factory.LazyAttribute(lambda x: faker.sha1())
n... | 2.203125 | 2 |
main.py | djlafferty7/itlookslikedanlaffertyoutside | 0 | 33102 | import json
import requests
import time
from flask import Flask, render_template, request
app = Flask(__name__)
API_KEY='<insert_api_key_here>'
@app.route('/')
def index():
background, style, message = setParams()
return render_template('index.html', background=background, style=style, message=message)
#fun... | 2.890625 | 3 |
meta/dice.py | dkkim93/meta-mapg | 15 | 33103 | import torch
def magic_box(x):
"""DiCE operation that saves computation graph inside tensor
See ``Implementation of DiCE'' section in the DiCE Paper for details
Args:
x (tensor): Input tensor
Returns:
1 (tensor): Tensor that has computation graph saved
References:
https://g... | 3.109375 | 3 |
src/coreapis/apps.py | salemzii/ChopFast | 0 | 33104 | from django.apps import AppConfig
class CoreapisConfig(AppConfig):
name = 'coreapis'
| 1.125 | 1 |
project/opendata/parse.py | FelippeJC/besa | 0 | 33105 | from .request import datastore_search
def get_data_from_datastore(expression):
"""Returns a list of records found in a datastore search"""
response = datastore_search(expression)
result = response.get("result", dict())
return result.get("records", dict())
| 2.984375 | 3 |
dynamicserialize/dstypes/gov/noaa/nws/ncep/common/dataplugin/gempak/request/Station.py | mjames-upc/python-awips | 0 | 33106 | <filename>dynamicserialize/dstypes/gov/noaa/nws/ncep/common/dataplugin/gempak/request/Station.py
# File auto-generated against equivalent DynamicSerialize Java class
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- -----------... | 2.15625 | 2 |
gghc/dbcluster.py | opengauss-mirror/openGauss-housekeeper | 0 | 33107 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# dbcluster.py
# GGHC cluster class
# Copyright (c) 2021 Chinasoft International Co., Ltd.
#
# gghc is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan P... | 2.046875 | 2 |
ProjectFiles/bin/Release/2.80/scripts/addons_contrib/io_directx_bel/import_x.py | BlazesRus/Bforartists | 1 | 33108 | <reponame>BlazesRus/Bforartists
# Blender directX importer
# version baby
# litterature explaining the parser directions :
# I don't want to load the whole file as it can be huge : go chunks
# also I want random access to 3d datas to import pieces, not always everything
# so step1 is a whole file fast parsing, retrie... | 1.953125 | 2 |
urduhack/utils/tests/test_text.py | fahdrazavi/urduhack | 0 | 33109 | <reponame>fahdrazavi/urduhack
# coding: utf8
"""Test cases for text.py file"""
| 1 | 1 |
tag_generation/preprocesing.py | krispingal/improved-happiness | 0 | 33110 | <reponame>krispingal/improved-happiness
"""Preprocessing for tag generation"""
from tag_generation.util import utils
import jsonlines
import csv
# For test
FILE_LOC = '/home/krispin/data/improved-happiness/'
# For dev
#FILE_LOC = '/home/krispin/data/improved-happiness/proto/'
skipped, wrote = 0, 0
def get_recipe_ta... | 2.578125 | 3 |
CDS_GRF/env/wrapper_grf_3vs3.py | ltzheng/CDS | 1 | 33111 | <filename>CDS_GRF/env/wrapper_grf_3vs3.py<gh_stars>1-10
import gfootball.env as football_env
from gfootball.env import observation_preprocessing
import gym
import numpy as np
import matplotlib.pyplot as plt
class GoogleFootballMultiAgentEnv(object):
"""An wrapper for GFootball to make it compatible with our codeb... | 2.578125 | 3 |
performance_test/testcase.py | DeqingQu/CacheControlHelper | 0 | 33112 | <reponame>DeqingQu/CacheControlHelper
from cache_control_helper import CacheControlHelper
import time
import sys
import requests
import requests_cache
requests_cache.install_cache('performance_test')
def get_request(url):
requests = CacheControlHelper()
try:
res = requests.get(url, timeout=120)
... | 2.765625 | 3 |
main.py | nimom38/Bangla-letter-frequency-statistics | 0 | 33113 | import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
import numpy as np
freq = {}
def read_file(filename='corpora.txt'):
f = open(filename, "r", encoding="utf-8")
for character in f.read():
if (character in freq):
freq[character] += 1
... | 2.90625 | 3 |
venv/Lib/site-packages/caffe2/python/serialized_test/coverage.py | Westlanderz/AI-Plat1 | 1 | 33114 |
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import os
import tempfile
from zipfile import ZipFile
'''
Generates a document in markdown format summrizing the coverage of serialized
testing. The document lives in
`caffe2/python/serialized_test/SerializedTestCoverage.m... | 2.515625 | 3 |
phylib/electrode/tests/test_mea.py | kushbanga/phylib | 6 | 33115 | <filename>phylib/electrode/tests/test_mea.py
# -*- coding: utf-8 -*-
"""Test MEA."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from pathlib import Path
from pytest import raises
import num... | 2 | 2 |
brownies/legacy/endl/endlmath.py | brown170/fudge | 14 | 33116 | # <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
"""
This module contains useful fudge math routines that do not fit into any other module.
"""
from pqu import PQU
from fudg... | 2.359375 | 2 |
object-oriented-design/python/jigsaw.py | DatGreekChick/ctci | 0 | 33117 | # 7.6: Jigsaw
| 1.015625 | 1 |
kyk/kyk.py | atrautsch/kyk | 0 | 33118 | #!/usr/bin/env python3
import os
import time
import shutil
import signal
import yaml
import sass
import pyinotify
from colorama import init, Fore, Style
from jsmin import jsmin
from csscompressor import compress
VERSION = '1.4.7'
class Kyk(object):
"""Kyk
Build JS
- if min: minify in place, append _m... | 2.046875 | 2 |
Ejercicios Entrada y Salida de Datos/Ejercicio 03.py | jaramosperez/Pythonizando | 1 | 33119 | # Ejercicio 3
# Crea un script llamado descomposicion.py que realice las siguientes tareas:
#
# Debe tomar 1 argumento que será un número entero positivo.
# En caso de no recibir un argumento, debe mostrar información acerca de cómo utilizar el script.
# El objetivo del script es descomponer el número en unidades, dece... | 4.0625 | 4 |
ansiscaf/ansiscaf.py | terryshi96/ansi | 3 | 33120 | import os
import sys
import argparse
_version_ = '0.0.1'
class scaffold():
result = []
def new_project(self):
if os.path.exists(self.result.project):
print("project has been existed")
exit(1)
os.mkdir(self.result.project)
os.chdir(self.result.project)
... | 2.75 | 3 |
server.py | alexa-griffin/shared-folders | 0 | 33121 | import os
import socket
import threading
import json
import sys
import math
IP = socket.gethostbyname_ex(socket.gethostname())[-1][-1]
PORT = 4450
ADDR = (IP, PORT)
SIZE = 2**10
FORMAT = "utf-8"
SERVER_PATH = "server"
LOGIN = "admin"
PASS = "<PASSWORD>"
def handle_client(conn, addr):
print(f"[NEW CONNECTION] {... | 2.90625 | 3 |
test/time_model_fitting.py | gaybro8777/pyPhenology | 15 | 33122 | <reponame>gaybro8777/pyPhenology
from pyPhenology import utils
observations, temp = utils.load_test_data(name='vaccinium')
import pandas as pd
import time
models_to_use = ['ThermalTime','Alternating','Uniforc','MSB','Unichill']
methods_to_use = ['DE','BF']
sensible_defaults = ['testing','practical','intensive']
timin... | 2.90625 | 3 |
BioExp/RCT/rct.py | parthnatekar/BioExp | 9 | 33123 | import keras
import random
import numpy as np
from glob import glob
from keras.models import Model
from keras.utils import np_utils
from keras.models import load_model
import matplotlib.pyplot as plt
import os
import keras.backend as K
import tensorflow as tf
from keras.utils import to_categorical
from tqdm import tqdm... | 2.109375 | 2 |
convolut/metric/loss.py | convolut/convolut | 9 | 33124 | from decouple import Module
from .events import MetricEvent
from ..model import ModelLossEndEvent
class LossMetric(Module):
def __init__(self):
super().__init__()
self.sub(ModelLossEndEvent, self.loss)
def loss(self, event: ModelLossEndEvent):
metric_value = event.loss.item()
... | 2.171875 | 2 |
inputs/json_file.py | Eugene-Kuzmenko/render_html_from_json | 0 | 33125 | import json
from collections import OrderedDict
def json_file(filename, converter):
with open(filename, 'r') as file:
raw = json.load(
file,
object_pairs_hook=OrderedDict # to insure that order of items in json won't be broken
)
return converter(raw)
| 3.21875 | 3 |
board.py | screw-pack/MacGyver | 0 | 33126 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# board.py
# Author: <NAME> <<EMAIL>>
# Version: 0.1
# License: MIT
"""Import modules"""
from random import sample
class Board:
"""board object which regroup the coordinates of the game's elements
(walls, start, end, guard, components...)"""
def __init__... | 3.9375 | 4 |
services/core/DNP3Agent/tests/unit_test_point_definitions.py | rmay-intwine/volttron | 406 | 33127 | <reponame>rmay-intwine/volttron<filename>services/core/DNP3Agent/tests/unit_test_point_definitions.py
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2018, 8minutenergy / Kisensum.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | 1.546875 | 2 |
Opencart/tests.py | BahrmaLe/otus_python_homework | 1 | 33128 | def test_open_home_page(driver, request):
url = 'opencart/'
return driver.get("".join([request.config.getoption("--address"), url]))
element = driver.find_elements_by_xpath("//base[contains(@href, 'http://1192.168.127.12/opencart/]")
assert element == 'http://192.168.56.103/opencart/'
assert driver.... | 2.46875 | 2 |
misago/misago/core/tests/test_frontendcontext_middleware.py | vascoalramos/misago-deployment | 2 | 33129 | from django.test import TestCase
from ..middleware import FrontendContextMiddleware
class MockRequest:
pass
class FrontendContextMiddlewareTests(TestCase):
def test_middleware_frontend_context_dict(self):
"""Middleware sets frontend_context dict on request"""
request = MockRequest()
... | 2.4375 | 2 |
tests/test_schema.py | repole/drowsy | 4 | 33130 | """
tests.test_parser
~~~~~~~~~~~~~~~~~
Parser tests for Drowsy.
"""
# :copyright: (c) 2016-2020 by <NAME> and contributors.
# See AUTHORS for more details.
# :license: MIT - See LICENSE for more details.
from marshmallow import fields
from marshmallow.exceptions import ValidationError
from dr... | 2.375 | 2 |
Assignment2_lastrun.py | iamnavya-agg/Emotion-Categorization-experiemnt | 0 | 33131 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v3.2.3),
on Sun Oct 13 21:34:23 2019
If you publish work using this script the most relevant publication is:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. (2019)
PsychoP... | 2.3125 | 2 |
two-phase-v2/OPE-master/run_ope.py | zizuzi/DeepEmbedding | 1 | 33132 | import sys
sys.path.insert(0, './')
sys.path.insert(0, './common')
sys.path.insert(0, './ML-FW')
sys.path.insert(0, './ML-OPE')
sys.path.insert(0, './Online-FW')
sys.path.insert(0, './Online-OPE')
sys.path.insert(0, './Streaming-FW')
sys.path.insert(0, './Streaming-OPE')
import time
import shutil
import utilities as ut... | 2.03125 | 2 |
tests/test_helper.py | swills/pykwalify | 275 | 33133 | <reponame>swills/pykwalify<filename>tests/test_helper.py
# -*- coding: utf-8 -*-
# python std lib
import logging
import logging.config
log = logging.getLogger()
# Set the root logger to be silent so all code that uses the python logger
# will not print anything unless we want it to, then it should be specified
# in... | 2.3125 | 2 |
setup.py | mechyai/RL-EmsPy | 8 | 33134 | from distutils.core import setup
setup(
name='RL-EmsPy',
version='0.0.1',
packages=['emspy'],
url='https://github.com/mechyai/RL-EmsPy',
license='Apache License 2.0',
author='<NAME>',
)
| 0.855469 | 1 |
src/hyperloop/geometry/inlet.py | uwhl/Hyperloop | 1 | 33135 | from math import pi, sqrt
from openmdao.core.component import Component
class InletGeom(Component):
'''Calculates the dimensions for the inlet and compressor entrance'''
def __init__(self):
super(InletGeom, self).__init__()
self.add_param('wall_thickness', 0.05, desc='thickness of inlet wall',... | 2.65625 | 3 |
gza/gzatcp.py | ynadji/drop | 6 | 33136 | <reponame>ynadji/drop<gh_stars>1-10
#!/usr/bin/env python
#
# DNS gameplay
from scapy.all import *
import sys,os,time
import nfqueue
import socket
from gzacommon import GZA
# time.windows, damballa, damballa, local
WHITELIST_IPS = ["207.46.232.", "172.22.0.", "172.22.10.", "192.168.", "0.0.0.0", "255.255.255.255"]
se... | 2.34375 | 2 |
static/images/uploads/convert-to-web.py | KrishSkywalker/krishgoel.com-v2 | 0 | 33137 | import os
from cv2 import cv2
for d in os.listdir():
if not d.endswith(".png"): continue
img = cv2.imread(d)
cv2.imwrite(d.replace(".png",".webp"), img)
os.remove(d) | 2.640625 | 3 |
test/internal/opts/process_compiler_opts_tests.bzl | buildbuddy-io/rules_xcodeproj | 30 | 33138 | <filename>test/internal/opts/process_compiler_opts_tests.bzl
"""Tests for compiler options processing functions."""
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
load("//test:utils.bzl", "stringify_dict")
# buildifier: disable=bzl-visibility
load("//xcodeproj/internal:opts.bzl", "testable")
process_... | 1.8125 | 2 |
nltk-drt/src/presuppdrt.py | napsternxg/nltk-drt | 1 | 33139 | """
NLTK DRT module extended with presuppositions
"""
__author__ = "<NAME>, <NAME>, <NAME>"
__version__ = "1.0"
__date__ = "Tue, 24 Aug 2010"
import re
import operator
from nltk.sem.logic import Variable
from nltk.sem.logic import EqualityExpression, ApplicationExpression, ExistsExpression, AndExpression
from nltk... | 3.03125 | 3 |
deploy_python/openem/Detect/__init__.py | bryan-flywire/openem | 10 | 33140 | from openem.models import ImageModel
from openem.models import Preprocessor
import cv2
import numpy as np
import tensorflow as tf
from collections import namedtuple
import csv
Detection=namedtuple('Detection', ['location',
'confidence',
'species',... | 2.703125 | 3 |
convert.py | FrilledShark/pi_graph | 0 | 33141 | <reponame>FrilledShark/pi_graph
import os
import re
filenames = sorted([frame for frame in os.listdir("frames")], key=lambda x: int(re.search(r'\d+', os.path.splitext(x)[0]).group()))
print("creating gif")
import imageio
with imageio.get_writer('storage/pi.gif', mode='I') as writer:
for filename in filenames:
... | 2.578125 | 3 |
module2-sql-for-analysis/insert_titanic.py | nsriniva/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 33142 | import os
import psycopg2
from psycopg2 import extras
import json
import pandas as pd
from dotenv import load_dotenv
def execute_values(conn, df, table):
"""
Using psycopg2.extras.execute_values() to insert the dataframe
"""
# Create a list of tupples from the dataframe values
tuples = [tuple(x) ... | 3.484375 | 3 |
modules/bot.py | RkyFissy/Fortnite-LobbyBot-v2 | 1 | 33143 | # -*- coding: utf-8 -*-
import asyncio
import datetime
import importlib
import io
import json
import logging
import os
import platform
import re
import subprocess
import sys
import textwrap
import traceback
from contextlib import redirect_stderr, redirect_stdout
from functools import partial
from glob i... | 1.773438 | 2 |
metagraph/tests/translators/test_matrix.py | paul-tqh-nguyen/metagraph | 18 | 33144 | import pytest
grblas = pytest.importorskip("grblas")
from metagraph.tests.util import default_plugin_resolver
from . import RoundTripper
from metagraph.plugins.numpy.types import NumpyMatrixType
from metagraph.plugins.graphblas.types import GrblasMatrixType
import numpy as np
def test_matrix_roundtrip_dense_square(... | 2.046875 | 2 |
src/by_hand_code/acm.py | vishalbelsare/parametric_modeling | 37 | 33145 | #!/usr/bin/env python
""" This file is a Python translation of the MATLAB file acm.m
Python version by RDL 29 Mar 2012
Copyright notice from acm.m:
copyright 1996, by <NAME>. For use with the book
"Statistical Digital Signal Processing and Modeling"
(John Wiley & Sons, 1996).
"""
from __future__ import print_fu... | 2.796875 | 3 |
crds/tests/test_checksum.py | sean-lockwood/crds | 0 | 33146 | import os
import shutil
import doctest
from crds.core import log, utils
from crds import tests, data_file
from crds.tests import test_config
from crds.refactoring import checksum
from crds.refactoring.checksum import ChecksumScript
def dt_checksum_script_fits_add():
"""
>>> old_state = test_config.setup()
... | 2.28125 | 2 |
fspipe/pipe.py | adamvinueza/fspipe | 0 | 33147 | from fsspec import AbstractFileSystem # type: ignore
from fsspec.implementations.local import LocalFileSystem # type: ignore
from typing import Callable, Optional
class Pipe(object):
"""A container for piping data through transformations.
Args:
src_fs (AbstractFileSystem): The source file system.
... | 2.578125 | 3 |
gitsy.py | GINMOT/GITSY | 1 | 33148 | <filename>gitsy.py
import os
from time import sleep
import sys
from sys import platform
import subprocess
import platform
#Main Service Initalizations
#def upcred():
#def multirep():
def clonehistory():
print(">>>>>>>> History >>>>>>>>")
print(" repositories cloned")
print(">>>>>>>>>... | 2.546875 | 3 |
convert.py | 9Knight9n/crawler-legislation-uk | 0 | 33149 | # from os import listdir
# from os.path import isfile, join
#
# from save import xht_files_dir, txt_files_dir_converted
# from utils import convert_xht_to_txt,convert_xht_to_txt_2
# only_files = [f for f in listdir(xht_files_dir) if isfile(join(xht_files_dir, f))]
# for index,file_ in enumerate(only_files):
# pri... | 3.140625 | 3 |
tests/regressiontests/custom_managers_regress/models.py | huicheese/Django-test3 | 19 | 33150 | """
Regression tests for custom manager classes.
"""
from django.db import models
class RestrictedManager(models.Manager):
"""
A manager that filters out non-public instances.
"""
def get_query_set(self):
return super(RestrictedManager, self).get_query_set().filter(is_public=True)
class Relat... | 2.78125 | 3 |
test_code/python-plotter-serial-beta/plotter_freq_checker.py | ithallojunior/data_transmission | 0 | 33151 | import serial
import matplotlib.pyplot as plt
import numpy as np
import time
pd = "/dev/tty.wchusbserial1410"
#pd = "/dev/tty.usbmodem1421"
p = serial.Serial(port=pd, baudrate=115200,
bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE)
p.flush()
time.sleep(0.5)
#plt.axis([0, 10, 0, 1])
plt.ion()
s... | 2.671875 | 3 |
leetcode/207_course_schedule.py | coocos/leetcode | 0 | 33152 | <reponame>coocos/leetcode
import unittest
import collections
from typing import List
class Solution:
"""
This solution performs a topological sort using Kahn's algorithm.
First a graph is constructed in the form of a dictionary which contains the
courses, their requirements and the courses that they ... | 3.8125 | 4 |
investment_report/migrations/0026_remove_howwecanhelp_sector.py | uktrade/pir-api | 1 | 33153 | <filename>investment_report/migrations/0026_remove_howwecanhelp_sector.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-09-01 14:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('investment_report', '0025... | 1.351563 | 1 |
src/models/transformer_encoder.py | sanket-pixel/attentive-mot | 1 | 33154 | import torch
import torch.nn.functional as f
from torch import nn
from einops import rearrange
def scaled_dot_product_attention(query, key, value):
attention = torch.einsum('bdtc,beuc->bdteu',[query,key])
mask = torch.zeros_like(attention)
for frame in torch.arange(mask.size(-2)):
mask[:, frame, :... | 2.140625 | 2 |
src/default_parameters.py | Vivswan/ECE-2162-Tomasulo | 0 | 33155 | TOMASULO_DEFAULT_PARAMETERS = {
"num_register": 32,
"num_rob": 128,
"num_cdb": 1,
"cdb_buffer_size": 0,
"nop_latency": 1,
"nop_unit_pipelined": 1,
"integer_adder_latency": 1,
"integer_adder_rs": 5,
"integer_adder_pipelined": 0,
"float_adder_latency": 3,
"float_adder_rs": 3... | 0.902344 | 1 |
hanlp/utils/__init__.py | antfootAlex/HanLP | 27,208 | 33156 | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-08-24 22:12
from . import rules
def ls_resource_in_module(root) -> dict:
res = dict()
for k, v in root.__dict__.items():
if k.startswith('_') or v == root:
continue
if isinstance(v, str):
if v.startswith('http') and n... | 2.421875 | 2 |
microbots/signup/crud.py | Varun11940/voice-enabled-chatbot | 36 | 33157 | <gh_stars>10-100
import config
import models
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, inspect
engine = create_engine(config.DATABASE_URI)
Session = sessionmaker(bind=engine)
class crudOps:
def createTable(self):
models.Base.metadata.create_all(engine)
def recreat... | 2.703125 | 3 |
capsNet.py | zhaoaite/ASTCapsNet | 0 | 33158 | """
License: Apache-2.0
Author: <NAME>
E-mail: <EMAIL>
"""
import tensorflow as tf
import rnn_cell_GRU as rnn_cell
import rnn
import numpy as np
from config import cfg
from utils import get_batch_data
from capsLayer import CapsLayer
from sklearn import metrics
import pickle
from sklearn.cross_validation import train... | 2.515625 | 3 |
settings.py | jjeejj/alien_invasion | 1 | 33159 | <gh_stars>1-10
# 设置类
class Settings():
'''保存设置信息'''
def __init__(self):
'''初始化游戏的静态设置'''
self.screen_width = 850
self.screen_heght = 600
self.bg_color = (230, 230, 230)
# 玩家飞船数量设置
self.ship_limit = 3
# 子弹设置
self.bullet_width = 3
... | 2.71875 | 3 |
stream.py | MusikPolice/picamera-web-interface | 0 | 33160 | <reponame>MusikPolice/picamera-web-interface<gh_stars>0
# Based on code shamelessly stolen from https://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming
import io
import picamera
import logging
import socketserver
import configparser
import json
from threading import Condition
from http import server
from... | 1.929688 | 2 |
downloader.py | mathieuhendey/lastfm_downloader | 3 | 33161 | <reponame>mathieuhendey/lastfm_downloader<filename>downloader.py
import sys
import pandas as pd
import requests
import pprint
from requests_toolbelt.threaded import pool
# Generate your own at https://www.last.fm/api/account/create
LASTFM_API_KEY = None
LASTFM_USER_NAME = None
TEXT = "#text"
ESTIMATED_TIME_FOR_PROCES... | 3.0625 | 3 |
src/trainer/fasttexttrainer.py | liuweiping2020/pyml | 0 | 33162 | <gh_stars>0
import numpy as np
from modeler.fasttextmodel import FastTextModel
from trainer.tftrainer import TFTrainer
class FastTextTrainer(TFTrainer):
def __init__(self):
self.num_classes = 19
self.learning_rate = 0.01
self.batch_size = 8
self.decay_steps = 1000
self.dec... | 2.484375 | 2 |
release/stubs.min/Autodesk/Revit/DB/Structure/__init__.py | YKato521/ironpython-stubs | 0 | 33163 | # encoding: utf-8
# module Autodesk.Revit.DB.Structure calls itself Structure
# from RevitAPI,Version=17.0.0.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
from __init___parts.AnalyticalAlignmentMethod import AnalyticalAlignmentMethod
from __init___p... | 1.304688 | 1 |
katana/pedals/booster.py | leon3110l/katana_tsl_patch | 0 | 33164 | from .pedal import BasePedal
from enum import IntEnum
class BoosterType(IntEnum):
DEFAULT = 10
MID_BOOST = 0
CLEAN_BOOST = 1
TREBLE_BOOST = 2
CRUNCH = 3
NATURAL_OD = 4
WARM_OD = 5
FAT_DS = 6
LEAD_DS = 7
METAL_DS = 8
OCT_FUZZ = 9
BLUES_OD = 10
OD_1 = 11
TUBESCREAM... | 2.28125 | 2 |
OpenCV/task5.py | Vishwajeetiitb/Autumn-of-Automation | 0 | 33165 | import numpy as np
import cv2
img = cv2.imread("test_image.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
camera = cv2.VideoCaptu... | 2.84375 | 3 |
src/models/ns.py | mhw32/meta-inference-public | 11 | 33166 | import os
import sys
import torch
from torch import nn
from torch.nn import functional as F, init
from src.utils import bernoulli_log_pdf
from src.objectives.elbo import \
log_bernoulli_marginal_estimate_sets
class Statistician(nn.Module):
def __init__(self, c_dim, z_dim, hidden_dim_statistic=3, hidden_dim=40... | 2.359375 | 2 |
posts/views.py | Agiruskiy/yatube | 0 | 33167 | <gh_stars>0
from django.core.paginator import Paginator
from django.shortcuts import render, get_object_or_404, redirect
from .models import Post, Groups
from django.contrib.auth import get_user_model, get_user
from .forms import NewPost
from django.contrib.auth.decorators import login_required
# Create your views he... | 2.109375 | 2 |
tests/examples/minlplib/robot200.py | ouyang-w-19/decogo | 2 | 33168 | <gh_stars>1-10
# NLP written by GAMS Convert at 04/21/18 13:54:04
#
# Equation counts
# Total E G L N X C B
# 1603 1603 0 0 0 0 0 0
#
# Variable counts
# x b i s1s s... | 1.703125 | 2 |
nonconformist/base.py | smazzanti/nonconformist | 301 | 33169 | <gh_stars>100-1000
#!/usr/bin/env python
"""
docstring
"""
# Authors: <NAME>
import abc
import numpy as np
from sklearn.base import BaseEstimator
class RegressorMixin(object):
def __init__(self):
super(RegressorMixin, self).__init__()
@classmethod
def get_problem_type(cls):
return 'regression'
class Cla... | 2.75 | 3 |
corehq/apps/receiverwrapper/rate_limiter.py | dborowiecki/commcare-hq | 0 | 33170 | from corehq.project_limits.rate_limiter import RateDefinition, RateLimiter, \
PerUserRateDefinition
from corehq.util.datadog.gauges import datadog_counter
from corehq.util.datadog.utils import bucket_value
from corehq.util.decorators import silence_and_report_error, enterprise_skip
from corehq.util.timer import Ti... | 1.789063 | 2 |
ShareSpace/views.py | BNordstrom16/ShareSpaceWeb | 0 | 33171 | from django.shortcuts import render, redirect
from django.views.generic import UpdateView, DeleteView
from .models import Storage
from django_tables2 import RequestConfig
from .tables import StorageTable
from django.contrib.auth.decorators import login_required
from .forms import StorageForm, QuestionForm
def index(r... | 2.015625 | 2 |
rest_framework_security/deny_repeat_password/signals.py | RubenEu/django-rest-framework-security | 7 | 33172 | <gh_stars>1-10
from django.apps import apps
from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver, Signal
from rest_framework_security.deny_repeat_password import config
from rest_framework_security.deny_repeat_password.emails import ChangedPa... | 2.03125 | 2 |
tests/test_post.py | DerrickOdhiambo/Flask-IP3 | 0 | 33173 | import unittest
from app.models import User,Post,Comments
from app import db
class PostTest(unittest.TestCase):
def setUp(self):
"""
Set up method that will run before every Test
"""
self.post= Post(category='Product', content='Yes we can!')
self.user_Derrick = User(userna... | 3.359375 | 3 |
ivi/agilent/agilent34410A.py | sacherjj/python-ivi | 161 | 33174 | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 <NAME>
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
... | 1.804688 | 2 |
python/add_two_numbers.py | babibo180918/leetcode | 0 | 33175 | <reponame>babibo180918/leetcode
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
... | 3.90625 | 4 |
ConvertCase.py | GuilhermeSenna/Streamlit-Apps | 0 | 33176 | <reponame>GuilhermeSenna/Streamlit-Apps<gh_stars>0
import SessionState
import base64
import streamlit as st
import pyperclip
# The input stores the string that is in text_area
# The output stores the conversion with the input
# This storage is needed because textarea comes before the button
session_state = SessionSta... | 3.359375 | 3 |
biblio/my_secondary_verifications.py | lokal-profil/isfdb_site | 0 | 33177 | <filename>biblio/my_secondary_verifications.py
#!_PYTHONLOC
#
# (C) COPYRIGHT 2020-2021 Ahasuerus
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision: 571 $
# Date: $Date: 2020-11-19 15:53:0... | 2.359375 | 2 |
extended_uva_judge/utilities.py | fritogotlayed/Extended-UVA-Judge | 0 | 33178 | <reponame>fritogotlayed/Extended-UVA-Judge
import os
import yaml
from extended_uva_judge import errors
def get_problem_directory(app_config):
"""Gets the directory containing the problem configs.
:return: The path to the problem configs.
:rtype: str
"""
problem_directory = app_config['problem_dir... | 2.8125 | 3 |
reshade/pooling/l2norm.py | jamesjiang52/Reshade | 0 | 33179 | <gh_stars>0
"""
The following classes are defined:
L2NormPoolingNeuron
L2NormPoolingLayer
"""
from math import sqrt
from ..utils.validate import *
from ..utils.flatten import *
class L2NormPoolingNeuron:
"""
Construct a new l2norm pooling neuron. The output takes on the square root
of the sum of ... | 3.359375 | 3 |
sisy/__main__.py | qorrect/sisy | 6 | 33180 | <gh_stars>1-10
from sisy import ui
if __name__ == "__main__":
ui()
| 0.859375 | 1 |
scripts/ur5_open_loop.py | lar-deeufba/real_time_grasp | 27 | 33181 | <reponame>lar-deeufba/real_time_grasp
#!/usr/bin/python
import rospy
import actionlib
import numpy as np
import argparse
import copy
from copy import deepcopy
import rosservice
import sys
import re
from std_msgs.msg import Float64MultiArray, Float32MultiArray
from control_msgs.msg import FollowJointTrajectoryAction, ... | 2.015625 | 2 |
certbot_dns_corenetworks/test/unit/test_dns_corenetwork.py | xoxys/certbot-dns-ispconfig | 1 | 33182 | """Tests for certbot_dns_corenetworks.dns_corenetworks."""
import unittest
import mock
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_USER = "my_user"
API_PASSWORD ... | 2.421875 | 2 |
examples/monitor.py | zhuxuanxuan23/ksc-sdk-python | 53 | 33183 | # -*- encoding:utf-8 -*-
from kscore.session import get_session
import json
if __name__ == "__main__":
s = get_session()
client = s.create_client("monitor", "cn-beijing-6", use_ssl=True)
clientv2 = s.create_client("monitorv2", "cn-beijing-6", use_ssl=True)
'''
通用产品线,不包含容器(docker)
'''
#Lis... | 1.992188 | 2 |
malware_rl/envs/utils/sorel.py | xenoxine/malware_rl | 61 | 33184 | <gh_stars>10-100
import os
import sys
import lightgbm as lgb
import numpy as np
from malware_rl.envs.utils.ember import PEFeatureExtractor
module_path = os.path.split(os.path.abspath(sys.modules[__name__].__file__))[0]
try:
model_path = os.path.join(module_path, "sorel.model")
except ValueError:
print("The ... | 2.125 | 2 |
hummingbot/connector/exchange/bittrex/bittrex_utils.py | joedomino874/hummingbot | 3,027 | 33185 | <filename>hummingbot/connector/exchange/bittrex/bittrex_utils.py
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange
CENTRALIZED = True
EXAMPLE_PAIR = "ZRX-ETH"
DEFAULT_FEES = [0.25, 0.25]
KEYS = {
"bittrex_api_key":
ConfigVar(key... | 1.71875 | 2 |
actions/list_members.py | stackstorm-enhancements/stackstorm-github | 1 | 33186 | <gh_stars>1-10
import datetime
from github.GithubException import UnknownObjectException
from lib.base import BaseGithubAction
from lib.formatters import user_to_dict
__all__ = [
'ListMembersAction'
]
class ListMembersAction(BaseGithubAction):
def run(self, user, base_url, filter=None, role=None, limit=20):... | 2.4375 | 2 |
src/calrissian/regularization/regularize_orthogonal.py | awlange/brainsparks | 3 | 33187 | import numpy as np
class RegularizeOrthogonal(object):
"""
Orthogonal
"""
def __init__(self, coeff_lambda=0.0):
self.coeff_lambda = coeff_lambda
def cost(self, layers):
c = 0.0
for layer in layers:
wt = layer.w.transpose()
for j in range(layer.outp... | 2.734375 | 3 |
data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/util.py | Keesiu/meta-kaggle | 0 | 33188 | <filename>data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/util.py<gh_stars>0
import sys, bisect
from collections import defaultdict
from itertools import islice, izip
import numpy as np
from scipy.misc import logsumexp
from scipy.spatial import distance
import Levenshtein
PUNCTUATION = set... | 2 | 2 |
Search_DnaA_trios/9_adjust_box_mismatch.py | DongMeiJing/DnaA-trios | 0 | 33189 | import pandas as pd
file = r'8_calculate_spacer_len.csv'
with open(file, 'r') as f:
data = pd.read_csv(f)
for i in data.index:
box_motif = data.at[i, 'box motif']
if '[' in box_motif:
data.at[i, 'Upstream mismatch'] = data.at[i, 'Upstream mismatch'] + 0.5
data.at[i, 'Downstream... | 2.4375 | 2 |
creatDjangoApp1/accounts/migrations/0006_auto_20201130_2119.py | imxiaow/django-xw-project | 1 | 33190 | <reponame>imxiaow/django-xw-project
# Generated by Django 3.1.3 on 2020-11-30 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_auto_20201130_1450'),
]
operations = [
migrations.AddField(
model_name='ord... | 1.632813 | 2 |
HelloWorld/guessinggame.py | zahraaliaghazadeh/python | 0 | 33191 | <filename>HelloWorld/guessinggame.py
# answer = 5
# print("please guess number between 1 and 10: ")
# guess = int(input())
#
# if guess < answer:
# print("Please guess higher")
# elif guess > answer:
# print ( "Please guess lower")
# else:
# print("You got it first time")
answer = 5
print ("Please guess n... | 4.25 | 4 |
spandex/tests/test_io.py | UDST/spandex | 21 | 33192 | import numpy as np
import pandas as pd
from pandas.util import testing as pdt
import pytest
from spandex import TableFrame
from spandex.io import db_to_df, df_to_db
def test_tableframe(loader):
table = loader.tables.sample.hf_bg
for cache in [False, True]:
tf = TableFrame(table, index_col='gid', cach... | 2.109375 | 2 |
cohesity_management_sdk/models/vserver_network_interface.py | sachinthakare-cohesity/management-sdk-python | 0 | 33193 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class VserverNetworkInterface(object):
"""Implementation of the 'Vserver Network Interface.' model.
Specifies information about a logical network interface on a
NetApp Vserver. The interface's IP address is the mount point for a
spec... | 2.609375 | 3 |
clld/lib/wordpress.py | Woseseltops/clld | 1 | 33194 | <gh_stars>1-10
"""
Client for the xmlrpc API of a wordpress blog.
.. note::
we ignore blog_id altogether, see
http://joseph.randomnetworks.com/archives/2008/06/10/\
blog-id-in-wordpress-and-xml-rpc-blog-apis/
thus, rely on identifying the appropriate blog by xmlrpc endpoint.
"""
import re
import xmlrp... | 2.703125 | 3 |
deprecated_examples_robust/multimedia/avmnist_MFM_robust.py | TianhaoFu/MultiBench | 0 | 33195 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))
from training_structures.MFM import train_MFM,test_MFM
from fusions.common_fusions import Concat
from unimodals.MVAE import LeNetEncoder,DeLeNet
from unimodals.common_models import MLP
from torch import nn
import torch
from objective_fu... | 1.796875 | 2 |
src/JyCnTwTranslator.py | jackychu0830/jy-cn-tw-translattor | 3 | 33196 | <reponame>jackychu0830/jy-cn-tw-translattor
import json
import os
from pygoogletranslation import Translator
JY_PATH = os.path.expanduser('~') + '/Movies/JianyingPro/videocut/'
def get_video_texts(filename):
"""
Get all text content from video
:param filename: file name
:return: all subtitle in list... | 3.140625 | 3 |
pygame_template.py | Pittsy24/pygame_template | 0 | 33197 | #!/usr/bin/python3
# By <NAME>
import sys
import random
import pygame
from pygame.locals import *
class Colours:
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
AQUA = (0, 255, 255)
GREY = (128, 128, 128)
NAVY = (0, 0, 128)
SILVER = (192, 192 ,192)
GREEN = (0, 128, 0)
OLIV... | 3.421875 | 3 |
Python3/0234-Palindrome-Linked-List/soln-1.py | wyaadarsh/LeetCode-Solutions | 5 | 33198 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:
... | 3.71875 | 4 |
dataset/ucmayo4.py | GorkemP/labeled-images-for-ulcerative-colitis | 2 | 33199 | <filename>dataset/ucmayo4.py<gh_stars>1-10
import torch
from torch.utils.data import Dataset
from PIL import Image
import os
import glob
class UCMayo4(Dataset):
"""Ulcerative Colitis dataset grouped according to Endoscopic Mayo scoring system"""
def __init__(self, root_dir, transform=None):
"""
... | 2.53125 | 3 |