max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/pybraw_ext/test_IBlackmagicRawFrame.py | anibali/pybraw | 2 | 12791151 | import numpy as np
import pytest
from numpy.testing import assert_allclose
from pybraw import _pybraw, verify
class CapturingCallback(_pybraw.BlackmagicRawCallback):
def ReadComplete(self, job, result, frame):
self.frame = frame
def ProcessComplete(self, job, result, processed_image):
self.pr... | 2 | 2 |
zadanka/zadanka.py | wrutkowski1000/wizualizacja-danych | 0 | 12791152 | <filename>zadanka/zadanka.py
class ciag_arytmetyczny:
global ciag
def Update(self):
self.ciag = [self.pierwsza_wart]
for i in range(self.ile_elementow - 1):
self.ciag.append(self.pierwsza_wart + self.roznica)
self.pierwsza_wart += self.roznica
def __init__(self, pier... | 3.359375 | 3 |
OldVersion.py | IHA114/PrNdOwN | 0 | 12791153 | #!/usr/bin/env python3
# Created By r2dr0dn
# Hd Video Downloader For PornHub
# Don't Copy The Code Without Giving The Credits Nerd
from __future__ import unicode_literals
try:
import os,sys,requests
import youtube_dl as dl
import validators as valid
from time import sleep as sl
from random import... | 2.453125 | 2 |
tests/test_mail.py | alex-oleshkevich/kupala | 8 | 12791154 | import pytest
from email.message import Message
from mailers import Email, InMemoryTransport, Mailer
from mailers.plugins.jinja_renderer import JinjaRendererPlugin
from pathlib import Path
from kupala.application import Kupala
from kupala.mails import send_mail, send_templated_mail
@pytest.mark.asyncio
async def tes... | 2.046875 | 2 |
binarysearch.io/subsequence_strings.py | mishrakeshav/Competitive-Programming | 2 | 12791155 | class Solution:
def solve(self, s1, s2):
# Write your code here
i = 0
if s1 == "":
return True
if s1 == s2:
return True
final = len(s1)-1
for s in s2:
if s == s1[i]:
i += 1
if i == final:
... | 3.453125 | 3 |
spectral.py | 17mcpc14/sna | 0 | 12791156 | <gh_stars>0
import numpy as np
import networkx as nx
import numpy.linalg as la
import scipy.cluster.vq as vq
import matplotlib.pyplot as plt
G = nx.karate_club_graph()
print("Node Degree")
for v in G:
print('%s %s' % (v, G.degree(v)))
nx.draw_circular(G, with_labels=True)
plt.show()
coord = nx.spring_layout(G,... | 2.4375 | 2 |
barcoderegression/__init__.py | jacksonloper/barcoderegression | 1 | 12791157 |
from . import parameters
from . import helpers
from . import updates
from . import simulations
from . import training
| 1.070313 | 1 |
urls.py | UM6SS-Bioinfo-team/Cov-MA | 0 | 12791158 | <reponame>UM6SS-Bioinfo-team/Cov-MA<gh_stars>0
from .views import *
from django.urls import path
from django.utils.translation import gettext_lazy as _
from rest_framework.authtoken.views import obtain_auth_token
app_name = 'covma'
urlpatterns = [
path("patient_list",patient_list,name= 'detail'),
path("p... | 1.703125 | 2 |
src/json_serializable_test.py | asokolsky/wan-monitor | 0 | 12791159 | <filename>src/json_serializable_test.py<gh_stars>0
#
#
#
from typing import List
import unittest
from json_serializable import JsonSerializable
class Animal( JsonSerializable ):
def __init__( s, species:str='', sound:str='', name:str='' ):
super().__init__()
s.name = name
s.sound = sound
... | 3.015625 | 3 |
tetraencoder/embed_dataset.py | TevenLeScao/tetraencoder | 0 | 12791160 | <reponame>TevenLeScao/tetraencoder
import argparse
from functools import partial
from multiprocess import set_start_method
from sentence_transformers import SentenceTransformer
from dataset_builders import GenWikiDataset, TRexDataset
from util import pair_sims_datasets_map
if __name__ == "__main__":
parser = arg... | 2.359375 | 2 |
tournament/migrations/0004_auto_20171202_0621.py | AfricaChess/lichesshub | 2 | 12791161 | <reponame>AfricaChess/lichesshub<filename>tournament/migrations/0004_auto_20171202_0621.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-02 06:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migr... | 1.703125 | 2 |
root/python/PythonTutorial/Py3CookBook/ch01/1.14.Sorting_Objects_Without_Native_Comparison_Support.py | ChyiYaqing/chyidlTutorial | 5 | 12791162 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# 1.14.Sorting_Objects_Without_Native_Comparison_Support.py
# ch01
#
# 🎂"Here's to the crazy ones. The misfits. The rebels.
# The troublemakers. The round pegs in the square holes.
# The ones who see things differently. They're not found
# of rules. And they have no re... | 3.3125 | 3 |
tests/test_output.py | domdfcoding/flake8-github-action | 1 | 12791163 | <reponame>domdfcoding/flake8-github-action
# 3rd party
import pytest
from coincidence.regressions import FileRegressionFixture, check_file_regression
from domdf_python_tools.paths import PathPlus
from flake8.main import cli # type: ignore
bad_code = PathPlus(__file__).parent / "bad_code.py"
def test_output(file_reg... | 2.0625 | 2 |
if- else condition/sum of even.py | sneh-pragya/LearningPrograming | 1 | 12791164 | //You are given an integer A, you need to find and return the sum of all the even numbers between 1 and A.
class Solution:
# @param A : integer
# @return an integer
def solve(self, A):
sum=0;
for i in range (1,A+1):
if (i%2==0):
sum+= i
... | 3.875 | 4 |
src/satyrus/satlib/source.py | pedromxavier/Satyrus3 | 1 | 12791165 | """
"""
# Future Imports
from __future__ import annotations
# Standard Library
import itertools as it
from pathlib import Path
class Source(str):
"""This source code object aids the tracking of tokens in order to
indicate error position on exception handling.
"""
LEXKEYS = {"lexpos", "chrpos", "line... | 3.09375 | 3 |
tests/test_tasks.py | oii/ogreserver | 0 | 12791166 | <filename>tests/test_tasks.py
from __future__ import absolute_import
from __future__ import unicode_literals
from contextlib import contextmanager
import datetime
from flask import appcontext_pushed, g
import mock
from ogreserver.models.ebook import Ebook
@contextmanager
def inject_db_session(app, db_session):
... | 2.265625 | 2 |
tests/test_docker.py | LaudateCorpus1/windlass | 4 | 12791167 | <reponame>LaudateCorpus1/windlass
#
# (c) Copyright 2018 Hewlett Packard Enterprise Development LP
#
# 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... | 1.960938 | 2 |
script.py | MishaVernik/ClickerHeroku | 0 | 12791168 | <gh_stars>0
from flask import Flask, request
import urllib.request
import requests
import time
from threading import Timer
app = Flask(__name__)
app.config['DEBUG'] = False
print("START __ 0001")
check_if_one = 0
what_now = 0
number_of_repeats = 0
sleeping_time = 0
link = ""
@app.route("/btn_find")
def get_ses():
... | 2.59375 | 3 |
src/data_manage/data_class/namespace_child.py | Amourspirit/ooo_uno_tmpl | 0 | 12791169 | <filename>src/data_manage/data_class/namespace_child.py
# coding: utf-8
from dataclasses import dataclass
@dataclass(frozen=True, eq=True)
class NamespaceChild:
namespace: str
sort: int = -1
def __lt__(self, other: object):
if not isinstance(other, NamespaceChild):
return NotImplement... | 2.390625 | 2 |
crawlers/the_muse_crawler.py | rpmoore8/job-crawler-and-classifier | 0 | 12791170 | import time
import requests
from config import levels, headers, cities
from db_utils.job import Job
from db_utils.db_methods import get_jobs_table, get_taken_ids
class TheMuseCrawler():
def __init__(self):
self.source = "themuse"
def scrape(self, city, insert_jobs_into_db = True):
jobs_table ... | 2.71875 | 3 |
datasets/check_utils.py | AkshatShetty101/dmm-8803 | 247 | 12791171 | import math
import time
import pickle
import sys
import os
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from datasets.data_utils import project_image_to_rect, compute_box_3d
def adjust_coord_for_view(points):
return points[:, [2, 0, 1]] * np.array([1, -1, -1])
def... | 2.453125 | 2 |
main.py | Night-Admin-Community/icq-offer-bot | 0 | 12791172 | from api.bot import Bot
import asyncio
TOKEN = "***.**********.**********:*********"
CHAT = "**********@chat.agent"
bot = Bot(token=TOKEN)
replics = {
"start": "Привет! С помощью этого бота ты можешь отправить материал в предложку каналов Night Admin Community!\nРазработчик: @night_admin\nНажми кнопку ниже для доба... | 2.296875 | 2 |
lonia/clustering.py | phanxuanphucnd/clustering | 2 | 12791173 | <reponame>phanxuanphucnd/clustering<gh_stars>1-10
import os
import torch
import random
import pickle
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Text, Any, Dict, Union, List
from transformers import AutoModel, AutoTokenizer
from sklearn.cluster import MiniBatchKMeans
from lonia.... | 2.171875 | 2 |
plugins/GPP.py | AlienExo/FListBot-Python- | 0 | 12791174 | #1dbdc6da34094db4e661ed43aac83d91
#Genuine People Personality Plugin v0.1
import traceback
import random
import re
from config import character
modules = ['traceback', 'random', 're']
request = re.compile('(could|can|would|might)(.*you)?(.*please)?(\?)?')
name = re.compile('({})[.,!\?:]?\s?'.format(character))
talk=... | 2.25 | 2 |
cisco/count_word.py | Akash671/coding | 0 | 12791175 | <reponame>Akash671/coding
s=str(input())
ans=[]
tmp=""
for i in s:
if i==" ":
ans.append(tmp)
tmp=""
else:
tmp+=i
ans.append(tmp)
ans2=[]
for i in ans:
if i.isdigit():
continue
else:
ans2.append(i)
#print(ans2)
ans3=[]
for a in ans2:
tmp=""
f=1
for j in range(len(a)-1):
if a[j]... | 3.328125 | 3 |
examples/indexer/python/search_transactions_paging.py | TheChronicMonster/docs | 92 | 12791176 | <reponame>TheChronicMonster/docs
# search_transactions_paging.py
import json
# requires Python SDK version 1.3 or higher
from algosdk.v2client import indexer
# instantiate indexer client
myindexer = indexer.IndexerClient(indexer_token="", indexer_address="http://localhost:8980")
nexttoken = ""
numtx = 1
# loop using... | 2.828125 | 3 |
modules/bullet.py | relrix/simplegame | 0 | 12791177 | from constants import *
from helper.spritesheet import *
class Bullet(pygame.sprite.Sprite):
""" This class represents the bullet . """
def __init__(self, sprite_sheet_data):
pygame.sprite.Sprite.__init__(self)
sprite_sheet = SpriteSheet(BULLET)
self.image = sprite_sheet.get_image(spr... | 3.234375 | 3 |
tests/test_utils.py | danielvdp/django-modeltrans | 31 | 12791178 | from django.test import TestCase
from django.utils.translation import override
from modeltrans.manager import transform_translatable_fields
from modeltrans.utils import (
build_localized_fieldname,
get_instance_field_value,
get_language,
get_model_field,
split_translated_fieldname,
)
from .app.mod... | 2.203125 | 2 |
anvil/sub_rig_templates/bird_wing.py | AndresMWeber/Anvil | 3 | 12791179 | <filename>anvil/sub_rig_templates/bird_wing.py<gh_stars>1-10
from limb import Limb
class BirdWing(Limb):
BUILT_IN_META_DATA = Limb.BUILT_IN_META_DATA.merge({'name': 'wing'}, new=True)
| 1.820313 | 2 |
adventofcode/day21/test_day21.py | EikaNN/AdventOfCode2017 | 2 | 12791180 | <filename>adventofcode/day21/test_day21.py
import unittest
from day21.day21 import Day21
class Day21Test(unittest.TestCase):
def test_part_one(self):
rules = [
'../.# => ##./#../...',
'.#./..#/### => #..#/..../..../#..#'
]
self.assertEqual(12, Day21('\n'.join(rules... | 2.859375 | 3 |
scrape_windbags.py | munjeli/windbag-image-scraper | 0 | 12791181 | import logging
import requests
from bs4 import BeautifulSoup
import json
import sys
import state_scraper
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def scrape_state_sites():
state_leg_list = "https://www.congress.gov/state-legislature-websites"
state_page = requests.get(sta... | 3.125 | 3 |
src/utils/pythonSrc/watchFaceParser/elements/weatherElements/today.py | chm-dev/amazfitGTSwatchfaceBundle | 49 | 12791182 | from watchFaceParser.elements.weatherElements.separate import Separate
class Today:
definitions = {
1: { 'Name': 'Separate', 'Type': Separate},
3: { 'Name': 'AppendDegreesForBoth', 'Type': 'bool'},
}
| 1.578125 | 2 |
ansys/dpf/core/operators/serialization/vtk_export.py | jfthuong/pydpf-core | 0 | 12791183 | """
vtk_export
===============
Autogenerated DPF operator classes.
"""
from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import _Outputs
from ansys.dpf.core.operators.specification import PinSpecification, Specificatio... | 2.21875 | 2 |
glyphrepository/soterm/models.py | BDAthlon/2017-Triple_Helix-1 | 1 | 12791184 | <reponame>BDAthlon/2017-Triple_Helix-1
# -*- coding: utf-8 -*-
"""BO term models."""
from glyphrepository.database import Column, Model, SurrogatePK, db, reference_col, relationship
class SOterm(SurrogatePK, Model):
"""A glyph."""
__tablename__ = 'soterms'
name = Column(db.String(80), unique=False, nulla... | 2.34375 | 2 |
pre_processing/pca.py | glee1228/segment_temporal_context_aggregation | 1 | 12791185 | <filename>pre_processing/pca.py
import os
import numpy as np
import torch
import torch.nn.functional as F
class PCA():
def __init__(self, n_components=1024, whitening=True,
parameters_path='models/pca_params_vcdb997090_resnet50_rmac_3840.npz'):
self.n_components = n_components
self... | 2.8125 | 3 |
ExamplesPython_3.6/Chapter3/FourierConvolution.py | Nixon-Aguado/Feature-Extraction-and-Image-Processing-Book-Examples | 30 | 12791186 | '''
Feature Extraction and Image Processing
<NAME> & <NAME>
http://www.southampton.ac.uk/~msn/book/
Chapter 3
FourierConvolution: Filter an image by using the Fourier transform
'''
# Set module functions
from ImageUtilities import imageReadL, showImageL, createImageL, showImageF, createImageF
from FourierUtilities i... | 3.328125 | 3 |
model_compression_toolkit/common/graph/base_node.py | eladc-git/model_optimization | 0 | 12791187 | <reponame>eladc-git/model_optimization
# Copyright 2021 Sony Semiconductors Israel, 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/lic... | 2.421875 | 2 |
setup.py | ojii/django-cms-epio-quickstart | 2 | 12791188 | # -*- coding: utf-8 -*-
from __future__ import with_statement
import epiocms
import fnmatch
import os
try:
from setuptools import setup, find_packages
except ImportError:
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
with open('README.rst', 'r') a... | 1.796875 | 2 |
markdown_generator/publications_bib.py | Naminoshi/aguena.github.io | 0 | 12791189 | import re
import calendar
def journals(key):
lib = {
'arXiv e-prints': 'ArXiv',
r'\apj': 'Astrophysical Journal',
'\mnras': 'Monthly Notices of the Royal Astronomical Society',
r'\aap': 'Astronomy and Astrophysics',
r'\prd': 'Physical Review D',
}
if key in lib:
return... | 2.78125 | 3 |
Desafios/Next_Desafio_01/main_Desafio_02.py | antoniosereno95/Python_Curso_em_Video | 0 | 12791190 | <filename>Desafios/Next_Desafio_01/main_Desafio_02.py
def abreArquivo(nome):
try:
a = open(nome, 'rt')
a.close()
except:
print('arquivo nao encontrado')
else:
print('Arquivo encontrado com sucesso =)')
def primeiralista(nome):
a = open(nome, 'rt')
lista1 = []
f... | 3.53125 | 4 |
explore_db.py | nateGeorge/scrape_wrds | 0 | 12791191 | <gh_stars>0
"""
names_ix has index gvkeyx and index name
- comes from idx_ann table in compd library -- need to rewrite query
idxcst_his has the historical index constituents
"""
import os
import gc
import time
import datetime
from collections import OrderedDict
from concurrent.futures import ThreadPoolExecutor
impo... | 1.867188 | 2 |
elements/python/11/10/soln.py | mmcloughlin/problems | 11 | 12791192 | import heapq
import random
class Stack(object):
def __init__(self):
self.h = []
def push(self, x):
heapq.heappush(self.h, (-len(self.h), x))
def pop(self):
if self.empty():
return None
_, x = heapq.heappop(self.h)
return x
def empty(self):
... | 3.515625 | 4 |
implementations/knapsackProblem.py | e-liyai/python_algorithms | 0 | 12791193 | def knapsack_dynamic_solution(objects, max_weight):
# object should be in the form of:
# {
# 'weight': [0, 5, 6, 2, 7, 1]
# 'value': [0, 4, 1, 5, 7, 8]
# }
if not isinstance(objects, dict):
return 'Object should be a dict'
elif len(objects['weight'])... | 3.5 | 4 |
osbot_gsuite/apis/create_slides/GSBot_to_GDrive.py | pbx-gs/gsbot-gsuite | 3 | 12791194 | <reponame>pbx-gs/gsbot-gsuite<gh_stars>1-10
from osbot_gsuite.apis.GDrive import GDrive
from osbot_utils.utils.Dev import Dev
from osbot_utils.utils.Files import Files
class GSBot_to_GDrive:
def __init__(self,gsuite_secret_id=None):
self.target_folder = 'gsbot-graphs'
self.gdrive ... | 2.328125 | 2 |
stretchablecorr/postprocess.py | xdze2/stretchablecorr | 1 | 12791195 |
import numpy as np
def integrate_displacement(displ_img_to_img):
"""Sum the image-to-image displacement value to
obtain image-to-reference displacement,
add zeros at the begining
Parameters
----------
displ_img_to_img : 3D array
3D array of shape `(nbr images - 1, nbr points, 2)`
... | 3.3125 | 3 |
models/sdnet_ada.py | vios-s/RA_FA_Cardiac | 7 | 12791196 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
import time
from models.unet_parts import *
from models.blocks import *
from models.rounding import *
from models.spectral_norm import *
from models.distance_corr import *
from models.spade_resblk import *
device... | 2.125 | 2 |
src/app/models/audio_features.py | okjuan/music-lib-bot | 1 | 12791197 | class AudioFeatures:
MIN_KEY_VALUE, MAX_KEY_VALUE = 0, 11
MIN_MODE_VALUE, MAX_MODE_VALUE = 0, 1
MIN_TIME_SIGNATURE, MAX_TIME_SIGNATURE = 0, 11
MIN_TEMPO, MAX_TEMPO = 0, 500
MIN_DURATION_MS, MAX_DURATION_MS = 0, 900000
MIN_LOUDNESS, MAX_LOUDNESS = -60, 0
MIN_PERCENTAGE, MAX_PERCENTAGE = 0, 1
... | 2.609375 | 3 |
Ch5 - Python Crash Course/Code/5.13_create_and_write_on_a_file.py | 1110sillabo/ProgrammingDigitalHumanitiesBook | 2 | 12791198 | # Create the file
with open('dataresults.txt', 'a') as file:
file.write('These are the results of our experiment')
file.write('\n') # Add new line with \n
file.write('Account X has N followers on social Z')
file.write('\n')
| 3.453125 | 3 |
pelicanconf.py | johnwquarles/japan-trip | 0 | 12791199 | <filename>pelicanconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'JQ'
SITENAME = 'Japan Trip 2018'
SITEURL = 'http://localhost:2018'
STATIC_PATHS = ['images', 'pdfs']
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = 'en'
DEFAULT_DATE_FORMAT = '%-m... | 2.03125 | 2 |
pretix_cwa/tasks.py | pretix/pretix-cwa | 3 | 12791200 | import logging
from pretix.base.email import get_email_context
from pretix.base.i18n import language
from pretix.base.models import OrderPosition
from pretix.base.services.mail import SendMailException
from pretix.base.services.tasks import EventTask
from pretix.celery_app import app
logger = logging.getLogger(__name_... | 1.859375 | 2 |
byceps/services/shop/order/transfer/number.py | GyBraLAN/byceps | 0 | 12791201 | """
byceps.services.shop.order.transfer.number
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from dataclasses import dataclass
from typing import NewType
from uuid import UUID
from ...shop.transfer.models import ShopID
OrderNumber... | 2.6875 | 3 |
server/image/image_controller.py | talandar/GameControl | 0 | 12791202 | <filename>server/image/image_controller.py<gh_stars>0
"""This class maintains the image database for display to clients"""
import os
class ImageDatabase(object):
"""container for image data"""
VALID_IMAGE_TYPES = ["png", "jpg"]
CATEGORIES = set()
FILE_DATA = {}
def __init__(self, root_dir):
... | 3.3125 | 3 |
face_engine/models/dlib_models.py | guesswh0/face_engine | 10 | 12791203 | <gh_stars>1-10
import os
import dlib
import numpy as np
from face_engine import RESOURCES
from face_engine.exceptions import FaceNotFoundError
from face_engine.fetching import fetch_file
from face_engine.models import Detector, Embedder
# download dependent models
for url in [
"http://dlib.net/files/mmod_human_f... | 2.609375 | 3 |
tests/test_week1_scc.py | manoldonev/algo2-assignments | 0 | 12791204 |
"""Week1 Test Cases: Strongly Connected Components"""
from week1.scc import scc
def test_scc():
graph = {
'a': ['c'],
'b': ['a'],
'c': ['b'],
'd': ['b', 'f'],
'e': ['d'],
'f': ['e'],
'g': ['e', 'h'],
'h': ['i'],
'i': ['g']
}
assert... | 3.359375 | 3 |
test/src/data/test_mask.py | gusriobr/vineyard-sketcher | 0 | 12791205 | <reponame>gusriobr/vineyard-sketcher
import os
import unittest
import numpy as np
import cfg_test as tcfg
from skimage import io
from image.mask import MaskMerger, clean_instaces, PrimeIdMasMerger
class TestMaskMerger(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.iterations = cls._load... | 2.078125 | 2 |
tools/copy_denied.py | JohnKvisol/Starbound_RU | 50 | 12791206 | #!/bin/python
from os import walk
from os.path import join, relpath, normpath
from json import load, dump
from multiprocessing import Pool
oldpath = "./experimental/translations"
newpath = "./translations"
substitutions = dict()
with open(join(newpath, "substitutions.json"),"r") as f:
substitutions = load(f)
fi... | 2.390625 | 2 |
app/main.py | engineerjoe440/djjoespotifyplaylister | 1 | 12791207 | <gh_stars>1-10
################################################################################
"""
DJ JOE Website Playlist File Generator
--------------------------------------
(c) 2021 - Stanley Solutions - <NAME>
This application serves an interface to allow the recording of Apple Music or
Spotify playlists.
"""
#... | 2.609375 | 3 |
lift_holdout_emotion.py | juancq/emotion-recognition-walking-acc | 5 | 12791208 | import argparse
import math
import yaml
import numpy as np
from collections import defaultdict
from sklearn import linear_model
from sklearn import metrics
from sklearn import preprocessing
from sklearn.dummy import DummyClassifier
from sklearn.ensemble import RandomForestClassifier
from permute.core import one_sample... | 2.21875 | 2 |
src/core/models.py | metabolism-of-cities/ARCHIVED-metabolism-of-cities-platform-v3 | 0 | 12791209 | <reponame>metabolism-of-cities/ARCHIVED-metabolism-of-cities-platform-v3<filename>src/core/models.py<gh_stars>0
from django.db import models
from multiplicity.models import ReferenceSpace, License
from django.forms import ModelForm
from django.template.defaultfilters import slugify
from tinymce import HTMLField
from dj... | 1.992188 | 2 |
src/cake-install.py | tanuck/cake-install | 0 | 12791210 | <filename>src/cake-install.py
#!/usr/bin/python
import argparse
import requests
import zipfile
import sys, os
import shutil
import shlex, subprocess
from requests.exceptions import ConnectionError, HTTPError, Timeout, TooManyRedirects
def run(args):
zipurls = {1: 'https://github.com/cakephp/cakephp/archive/1.3.20.z... | 2.578125 | 3 |
app/views/admin/index.py | mrakzero/FlaskCMS | 1 | 12791211 | from flask import render_template
from app.views.admin import bp_admin
@bp_admin.route('/')
def index():
return render_template('admin/index.html')
@bp_admin.route('/dashboard')
def dashboard():
return render_template('admin/dashboard.html')
| 1.851563 | 2 |
db/base.py | zy7y/HelloFastAPI | 1 | 12791212 | <filename>db/base.py<gh_stars>1-10
# 导入所有模型, 用于迁移文件
from db.base_class import Base
from models.user import User
from models.movie import Movie
| 1.6875 | 2 |
Test/Python.py | ConAntares/Photonica | 0 | 12791213 | <reponame>ConAntares/Photonica
""" Python Test """
#### Lagrange Interpolation Formula
import time
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import lagrange
to = time.time()
def lagrange_interpolate(x_set, y_set, t_step):
""" Lagrange interpolate """
p_re = lagrange(x_set, y_... | 2.53125 | 3 |
Artificial Algae Algorithm/CalculateGreatness.py | shahind/Nature-Inspired-Algorithms | 17 | 12791214 | <filename>Artificial Algae Algorithm/CalculateGreatness.py
import numpy as np
def CalculateGreatness(BigX,ObjX):
ObjX = (ObjX - np.min(ObjX))/ np.ptp(ObjX)
s2 = np.size(BigX)
BigY = []
for i in range(0,s2):
fKs = np.abs(BigX[:,i]/2.0)
M = (ObjX[i] / (fKs + ObjX[i]))
dX = ... | 3.0625 | 3 |
Statistics/Median.py | sh667/statistical-calculator | 1 | 12791215 | <reponame>sh667/statistical-calculator
from Calculator.Division import division
from Calculator.Addition import addition
def get_median(data):
num_values = len(data)
if num_values % 2 == 0:
value = int(division(2, num_values))
a = data[value]
value = value - 1
b = data[value]
... | 3.71875 | 4 |
src/github_bot_api/signature.py | NiklasRosenstein/python-github-bot-api | 8 | 12791216 |
"""
Helper to check the signature of a GitHub event request.
"""
import hmac
def compute_signature(payload: bytes, secret: bytes, algo: str = 'sha256') -> str:
"""
Computes the HMAC signature of *payload* given the specified *secret* and the given hashing *algo*.
# Parmeters
payload: The payload for which ... | 3.296875 | 3 |
tests/test_helpers.py | Xcalizorz/commodore | 0 | 12791217 | <filename>tests/test_helpers.py
"""
Unit-tests for helpers
"""
from pathlib import Path
import commodore.helpers as helpers
from commodore.config import Config
from commodore.component import Component, component_dir
def test_apierror():
e = helpers.ApiError("test")
assert f"{e}" == "test"
try:
... | 2.796875 | 3 |
nnef_tools/conversion/onnx/onnx_custom.py | rgiduthuri/NNEF-Tools | 1 | 12791218 | <reponame>rgiduthuri/NNEF-Tools
# Copyright (c) 2017 The Khronos Group 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 requi... | 1.117188 | 1 |
tests/test_mode_pytest.py | cle-b/httpdbg | 0 | 12791219 | # -*- coding: utf-8 -*-
import io
import os
import requests
from httpdbg.httpdbg import ServerThread, app
from httpdbg.mode_pytest import run_pytest
from httpdbg.__main__ import pyhttpdbg_entry_point
from utils import _run_under_httpdbg
def test_run_pytest(httpbin):
def _test(httpbin):
os.environ["HTTPD... | 2.234375 | 2 |
word_to_score.py | webdotorg/word-game-tool | 0 | 12791220 | <filename>word_to_score.py<gh_stars>0
# function to convert a word to the base point value using the letter
# does not account for value modifications based on a board
def point_conversion(word):
# Convert word passed in to uppercase so it can find
# keys in dictionary
word = word.upper()
# dictiona... | 3.90625 | 4 |
core/parser.py | ceilingfans/emond | 0 | 12791221 | from enum import Enum, auto
from typing import List
from core.error import print_error, Errors
VALID_TOKENS = "+-><][%|^$?!/"
class TokenType(Enum):
ADD = auto() # +
MINUS = auto() # -
CELL_SHIFT_LEFT = auto() # <
CELL_SHIFT_RIGHT = auto() # >
LOOP_START = auto() ... | 3.234375 | 3 |
orthogonal_snakemake/make_cfmid_energy_dash_collision_energy.py | plbremer/cfmid_4_benchmarking | 0 | 12791222 | import pandas
#################
input_panda_address=snakemake.input.input_panda_address
output_panda_address=snakemake.output.output_panda_address
#################
input_panda=pandas.read_csv(input_panda_address,sep='¬',header=0)
def fill_cfmid_collision_energy_column(temp_panda):
#iterrate through entire panda... | 2.78125 | 3 |
models/morphing_encoder.py | Gerryflap/master_thesis | 0 | 12791223 | <reponame>Gerryflap/master_thesis
"""
Models a Gz/Encoder that is able to generate morphs.
This allows for a single method that captures all morphing methods proposed in RT, apart from gradient descend.
This method is meant to be overridden by some encoders but the default implementation takes the mean.
"""... | 2.625 | 3 |
Python/645set_mismatch.py | Apocrypse/LeetCode | 4 | 12791224 | <filename>Python/645set_mismatch.py
class Solution:
def findErrorNums(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
duplication = sum(nums) - sum(set(nums))
missing = n * (n + 1) // 2 - sum(set(nums))
return [duplication, m... | 3.390625 | 3 |
lacquer/tree/visitor.py | provingground-moe/lacquer | 30 | 12791225 | <reponame>provingground-moe/lacquer
# -*- coding: utf-8 -*-
#
# 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 la... | 2.109375 | 2 |
skinapp/views.py | zeochoy/skinapp | 4 | 12791226 | import os
import glob
from flask import Flask
from flask import jsonify
from flask import request, render_template
from skinapp import app
from model.utils import *
from model.skinmodel import *
valid_mimetypes = ['image/jpeg', 'image/png']
@app.route('/')
def index():
samples = glob.glob("%s/*" % app.config['SA... | 2.4375 | 2 |
Q530.py | Linchin/python_leetcode_git | 0 | 12791227 | <filename>Q530.py
"""
530
easy
min absolute difference in BST
Given the root of a Binary Search Tree (BST), return the minimum absolute
difference between the values of any two different nodes in the tree.
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
... | 3.78125 | 4 |
realtime_test20200807/get_d4_calctime.py | takumihonda/AIP_realtime | 0 | 12791228 | import os
import sys
from datetime import datetime, timedelta
import numpy as np
data_path = "../../dat4figs_JAMES/Fig06"
os.makedirs( data_path, exist_ok=True )
USE_ARCH_DAT = True
#USE_ARCH_DAT = False
quick_hist = False
quick_bar = True
quick_bar = False
def d4_computation_time_nparray( top='' ):
dirs = [ ... | 2.125 | 2 |
source/grammar/openqasm_reference_parser/exceptions.py | shiyunon/openqasm | 603 | 12791229 | <gh_stars>100-1000
__all__ = ["Qasm3ParserError"]
class Qasm3ParserError(Exception):
pass
| 1.21875 | 1 |
bessel_zeros/bessel_zeros.py | GrzegorzMika/Towards-adaptivity-via-a-new-discrepancy-principle-for-Poisson-inverse-problems | 0 | 12791230 | <reponame>GrzegorzMika/Towards-adaptivity-via-a-new-discrepancy-principle-for-Poisson-inverse-problems
import numpy as np
import os
zeros = np.loadtxt('./bessel_zeros_short.txt')
np.save('bessel_zeros_short', zeros)
if os.path.exists('./bessel_zeros_short.txt'):
os.remove('./bessel_zeros_short.txt')
| 2.71875 | 3 |
read-camera.py | duchengyao/pycv | 4 | 12791231 | # -*- coding: utf-8 -*-
# 使用openCV抓取视频
# 空格-->>截图,ESC-->>退出。
# 代码修改自 http://blog.csdn.net/tanmengwen/article/details/41892977
import cv2.cv as cv
import time
if __name__ == '__main__':
cv.NamedWindow("camRra", 1)
capture = cv.CaptureFromCAM(0) #开启摄像头
# capture = cv.CaptureFromFile("Video.avi... | 3.328125 | 3 |
final-activity/submission.py | JVBravoo/Learning-Machine-Learning | 1 | 12791232 | def my_agent(obs, config):
# Use the best model to select a column
col, _ = model.predict(np.array(obs['board']).reshape(6,7,1))
# Check if selected column is valid
is_valid = (obs['board'][int(col)] == 0)
# If not valid, select random move.
if is_valid:
return int(col)
else:
... | 3.046875 | 3 |
test/utils/devices/temperature_control_mock_test.py | kieransukachevin/AlkalinityTitrator | 0 | 12791233 | import time
import titration.utils.devices.board_mock as board
import titration.utils.devices.temperature_control_mock as temperature_control
import titration.utils.devices.temperature_probe_mock as temperature_probe
def test_temperature_control_create():
sensor = temperature_probe.Temperature_Probe(
boa... | 2.53125 | 3 |
dace/transformation/dataflow/matrix_product_transpose.py | Walon1998/dace | 1 | 12791234 | <filename>dace/transformation/dataflow/matrix_product_transpose.py
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Implements the matrix-matrix product transpose transformation. """
from copy import deepcopy as dcpy
import dace
from dace.sdfg import nodes, graph as gr
from dace.sdfg.sdf... | 2.390625 | 2 |
cobald_tests/daemon/core/test_config.py | maxfischer2781/cobald | 7 | 12791235 | <gh_stars>1-10
from tempfile import NamedTemporaryFile
import pytest
import copy
from cobald.daemon.config.mapping import ConfigurationError
from cobald.daemon.core.config import load, COBalDLoader, yaml_constructor
from cobald.controller.linear import LinearController
from ...mock.pool import MockPool
# register ... | 2.140625 | 2 |
models/oomusic_remote.py | nicolasmartinelli/oomusic | 4 | 12791236 | # -*- coding: utf-8 -*-
import base64
import uuid
from io import BytesIO
import qrcode
from odoo import api, fields, models
class MusicRemote(models.Model):
_name = "oomusic.remote"
_description = "Remote Control"
def _default_name(self):
return fields.Date.to_string(fields.Date.context_today(... | 2.34375 | 2 |
src/rayoptics/qtgui/__init__.py | NelisW/ray-optics | 0 | 12791237 | <reponame>NelisW/ray-optics<gh_stars>0
""" package supplying Qt5 desktop application and associated functional support
The ``rayoptics.qtgui`` subpackage provides a desktop app that runs under
Anaconda. It also provides a series of higher level interfaces used by
rayoptics. These include:
- an int... | 1.273438 | 1 |
src/test/test_preprocess_data.py | BLannoo/medical-named-entity-recognition | 0 | 12791238 | from pathlib import Path
import pandas as pd
import spacy
from assertpy import assert_that
from src.definitions import PROJECT_ROOT
from src.main.preprocess_data import preprocess_data, parse_passage
def test_preprocess_data(tmp_path: Path):
preprocess_data(
data_root=PROJECT_ROOT / "data/test/raw",
... | 2.671875 | 3 |
stats/scripts/z3_utils.py | satbekmyrza/chc-spacer-code | 1 | 12791239 | <filename>stats/scripts/z3_utils.py
#!/usr/bin/env python
############################################
#
# Some utility routines for Z3
#
############################################
import z3
I = z3.IntSort ()
B = z3.BoolSort ()
def z3_translate (x, ctx):
""" A version of z3.AstRef.translate that handles sorts... | 2.484375 | 2 |
proximitysensor/sunclock.py | Smytten/Tangible_NFT_Thesis | 1 | 12791240 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple test for NeoPixels on Raspberry Pi
import time
import board
import neopixel
import colorsys
import threading
class sunController():
def __init__(self):
# Choose an open pin connected to the Data In ... | 2.921875 | 3 |
autopandas_v2/generators/compilation/ir/signatures.py | chyanju/autopandas | 16 | 12791241 | <reponame>chyanju/autopandas
import ast
from numpy import nan
from typing import List, Tuple, Any, Set
class ISignature:
def __init__(self, sig: str):
self.sig: str = sig
self.fname: str = None
self.pos_args: List[str] = None
self.kw_args: List[Tuple[str, Any]] = None # Keyword ar... | 3.125 | 3 |
tests/test_databaseAccess.py | maxbechtold/dirt-rally-time-recorder | 18 | 12791242 | import unittest
from unittest.mock import MagicMock, call
from timerecorder.database import Database
from timerecorder.databaseAccess import DatabaseAccess
class TestDatabaseAccess(unittest.TestCase):
def setUp(self):
self.database = Database('test')
self.database.recordResults = MagicMock()
... | 2.9375 | 3 |
test/test-projections.py | dkogan/mrcal | 80 | 12791243 | <gh_stars>10-100
#!/usr/bin/python3
r'''Tests for project() and unproject()
Here I make sure the projection functions return the correct values. A part of
this is a regression test: the "right" project() results were recorded at some
point, and any deviation is flagged.
This also test gradients, normalization and in... | 1.898438 | 2 |
my_custom_maintenance/my_custom_maintenance/doctype/machine_status/machine_status.py | msf4-0/ERPNext_my_custom__maintenance | 0 | 12791244 | <reponame>msf4-0/ERPNext_my_custom__maintenance
# -*- coding: utf-8 -*-
# Copyright (c) 2021, cjs and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class MachineStatus(Document):
# return True if API ex... | 1.796875 | 2 |
examples/internationalisation/testLangs.py | tgolsson/appJar | 666 | 12791245 | <filename>examples/internationalisation/testLangs.py
import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
app.changeLanguage(btn)
app=gui()
app.showSplash()
app.addLabel("l1", "default text")
app.addButtons(["English", "Korean", "French"], press)
app.addLabel("l2", "default text")
app.addL... | 2.6875 | 3 |
python/project/business.py | Jai-Doshi/Python-Project | 0 | 12791246 | # IMPORTING LIBRARIES
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import datetime
import warnings
# DECLARING VARIABLES
# USER INPUT LIST
name = []
age = []
loc = []
cat = []
subcat = []
year = []
# ADMIN INPUT LIST
cat_list = []
cat_sub = {}
... | 3.46875 | 3 |
selenium_app.py | CesarRodriguezPro/TimeStationAutoclockout | 0 | 12791247 | from selenium import webdriver
from selenium.webdriver.support.ui import Select
from datetime import date
from get_names import send_names
'''
this app automatic login in to a website and cut the hours of the people who forgot to clock out
in lunch time
'''
####################################### Basic settings ####... | 3.1875 | 3 |
tests/test_methylation_masking.py | HarryZhang1224/BSBolt | 10 | 12791248 | <filename>tests/test_methylation_masking.py
import unittest
import numpy as np
from bsbolt.Impute.Validation.MaskValues import MaskImputationValues
from bsbolt.Impute.Impute_Utils.ImputationFunctions import get_bsb_matrix
from tests.TestHelpers import test_directory
test_methylation_data = f'{test_directory}/TestData... | 2.515625 | 3 |
monai/apps/detection/utils/detector_utils.py | function2-llx/MONAI | 0 | 12791249 | # Copyright (c) MONAI Consortium
# 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, so... | 2.234375 | 2 |
document_clustering/cluster.py | chuajiesheng/twitter-sentiment-analysis | 0 | 12791250 | <filename>document_clustering/cluster.py
# coding=utf-8
# OS-level import
import sys
import os
import code
# Data related import
import numpy as np
import pandas as pd
import nltk
import re
import os
import codecs
from sklearn import feature_extraction
import mpld3
from nltk.stem.snowball import SnowballStemmer
from ... | 2.921875 | 3 |