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 |
|---|---|---|---|---|---|---|
test/tests.py | gzu300/Linear_Algebra | 0 | 8900 | <filename>test/tests.py
import unittest
from pkg import Linear_Algebra
import numpy as np
class TestLU(unittest.TestCase):
def setUp(self):
self.U_answer = np.around(np.array([[2,1,0],[0,3/2,1],[0,0,4/3]], dtype=float), decimals=2).tolist()
self.L_answer = np.around(np.array([[1,0,0],[1/2,1,0],[0,2... | 3.046875 | 3 |
src/backend/common/models/favorite.py | ofekashery/the-blue-alliance | 266 | 8901 | from backend.common.models.mytba import MyTBAModel
class Favorite(MyTBAModel):
"""
In order to make strongly consistent DB requests, instances of this class
should be created with a parent that is the associated Account key.
"""
def __init__(self, *args, **kwargs):
super(Favorite, self)._... | 2.328125 | 2 |
Cartwheel/lib/Python26/Lib/site-packages/wx-2.8-msw-unicode/wx/lib/filebrowsebutton.py | MontyThibault/centre-of-mass-awareness | 27 | 8902 | #----------------------------------------------------------------------
# Name: wxPython.lib.filebrowsebutton
# Purpose: Composite controls that provide a Browse button next to
# either a wxTextCtrl or a wxComboBox. The Browse button
# launches a wxFileDialog and loads the result i... | 2.71875 | 3 |
modules/pygsm/devicewrapper.py | whanderley/eden | 205 | 8903 | <gh_stars>100-1000
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
# arch: pacman -S python-pyserial
# debian/ubuntu: apt-get install python-serial
import serial
import re
import errors
class DeviceWrapper(object):
def __init__(self, logger, *args, **kwargs):
self.device = serial.Se... | 2.53125 | 3 |
day1/loops.py | alqmy/The-Garage-Summer-Of-Code | 0 | 8904 | <gh_stars>0
# while True:
# # ejecuta esto
# print("Hola")
real = 7
print("Entre un numero entre el 1 y el 10")
guess = int(input())
# =/=
while guess != real:
print("Ese no es el numero")
print("Entre un numero entre el 1 y el 10")
guess = int(input())
# el resto
print("Yay! Lo sacastes!")
| 3.96875 | 4 |
pentest-scripts/learning-python-for-forensics/Chapter 6/rot13.py | paulveillard/cybersecurity-penetration-testing | 6 | 8905 | <reponame>paulveillard/cybersecurity-penetration-testing
def rotCode(data):
"""
The rotCode function encodes/decodes data using string indexing
:param data: A string
:return: The rot-13 encoded/decoded string
"""
rot_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'... | 4.1875 | 4 |
examples/sim_tfidf.py | sunyilgdx/CwVW-SIF | 12 | 8906 | <gh_stars>10-100
import pickle, sys
sys.path.append('../src')
import data_io, sim_algo, eval, params
## run
# wordfiles = [#'../data/paragram_sl999_small.txt', # need to download it from <NAME>'s github (https://github.com/jwieting/iclr2016)
# '../data/glove.840B.300d.txt' # need to download it first
# ]
wor... | 2.453125 | 2 |
tests/cases/cls.py | div72/py2many | 345 | 8907 | <gh_stars>100-1000
class Foo:
def bar(self):
return "a"
if __name__ == "__main__":
f = Foo()
b = f.bar()
print(b) | 2.59375 | 3 |
theano-rfnn/mnist_loader.py | jhja/RFNN | 55 | 8908 | <filename>theano-rfnn/mnist_loader.py
import numpy as np
import os
from random import shuffle
datasets_dir = './../data/'
def one_hot(x,n):
if type(x) == list:
x = np.array(x)
x = x.flatten()
o_h = np.zeros((len(x),n))
o_h[np.arange(len(x)),x] = 1
return o_h
def mnist(ntrain=60000,ntest=10000,onehot=True):
... | 2.453125 | 2 |
Ejercicio 2.py | crltsnch/Ejercicios-grupales | 0 | 8909 | import math
import os
import random
import re
import sys
def compareTriplets(a, b):
puntosA=0
puntosB=0
for i in range (0,3):
if a[i]<b[i]:
puntosB+=1
elif a[i]>b[i]:
puntosA+=1
puntosTotales=[puntosA, puntosB]
return puntosTotales
if __name__ == '__mai... | 3.625 | 4 |
app/routes/router.py | nityagautam/ReportDashboard-backend | 1 | 8910 | #===============================================================
# @author: <EMAIL>
# @written: 08 December 2021
# @desc: Routes for the Backend server
#===============================================================
# Import section with referecne of entry file or main file;
from __main__ import applicatio... | 2.390625 | 2 |
idaes/generic_models/properties/core/examples/ASU_PR.py | carldlaird/idaes-pse | 112 | 8911 | <filename>idaes/generic_models/properties/core/examples/ASU_PR.py
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energ... | 2 | 2 |
tests/functional/test_calculator.py | bellanov/calculator | 0 | 8912 | """TODO: Move the Threads Here"""
| 1.054688 | 1 |
autokeras/hypermodel/graph.py | Sette/autokeras | 0 | 8913 | <reponame>Sette/autokeras
import functools
import pickle
import kerastuner
import tensorflow as tf
from tensorflow.python.util import nest
from autokeras.hypermodel import base
from autokeras.hypermodel import compiler
class Graph(kerastuner.engine.stateful.Stateful):
"""A graph consists of connected Blocks, Hy... | 2.796875 | 3 |
Python/longest-valid-parentheses.py | shreyventure/LeetCode-Solutions | 388 | 8914 | '''
Speed: 95.97%
Memory: 24.96%
Time complexity: O(n)
Space complexity: O(n)
'''
class Solution(object):
def longestValidParentheses(self, s):
ans=0
stack=[-1]
for i in range(len(s)):
if(s[i]=='('):
stack.append(i)
else:
stack.pop()
... | 3.484375 | 3 |
setup.py | i25ffz/openaes | 0 | 8915 | <reponame>i25ffz/openaes
from distutils.core import setup, Extension
import os.path
kw = {
'name':"PyOpenAES",
'version':"0.10.0",
'description':"OpenAES cryptographic library for Python.",
'ext_modules':[
Extension(
'openaes',
include_dirs = ['inc', 'src/isaac'],
# define_macros=[('ENABLE_PYTHON', '1')... | 1.390625 | 1 |
examples/isosurface_demo2.py | jayvdb/scitools | 62 | 8916 | #!/usr/bin/env python
# Example taken from:
# http://www.mathworks.com/access/helpdesk/help/techdoc/visualize/f5-3371.html
from scitools.easyviz import *
from time import sleep
from scipy import io
setp(interactive=False)
# Displaying an Isosurface:
mri = io.loadmat('mri_matlab_v6.mat')
D = mri['D']
#Ds = smooth3(D... | 2.5625 | 3 |
structural_model/util_morphology.py | zibneuro/udvary-et-al-2022 | 1 | 8917 | <gh_stars>1-10
import os
import numpy as np
import json
import util_amira
def getEdgeLabelName(label):
if(label == 6):
return "axon"
elif(label == 4):
return "apical"
elif(label == 5):
return "basal"
elif(label == 7):
return "soma"
else:
return "other"
def... | 2.71875 | 3 |
invenio_madmp/views.py | FAIR-Data-Austria/invenio-madmp | 1 | 8918 | """Blueprint definitions for maDMP integration."""
from flask import Blueprint, jsonify, request
from invenio_db import db
from .convert import convert_dmp
from .models import DataManagementPlan
def _summarize_dmp(dmp: DataManagementPlan) -> dict:
"""Create a summary dictionary for the given DMP."""
res = {... | 2.53125 | 3 |
retrieval/urls.py | aipassio/visual_retrieval | 0 | 8919 | <gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('retrieval_insert', views.retrieval_insert, name='retrieval_insert'),
path('retrieval_get', views.retrieval_get, name='retrieval_get')
] | 1.539063 | 2 |
scripts/Interfacing/encoder_class.py | noshluk2/Wifi-Signal-Robot-localization | 0 | 8920 | <reponame>noshluk2/Wifi-Signal-Robot-localization<filename>scripts/Interfacing/encoder_class.py
import RPi.GPIO as GPIO
import threading
class Encoder(object):
def __init__(self, r_en_a,r_en_b,l_en_a,l_en_b):
GPIO.setmode(GPIO.BCM)
GPIO.setup(r_en_a, GPIO.IN)
GPIO.setup(r_en_b, GPIO.IN)
... | 2.703125 | 3 |
systori/apps/equipment/urls.py | systori/systori | 12 | 8921 | <filename>systori/apps/equipment/urls.py
from django.conf.urls import url
from django.urls import path, include
from systori.apps.user.authorization import office_auth
from systori.apps.equipment.views import EquipmentListView, EquipmentView, EquipmentCreate, EquipmentDelete, EquipmentUpdate, RefuelingStopCreate, Refu... | 2.078125 | 2 |
40_3.py | rursvd/pynumerical2 | 0 | 8922 | <reponame>rursvd/pynumerical2<gh_stars>0
from numpy import zeros
# Define ab2 function
def ab2(f,t0,tf,y0,n):
h = (tf - t0)/n
t = zeros(n+1)
y = zeros(n+1)
t[0] = t0
y[0] = y0
y[1] = y[0] + h * f(t[0],y[0])
t[1] = t[0] + h
for i in range(1,n):
y[i+1] = y[i] + (3.0/2.0) ... | 2.65625 | 3 |
test/test_parse_cs.py | NeonDaniel/lingua-franca | 0 | 8923 | <reponame>NeonDaniel/lingua-franca
#
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 2.109375 | 2 |
src/net/pluto_ftp.py | WardenAllen/Uranus | 0 | 8924 | <gh_stars>0
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2020/9/18 12:02
# @Author : WardenAllen
# @File : pluto_ftp.py
# @Brief :
import paramiko
class PlutoFtp :
# paramiko's Sftp() object.
__sftp = object
def connect_by_pass(self, host, port, uname, pwd):
transport = paramik... | 2.546875 | 3 |
piped/processors/test/__init__.py | alexbrasetvik/Piped | 3 | 8925 | # Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
| 0.824219 | 1 |
assistance_bot/app.py | reakfog/personal_computer_voice_assistant | 0 | 8926 | import sys
sys.path = ['', '..'] + sys.path[1:]
import daemon
from assistance_bot import core
from functionality.voice_processing import speaking, listening
from functionality.commands import *
if __name__ == '__main__':
speaking.setup_assistant_voice(core.ttsEngine, core.assistant)
while True:
# st... | 2.328125 | 2 |
python/testData/resolve/AssignmentExpressionsAndOuterVar.py | tgodzik/intellij-community | 2 | 8927 | <filename>python/testData/resolve/AssignmentExpressionsAndOuterVar.py<gh_stars>1-10
total = 0
partial_sums = [total := total + v for v in values]
print("Total:", total)
<ref> | 1.890625 | 2 |
exhale/deploy.py | florianhumblot/exhale | 0 | 8928 | <reponame>florianhumblot/exhale
# -*- coding: utf8 -*-
########################################################################################
# This file is part of exhale. Copyright (c) 2017-2022, <NAME>. #
# Full BSD 3-Clause license available here: #
# ... | 1.523438 | 2 |
src/bayesian_reliability_comparison.py | rloganiv/bayesian-blackbox | 8 | 8929 | import argparse
import multiprocessing
import os
import random
import numpy as np
from data_utils import DATAFILE_LIST, DATASET_LIST, prepare_data, RESULTS_DIR
from models import SumOfBetaEce
random.seed(2020)
num_cores = multiprocessing.cpu_count()
NUM_BINS = 10
NUM_RUNS = 100
N_list = [100, 200, 500, 1000, 2000, 5... | 2.25 | 2 |
psyneulink/core/components/functions/statefulfunctions/statefulfunction.py | SamKG/PsyNeuLink | 0 | 8930 | <gh_stars>0
#
# Princeton University licenses this file to You 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 agree... | 1.554688 | 2 |
ee/clickhouse/sql/person.py | wanderlog/posthog | 0 | 8931 | <reponame>wanderlog/posthog<gh_stars>0
from ee.clickhouse.sql.clickhouse import KAFKA_COLUMNS, STORAGE_POLICY, kafka_engine
from ee.clickhouse.sql.table_engines import CollapsingMergeTree, ReplacingMergeTree
from ee.kafka_client.topics import KAFKA_PERSON, KAFKA_PERSON_DISTINCT_ID, KAFKA_PERSON_UNIQUE_ID
from posthog.s... | 1.773438 | 2 |
scripts/dump_training_data.py | davmre/sigvisa | 0 | 8932 | from sigvisa.learn.train_coda_models import get_shape_training_data
import numpy as np
X, y, evids = get_shape_training_data(runid=4, site="AS12", chan="SHZ", band="freq_2.0_3.0", phases=["P",], target="amp_transfer", max_acost=np.float("inf"), min_amp=-2)
np.savetxt("X.txt", X)
np.savetxt("y.txt", y)
np.savetxt("evid... | 2.515625 | 3 |
shdw/tools/welford.py | wbrandenburger/ShadowDetection | 2 | 8933 | <gh_stars>1-10
import math
import numpy as np
# plt.style.use('seaborn')
# plt.rcParams['figure.figsize'] = (12, 8)
def welford(x_array):
k = 0
M = 0
S = 0
for x in x_array:
k += 1
Mnext = M + (x - M) / k
S = S + (x - M)*(x - Mnext)
M = Mnext
return (M, S/(k-1))
... | 3.578125 | 4 |
day3/functions.py | lilbond/bitis | 0 | 8934 |
def greet():
print("Hi")
def greet_again(message):
print(message)
def greet_again_with_type(message):
print(type(message))
print(message)
greet()
greet_again("Hello Again")
greet_again_with_type("One Last Time")
greet_again_with_type(1234)
# multiple types
def multiple_types(x):
if x < 0:
... | 4 | 4 |
test.py | KipCrossing/Micropython-AD9833 | 11 | 8935 | from ad9833 import AD9833
# DUMMY classes for testing without board
class SBI(object):
def __init__(self):
pass
def send(self, data):
print(data)
class Pin(object):
def __init__(self):
pass
def low(self):
print(" 0")
def high(self):
prin... | 3.015625 | 3 |
tests/test_api_network.py | devicehive/devicehive-plugin-python-template | 0 | 8936 | # Copyright (C) 2018 DataArt
#
# 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, ... | 1.742188 | 2 |
filehandler.py | miciux/telegram-bot-admin | 1 | 8937 | <filename>filehandler.py
import logging
import abstracthandler
import os
class FileHandler(abstracthandler.AbstractHandler):
def __init__(self, conf, bot):
abstracthandler.AbstractHandler.__init__(self, 'file', conf, bot)
self.log = logging.getLogger(__name__)
self.commands={}
self... | 2.875 | 3 |
tensorflow_federated/python/learning/federated_evaluation.py | Tensorflow-Devs/federated | 0 | 8938 | <reponame>Tensorflow-Devs/federated<filename>tensorflow_federated/python/learning/federated_evaluation.py
# Copyright 2019, The TensorFlow Federated 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 ... | 1.898438 | 2 |
pylibcontainer/image.py | joaompinto/pylibcontainer | 7 | 8939 | from __future__ import print_function
import os
import shutil
import hashlib
import requests
import click
from tempfile import NamedTemporaryFile
from hashlib import sha256
from os.path import expanduser, join, exists, basename
from .utils import HumanSize
from .tar import extract_layer
from . import trust
from . impor... | 2.375 | 2 |
utest/test_compareimage.py | michel117/robotframework-doctestlibrary | 1 | 8940 | from DocTest.CompareImage import CompareImage
import pytest
from pathlib import Path
import numpy
def test_single_png(testdata_dir):
img = CompareImage(testdata_dir / 'text_big.png')
assert len(img.opencv_images)==1
assert type(img.opencv_images)==list
type(img.opencv_images[0])==numpy.ndarray
def tes... | 2.296875 | 2 |
cvstudio/view/widgets/labels_tableview/__init__.py | haruiz/PytorchCvStudio | 32 | 8941 | <reponame>haruiz/PytorchCvStudio<gh_stars>10-100
from .labels_tableview import LabelsTableView
| 1.140625 | 1 |
experiments/solve_different_methods.py | vishalbelsare/ags_nlp_solver | 8 | 8942 | import functools
import numpy as np
import math
import argparse
import ags_solver
import go_problems
import nlopt
import sys
from Simple import SimpleTuner
import itertools
from scipy.spatial import Delaunay
from scipy.optimize import differential_evolution
from scipy.optimize import basinhopping
from sdaopt import sda... | 1.875 | 2 |
src/py/fc.py | mattyschell/geodatabase-toiler | 0 | 8943 | import arcpy
import logging
import pathlib
import subprocess
import gdb
import cx_sde
class Fc(object):
def __init__(self
,gdb
,name):
# gdb object
self.gdb = gdb
# ex BUILDING
self.name = name.upper()
# esri tools usually expect this C:/s... | 2.015625 | 2 |
desafiosCursoEmVideo/ex004.py | gomesGabriel/Pythonicos | 1 | 8944 | <reponame>gomesGabriel/Pythonicos
n = input('Digite algo: ')
print('O tipo primitivo da variável é: ', type(n))
print('O que foi digitado é alfa numérico? ', n.isalnum())
print('O que foi digitado é alfabético? ', n.isalpha())
print('O que foi digitado é um decimal? ', n.isdecimal())
print('O que foi digitado é minúscu... | 4.09375 | 4 |
Machine learning book/3 - MultiLayer Perceptron/test_regression.py | dalmia/Lisa-Lab-Tutorials | 25 | 8945 | <reponame>dalmia/Lisa-Lab-Tutorials
from numpy import *
import numpy as np
import matplotlib.pyplot as plt
from mlp import mlp
x = ones((1, 40)) * linspace(0, 1, 40)
t = sin(2 * pi * x) + cos(2 * pi * x) + np.random.randn(40) * 0.2
x = transpose(x)
t = transpose(t)
n_hidden = 3
eta = 0.25
n_iterations = 101
plt.plot... | 3.359375 | 3 |
gomoku/networks/__init__.py | IllIIIllll/reinforcement-learning-omok | 1 | 8946 | # © 2020 지성. all rights reserved.
# <<EMAIL>>
# Apache License 2.0
from .small import *
from .medium import *
from .large import * | 1.171875 | 1 |
alipay/aop/api/domain/AlipayEbppInvoiceAuthSignModel.py | snowxmas/alipay-sdk-python-all | 1 | 8947 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayEbppInvoiceAuthSignModel(object):
def __init__(self):
self._authorization_type = None
self._m_short_name = None
self._user_id = None
@property
def authoriza... | 2.109375 | 2 |
sdk/python/tekton_pipeline/models/v1beta1_embedded_task.py | jmcshane/experimental | 0 | 8948 | # Copyright 2020 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 1.5625 | 2 |
tzp.py | gmlunesa/zhat | 1 | 8949 | <filename>tzp.py
import zmq
import curses
import argparse
import configparser
import threading
import time
from curses import wrapper
from client import Client
from ui import UI
def parse_args():
parser = argparse.ArgumentParser(description='Client for teezeepee')
# Please specify your username
parser.... | 2.421875 | 2 |
anonlink-entity-service/backend/entityservice/tasks/solver.py | Sam-Gresh/linkage-agent-tools | 1 | 8950 | <gh_stars>1-10
import anonlink
from anonlink.candidate_generation import _merge_similarities
from entityservice.object_store import connect_to_object_store
from entityservice.async_worker import celery, logger
from entityservice.settings import Config as config
from entityservice.tasks.base_task import TracedTask
from... | 2 | 2 |
portal/migrations/0007_auto_20170824_1341.py | nickmvincent/ugc-val-est | 2 | 8951 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-24 13:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0006_auto_20170824_0950'),
]
operations = [
migrations.AddField(
... | 1.734375 | 2 |
exercise-09/programming_assignment/hopfield.py | AleRiccardi/technical-neural-network-course | 0 | 8952 | <filename>exercise-09/programming_assignment/hopfield.py
import numpy as np
import random
letter_C = np.array([
[1, 1, 1, 1, 1],
[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
])
noisy_C = np.array([
[1, 1, 1, 1, 1],
[0, 1, 0, 0, 1],
[1, 0, 0, 0, 0],
[1, 0, 0, 1... | 3.28125 | 3 |
util/infoclient/test_infoclient.py | cdla/murfi2 | 7 | 8953 |
from infoclientLib import InfoClient
ic = InfoClient('localhost', 15002, 'localhost', 15003)
ic.add('roi-weightedave', 'active')
ic.start()
| 1.625 | 2 |
lrtc_lib/experiment_runners/experiment_runner.py | MovestaDev/low-resource-text-classification-framework | 57 | 8954 | <gh_stars>10-100
# (c) Copyright IBM Corporation 2020.
# LICENSE: Apache License 2.0 (Apache-2.0)
# http://www.apache.org/licenses/LICENSE-2.0
import abc
import logging
import time
from collections import defaultdict
from typing import List
import numpy as np
from dataclasses import dataclass
logging.basicConfig(le... | 1.625 | 2 |
contrast/environment/data.py | alexbjorling/acquisition-framework | 0 | 8955 | <gh_stars>0
try:
from tango import DeviceProxy, DevError
except ModuleNotFoundError:
pass
class PathFixer(object):
"""
Basic pathfixer which takes a path manually.
"""
def __init__(self):
self.directory = None
class SdmPathFixer(object):
"""
MAX IV pathfixer which takes a pat... | 2.453125 | 2 |
game_2048/views.py | fung04/csrw_game | 0 | 8956 | import json
from django.contrib.auth.models import User
from django.http import JsonResponse
from django.shortcuts import redirect, render
from .models import Game2048
# Create your views here.
# test_user
# 8!S#5RP!WVMACg
def game(request):
return render(request, 'game_2048/index.html')
def set_result(req... | 2.40625 | 2 |
distdeepq/__init__.py | Silvicek/distributional-dqn | 131 | 8957 | from distdeepq import models # noqa
from distdeepq.build_graph import build_act, build_train # noqa
from distdeepq.simple import learn, load, make_session # noqa
from distdeepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer # noqa
from distdeepq.static import *
from distdeepq.plots import PlotMachine
| 1.203125 | 1 |
python/10.Authentication-&-API-Keys.py | 17nikhil/codecademy | 0 | 8958 | # Authentication & API Keys
# Many APIs require an API key. Just as a real-world key allows you to access something, an API key grants you access to a particular API. Moreover, an API key identifies you to the API, which helps the API provider keep track of how their service is used and prevent unauthorized or maliciou... | 2.140625 | 2 |
plucker/__init__.py | takkaria/json-plucker | 0 | 8959 | <filename>plucker/__init__.py
from .plucker import pluck, Path
from .exceptions import PluckError
__all__ = ["pluck", "Path", "PluckError"]
| 1.6875 | 2 |
arviz/plots/pairplot.py | gimbo/arviz | 0 | 8960 | <reponame>gimbo/arviz<filename>arviz/plots/pairplot.py<gh_stars>0
"""Plot a scatter or hexbin of sampled parameters."""
import warnings
import numpy as np
from ..data import convert_to_dataset, convert_to_inference_data
from .plot_utils import xarray_to_ndarray, get_coords, get_plotting_function
from ..utils import _v... | 2.5625 | 3 |
cuestionario/formularios.py | LisandroCanteros/Grupo2_COM06_Info2021 | 0 | 8961 | from django.forms import ModelForm
from .models import Cuestionario, Categoria
from preguntas.models import Pregunta, Respuesta
class CuestionarioForm(ModelForm):
class Meta:
model = Cuestionario
fields = '__all__'
class PreguntaForm(ModelForm):
class Meta:
model = Pregunta
fi... | 2.265625 | 2 |
vitcloud/views.py | biocross/VITCloud | 2 | 8962 | <filename>vitcloud/views.py
from django.views.generic import View
from django.http import HttpResponse
import os, json, datetime
from django.shortcuts import redirect
from django.shortcuts import render_to_response
from vitcloud.models import File
from django.views.decorators.csrf import csrf_exempt
from listingapikeys... | 1.890625 | 2 |
blurple/ui/base.py | jeremytiki/blurple.py | 4 | 8963 | <reponame>jeremytiki/blurple.py
from abc import ABC
import discord
class Base(discord.Embed, ABC):
async def send(self, client: discord.abc.Messageable):
""" Send the component as a message in discord.
:param client: The client used, usually a :class:`discord.abc.Messageable`. Must have implemen... | 3 | 3 |
migrations/versions/e86dd3bc539c_change_admin_to_boolean.py | jonzxz/project-piscator | 0 | 8964 | """change admin to boolean
Revision ID: e86dd3bc539c
Revises: <KEY>
Create Date: 2020-11-11 22:32:00.707936
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e86dd3bc539c'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | 1.53125 | 2 |
school/migrations/0010_alter_sala_unique_together.py | adrianomqsmts/django-escola | 0 | 8965 | <reponame>adrianomqsmts/django-escola
# Generated by Django 4.0.3 on 2022-03-16 03:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('school', '0009_rename_periodo_semestre_alter_semestre_options_and_more'),
]
operations = [
migrations.AlterUni... | 1.765625 | 2 |
code_trunk/trainer/abc.py | chris4540/DD2430-ds-proj | 0 | 8966 | """
Abstract training class
"""
from abc import ABC as AbstractBaseClass
from abc import abstractmethod
class AdstractTrainer(AbstractBaseClass):
@abstractmethod
def run(self):
pass
@abstractmethod
def prepare_data_loaders(self):
"""
For preparing data loaders and save them a... | 3.234375 | 3 |
quadpy/triangle/cools_haegemans.py | melvyniandrag/quadpy | 1 | 8967 | <reponame>melvyniandrag/quadpy
# -*- coding: utf-8 -*-
#
from mpmath import mp
from .helpers import untangle2
class CoolsHaegemans(object):
"""
<NAME>, <NAME>,
Construction of minimal cubature formulae for the square and the triangle
using invariant theory,
Department of Computer Science, K.U.Leu... | 2.53125 | 3 |
account/admin.py | RichardLeeH/invoce_sys | 0 | 8968 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from account.models import Profile
admin.site.site_header = 'invoc... | 1.929688 | 2 |
oops/#016exceptions.py | krishankansal/PythonPrograms | 0 | 8969 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 08:40:11 2020
@author: krishan
"""
def funny_division2(anumber):
try:
if anumber == 13:
raise ValueError("13 is an unlucky number")
return 100 / anumber
except (ZeroDivisionError, TypeError):
... | 3.671875 | 4 |
config/simclr_config.py | denn-s/SimCLR | 5 | 8970 | <filename>config/simclr_config.py
import os
from datetime import datetime
import torch
from dataclasses import dataclass
class SimCLRConfig:
@dataclass()
class Base:
output_dir_path: str
log_dir_path: str
log_file_path: str
device: object
num_gpu: int
logger_na... | 2.546875 | 3 |
test/unit/common/middleware/s3api/test_obj.py | Priyanka-Askani/swift | 1 | 8971 | # Copyright (c) 2014 OpenStack Foundation
#
# 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 ... | 1.59375 | 2 |
pynyzo/pynyzo/keyutil.py | EggPool/pynyzo | 6 | 8972 | """
Eddsa Ed25519 key handling
From
https://github.com/n-y-z-o/nyzoVerifier/blob/b73bc25ba3094abe3470ec070ce306885ad9a18f/src/main/java/co/nyzo/verifier/KeyUtil.java
plus
https://github.com/n-y-z-o/nyzoVerifier/blob/17509f03a7f530c0431ce85377db9b35688c078e/src/main/java/co/nyzo/verifier/util/SignatureUtil.java
"""
# ... | 2.765625 | 3 |
mldftdat/scripts/train_gp.py | mir-group/CiderPress | 10 | 8973 | from argparse import ArgumentParser
import os
import numpy as np
from joblib import dump
from mldftdat.workflow_utils import SAVE_ROOT
from mldftdat.models.gp import *
from mldftdat.data import load_descriptors, filter_descriptors
import yaml
def parse_settings(args):
fname = args.datasets_list[0]
if args.suff... | 2.203125 | 2 |
picoCTF-web/api/routes/admin.py | zaratec/picoCTF | 0 | 8974 | <filename>picoCTF-web/api/routes/admin.py
import api
import bson
from api.annotations import (
api_wrapper,
log_action,
require_admin,
require_login,
require_teacher
)
from api.common import WebError, WebSuccess
from flask import (
Blueprint,
Flask,
render_template,
request,
send... | 2.296875 | 2 |
python code/influxdb_worker.py | thongnbui/MIDS_251_project | 0 | 8975 | <reponame>thongnbui/MIDS_251_project
#!/usr/bin/python
import json
import argparse
from influxdb import InfluxDBClient
parser = argparse.ArgumentParser(description = 'pull data for softlayer queue' )
parser.add_argument( 'measurement' , help = 'measurement001' )
args = parser.parse_args()
client_influxdb = InfluxDB... | 2.5625 | 3 |
src/python/pants/backend/docker/lint/hadolint/subsystem.py | xyzst/pants | 0 | 8976 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from typing import cast
from pants.core.util_rules.config_files import ConfigFilesRequest
from pants.core.util_rules.external_tool import TemplatedExte... | 1.9375 | 2 |
venv/lib/python3.9/site-packages/biorun/fetch.py | LucaCilibrasi/docker_viruclust | 0 | 8977 | <filename>venv/lib/python3.9/site-packages/biorun/fetch.py
"""
Handles functionality related to data storege.
"""
import sys, os, glob, re, gzip, json
from biorun import const, utils, objects, ncbi
from biorun.models import jsonrec
import biorun.libs.placlib as plac
# Module level logger.
logger = utils.logger
# A ni... | 2.265625 | 2 |
game/items/game_item.py | LaverdeS/Genetic_Algorithm_EGame | 2 | 8978 | <filename>game/items/game_item.py<gh_stars>1-10
import numpy as np
from random import randint
from PyQt5.QtGui import QImage
from PyQt5.QtCore import QPointF
class GameItem():
def __init__(self, parent, boundary, position=None):
self.parent = parent
self.config = parent.config
self.items_... | 2.8125 | 3 |
source/deepsecurity/models/application_type_rights.py | felipecosta09/cloudone-workload-controltower-lifecycle | 1 | 8979 | # coding: utf-8
"""
Trend Micro Deep Security API
Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate De... | 1.523438 | 2 |
code-samples/aws_neptune.py | hardikvasa/database-journal | 45 | 8980 | from __future__ import print_function # Python 2/3 compatibility
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverR... | 2.390625 | 2 |
kits19cnn/io/preprocess_train.py | Ramsha04/kits19-2d-reproduce | 0 | 8981 | <reponame>Ramsha04/kits19-2d-reproduce
import os
from os.path import join, isdir
from pathlib import Path
from collections import defaultdict
from tqdm import tqdm
import nibabel as nib
import numpy as np
import json
from .resample import resample_patient
from .custom_augmentations import resize_data_and_seg, crop_to_... | 2.265625 | 2 |
setup.py | opywan/calm-dsl | 0 | 8982 | <reponame>opywan/calm-dsl
import sys
import setuptools
from setuptools.command.test import test as TestCommand
def read_file(filename):
with open(filename, "r", encoding='utf8') as f:
return f.read()
class PyTest(TestCommand):
"""PyTest"""
def finalize_options(self):
"""finalize_options... | 1.90625 | 2 |
hanlp/pretrained/tok.py | chen88358323/HanLP | 2 | 8983 | <reponame>chen88358323/HanLP
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-28 21:12
from hanlp_common.constant import HANLP_URL
SIGHAN2005_PKU_CONVSEG = HANLP_URL + 'tok/sighan2005-pku-convseg_20200110_153722.zip'
'Conv model (:cite:`wang-xu-2017-convolutional`) trained on sighan2005 pku dataset.'
SIGHAN2005... | 1.28125 | 1 |
third_party/webrtc/src/chromium/src/tools/swarming_client/tests/logging_utils_test.py | bopopescu/webrtc-streaming-node | 8 | 8984 | #!/usr/bin/env python
# Copyright 2015 The Swarming Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0 that
# can be found in the LICENSE file.
import logging
import os
import subprocess
import sys
import tempfile
import shutil
import unittest
import re
THIS_FILE... | 2.265625 | 2 |
model_selection.py | HrishikV/ineuron_inceome_prediction_internship | 0 | 8985 | from featur_selection import df,race,occupation,workclass,country
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import cross_val_score,KFold
from sklearn.linear_model import LogisticRegression
from imblearn.pipeline import Pipeline
from sklearn.compose import ColumnT... | 2.8125 | 3 |
tests/apps/newlayout/tasks/init_data.py | blazelibs/blazeweb | 0 | 8986 | <gh_stars>0
from __future__ import print_function
def action_010():
print('doit')
| 1.242188 | 1 |
2021/d8b_bits.py | apie/advent-of-code | 4 | 8987 | <reponame>apie/advent-of-code<gh_stars>1-10
#!/usr/bin/env python3
import pytest
import fileinput
from os.path import splitext, abspath
F_NAME = 'd8'
#implement day8 using bits
def find_ones(d):
'''count number of ones in binary number'''
ones = 0
while d > 0:
ones += d & 1
d >>= 1
retu... | 3.359375 | 3 |
frame_dataloader/spatial_dataloader.py | rizkiailham/two-stream-action-recognition-1 | 67 | 8988 | """
********************************
* Created by mohammed-alaa *
********************************
Spatial Dataloader implementing sequence api from keras (defines how to load a single item)
this loads batches of images for each iteration it returns [batch_size, height, width ,3] ndarrays
"""
import copy
import ran... | 2.9375 | 3 |
dianhua/worker/crawler/china_mobile/hunan/base_request_param.py | Svolcano/python_exercise | 6 | 8989 | <gh_stars>1-10
# -*- coding:utf-8 -*-
"""
@version: v1.0
@author: xuelong.liu
@license: Apache Licence
@contact: <EMAIL>
@software: PyCharm
@file: base_request_param.py
@time: 12/21/16 6:48 PM
"""
class RequestParam(object):
"""
请求相关
"""
# URL
START_URL = "https://www.hn.10086.cn/service/static... | 2.265625 | 2 |
day02/puzzle2.py | jack-beach/AdventOfCode2019 | 0 | 8990 | <reponame>jack-beach/AdventOfCode2019
# stdlib imports
import copy
# vendor imports
import click
@click.command()
@click.argument("input_file", type=click.File("r"))
def main(input_file):
"""Put your puzzle execution code here"""
# Convert the comma-delimited string of numbers into a list of ints
masterR... | 3.859375 | 4 |
ionosenterprise/items/backupunit.py | ionos-cloud/ionos-enterprise-sdk-python | 6 | 8991 | <filename>ionosenterprise/items/backupunit.py
class BackupUnit(object):
def __init__(self, name, password=<PASSWORD>, email=None):
"""
BackupUnit class initializer.
:param name: A name of that resource (only alphanumeric characters are acceptable)"
:type name: ``str``
... | 2.96875 | 3 |
install.py | X-lab-3D/PANDORA | 0 | 8992 | import os
dirs = [
'./PANDORA_files', './PANDORA_files/data', './PANDORA_files/data/csv_pkl_files',
'./PANDORA_files/data/csv_pkl_files/mhcseqs', './PANDORA_files/data/PDBs',
'./PANDORA_files/data/PDBs/pMHCI', './PANDORA_files/data/PDBs/pMHCII',
'./PANDORA_files/data/PDBs/Bad', './PANDO... | 2.25 | 2 |
app/auth/views.py | MainaKamau92/apexselftaught | 4 | 8993 | <gh_stars>1-10
# app/auth/views.py
import os
from flask import flash, redirect, render_template, url_for, request
from flask_login import login_required, login_user, logout_user, current_user
from . import auth
from .forms import (LoginForm, RegistrationForm,
RequestResetForm, ResetPasswordForm)
fro... | 2.671875 | 3 |
oslo_messaging/_drivers/zmq_driver/client/publishers/zmq_dealer_publisher.py | devendermishrajio/oslo.messaging | 1 | 8994 | <filename>oslo_messaging/_drivers/zmq_driver/client/publishers/zmq_dealer_publisher.py
# Copyright 2015 Mirantis, 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
#
# ... | 1.90625 | 2 |
coba/environments/filters.py | mrucker/banditbenchmark | 0 | 8995 | import pickle
import warnings
import collections.abc
from math import isnan
from statistics import mean, median, stdev, mode
from abc import abstractmethod, ABC
from numbers import Number
from collections import defaultdict
from itertools import islice, chain
from typing import Hashable, Optional, Sequence, Union, Ite... | 2.5 | 2 |
python/cuml/preprocessing/LabelEncoder.py | egoolish/cuml | 7 | 8996 | <gh_stars>1-10
#
# Copyright (c) 2019, NVIDIA 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 2.859375 | 3 |
cleaning.py | jhamrick/cogsci-proceedings-analysis | 0 | 8997 | <filename>cleaning.py
import re
import difflib
import pandas as pd
import numpy as np
from nameparser import HumanName
from nameparser.config import CONSTANTS
CONSTANTS.titles.remove("gen")
CONSTANTS.titles.remove("prin")
def parse_paper_type(section_name):
section_name = section_name.strip().lower()
if sect... | 2.890625 | 3 |
quem_foi_para_mar_core/migrations/0004_auto_20200811_1945.py | CamilaBodack/template-projeto-selecao | 1 | 8998 | <filename>quem_foi_para_mar_core/migrations/0004_auto_20200811_1945.py
# Generated by Django 3.1 on 2020-08-11 19:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quem_foi_para_mar_core', '0003_auto_20200811_1944'),
]
operations = [
migration... | 1.570313 | 2 |
examples/tinytag/fuzz.py | MJ-SEO/py_fuzz | 0 | 8999 | from pythonfuzz.main import PythonFuzz
from tinytag import TinyTag
import io
@PythonFuzz
def fuzz(buf):
try:
f = open('temp.mp4', "wb")
f.write(buf)
f.seek(0)
tag = TinyTag.get(f.name)
except UnicodeDecodeError:
pass
if __name__ == '__main__':
fuzz()
| 2.25 | 2 |