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 |
|---|---|---|---|---|---|---|
crimsobot/cogs/mystery.py | the-garlic-os/crimsoBOT | 0 | 12763351 | import asyncio
import discord
from discord.ext import commands
from crimsobot.bot import CrimsoBOT
from crimsobot.utils import tarot
from crimsobot.utils import tools as c
from crimsobot.utils.tarot import Deck, Suit
class Mystery(commands.Cog):
def __init__(self, bot: CrimsoBOT):
self.bot = bot
@c... | 2.640625 | 3 |
sr/app/middleware/ebay.py | Vyto96/SRP | 2 | 12763352 | from flask import jsonify, redirect, request, session
from . import middle
import requests, os
from urllib.parse import unquote, quote
@middle.route('/ebay/get_token', methods=['POST', 'GET'])
def ebay_auth():
url = os.environ.get('EBAY_RUNAME')
return redirect(url)
@middle.route('/ebay/get_token/response... | 2.71875 | 3 |
preprocess_stamp_aug_zebra.py | AlamiMejjati/neurips18_hierchical_image_manipulation | 0 | 12763353 | import os
import glob
from shutil import copy2
from PIL import Image
import json
import numpy as np
import argparse
import shutil
from skimage import io
from tqdm import tqdm
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
eli... | 2.3125 | 2 |
backend/kale/tests/assets/kfp_dsl/pipeline_parameters_and_metrics.py | adamjm/kale | 0 | 12763354 | import kfp.dsl as dsl
import json
import kfp.components as comp
from collections import OrderedDict
from kubernetes import client as k8s_client
def create_matrix(d1: int, d2: int):
pipeline_parameters_block = '''
d1 = {}
d2 = {}
'''.format(d1, d2)
block1 = '''
import numpy as np
'''
... | 2.140625 | 2 |
VPhys_MET.py | JCCPort/Tests | 0 | 12763355 | <filename>VPhys_MET.py
import pandas as pd
import numpy as np
import scipy as sc
import math
import numba as nb | 1.289063 | 1 |
image_registration/matrix.py | nehagoyal1994/mito | 0 | 12763356 | <gh_stars>0
import cv2, math, imutils
import numpy as np
import os
def matrixHomographyAligned(ptsA, ptsB, img, tmp, maskImg, maskTmp):
# compute the homography matrix between the two sets of matched points
(H, mask) = cv2.findHomography(ptsA, ptsB, method=cv2.RANSAC)
# use the homography matrix ... | 2.859375 | 3 |
psp/caget.py | slaclab/psp | 0 | 12763357 | <reponame>slaclab/psp<filename>psp/caget.py<gh_stars>0
#!/usr/bin/env python
import pyca
from Pv import Pv
import sys
import time
from options import Options
def caget(pvname):
pv = Pv(pvname)
pv.connect(1.)
pv.get(False, 1.)
pv.disconnect()
return pv.value
if __name__ == '__main__':
options = Optio... | 2.203125 | 2 |
app/__init__.py | rilder-almeida/projeto_case_enfase | 0 | 12763358 | from .core import get_dataset
| 1.03125 | 1 |
src/main.py | chilin0525/model-layer-profiling | 0 | 12763359 | from . import argv
import os
import sys
import json
import csv
from . import dlprof_parser
from .show_gpu_info import show_gpu
from .profiling_command import *
def to_dict(result):
tmp = dict()
tmp["summary"] = list()
for i in result:
tmp["summary"].append(
i.to_dict()
)
re... | 2.78125 | 3 |
stix2/v20/vocab.py | frank7y/cti-python-stix2 | 277 | 12763360 | """
STIX 2.0 open vocabularies and enums
"""
ATTACK_MOTIVATION_ACCIDENTAL = "accidental"
ATTACK_MOTIVATION_COERCION = "coercion"
ATTACK_MOTIVATION_DOMINANCE = "dominance"
ATTACK_MOTIVATION_IDEOLOGY = "ideology"
ATTACK_MOTIVATION_NOTORIETY = "notoriety"
ATTACK_MOTIVATION_ORGANIZATIONAL_GAIN = "organizational-gain"
ATTA... | 1.765625 | 2 |
chat/discord/discordprivatemessagingserver.py | squahtx/hal9000 | 0 | 12763361 | from base import InternedCollection
from base import InternedNamedCollection
from chat import ChatServer
from .discordchatchannel import DiscordChatChannel
from .discorduser import DiscordUser
class DiscordPrivateMessagingServer(ChatServer):
def __init__(self, chatService, client):
super(DiscordPrivateMess... | 2.546875 | 3 |
ipfe/data.py | michaelborck/ipfe | 3 | 12763362 | <filename>ipfe/data.py
"""Additional test images.
For more images, see
- http://sipi.usc.edu/database/database.php
"""
import numpy as np
from scipy import ndimage
from skimage.io import imread
import os.path as _osp
data_dir = _osp.abspath(_osp.dirname(__file__)) + "/data"
def load(f):
"""Load an image file... | 2.5 | 2 |
null_model.py | CSB-IG/BioNetworkInference_ModularAnalysis | 0 | 12763363 | #written by <NAME>
import sys
import itertools
import random
import math
import networkx as nx
def gnp_random_graph(p, diccionario, m, directed=False):
if directed:
G=nx.DiGraph()
else:
G=nx.Graph()
G.add_nodes_from(diccionario)
if p<=0:
return G
if p>=1:
return nx.complete_graph... | 3.03125 | 3 |
guiding.py | StarlightHunter/galaxydslr | 0 | 12763364 | """
PHD2 guider helper
"""
from thirdparty.phd2guider import Guider as PHD2Guider
class GuiderHelper:
guider = None
def connect(self, hostname="localhost"):
if self.guider is None:
self.guider = PHD2Guider(hostname)
self.guider.Connect()
def disconnect(self):
if... | 2.671875 | 3 |
django/utils/migration_helpers.py | Haakenlid/tassen | 16 | 12763365 | from django.core import serializers
from django.db import connection
from psycopg2 import sql
def reset_primary_key_index(table, col='id'):
"""Sets the postgres primary key index to one larger than max"""
query = sql.SQL(
'''SELECT setval(
pg_get_serial_sequence(%(table)s, %(col)s),
... | 2.453125 | 2 |
SourceCode/Module13/PartB/taxi.py | hackettccp/CIS106SampleCode | 2 | 12763366 | <reponame>hackettccp/CIS106SampleCode
#Imports the Bus and Car object
from bus import Bus
from car import Car
"""
Taxi Object.
"""
#Class Header
class Taxi(Bus, Car) :
#Initializer
def __init__(self, make_in, model_in, year_in, riders_in , doors_in) :
Bus.__init__(self, make_in, model_in, year_in, riders_in)... | 3.03125 | 3 |
pycbio/hgdata/binnerSA.py | diekhans/read-through-analysis | 0 | 12763367 | # Copyright 2006-2012 <NAME>
""" Version of Binner class that works with sqlalchemy
"""
from .rangeFinder import Binner
from sqlalchemy import and_, or_
class BinnerSA(Binner):
"""generate sqlalchemy query to find overlapping ranges using bin numbers"""
@staticmethod
def getOverlappingSqlExpr(seqCol, binC... | 2.703125 | 3 |
dctorch/functional.py | GallagherCommaJack/dctorch | 0 | 12763368 | import torch
import scipy.fft
import numpy as np
from functools import lru_cache
@lru_cache()
def compute_dct_mat(n: int, device: str, dtype: torch.dtype) -> torch.Tensor:
m = scipy.fft.dct(np.eye(n), norm="ortho")
return torch.tensor(m, device=device, dtype=dtype)
@lru_cache()
def compute_idct_mat(n: int, ... | 2.28125 | 2 |
htmlmin/tests/test_decorator.py | Embed-Engineering/django-htmlmin | 389 | 12763369 | <filename>htmlmin/tests/test_decorator.py
# Copyright 2013 django-htmlmin authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
from django.test.client import Client
class TestDecorator(unittest.TestCase):
@classmetho... | 2.640625 | 3 |
merge.py | willyrv/SSPSC_vs_StSI | 1 | 12763370 | <gh_stars>1-10
#!/usr/bin/env python
OUTPUT_FILENAME = "output"
TOTAL_OF_FILES = 2
if __name__ == "__main__":
# make an array of files of size 100
results = []
for i in range(1, TOTAL_OF_FILES+1):
a = open("./{}{}.txt".format(OUTPUT_FILENAME, i), 'r')
text = a.read()
a.close()
... | 2.671875 | 3 |
virtualEnvironment/lib/python2.7/site-packages/twine/cli.py | tnkteja/myhelp | 0 | 12763371 | <filename>virtualEnvironment/lib/python2.7/site-packages/twine/cli.py
# Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | 2.15625 | 2 |
exe0403.py | juniorpedroso/Curso-Intensivo-de-Python | 0 | 12763372 | # Exercício 4.3 - List Comprehensions
numbers = [value for value in range(1, 21)]
print(numbers) | 3.46875 | 3 |
pygimli/physics/SIP/siptools.py | baender/gimli | 224 | 12763373 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pygimli functions for dc resistivity / SIP data."""
# TODO Please sort the content into SIP package!
import pylab as P
import numpy as N
import pygimli as pg
from pygimli.utils import rndig
def astausgleich(ab2org, mn2org, rhoaorg):
"""shifts ... | 2.3125 | 2 |
xmlutil/__init__.py | yangaound/xmlutil | 0 | 12763374 | # -*- coding: utf-8 -*-
'''
Source:
https://github.com/yangaound/xmlutil
Created on 2016年12月24日
@author: albin
'''
import re
import abc
import itertools
from collections import defaultdict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import petl
try:
... | 2.40625 | 2 |
examples/__init__.py | gelijergensen/PermutationImportance | 4 | 12763375 | <gh_stars>1-10
"""These are just examples of using the various methods in PermutationImportance"""
| 1.140625 | 1 |
explorebg/explore_auth/forms.py | bvoytash/Quiz-Application | 0 | 12763376 | <gh_stars>0
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, UsernameField
from importlib._common import _
UserModel = get_user_model()
class SignUpForm(UserCreationForm):
class Meta:
model = UserModel
... | 2.21875 | 2 |
config.py | the-data-science-union/dsu-mlpp | 0 | 12763377 | import os
from os.path import join, dirname
from dotenv import load_dotenv
from pymongo import MongoClient
import pymysql.cursors
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
client = MongoClient('localhost', 27017, username='admin', password="<PASSWORD>")
sql_client = lambda db: pymysql.co... | 2.09375 | 2 |
xiuhong_ms_hbond_code/Stable-MCCE/bin/pymccelib.py | caixiuhong/Develop-MCCE | 0 | 12763378 | <reponame>caixiuhong/Develop-MCCE
#!/usr/bin/env python
import logging
class Env:
def __init__(self):
# hard code values
self.tpl = {}
self.atomnames = {}
self.radius = {}
self.charge = {}
return
def load_ftpl(self, fname):
"""Load a ftpl file"""
... | 2.8125 | 3 |
Trading_Strategies/ML/GA_ESN.py | mikimaus78/ml_monorepo | 51 | 12763379 | <reponame>mikimaus78/ml_monorepo
import pandas as pd
import numpy as np
from Features import *
def fitness(S, T, Close) :
F = pd.Series(0.0, index=Close.index)
if S.count() == 0:
print "No signal to evaluate"
return 1e10
for i in range(len(T)) :
if (i == 0) or (i == len(T)-1): con... | 2.46875 | 2 |
pai-management/k8sPaiLibrary/maintaintool/docker-config-update.py | luoch/pai | 2 | 12763380 | <filename>pai-management/k8sPaiLibrary/maintaintool/docker-config-update.py
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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... | 1.789063 | 2 |
Finals Practice/23.py | ikramulkayes/Python_season2 | 0 | 12763381 | <filename>Finals Practice/23.py
def func(word):
word = word.split(", ")
dic = {"Magic":[],"Normal":[]}
for elm in word:
decide = ""
first = elm[0]
first = int(first)
sum1 = 0
for sval in elm[1::]:
sum1 += int(sval)
if first == sum1:
... | 4.0625 | 4 |
elib/strings.py | MasterEnderman/EnderLib | 1 | 12763382 | from elib import *
class strings(enderlib):
pass
class stringsUnification(strings):
pass
class stringsUnificationSettings(stringsUnification):
head = """#priority {}
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;
import crafttweaker.liquid.ILiquidDefinition;
import crafttweak... | 2.28125 | 2 |
Aula 21 funcoes parte 2 exe 01.py | luizgarcindo/exercicio-curso-gustavo-guanabara | 0 | 12763383 | <filename>Aula 21 funcoes parte 2 exe 01.py
def contador(i,f,p):
"""
Faz a contagem e mostra na tela
:param i: inicio da contagem
:param f: fim da contagem
:param p: passo da contagem
:return: sem retorno
"""
c=i
while c<=f:
print(f'{c} ', end='')
c +=p
print('F... | 3.765625 | 4 |
psgan/solver.py | liuyaohua2017/PSGAN | 0 | 12763384 | <reponame>liuyaohua2017/PSGAN<filename>psgan/solver.py
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
import os.path as osp
pwd = osp.split(osp.realpath(__file__))[0]
import time
import datetime
import torch
from torch import nn
from torchvision.transforms import ToPILImage
from torchvision.utils import save_i... | 1.820313 | 2 |
pyPack/HTML_constantes.py | slozano54/projetDNB | 1 | 12763385 | <reponame>slozano54/projetDNB
#!/usr/bin/python3
#-*- coding: utf8 -*-
# @author : <NAME>
"""
Générer les parties communes aux fichiers HTML.
On met les constantes dans des chaînes.
"""
pass
docTypeHead = (
"""
<!doctype html>
<html lang=\"fr\">
<head>
<meta charset=\"UTF-8\">
<meta http-equiv="conten... | 2.03125 | 2 |
03_linked_list.py | mwizasimbeye11/algorithms_in_python | 1 | 12763386 | <filename>03_linked_list.py<gh_stars>1-10
class Node:
def __init__(self, data):
self.data = data # Assign the data here
self.next = None # Set next to None by default.
class LinkedList:
def __init__(self):
self.head = None
# Display the list. Linked list traversal.
def display... | 4.28125 | 4 |
evalto/reducer/reducer.py | jsoldani/ship-to | 0 | 12763387 | import os
import errno
import sys
from pyswip import Prolog
# function for reducing a topology to a term "l(type,dir,term1,term2)"
def reduce(outputFile):
# load Prolog program "reducer"
prolog = Prolog()
prolog.consult("prolog/reducer.pl")
# check well-formedness
violating = list(prolog.query("vi... | 2.796875 | 3 |
docsbox/docs/tasks.py | Harshad2294/docsbox | 0 | 12763388 | import os
import shutil
import datetime
from pylokit import Office
from wand.image import Image
from tempfile import NamedTemporaryFile, TemporaryDirectory
from rq import get_current_job
from docsbox import app, rq
from docsbox.docs.utils import make_zip_archive, make_thumbnails
@rq.job(timeout=app.config["REDIS_... | 2.609375 | 3 |
apps/consultants/urls.py | kradalby/kavik | 0 | 12763389 | from django.conf.urls import patterns, include, url
urlpatterns = patterns('apps.consultants.views',
url(r'^maillist/$', 'maillist', name='maillist'),
url(r'^vcf/$', 'vcf', name='vcf'),
url(r'^maillist/(?P<team_id>[0-9]{2}|(tl))/$', 'maillist', name='maillist'),
)
| 1.679688 | 2 |
actions/video.py | paulomcnally/pi-voice | 1 | 12763390 | <reponame>paulomcnally/pi-voice
import subprocess
class Video:
@staticmethod
def run():
subprocess.run(['sh', '/home/pi/pi-voice/actions/video.sh'])
| 2.046875 | 2 |
papermerge/core/serializers/content_type.py | papermerge/papermerge-core | 45 | 12763391 | <filename>papermerge/core/serializers/content_type.py
from django.contrib.auth.models import ContentType
from rest_framework_json_api import serializers
class ContentTypeSerializer(serializers.ModelSerializer):
class Meta:
model = ContentType
resource_name = 'content-types'
fields = ('id... | 1.703125 | 2 |
code/KL_UCB/KL_UCB.py | christopher-salomon-smith/vip-mab | 0 | 12763392 | <filename>code/KL_UCB/KL_UCB.py
import numpy as np
import scipy.stats as sps
import matplotlib.pyplot as plt
import math
class KL_UCB:
''' Representation of a single agent bandit problem and a method to run the KL_UCB algorithm on this problem
Attributes
----------
T: The number of time st... | 3.28125 | 3 |
src/test.py | MasayukiNagai/VersUS | 2 | 12763393 | # test script
import os
import logging
from Handlers.SeqHandler import *
from Handlers.ClinVarHandler import *
from Handlers.BLASTHandler import *
from Handlers.CADDHandler import *
from Handlers.VEPHandler import *
from Handlers.FileHandler import *
from VersUS import *
gene_file = './data/gene/HumanEnzWithEC.csv'
se... | 2.109375 | 2 |
checkAllEps.py | stummyhurt/noTBA-scripterx | 2 | 12763394 | import asyncio
from helpers import get_db
import importlib
import json
import logging
import sys
from datetime import datetime
from os import path
from queue import Queue
import requests
from alive_progress import alive_bar
from checkEp import check_episode
dir = path.split(path.abspath(__file__))[0]
# logging setu... | 2.28125 | 2 |
packageopt/repositories/implementations/vola_repo.py | nspostnov/for-article-optimal-position-liquidation | 0 | 12763395 | from ..abstract_base_classes import RepoABC
from ...models.vola import Vola
__all__ = ['VolaRepo']
class VolaRepo(RepoABC):
def __init__(self, volatablecruder):
self._volatablecruder = volatablecruder
def get(self, key):
vola = Vola()
vola.set_key(key)
return self._volatabl... | 2.359375 | 2 |
Exercises/grade_determiner.py | Peabody29/Python_Projects-ST | 0 | 12763396 | """This program takes a score between 0.0 and 1.0 and
returns an appropriate grade for score inputted"""
try:
grade = float(input('Enter your score: '))
if grade < 0.6:
print('Your score', grade, 'is F')
elif 0.6 <= grade <= 0.7:
print('Your score', grade, 'is D')
elif 0.7 <= grade <= 0.... | 4.34375 | 4 |
Cloudfn/semana_scrapper.py | orangebacked/GCP_references | 0 | 12763397 | import requests
from lxml import html
import pandas as pd
import datetime
from lxml import etree
import google.cloud.storage
import re
from google.cloud import bigquery
import html as hhhh
from functools import reduce
def scrapping(article):
r1 = requests.get('https://www.semana.com{}'.format(artic... | 2.953125 | 3 |
app/config.py | RyanHartje/base_flask | 0 | 12763398 | # You can gen a bcrypt hash here:
## http://bcrypthashgenerator.apphb.com/
pwhash = 'bcrypt'
# You can generate salts and other secrets with openssl
# For example:
# $ openssl rand -hex 16
# 1ca632d8567743f94352545abe2e313d
salt = "<PASSWORD>"
secret_key = 'fe65757e00193b8bc2e18444fa51d873'
mongo_db = 'mydata... | 1.6875 | 2 |
data/yaml2json.py | six-two/react_cv | 0 | 12763399 | <filename>data/yaml2json.py
#!/usr/bin/env python3
import json
import os
import sys
import time
# external: pip3 install PyYAML
import yaml
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
os.chdir(SCRIPT_DIR)
def readYaml(inputPath):
try:
with open(inputPath, "r") as inputStream:
ret... | 2.96875 | 3 |
opentelemetry-api/src/opentelemetry/_metrics/instrument.py | ekmixon/opentelemetry-python | 1 | 12763400 | # Copyright The OpenTelemetry 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 ... | 1.84375 | 2 |
books/dongbin-na/part3_greedy/greedy_1.py | livlikwav/Algorithms | 1 | 12763401 | <gh_stars>1-10
'''
* 오름차순이 이므로 max를 체크할 필요가 없다.
'''
N = int(input())
data = list(map(int, input().split()))
data.sort()
# debug
print(N)
print(data)
result = 0
max = 0
count = 0
for num in data:
if max == 0:
max = num
elif max < num:
max = num
count += 1
if max == count:
res... | 3.109375 | 3 |
plot_charts.py | anuprulez/similar_galaxy_tools | 2 | 12763402 | <gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
from pylab import *
from matplotlib_venn import venn2
import json
# Font close to Times New Roman
# https://mondaybynoon.com/linux-font-equivalents-to-popular-web-typefaces/
FONT_SIZE = 26
plt.rcParams["font.family"] = "FreeSerif"
plt.rc('text', usetex... | 2.546875 | 3 |
main/gdalwarp.py | crschmidt/labs-rectifier | 6 | 12763403 | <reponame>crschmidt/labs-rectifier<gh_stars>1-10
from ctypes import CDLL, Structure, c_char_p, c_double, c_void_p, c_int, pointer
try:
libgdal = CDLL("libgdal.so")
except OSError:
try:
libgdal = CDLL("libgdal1.so")
except OSError:
libgdal = CDLL("libgdal1.4.0.so.1")
libgdal.CPLGetLastError... | 2.203125 | 2 |
src/main/python/client/PythonClient.py | mfentler-tgm/sew5-simple-user-database-mfentler-tgm | 0 | 12763404 | #from clientController import ClientController
from client.clientController import ClientController
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
def main():
try:
app = QtWidgets.QApplication([])
controller = ClientController()
controller.show()
app.exec_()
except Except... | 2.328125 | 2 |
day1.py | willjrh/Advent-of-code-21 | 0 | 12763405 | import numpy as np
def day_1(file: str):
"""Read in day 1 part 1 input and count increasing values"""
with open(file) as f:
data_in = f.read()
# convert data to float
data = [float(i) for i in data_in.split()]
# Part 1
print(sum(np.diff(np.array(data)) > 0))
# Part 2
convolut... | 3.578125 | 4 |
wildlifecompliance/components/artifact/models.py | mintcoding/wildlifecompliance | 0 | 12763406 | from __future__ import unicode_literals
import logging
from django.db import models
from django.contrib.gis.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from django.db.models import Max
from django.utils.encoding import python_2_unicode_compatible
from ledger.accounts.models import EmailU... | 1.671875 | 2 |
examples/python/corepy/typecheck.py | airgiser/ucb | 1 | 12763407 | <gh_stars>1-10
#!/usr/bin/python
def displayNumType(val):
print val, 'is',
if isinstance(val, (int, long, float, complex)):
print 'a number of type:', type(val).__name__
else:
print 'not a number at all!'
displayNumType(23)
displayNumType(999999999999999999999L)
displayNumType(23.3)
displa... | 3.21875 | 3 |
examples/plotting/file/hover_glyph.py | g-parki/bokeh | 15,193 | 12763408 | from bokeh.models import HoverTool
from bokeh.plotting import figure, output_file, show
from bokeh.sampledata.glucose import data
x = data.loc['2010-10-06'].index.to_series()
y = data.loc['2010-10-06']['glucose']
# Basic plot setup
p = figure(width=800, height=400, x_axis_type="datetime",
tools="", toolbar... | 2.859375 | 3 |
shell-sort/python/main.py | NikitaKolotushkin/Basics-Algorithms | 0 | 12763409 | <filename>shell-sort/python/main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def shell_sort(list_: list) -> list:
"""Returns a sorted list, by shell sort method
:param list_: The list to be sorted
:type list_: list
:rtype: list
:return: Sorted list, by shell sort method
"""
half = l... | 4.21875 | 4 |
core/src/zeit/wochenmarkt/sources.py | rickdg/vivi | 5 | 12763410 | import zc.sourcefactory.contextual
import zc.sourcefactory.source
import zeit.cms.content.contentsource
import zeit.cms.content.sources
import zeit.wochenmarkt.interfaces
import zope.interface
import zope.schema.interfaces
class RecipeCategoriesSource(
zc.sourcefactory.contextual.BasicContextualSourceFactory)... | 1.71875 | 2 |
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteGPacket.py | bytesnake/Enzyme | 0 | 12763411 | from __future__ import print_function
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
def run_test_g_pa... | 1.96875 | 2 |
setup.py | danpeczek/ai-katie | 0 | 12763412 | import setuptools
import os
import re
with open("README.rst", "r", encoding="utf-8") as fh:
long_description = fh.read()
def load_version():
""" Loads a file content """
filename = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "katie", "__init__.py"))
with open(filename, "r... | 1.742188 | 2 |
src/model/bert/bert.py | Twitter-Fake/twitter-fake | 1 | 12763413 | from util import get_dataset
from sklearn.metrics import classification_report
import numpy as np
from keras.layers import Dense, Input, concatenate
from keras.models import Model
from keras import backend as K
def recall_m(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
po... | 2.421875 | 2 |
GUIfiles/ui_mainWindow.py | NicolasJacson/cam2ascii | 1 | 12763414 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'mainWindowWYIqrE.ui'
##
## Created by: Qt User Interface Compiler version 5.14.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
#########... | 1.835938 | 2 |
sapp/pipeline/base_parser.py | MLH-Fellowship/sapp | 1 | 12763415 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Abstract Parser for Zoncolan like output"""
import logging
import pprint
from collections import defaultdict
from typing import (
Any,... | 1.914063 | 2 |
src/2-initialize.py | abroniewski/DBLP-Research-Paper-Graph-Modeling | 0 | 12763416 | <reponame>abroniewski/DBLP-Research-Paper-Graph-Modeling
from utils import Neo4jConnection
import time
def delete_all_existing_nodes():
print(f"Deleting all existing nodes and edges.")
tic = time.perf_counter()
query_delete_all_existing_nodes = '''
MATCH (n) DETACH DELETE n
'''
conn.query(q... | 3.046875 | 3 |
MHD/FEniCS/StabNS/NSpreconditioner.py | wathen/PhD | 3 | 12763417 | import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy as np
from dolfin import tic, toc
class BaseMyPC(object):
def setup(self, pc):
pass
def reset(self, pc):
pass
def apply(self, pc, x, y):
raise NotImplementedError
def applyT(self, pc, x, y)... | 2.375 | 2 |
Core/Solvers/KDA/KDA_Solution_Class.py | zztcok/SNAC_PSNAC | 1 | 12763418 | <reponame>zztcok/SNAC_PSNAC
import sys
import os
from pyomo.environ import *
from pyomo.opt import SolverFactory
import itertools
from pyutilib.misc import Options
import time as timer
import pdb
import gc
import re
class KDA:
def __init__(self, model_data, solver, mipgap,solve_output, _opts, fixed_parameters={}, pen... | 2.28125 | 2 |
skoda/sm5_evaluation.py | mmalekzadeh/privacy-autoencoder | 18 | 12763419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in September 2017
@author: mmalekzadeh
"""
import numpy as np
from keras.models import model_from_json
from keras import backend as K
def mcor(y_true, y_pred):
#matthews_correlation
y_pred_pos = K.round(K.clip(y_pred, 0, 1))
y_pred_neg = 1 - y_... | 2.75 | 3 |
ctapipe/image/reducers.py | Pluto9th/ctapipe | 0 | 12763420 | """
Algorithms for the data volume reduction.
"""
from abc import abstractmethod
from ctapipe.core import Component
__all__ = [
'DataVolumeReducer',
]
class DataVolumeReducer(Component):
"""
Base component for data volume reducers.
Parameters
----------
config : traitlets.loader.Config
... | 2.59375 | 3 |
Code-Sleep-Python/Encryption-Techniques/AES/tables.py | shardul08/Code-Sleep-Python | 420 | 12763421 | sbox = [
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
0x04, 0xC7, 0x23, 0... | 1.023438 | 1 |
storm/base/pd.py | italiangrid/grinder-load-testsuite | 0 | 12763422 | <filename>storm/base/pd.py<gh_stars>0
from common import TestID, log_surl_call_result
from eu.emi.security.authn.x509.impl import PEMCredential
from exceptions import Exception
from jarray import array
from java.io import FileInputStream
from javax.net.ssl import X509ExtendedKeyManager
from net.grinder.plugin.http impo... | 1.976563 | 2 |
json_handling.py | e-diamond/ac-flowers | 0 | 12763423 | import json
class JSON:
@staticmethod
def readFromURL(url):
import requests
print("Downloading data...")
response = requests.get(url)
return json.loads(response.text)
@staticmethod
def readFromFile(filename):
file = open(filename, "r")
data = file.rea... | 3.390625 | 3 |
opyapi/schema/validators/validate_datetime.py | dkraczkowski/opyapi | 5 | 12763424 | from datetime import datetime
from typing import Optional
from opyapi.schema.errors import NotWithinMaximumBoundaryError
from opyapi.schema.errors import NotWithinMinimumBoundaryError
from opyapi.schema.errors import ValidationError
from opyapi.schema.formatters import format_datetime
def validate_datetime(
valu... | 3.03125 | 3 |
tests/test_parameterized_interface.py | DamonGeorge/Parameterized | 0 | 12763425 | import json
from enum import Enum
import pytest
from parameterized import ParameterizedInterface
@pytest.fixture
def example_enum():
class TestEnum(Enum):
ONE = 1
TWO = 2
THREE = 3
return TestEnum
class TestParameterizedInterface:
def test_abc(self, example_enum):
clas... | 2.625 | 3 |
telegraph/telenote.py | ds19991999/ONote | 2 | 12763426 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from .api import Telegraph
class TeleNote(Telegraph):
def __init__(self, access_token=None, reconnect_times=3, my_proxies=None,
timeout=5, author_name=None, short_name=None, author_url=None):
super().__init__(access_token, reconnect_times, my... | 2.703125 | 3 |
hw_5/util.py | YuguangTong/AY250-hw | 0 | 12763427 | <gh_stars>0
from urllib.request import urlopen
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
def is_number(s):
"""
check if a string represents an integer or float number
parameter
--------
s: a string
return
------
return True iff S represents a nu... | 3.546875 | 4 |
python/convergdb/athena.py | ray-pan-bci/convergdb | 10 | 12763428 | from convergdb_logging import *
from batch_control import *
from athena import *
from cloudwatch import *
from glue import *
from s3 import *
from sns import *
from spark_partitions import *
from spark import *
from state import *
from string import Template
def initiate_athena_query(query, database, s3_output, regio... | 1.882813 | 2 |
Arase/MEPe/CalculatePADs.py | mattkjames7/Arase | 0 | 12763429 | <gh_stars>0
import numpy as np
from .Read3D import Read3D
from .GetPitchAngle import GetPitchAngle
import DateTimeTools as TT
import DateTimeTools as TT
from scipy.stats import binned_statistic
def CalculatePADs(Date,na=18,Verbose=True):
'''
Calculates a pitch angle distribution of the differential energy flux
data... | 2.28125 | 2 |
2021/day_10/solution.py | krother/advent_of_code | 3 | 12763430 | <reponame>krother/advent_of_code<gh_stars>1-10
"""
Syntax Scoring
https://adventofcode.com/2021/day/10
"""
MATCHES = {
'<': '>',
'(': ')',
'{': '}',
'[': ']'
}
ERROR_SCORE = {
')': 3,
']': 57,
'}': 1197,
'>': 25137,
}
AUTOCOMPLETE_SCORE = {
')': 1,
']': 2,
'}': 3,
'>... | 3.375 | 3 |
SLpackage/private/pacbio/pythonpkgs/pypeflow/lib/python2.7/site-packages/pypeflow/do_task.py | fanglab/6mASCOPE | 5 | 12763431 | #! python2.7
from . import do_support, util
from .io import fix_relative_symlinks
import argparse
import copy
import importlib
import inspect
import json
import logging
import os
import pprint
import re
import string
import sys
import time
from pipes import quote # shlex in python3.3+
DONE = 'done'
STATUS = 'status'
TI... | 2.5625 | 3 |
src/comparators/compare_functions/__init__.py | asd249180/similarity_and_matching | 0 | 12763432 | <gh_stars>0
from src.comparators.compare_functions.cka import cka
from src.comparators.compare_functions.cca import cca
from src.comparators.compare_functions.l2 import l2
from src.comparators.compare_functions.ps_inv import ps_inv
from src.comparators.compare_functions.correlation import correlation
from src.comparato... | 2.265625 | 2 |
lab_manager/urls.py | FlorianJa/Lab-Manager | 0 | 12763433 | <reponame>FlorianJa/Lab-Manager<filename>lab_manager/urls.py<gh_stars>0
from django.conf.urls import url
from lab_manager import views
app_name = 'lab_manager'
urlpatterns = [
url(r'^api/printers$', views.fablab_printers),
url(r'^api/printers/(?P<pk>[0-9]+)$', views.fablab_printers_detail),
url(r'^api/fil... | 1.773438 | 2 |
tests/test_beatmap.py | Vergenter/OsuPyParser | 0 | 12763434 | <reponame>Vergenter/OsuPyParser
from osupyparser import OsuFile
import time
import unittest
class TestBeatmap(unittest.TestCase):
def test_basic_functionality(self):
start = time.perf_counter()
data = OsuFile("tests//testv2.osu").parse_file()
end = time.perf_counter()
self.assertTr... | 2.671875 | 3 |
silx/opencl/test/test_sparse.py | physwkim/silx | 2 | 12763435 | <filename>silx/opencl/test/test_sparse.py
#!/usr/bin/env python
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2018-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this so... | 1.578125 | 2 |
fiat/metric.py | chamhoo/Severstal | 0 | 12763436 | <filename>fiat/metric.py
"""
auther: leechh
metric - large is better
"""
import tensorflow as tf
def dice():
def metric(y_true, y_pred):
smooth = 1e-8
y_true = tf.keras.backend.flatten(y_true)
y_pred = tf.keras.backend.flatten(y_pred)
intersection = tf.reduce_sum(tf.multiply(y_tru... | 2.515625 | 3 |
module/output_block.py | sc0ttms/SE-TFCN | 9 | 12763437 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from torchinfo import summary
class OutputBlock(nn.Module):
def __init__(self, num_channels):
super().__init__()
self.num_channels = num_channels
self.net = nn.Sequential(nn.Conv2d(self.num_channels[0], self.num_c... | 3.03125 | 3 |
local_server/esconector.py | IoT-Vigilant/iotvigilant-cybercamp-2018 | 2 | 12763438 | <filename>local_server/esconector.py
#!/usr/bin/python3
"""
###########################################
# IoT Vigilant Orchestrator
###########################################
"""
from elasticsearch import Elasticsearch
import time
es_host = "localhost"
es_port = 9200
es_index = "rawdata"
es_index_ml = "mloutput"
es_... | 2.125 | 2 |
corehq/ex-submodules/couchforms/const.py | dimagilg/commcare-hq | 471 | 12763439 |
TAG_TYPE = "#type"
TAG_XML = "#xml"
TAG_VERSION = "@version"
TAG_UIVERSION = "@uiVersion"
TAG_NAMESPACE = "@xmlns"
TAG_NAME = "@name"
TAG_META = "meta"
TAG_FORM = 'form'
ATTACHMENT_NAME = "form.xml"
MAGIC_PROPERTY = 'xml_submission_file'
RESERVED_WORDS = [TAG_TYPE, TAG_XML, TAG_VERSION, TAG_UIVERSION, TAG_NAMESPA... | 1.039063 | 1 |
rlschool/metamaze/test.py | HaojieSHI98/RLSchool | 169 | 12763440 | import gym
import sys
import rlschool.metamaze
def test_2d_maze(max_iteration):
print("Testing 2D Maze...")
maze_env = gym.make("meta-maze-2D-v0", enable_render=False)
cell_scale = 9
task = maze_env.sample_task(cell_scale=cell_scale)
maze_env.set_task(task)
iteration = 0
while iteration < m... | 3.53125 | 4 |
code/default/x_tunnel/local/heroku_front/host_manager.py | wuyongwen/XX-Net | 0 | 12763441 | import random
import time
from front_base.host_manager import HostManagerBase
class HostManager(HostManagerBase):
def __init__(self, logger, appids=[]):
self.logger = logger
self.appids = appids
def set_appids(self, appids):
self.appids = appids
def get_sni_host(self, ip):
... | 2.421875 | 2 |
astropy/cosmology/__init__.py | jvictor42/astropy | 0 | 12763442 | <filename>astropy/cosmology/__init__.py<gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
""" astropy.cosmology contains classes and functions for cosmological
distance measures and other cosmology-related calculations.
See the `Astropy documentation
<https://docs.astropy.org/en/latest/cosmolo... | 1.640625 | 2 |
lib/matplotlib/testing/compare.py | stefanv/matplotlib | 1 | 12763443 | <filename>lib/matplotlib/testing/compare.py
#=======================================================================
""" A set of utilities for comparing results.
"""
#=======================================================================
import matplotlib
from matplotlib.testing.noseclasses import ImageComparisonFai... | 2.796875 | 3 |
pubsub/tests/unit/pubsub_v1/subscriber/test_policy_thread.py | alercunha/google-cloud-python | 1 | 12763444 | <gh_stars>1-10
# Copyright 2017, Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 1.851563 | 2 |
escnn/nn/modules/nonlinearities/fourier_quotient.py | QUVA-Lab/escnn | 4 | 12763445 | <reponame>QUVA-Lab/escnn
from escnn.group import *
from escnn.gspaces import *
from escnn.nn import FieldType
from escnn.nn import GeometricTensor
from ..equivariant_module import EquivariantModule
import torch
import torch.nn.functional as F
from typing import List, Tuple, Any
import numpy as np
__all__ = ["Quot... | 2.125 | 2 |
caia/circrequests/steps/query_source_url.py | umd-lib/caia | 0 | 12763446 | <reponame>umd-lib/caia
import logging
from typing import List
from caia.circrequests.circrequests_job_config import CircrequestsJobConfig
from caia.core.http import http_get_request
from caia.core.step import Step, StepResult
logger = logging.getLogger(__name__)
class QuerySourceUrl(Step):
"""
Queries the s... | 2.140625 | 2 |
cla_public/apps/base/tests/test_healthchecks.py | farrepa/cla_public | 0 | 12763447 | import unittest
import mock
import requests
from cla_public import app
from cla_public.apps.base import healthchecks
class DiskSpaceHealthcheckTest(unittest.TestCase):
@mock.patch("os.statvfs")
def test_disk_space_check_reports_on_available_and_total_space(self, stat_mock):
stat_mock.return_value.f_b... | 2.59375 | 3 |
venv/Lib/site-packages/gevent/tests/test__monkey_ssl_warning3.py | asanka9/Quession-Discussion-App-Socket.Io-NLP | 13 | 12763448 | <reponame>asanka9/Quession-Discussion-App-Socket.Io-NLP
import unittest
import warnings
import sys
# All supported python versions now provide SSLContext.
# We subclass without importing by name. Compare with
# warning2.py
import ssl
class MySubclass(ssl.SSLContext):
pass
# This file should only have this one te... | 2.3125 | 2 |
sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/connectivity_collection.py | yanfa317/azure-sdk-for-python | 0 | 12763449 | <filename>sdk/managednetwork/azure-mgmt-managednetwork/azure/mgmt/managednetwork/models/connectivity_collection.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in ... | 1.84375 | 2 |
kikola/templatetags/json_tags.py | playpauseandstop/kikola | 4 | 12763450 | """
=============================
kikola.templatetags.json_tags
=============================
Template filter to dumps Python var to JSON in templates.
Installation
============
Just add ``kikola`` to ``INSTALLED_APPS`` var of your project settings.
Filters
=======
jsonify
-------
Custom template filter ``jsonify... | 2.53125 | 3 |