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 |
|---|---|---|---|---|---|---|
auth/api/urls.py | gabrielangelo/revelo-wallet | 0 | 25000 | <filename>auth/api/urls.py
from django.conf.urls import url
from rest_framework_jwt.views import (
obtain_jwt_token,
refresh_jwt_token,
verify_jwt_token
)
urlpatterns = [
url(r'^obtain-token', obtain_jwt_token),
url(r'^token-refresh/', refresh_jwt_token),
url(r'^api-token-verify/', verify_j... | 1.742188 | 2 |
test/check_multiset.py | constantinpape/paintera_tools | 1 | 25001 | import nifty.tools as nt
import numpy as np
import z5py
from elf.label_multiset import deserialize_multiset
from tqdm import trange
def check_serialization(mset1, mset2):
if len(mset1) != len(mset2):
print("Serialization sizes disagree:", len(mset1), len(mset2))
return False
if not np.array_... | 2.421875 | 2 |
jp.atcoder/abc119/abc119_c/11972856.py | kagemeka/atcoder-submissions | 1 | 25002 | <gh_stars>1-10
import sys
from itertools import product
n, *abc = map(int, sys.stdin.readline().split())
*l, = map(int, sys.stdin.read().split())
def main():
cand = []
for p in product([0, 1, 2, 3], repeat=n):
group = [[] for _ in range(4)]
for i in range(n):
group[p[i]]... | 2.453125 | 2 |
projects/Gan/gan.py | Bingwen-Hu/hackaway | 0 | 25003 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision.transforms import ToTensor
from torchvision.datasets import MNIST
from vis_util import visual_mnist
##### settings
x_dim = 28 * 28 # size of mnist digit
z_dim = 100 # random noise
h_dim = 128 ... | 3.1875 | 3 |
apps/orgs/views.py | hzde0128/edu_online | 11 | 25004 | from django.shortcuts import render, redirect, reverse
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q
from django.views.generic import View
from .models import OrgInfo, CityInfo, TeacherInfo
from operations.models import UserLove
# Create your views here.
clas... | 2.265625 | 2 |
PictureColoring/MyUtils.py | chiihero/DeepLearning | 0 | 25005 | from keras.callbacks import TensorBoard,EarlyStopping,TerminateOnNaN,ReduceLROnPlateau,ModelCheckpoint
import os
import sys
import tensorflow as tf
import keras.backend.tensorflow_backend as KTF
file_abspath = os.path.abspath(sys.argv[0]) # exe所在文件地址
location = os.path.dirname(file_abspath) # exe所在文件夹目录地址
tbCallB... | 2 | 2 |
tests/analysis/test_executor.py | shapiromatron/bmds-server | 1 | 25006 | <gh_stars>1-10
from copy import deepcopy
from bmds.bmds3.constants import ContinuousModelIds, DichotomousModelIds
from bmds.bmds3.types.priors import PriorClass
from bmds_server.analysis.executor import AnalysisSession
class TestAnalysisSession:
def test_default_dichotomous(self, bmds3_complete_dichotomous):
... | 2.28125 | 2 |
1094.py | gabzin/beecrowd | 3 | 25007 | <reponame>gabzin/beecrowd
tot=coe=rat=sap=0
for i in range(int(input())):
n,s=input().split()
n=int(n)
tot+=n
if s=='C':coe+=n
elif s=='R':rat+=n
elif s=='S':sap+=n
print(f"Total: {tot} cobaias\nTotal de coelhos: {coe}\nTotal de ratos: {rat}\nTotal de sapos: {sap}")
p=(coe/tot)*100
print("Percen... | 3.390625 | 3 |
extras/createTestBlocksForReadBlkUpdate.py | Manny27nyc/BitcoinArmory | 505 | 25008 | from sys import path
path.append('..')
from armoryengine import *
TheBDM.setBlocking(True)
TheBDM.setOnlineMode(True)
if not os.path.exists('testmultiblock'):
os.mkdir('testmultiblock')
fout = []
fout.append([0, 101, 'testmultiblock/blk00000.dat'])
fout.append([0, 102, 'testmultiblock/blk00000_test1.dat']) #... | 2.078125 | 2 |
dashboard/migrations/0034_auto_20201226_2150.py | BDALab/GENEActiv-sleep-analyses-system | 0 | 25009 | # Generated by Django 3.1.1 on 2020-12-26 20:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0033_auto_20201226_2148'),
]
operations = [
migrations.RenameField(
model_name='sleepnight',
old_name='data',
... | 1.796875 | 2 |
fear_greed_index/CNNFearAndGreedIndex.py | mcharipar/multi_tool_bot | 0 | 25010 | """Fear and Greed Index Class"""
__docformat__ = "numpy"
from matplotlib import pyplot as plt
from fear_greed_index import scrape_cnn
from fear_greed_index.FearAndGreedIndicator import FearAndGreedIndicator
class CNNFearAndGreedIndex:
"""CNN Fear and Greed Index
Attributes
----------
junk_bond_deman... | 2.953125 | 3 |
pyDEV/imagespic.py | wangzhihong911/py37 | 0 | 25011 | <filename>pyDEV/imagespic.py<gh_stars>0
#!/usr/bin/dev python
# coding=utf-8
#让爬虫等待几秒
from pyDEV import BsDI, ToolDI
from bs4 import BeautifulSoup;
import os
import urllib;
#创建入口url
url_web = "http://48et.com/pic/12/"
html_pag = '';
for i in range(1,1001):
if i > 1 :
html_pag='p_'+str(i)+'.html'
url_w... | 2.890625 | 3 |
models/van_der_waals.py | HARSHAL-IITB/spa-design-tool | 0 | 25012 | <reponame>HARSHAL-IITB/spa-design-tool
#! /usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015, EPFL Reconfigurable Robotics Laboratory,
# <NAME>, <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documenta... | 1.132813 | 1 |
party/migrations/0002_auto__chg_field_party_primaries_date__chg_field_party_qualifying_date_.py | daonb/okqa | 0 | 25013 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Party.primaries_date'
db.alter_column('party_party', 'primaries_date', self.gf('django.db... | 2.296875 | 2 |
modules/boost/simd/arithmetic/script/average.py | timblechmann/nt2 | 2 | 25014 | [ ## this file was manually modified by jt
{
'functor' : {
'description' : [ "The function always returns a value of the same type than the entry.",
"Take care that for integers the value returned can differ by one unit",
"from \c ceil((a+b)/2.0) o... | 1.742188 | 2 |
conductor_helpers/workflow.py | metamorph-inc/conductor-mdao | 0 | 25015 | <reponame>metamorph-inc/conductor-mdao
from __future__ import print_function
from conductor.conductor import MetadataClient, WorkflowClient
class Workflow(object):
def __init__(self, name, description=None):
self.tasks = {}
self.inputs = {}
self.outputs = {}
self.connections = {}
... | 2.546875 | 3 |
vswitch/server.py | jvy1106/vswitch | 0 | 25016 | <filename>vswitch/server.py
'''super basic web server to start/stop and monitor virtual environments'''
import sys
import os
import logging
import web
import time
import argparse
from webpyutils import api
from webpyutils import APIServer
from vswitch import VirtualSwitch
#get project path from current file or venv it... | 2.5 | 2 |
vmware.py | Sbaljepa/get_esxi_host_info | 0 | 25017 | from con_esxi_host import *
from math import pow, ceil
class vmware:
def get_vm_info(self):
si = connect_to_host()
#global virtual
inv = si.RetrieveContent()
dc1 = inv.rootFolder.childEntity[0]
vmList = dc1.vmFolder.childEntity
virtual = []
for vm in... | 1.984375 | 2 |
src/code.py | aniketdashpute/Watermark-python | 0 | 25018 | <gh_stars>0
import numpy as np
import cv2
import matplotlib.pyplot as plt
from pathlib import Path
import glob2 as glob
import os
import sys
savedir = "./output/"
def AddWatermarkFolder(str_foldername, str_watermarkname, alpha1=1.0, alpha2=0.2):
path = str_foldername + '/*.png*'
for iter, path_name in enumera... | 2.921875 | 3 |
idfy_rest_client/models/person_person_information.py | dealflowteam/Idfy | 0 | 25019 | # -*- coding: utf-8 -*-
"""
idfy_rest_client.models.person_person_information
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
from idfy_rest_client.api_helper import APIHelper
class PersonPersonInformation(object):
"""Implementation of the 'Person.P... | 2.203125 | 2 |
deployer/logger.py | bwood/deployer | 1 | 25020 | import logging
import subprocess
# create logger
logger = logging.getLogger('simple_example')
logger.setLevel(logging.DEBUG)
# create console handler and set level to INFO
console_logger = logging.StreamHandler()
console_logger.setLevel(logging.INFO)
# create formatter
formatter = logging.Formatter('%(asctime)s - %(... | 2.453125 | 2 |
home/views.py | felixyin/qdqtrj_website | 0 | 25021 | <reponame>felixyin/qdqtrj_website
from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.views.decorators.gzip import gzip_page
from django.views.generic import DetailView
from about.models import AboutItem
from blog.models import Arti... | 2.046875 | 2 |
lib/scaler/preprocessing_data/data_preprocessor.py | thangbk2209/mfea_autoscaling | 0 | 25022 | import numpy as np
from pandas import read_csv
import pandas as pd
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from config import *
from lib.preprocess.read_data import DataReader
from lib.scaler.preprocessing_data.data_normalizer import DataNormalizer
class DataPreprocessor:... | 2.84375 | 3 |
devel/.private/px_comm/lib/python2.7/dist-packages/px_comm/msg/_CameraInfo.py | akshastry/Neo_WS | 1 | 25023 | <reponame>akshastry/Neo_WS
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from px_comm/CameraInfo.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
import std_msgs.msg
class Camera... | 1.585938 | 2 |
search/models.py | IATI/new-website | 4 | 25024 | <gh_stars>1-10
from itertools import chain
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from wagtail.core.models import Page
from wagtail.search.models import Query
from about.models import AboutPage, AboutSubPage, CaseStudyPage, HistoryPage, PeoplePage
fr... | 2.265625 | 2 |
gluoncv/model_zoo/action_recognition/r2plus1d.py | AND2797/gluon-cv | 1 | 25025 | # pylint: disable=arguments-differ,unused-argument,line-too-long
"""R2Plus1D, implemented in Gluon. https://arxiv.org/abs/1711.11248.
Code partially borrowed from https://github.com/pytorch/vision/blob/master/torchvision/models/video/resnet.py."""
__all__ = ['R2Plus1D', 'r2plus1d_resnet18_kinetics400',
'r2... | 2.203125 | 2 |
run.py | jsicot/idref2zotero | 1 | 25026 | #!/usr/bin/env python3
import retrieve_author_ppn as autppn
import retrieve_references as refs
import zot_helpers as pyzot
from itertools import islice
researchers = autppn.constructOutput('test.csv')
autppn.writeCsv('out.csv', researchers)
for researcher in researchers:
ppn = researcher['ppn']
creator_name... | 2.703125 | 3 |
setup.py | walwe/autolabel | 1 | 25027 | #!/usr/bin/env python
from pkg_resources import get_distribution
from setuptools import setup, find_packages
with open("README.md", "r") as f:
long_description = f.read()
version = get_distribution("autolabel").version
setup(
packages=find_packages(),
install_requires=[
'click',
'more-ite... | 1.523438 | 2 |
desafio_005_antecessor_e_sucessor.py | VagnerGit/PythonCursoEmVideo | 0 | 25028 | <reponame>VagnerGit/PythonCursoEmVideo<filename>desafio_005_antecessor_e_sucessor.py
"""
Exercício Python 5:
Faça um programa que leia um número Inteiro e
mostre na tela o seu sucessor e seu antecessor.
"""
n = int(input('digite um numero inteiro '))
#ant = n-1
#post = n+1
#print('O antecessor de {} é {} e posterior é... | 3.046875 | 3 |
checkov/version.py | jmeredith16/checkov | 0 | 25029 | <reponame>jmeredith16/checkov
version = '2.0.706'
| 0.867188 | 1 |
test/meshes.py | jtpils/optimesh | 1 | 25030 | <reponame>jtpils/optimesh
import os.path
import numpy
from scipy.spatial import Delaunay
import meshio
from meshplex import MeshTri
def simple0():
#
# 3___________2
# |\_ 2 _/|
# | \_ _/ |
# | 3 \4/ 1 |
# | _/ \_ |
# | _/ \_ |
# |/ 0 \|
# 0--------... | 2.125 | 2 |
odym/modules/test/DSM_test_known_results.py | DominikWiedenhofer/ODYM | 3 | 25031 | <filename>odym/modules/test/DSM_test_known_results.py
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 11 16:19:39 2014
"""
import os
import sys
import imp
# Put location of
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..\\..')) + '\\modules') # add ODYM module directory to system path
#... | 2.234375 | 2 |
tox_docker/tests/util.py | tkdchen/tox-docker | 0 | 25032 | import os
from docker.models.containers import Container
import docker
import pytest
from tox_docker.config import runas_name
def find_container(instance_name: str) -> Container:
# TODO: refactor this as a pytest fixture
# this is running in a child-process of the tox instance which
# spawned the conta... | 2.484375 | 2 |
equipment/viewsets.py | aschrist/WebServerAndClient | 0 | 25033 | <gh_stars>0
from django.core.exceptions import PermissionDenied
from rest_framework import viewsets, mixins
from rest_framework.decorators import action
from rest_framework.response import Response
from emstrack.mixins import UpdateModelUpdateByMixin, BasePermissionMixin
from equipment.models import EquipmentItem, Eq... | 1.960938 | 2 |
HLTrigger/Configuration/python/HLT_75e33/paths/HLT_DoublePFPuppiJets128_DoublePFPuppiBTagDeepCSV_2p4_cfi.py | PKUfudawei/cmssw | 1 | 25034 | <reponame>PKUfudawei/cmssw
import FWCore.ParameterSet.Config as cms
from ..modules.hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi import *
from ..modules.hltDoublePFPuppiJets128Eta2p4MaxDeta1p6_cfi import *
from ..modules.hltDoublePFPuppiJets128MaxEta2p4_cfi import *
from ..modules.l1tDoublePFPuppiJet112offMaxEta2p4_cfi i... | 0.957031 | 1 |
convert_m2.py | Alex92rus/ErrorDetectionProject | 1 | 25035 | <reponame>Alex92rus/ErrorDetectionProject
def extract_to_m2(filename, annot_triples):
"""
Extracts error detection annotations in m2 file format
Args:
filename: the output m2 file
annot_triples: the annotations of form (sentence, indexes, selections)
"""
with open(filename, 'w+') as ... | 3.578125 | 4 |
Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py | VincentWei/mdolphin-core | 6 | 25036 | <reponame>VincentWei/mdolphin-core<gh_stars>1-10
# Copyright (c) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above cop... | 1.484375 | 1 |
tark/transcript/models.py | Ensembl/tark | 5 | 25037 | <gh_stars>1-10
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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
htt... | 2.015625 | 2 |
scripts/facebook_account_scraping.py | nvanderperren/social-media-archiving | 0 | 25038 | #!usr/bin/env python3
# -*- coding: utf-8 -*-
#
# @author <NAME>
#
# get posts of a fb page, group or account
# returns a json lines files with a line for each post
#
from argparse import ArgumentParser
from datetime import date, datetime
from facebook_scraper import get_posts
from json import dumps, JSONEncoder
clas... | 3.03125 | 3 |
ked/gui/ked.py | idealtitude/ked | 0 | 25039 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
class Ked:
def __init__(self, app_path, ufile=None):
glade_layout = f'{app_path}/data/ked_layout.glade'
self.builder = gtk.Builder()
self.builder.add_from_file(glade_layout)
win = self.builder.get_obje... | 2.28125 | 2 |
patchy/__init__.py | peternara/graph-based-image-classification-gcn | 44 | 25040 | <reponame>peternara/graph-based-image-classification-gcn
from .patchy import PatchySan
from .helper.labeling import labelings,\
scanline,\
betweenness_centrality
from .helper.neighborhood_assembly import neighborhood_assemblies,\
... | 1.132813 | 1 |
analysis/202106--uncertainty_vs_flux/compare_images.py | rsiverd/ultracool | 0 | 25041 | #!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 :
#
# Compare an image file and its associated uncertainty image.
#
# <NAME>
# Created: 2021-06-03
# Last modified: 2021-06-03
#--------------------------------------------------------------------------
#*********************************... | 2.03125 | 2 |
tests/utils/mock_server.py | ant-lastline/cb-lastline-connector | 2 | 25042 | import logging
import os
try:
import simplejson as json
except ImportError:
import json
from flask import Flask, request, make_response, Response
from cStringIO import StringIO
import zipfile
def get_mocked_server(binary_directory):
mocked_cb_server = Flask('cb')
files = os.listdir(binary_directory... | 2.4375 | 2 |
neural_networks/softmax_loss.py | Yao-Shao/Maching-Learning-only-with-Numpy | 1 | 25043 | <gh_stars>1-10
import numpy as np
def softmax_loss(in_, label):
'''
The softmax loss computing process
inputs:
in_ : the output of previous layer, shape: [number of images, number of kinds of labels]
label : the ground true of these images, shape: [1, number of images]
ou... | 3.328125 | 3 |
alertmanager_telegram/config.py | medeirosjrm/alertmanager-telegram | 5 | 25044 | <reponame>medeirosjrm/alertmanager-telegram<filename>alertmanager_telegram/config.py
import os
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID")
if not TELEGRAM_CHAT_ID:
raise ValueError("No TELEGRAM_CHAT_ID set for application")
TELEGRAM_TOKEN = os.environ.get("TELEGRAM_TOKEN")
if not TELEGRAM_TOKEN:
rai... | 1.828125 | 2 |
data-processing/tests/test_parse_tex.py | rishamsidhu/scholar-reader | 0 | 25045 | from common.parse_tex import (
BeginDocumentExtractor,
BibitemExtractor,
DocumentclassExtractor,
EquationExtractor,
MacroExtractor,
PlaintextExtractor,
)
from common.types import MacroDefinition
from entities.sentences.extractor import SentenceExtractor
def test_extract_plaintext_with_newlines... | 2.9375 | 3 |
appexemple/__main__.py | yoannmos/Inupdater-AppExemple | 0 | 25046 | <gh_stars>0
import sys
from pathlib import Path
from appexemple import __version__
print(
f"""
Hello you are in App Exemple version {__version__}\n
sys.argv[-1] : {sys.argv[-1]}\n
Path().cwd() : {Path().cwd()}\n
Path(__file__) : {Path(__file__)},\n
"""
)
input("Press [Enter] to quit.")
| 1.851563 | 2 |
{{cookiecutter.repo_slug}}/tests/unit/user/test_managers.py | ikhomutov/cookiecutter-shmango | 0 | 25047 | <filename>{{cookiecutter.repo_slug}}/tests/unit/user/test_managers.py
import pytest
pytestmark = pytest.mark.django_db
class TestUserManagers:
def test_create_user(self, django_user_model, faker):
email = faker.email()
password = faker.password()
user = django_user_model.objects.create_u... | 2.25 | 2 |
sqlalchemy/sqlalchemy-0.3.6+codebay/test/base/dependency.py | nakedible/vpnease-l2tp | 5 | 25048 | from testbase import PersistTest
import sqlalchemy.topological as topological
import unittest, sys, os
from sqlalchemy import util
# TODO: need assertion conditions in this suite
class DependencySorter(topological.QueueDependencySorter):pass
class DependencySortTest(PersistTest):
def assert_sort(s... | 2.8125 | 3 |
tensorcircuit/backends.py | refraction-ray/tensorcircuit | 21 | 25049 | <gh_stars>10-100
"""
backend magic inherited from tensornetwork
"""
from typing import Union, Text, Any, Optional, Callable, Sequence
from functools import partial
from scipy.linalg import expm
import numpy as np
import warnings
from tensornetwork.backends.tensorflow import tensorflow_backend
from tensornetwork.backe... | 1.9375 | 2 |
venv/lib/python3.7/site-packages/webdriver_manager/microsoft.py | wayshon/pylogin | 0 | 25050 | from webdriver_manager.driver import EdgeDriver, IEDriver
from webdriver_manager.manager import DriverManager
from webdriver_manager import utils
class EdgeDriverManager(DriverManager):
def __init__(self, version=None,
os_type=utils.os_name()):
super(EdgeDriverManager, self).__init__()
... | 2.359375 | 2 |
examples/plot_replay_experiment.py | dataiku-research/cardinal | 17 | 25051 | <gh_stars>10-100
"""
Replay and experiment
=====================
In a previous example, we have shown how experiments can be resumed.
Cardinal also allows for experiments to be replayed, meaning that
one can save intermediate data to be able to run analysis on the
experiment without having to retrain all the models. L... | 3.046875 | 3 |
cryspy/B_parent_classes/cl_3_data.py | eandklahn/cryspy | 0 | 25052 | """Parent class DataN."""
import os
import os.path
from warnings import warn
from typing import Union, NoReturn
from pycifstar import Data, to_data
from cryspy.A_functions_base.function_1_markdown import md_to_html
from cryspy.A_functions_base.function_1_objects import \
get_functions_of_objet, get_table_html_for_... | 2.515625 | 3 |
vivisect/tests/vivbins.py | mubix/vivisect | 1 | 25053 | import os
import unittest
def require(f):
def skipit(*args, **kwargs):
raise unittest.SkipTest('VIVBINS env var...')
if os.getenv('VIVBINS') == None:
return skipit
return f
| 2.296875 | 2 |
hackerearth/Algorithms/Restoring trees/solution.py | ATrain951/01.python-com_Qproject | 4 | 25054 | <reponame>ATrain951/01.python-com_Qproject
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
... | 3.15625 | 3 |
src/machine_learning/collaborative_filtering/__init__.py | przemek1990/machine-learning | 0 | 25055 | __author__ = 'przemyslaw.pioro'
| 0.957031 | 1 |
Sorting/Sorts.py | niranjan09/DataStructures_Algorithms | 0 | 25056 | import time
def swap(arr, i , j):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def selection_sort(arr):
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if(arr[i] > arr[j]):
swap(arr, i, j)
return arr
def bubble_sort(arr):
swapped = True
while(swapped == True):
swapped = False
for i in ran... | 4.0625 | 4 |
__init__.py | Moviesbazar/Pdiskuploader_bot | 1 | 25057 | <filename>__init__.py
#!/usr/bin/env python3
"""
Source Code of Pdiskuploaderbot
"""
| 0.984375 | 1 |
Beam/TextAnalysis/setup.py | Balaviknesh/YelpHelp | 0 | 25058 | from setuptools import setup
from setuptools.command.install import install as _install
class Install(_install):
def run(self):
_install.do_egg_install(self)
import nltk
nltk.download("popular")
setup(
cmdclass={'install': Install},
install_requires=['nltk'],
setup_requires=[... | 1.96875 | 2 |
code/test3/1.py | Bc-Gg/Algorithms | 8 | 25059 | <reponame>Bc-Gg/Algorithms
'''
author : bcgg
可惜时间爆了
其实写的很好
中间很多可以改进
'''
ans = 0
def merge(arr, l, m, r):
global ans
n1 = m - l + 1
n2 = r - m
L = [0] * (n1)
R = [0] * (n2)
for i in range(0, n1):
L[i] = arr[l + i]
for j in range(0, n2):
R[j] = arr[m + 1 + j]
i = 0
j = ... | 3.234375 | 3 |
Python/sir_cost.py | Wasim5620/SIRmodel | 26 | 25060 | <reponame>Wasim5620/SIRmodel
# cost function for the SIR model for python 2.7
# <NAME> (<EMAIL>)
# <NAME> (<EMAIL>) -7-9-17
import numpy as np
import sir_ode
from scipy.stats import poisson
from scipy.stats import norm
from scipy.integrate import odeint as ode
def NLL(params, data, times): #negative log likelihood
... | 2.84375 | 3 |
restler/unit_tests/test_basic_functionality_end_to_end.py | Ayudjj/mvp | 1 | 25061 | <reponame>Ayudjj/mvp
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
""" Runs functional tests, which invoke the RESTler engine and check the RESTler output logs
for correctness.
When new baseline logs are necessary due to known breaking changes in the logic, a run that
matches the test shoul... | 2.3125 | 2 |
conf_site/api/tests/test_conference.py | pydata/conf_site | 13 | 25062 | from django.urls import reverse
from rest_framework import status
from conf_site.api.tests import ConferenceSiteAPITestCase
class ConferenceSiteAPIConferenceTestCase(ConferenceSiteAPITestCase):
def test_conference_api_anonymous_user(self):
response = self.client.get(reverse("conference-detail"))
... | 2.3125 | 2 |
backend/app/app/crud/__init__.py | luovkle/FastAPI-Note-Taking | 0 | 25063 | from .crud_user import crud_user # noqa: F401
from .crud_note import crud_note # noqa: F401
| 1.046875 | 1 |
fhirbug/constants.py | VerdantAI/fhirbug | 8 | 25064 |
# Audit Event Outcomes
AUDIT_SUCCESS = "0"
AUDIT_MINOR_FAILURE = "4"
AUDIT_SERIOUS_FAILURE = "8"
AUDIT_MAJOR_FAILURE = "12"
| 1.117188 | 1 |
python_materials/web-server-s3.py | C-Lizzo14/CS488S21 | 2 | 25065 | <filename>python_materials/web-server-s3.py
# Python3.7+
import socket
import json
HOST, PORT = '', 1600
def parse_request(text):
request_line = text.splitlines()[0]
request_line = request_line.rstrip(b'\r\n')
requests = request_line.split()
params_dict = {}
if requests[0] == b'POST':
req... | 2.90625 | 3 |
task_queue/management/commands/run_scheduler.py | 2600box/harvest | 9 | 25066 | import asyncio
from django.core.management.base import BaseCommand
from Harvest.utils import get_logger
from task_queue.scheduler import QueueScheduler
logger = get_logger(__name__)
class Command(BaseCommand):
help = "Run the queue consumer"
def handle(self, *args, **options):
QueueScheduler().run... | 2.015625 | 2 |
waateax/users/migrations/0004_auto_20200910_1516.py | hendu25/waatea | 4 | 25067 | # Generated by Django 3.0.10 on 2020-09-10 13:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_user_mobile_phone'),
]
operations = [
migrations.AlterField(
model_name='user',
name='mobile_phone',
... | 1.648438 | 2 |
examples/example2.py | alenaizan/resp | 10 | 25068 | <reponame>alenaizan/resp<filename>examples/example2.py<gh_stars>1-10
import psi4
import resp
# Initialize two different conformations of ethanol
geometry = """C 0.00000000 0.00000000 0.00000000
C 1.48805540 -0.00728176 0.39653260
O 2.04971655 1.37648153 0.25604810
H 3.06429978 1.37151670 0.52641124
... | 2.296875 | 2 |
data_processing/test.py | FMsunyh/keras-retinanet | 0 | 25069 | # -*- coding: utf-8 -*-
# @Time : 5/31/2018 9:20 PM
# @Author : sunyonghai
# @File : test.py
# @Software: ZJ_AI
from multiprocessing import Pool, Lock, Value
import os
tests_count = 80
lock = Lock()
counter = Value('i', 0) # int type,相当于java里面的原子变量
def run(fn):
global tests_count, lock, counter
wi... | 2.84375 | 3 |
neurofire/models/hed/fusionhed.py | nasimrahaman/neurofire | 9 | 25070 | <gh_stars>1-10
import torch.nn as nn
import torch
import torch.nn.functional as F
from .hed import HED
class FusionHED(nn.Module):
def __init__(self, in_channels=3,
out_channels=1, dilation=1,
conv_type_key='default',
block_type_key='default',
ou... | 2.09375 | 2 |
examples/filter_simple.py | uvm-plaid/dduo-python | 4 | 25071 | <reponame>uvm-plaid/dduo-python<filename>examples/filter_simple.py
import sys
sys.path.append("../")
import duet
from duet import pandas as pd
epsilon = 1.0
alpha = 10
df = pd.read_csv("test.csv")
with duet.RenyiFilter(9,1.0):
noisy_count = duet.renyi_gauss(df.shape[0], α = alpha, ε = epsilon)
print(f'NoisyC... | 2.09375 | 2 |
tartaruga espiral.py | talitadeoa/head-first-code | 0 | 25072 | import turtle
tortuguinha = turtle.Turtle()
tortuguinha.shape('turtle')
tortuguinha.color('red')
tortugo = turtle.Turtle()
tortugo.shape('turtle')
tortugo.color('blue')
def faz_quadradin(the_turtle):
for i in range(0,4):
the_turtle.forward(100)
the_turtle.right(90)
def faz_espiral(the_turtle):
... | 3.546875 | 4 |
rechun/dl/multimodelcontext.py | alainjungo/reliability-challenges-uncertainty | 56 | 25073 | <filename>rechun/dl/multimodelcontext.py
import torch
import common.trainloop.context as ctx
import common.trainloop.factory as factory
import common.model.management as mgt
import common.utils.torchhelper as th
class MultiModelTorchTrainContext(ctx.TorchTrainContext):
def __init__(self, device_str) -> None:
... | 2.046875 | 2 |
ALGOs/Perceptron/logic_gates.py | iamharshit/ML_works | 1 | 25074 | #The input to the gate can only be 0 or 1
'''
Single Layer Perceptrons
'''
def AND_perceptron(x1,x2):
w1, w2, t = 1, 1, 2
return w1*x1 + w2*x2 >=t
def OR_perceptron(x1,x2):
w1, w2, t = 1, 1, 1
return w1*x1 + w2*x2 >=t
def AND_perceptron(x1):
w1, t = -1, 0
return w1*x1 >=t
'''
Multi Layer Per... | 3.6875 | 4 |
Analysis/Metric_Impact_Hijacking/give_metric_ases_from_clusters.py | cgeorgitsis/ai4netmon | 0 | 25075 | <filename>Analysis/Metric_Impact_Hijacking/give_metric_ases_from_clusters.py
import pandas as pd
import numpy as np
import random, os, json
from collections import defaultdict
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans, SpectralClustering
from scipy.spatial.distance import pdist, squareform... | 2.734375 | 3 |
kingbird/tests/unit/objects/test_base.py | starlingx-staging/stx-kingbird | 0 | 25076 | # Copyright (c) 2015 Ericsson AB.
# 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 applicab... | 2.171875 | 2 |
src/tests/tests.py | veleritas/mychem.info | 1 | 25077 | <filename>src/tests/tests.py
import sys
import os
# Add this directory to python path (contains nosetest_config)
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from biothings.tests import BiothingTest
from biothings.tests.settings import NosetestSettings
ns = NosetestSettings()
class {% nosetest_setti... | 1.796875 | 2 |
hardware/camera/drivers.py | smartenv/smartcan | 0 | 25078 | import tempfile
from abc import ABC, abstractmethod
from time import sleep, time
from hardware.camera import Photo, Resolution
class CameraDriver(ABC):
@abstractmethod
def capture(self) -> Photo:
pass
class PiCameraDriver(CameraDriver):
def __init__(self, resolution=Resolution(1024, 768), iso... | 3.203125 | 3 |
src/sms_verifier/settings.py | ArieLevs/sms-verifier-backend | 0 | 25079 | <gh_stars>0
"""
Django settings for sms_verifier project.
Generated by 'django-admin startproject' using Django 2.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
... | 2.078125 | 2 |
test/test_termCombinationLib.py | ozanozisik/orsum | 1 | 25080 | <reponame>ozanozisik/orsum
from termCombinationLib import initializeTermSummary, applyRule, recurringTermsUnified, supertermRepresentsLessSignificantSubterm, subtermRepresentsLessSignificantSimilarSuperterm, subtermRepresentsSupertermWithLessSignificanceAndLessRepresentativePower, commonSupertermInListRepresentsSubterm... | 1.90625 | 2 |
bindings/pydeck/pydeck/exceptions/__init__.py | marsupialmarcos/deck.gl | 0 | 25081 | <filename>bindings/pydeck/pydeck/exceptions/__init__.py
from .exceptions import PydeckException # noqa
| 1.203125 | 1 |
notebooks/tpot_exported_pipeline.py | rsouza/FGV_Intro_DS | 38 | 25082 | <reponame>rsouza/FGV_Intro_DS
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline, make_union
from tpot.builtins import StackingEstimator
from xgboost import XGBClassifier
from sklearn.preprocessing import FunctionTransformer
from copy i... | 2.828125 | 3 |
own/NER_torch/ner_dataset.py | felixdittrich92/DeepLearning-pyTorch | 1 | 25083 | <filename>own/NER_torch/ner_dataset.py
import os
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
from sklearn.model_selection import train_test_split
from torch.utils.data import DataLoader, Dataset
from transformers import BertTokenizerFast
os.environ["TOKENIZERS_PARALLELISM"] = "t... | 2.546875 | 3 |
wikilabels/tests/test_stats_routes.py | notconfusing/wikilabels | 0 | 25084 | <gh_stars>0
from .routes_test_fixture import app # noqa
def test_stats(client):
assert client.get("/stats/")._status_code == 200
| 1.429688 | 1 |
show_history.py | FairyDevicesRD/statistical-quality-estimation | 0 | 25085 | <reponame>FairyDevicesRD/statistical-quality-estimation
import argparse
import logging
import pathlib
import re
import warnings
import numpy as np
import dirichlet
from sklearn.linear_model import LogisticRegression
from optimize import load_config, load_data, get_loglikelihood, get_mse
logger = logging.getLogger()
... | 2.265625 | 2 |
src/backend/web/handlers/apidocs.py | ofekashery/the-blue-alliance | 0 | 25086 | <filename>src/backend/web/handlers/apidocs.py
from backend.common.decorators import cached_public
from backend.web.profiled_render import render_template
@cached_public(timeout=int(60 * 60 * 24 * 7))
def apidocs_trusted_v1() -> str:
template_values = {
"title": "Trusted APIv1",
"swagger_url": "/sw... | 2.0625 | 2 |
tests/common/devices/vmhost.py | emilmih/sonic-mgmt | 132 | 25087 | from tests.common.devices.base import AnsibleHostBase
class VMHost(AnsibleHostBase):
"""
@summary: Class for VM server
For running ansible module on VM server
"""
def __init__(self, ansible_adhoc, hostname):
AnsibleHostBase.__init__(self, ansible_adhoc, hostname)
@property
def e... | 2.265625 | 2 |
normatrix/normatrix/plugged/__init__.py | romainpanno/NorMatrix | 0 | 25088 | <gh_stars>0
"""All plugging called to check norm for a C file."""
__all__ = [
"columns",
"comma",
"function_line",
"indent",
"libc_func",
"nested_branches",
"number_function",
"parenthesis",
"preprocessor",
"snake_case",
"solo_space",
"statements",
"trailing_newline",... | 1.25 | 1 |
sc2monitor/controller.py | 2press/sc2monitor | 1 | 25089 | """Control the sc2monitor."""
import asyncio
import logging
import math
import time
from datetime import datetime, timedelta
from operator import itemgetter
import aiohttp
import sc2monitor.model as model
from sc2monitor.handlers import SQLAlchemyHandler
from sc2monitor.sc2api import SC2API
logger = logging.getLogge... | 2.53125 | 3 |
impermagit/repo.py | tomheon/impermagit | 0 | 25090 | <reponame>tomheon/impermagit
from contextlib import contextmanager
import errno
import os
import shutil
import subprocess
import tempfile
class GitExeException(Exception):
"""
Thrown when the external git exe doesn't return a 0.
"""
pass
class Repo(object):
"""
Interface to a git repo.
... | 2.765625 | 3 |
chaospy/distributions/copulas/__init__.py | lblonk/chaospy | 0 | 25091 | r"""
Copulas are a type dependency structure imposed on independent variables to
achieve to more complex problems without adding too much complexity.
To construct a copula one needs a copula transformation and the
Copula wrapper::
>>> dist = chaospy.Iid(chaospy.Uniform(), 2)
>>> copula = chaospy.Gumbel(dist, ... | 3.1875 | 3 |
documentation/examples/policy_aggregation.py | oscardavidtorres1994/cadCAD | 1 | 25092 | import pandas as pd
from tabulate import tabulate
from cadCAD.configuration import append_configs
from cadCAD.configuration.utils import config_sim
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
from cadCAD import configs
# Policies per Mechanism
def p1m1(_g, step, sH, s):
return {'policy1': ... | 2.140625 | 2 |
lib/Agent.py | mbhatt1/Mofosploit | 6 | 25093 | <gh_stars>1-10
from lib.imports import *
from lib.Constants import *
from lib.Environment import *
from lib.ML_Modules import ML_Nnet
from lib.parameter_server import Server as ParameterServer
'''
Single Agent
'''
class Agent:
def __init__(self, name, parameter_server):
self.brain = ML_NNet(name, paramet... | 2.28125 | 2 |
wrt/wrt-packertool-android-tests/test.py | tiwanek/crosswalk-test-suite | 0 | 25094 | <reponame>tiwanek/crosswalk-test-suite
import sys, os, os.path, time, shutil
import commands
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement as SE
import metacomm.combinatorics.all_pairs2
all_pairs = metacomm.combinatorics.all_pairs2.... | 2.484375 | 2 |
bigcommerce/resources/options.py | sebaacuna/bigcommerce-api-python | 0 | 25095 | from .base import *
class Options(ListableApiResource, CreateableApiResource, UpdateableApiResource, DeleteableApiResource):
resource_name = 'options'
def values(self, id=None):
if id:
return OptionValues.get(self.id, id, connection=self._connection)
else:
return Optio... | 2.328125 | 2 |
itscsapp/admision/models/__init__.py | danyRivC/itscsapp | 0 | 25096 | <reponame>danyRivC/itscsapp<filename>itscsapp/admision/models/__init__.py
from .admision_carrer import *
from .admision_event import *
| 1.132813 | 1 |
paperswithcode/models/evaluation/result.py | lambdaofgod/paperswithcode-client | 1 | 25097 | from datetime import datetime
from typing import Optional
from tea_client.models import TeaClientModel
class Result(TeaClientModel):
"""Evaluation table row object.
Attributes:
id (str): Result id.
best_rank (int, optional): Best rank of the row.
metrics (dict): Dictionary of metrics... | 2.421875 | 2 |
tests/api_resources/test_porting_order.py | rjkboyle/telnyx-python | 35 | 25098 | from __future__ import absolute_import, division, print_function
import pytest
import telnyx
TEST_RESOURCE_ID = "f1486bae-f067-460c-ad43-73a92848f902"
class TestPortingOrder(object):
def test_is_listable(self, request_mock):
resources = telnyx.PortingOrder.list()
request_mock.assert_requested("... | 2.3125 | 2 |
tests/garage/replay_buffer/test_replay_buffer.py | Maltimore/garage | 1 | 25099 | <gh_stars>1-10
import numpy as np
from garage.replay_buffer import SimpleReplayBuffer
from tests.fixtures.envs.dummy import DummyDiscreteEnv
class TestReplayBuffer:
def test_add_transition_dtype(self):
env = DummyDiscreteEnv()
obs = env.reset()
replay_buffer = SimpleReplayBuffer(
... | 1.898438 | 2 |