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 |
|---|---|---|---|---|---|---|
iq_project/iq_app/urls.py | donkripton/IQ-test | 0 | 12785851 | <gh_stars>0
from django.conf.urls import patterns, url
from iq_app import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^signup/$', views.signup, name='signup'),
#user auth urls
url(r'^login/$', views.user_login, name='login'),
url(r'^home/$', views.home, name='home')... | 1.601563 | 2 |
tests/test_dbinspector.py | cgons/dbinspector | 0 | 12785852 | <gh_stars>0
from dbinspector import DBInspector
class TestDBInspector:
def test_get_count(self, connection):
"""Ensure DBInspector.get_count() returns accurate count of queries executed"""
with DBInspector(connection) as inspector:
connection.execute("SELECT 1")
connection.... | 2.578125 | 3 |
bot/com/oth/mix.py | VoxelPrismatic/prizai | 2 | 12785853 | #!/usr/bin/env python3
# -*- coding: utf-8 -*
#/// DEPENDENCIES
import os, signal
import typing, asyncio
import discord #python3.7 -m pip install -U discord.py
import logging, subprocess
from util import embedify, pages
from discord.ext import commands
from discord.ext.commands import Bot, MissingPe... | 2.234375 | 2 |
03-algorithms/03-k-nearest-neighbors/codebase/kd_tree/tests/test_kd_tree_kclosest.py | jameszhan/notes-ml | 0 | 12785854 | <filename>03-algorithms/03-k-nearest-neighbors/codebase/kd_tree/tests/test_kd_tree_kclosest.py<gh_stars>0
# -*- coding: utf-8 -*-
import os
import sys
import logging
import unittest
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
parent_path = os.path.abspath(os.path.join(os.p... | 2.546875 | 3 |
apps/convert_apt_data.py | euctrl-pru/rt-python | 0 | 12785855 | #!/usr/bin/env python
#
# Copyright (c) 2017-2018 Via Technology Ltd. All Rights Reserved.
# Consult your license regarding permissions and restrictions.
"""
Software to read Eurocontrol APDS files.
"""
import sys
import os
import bz2
import csv
import errno
import pandas as pd
from enum import IntEnum, unique
from p... | 2.75 | 3 |
legal_advice_builder/signals.py | prototypefund/django-legal-advice-builder | 4 | 12785856 | <reponame>prototypefund/django-legal-advice-builder
import django.dispatch
answer_created = django.dispatch.Signal()
| 1.296875 | 1 |
src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py | zopefoundation/zope.app.applicationcontrol | 0 | 12785857 | <filename>src/zope/app/applicationcontrol/browser/tests/test_servercontrolview.py<gh_stars>0
##############################################################################
#
# Copyright (c) 2001, 2002, 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zo... | 1.9375 | 2 |
test/old_cintojson.py | sqohapoe/CQOSJ_LIU | 66 | 12785858 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import re
import sys
import json
#import copy
import codecs
#reload(sys)
#sys.setdefaultencoding('UTF-8')
DEBUG_MODE = False
CIN_HEAD = "%gen_inp"
ENAME_HEAD = "%ename"
CNAME_HEAD = "%cname"
ENCODI... | 2.515625 | 3 |
lambdas_with_docker/lambda_to_lambda_caller.py | koki-nakamura22/lambda-local-dev-example | 0 | 12785859 | <reponame>koki-nakamura22/lambda-local-dev-example
# This function is the caller.
#
# How to execute this file.
# Must upload this file and lambda_to_lambda_callee.py to AWS Lambda then executing them
# because it cannot execute another Lambda function locally.
import json
import boto3
def lambda_handler(ev... | 2.4375 | 2 |
vanadis/__init__.py | CyanideCN/vanadis | 1 | 12785860 | <gh_stars>1-10
from vanadis.colormap import Colormap
from vanadis.palette import parse_palette
__version__ = '0.0.3' | 1.226563 | 1 |
hackru/locustfile.py | sakib/hackru | 3 | 12785861 | <reponame>sakib/hackru
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
#def on_start(self):
# """ on_start is called when a Locust starts, before tasks scheduled """
#self.login()
#print "starting locust (%r)" % (self.locust)
#def login(self):
# self.clie... | 2.8125 | 3 |
kernel/builder.py | dereklpeck/paradoxia | 1 | 12785862 | <gh_stars>1-10
"""
Generate Agent
"""
import os
import subprocess
def create_agent(lhost, lport, mode):
if(len(lhost) > 0 and len(lport) > 0 and len(mode) > 0):
if(mode == "static"):
static = True
else:
print("[WARNING]: It is recommended you create a static Bot.")
static = False
os.chdir("bot")
... | 2.84375 | 3 |
accounts/views.py | RomanOsadchuk/nospoil | 0 | 12785863 | from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.views.generic import DetailView, TemplateView
from d... | 2.03125 | 2 |
solutions/6002.py | pacokwon/leetcode | 2 | 12785864 | class Bitset:
def __init__(self, size):
self.bitmap = 0
self.size = size
self.cnt = 0
def fix(self, idx):
if self.bitmap & (1 << idx) == 0:
self.bitmap = self.bitmap | (1 << idx)
self.cnt += 1
def unfix(self, idx):
if self.bitmap & (1 << idx)... | 3.125 | 3 |
uiCompile2.py | bambooshoot/renameFileList | 0 | 12785865 | <gh_stars>0
from pyside2uic import compileUi
import py_compile,glob,os,re
uiPath=os.curdir
print uiPath
preIndex=len(uiPath)+1
uiFiles=glob.glob("%s/*.ui"%uiPath)
print uiFiles
for uiFile in uiFiles:
print uiFile
fileBaseName=re.search("[^\\\\]+.ui$",uiFile).group(0)
fileBaseName=re.search("^[^.]+",fileBas... | 2.40625 | 2 |
zorro/scripts/calcMeanFRCs.py | C-CINA/zorro | 8 | 12785866 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 7 16:12:33 2016
@author: rmcleod
"""
import numpy as np
import matplotlib.pyplot as plt
import os, os.path, glob
mcFRCFiles = glob.glob( "FRC/*mcFRC.npy" )
zorroFRCFiles = glob.glob( "FRC/*zorroFRC.npy" )
zorroFRCs = [None] * len( zorroFRCFiles)
for J in np.arange( ... | 2.375 | 2 |
csgo_gsi_arduino_lcd/data/arduino_mediator.py | Darkness4/csgo-gsi-arduino | 5 | 12785867 | # -*- coding: utf-8 -*-
"""
ArduinoMediator.
@auteur: Darkness4
"""
import logging
from threading import Thread
from time import sleep, time
from typing import Optional
from csgo_gsi_arduino_lcd.entities.state import State
from csgo_gsi_arduino_lcd.entities.status import Status
from serial import Serial
class Ardui... | 2.59375 | 3 |
scripts/data_collect.py | ehu-ai/domrand | 20 | 12785868 | <filename>scripts/data_collect.py
#!/usr/bin/env python2
from __future__ import print_function
import os
import argparse
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
"""
Hacky script for collecting real world samples
(uses ros)
... | 2.6875 | 3 |
nlzss/verify.py | meunierd/nlzss | 48 | 12785869 | <reponame>meunierd/nlzss<filename>nlzss/verify.py
#!/usr/bin/env python3
import sys
from sys import stdin, stdout, stderr, exit
from os import SEEK_SET, SEEK_CUR, SEEK_END
from errno import EPIPE
from struct import pack, unpack
class DecompressionError(ValueError):
pass
class VerificationError(ValueError):
p... | 2.578125 | 3 |
adi_study_watch/nrf5_sdk_15.2.0/adi_study_watch/cli/m2m2/inc/python/temperature_application_interface_def.py | ArrowElectronics/Vital-Signs-Monitoring | 5 | 12785870 | <reponame>ArrowElectronics/Vital-Signs-Monitoring
from ctypes import *
from common_application_interface_def import *
from m2m2_core_def import *
class M2M2_TEMPERATURE_APP_CMD_ENUM_t(c_ubyte):
_M2M2_TEMPERATURE_APP_CMD_LOWEST = 0x60
M2M2_TEMPERATURE_APP_CMD_SET_FS_REQ = 0x62
M2M2_TEMPERATURE_APP_CMD_SE... | 2.390625 | 2 |
experiments/utils.py | pedrobn23/pyutai | 3 | 12785871 | import numpy as np
from pyutai import trees
from potentials import cluster
def cpd_size(cpd):
return np.prod(cpd.cardinality)
def unique_values(cpd):
unique, _ = np.unique(cpd.values, return_counts=True)
return len(unique)
def stats(net):
if not net.endswith('.bif'):
raise ValueError('Net ... | 2.46875 | 2 |
geopayment/providers/__init__.py | Lh4cKg/tbcpay | 0 | 12785872 | <filename>geopayment/providers/__init__.py
from geopayment.providers.credo import CredoProvider
from geopayment.providers.tbc import TBCProvider
from geopayment.providers.bog import IPayProvider, IPayInstallmentProvider
| 1.234375 | 1 |
PCscrapy/spiders/PCscrap.py | arju88nair/PCScrapy | 0 | 12785873 | <reponame>arju88nair/PCScrapy<filename>PCscrapy/spiders/PCscrap.py<gh_stars>0
import scrapy
import re
import datetime
import logging
import time
import RAKE
from datetime import datetime
import hashlib
from scrapy.spiders import XMLFeedSpider
from pymongo import MongoClient
from PCscrapy.scrapLinks import Links
from sc... | 2.46875 | 2 |
compile_trump.py | DarkGuenther/TrumpBot | 0 | 12785874 | """Loads all of Trumps tweets and saves them to a pickle for easier access"""
import pickle
import json
RAW_FILE = "trump_tweets_raw.txt"
PICKLE_FILE = "trump_tweets.pickle"
raw = json.load(open(RAW_FILE))
tweets = [e["text"] for e in raw]
clean_tweets = []
# Filter out urls
for t in tweets:
parts = []
for... | 3.640625 | 4 |
src/component/ScanPaths.py | renchangjiu/kon-windows | 2 | 12785875 | import os
import threading
from PyQt5 import QtCore
from PyQt5.QtCore import QObject
from src.Apps import Apps
from src.model.Music import Music
from src.model.MusicList import MusicList
from src.service.MP3Parser import MP3
class ScanPaths(QObject, threading.Thread):
""" 异步扫描指定目录(指配置文件)下的所有音乐文件, 并写入数据库 """
... | 2.640625 | 3 |
exercises/ja/exc_03_16_02.py | Jette16/spacy-course | 2,085 | 12785876 | <filename>exercises/ja/exc_03_16_02.py
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファストフードレストランチェーンです。"
)
# parserを無効化
with ____.____(____):
# テキストを処理する
doc = ____
# docの固有表現を表示
print(____)
| 2.6875 | 3 |
pvfit/measurement/spectral_correction.py | markcampanelli/pvfit | 4 | 12785877 | <gh_stars>1-10
import warnings
import numpy
import scipy.constants
import scipy.interpolate
from pvfit.common.constants import c_m_per_s, h_J_s, q_C
class DataFunction:
r"""
Store data representing one/more functions in :math:`\mathbb{R}^2`
with common, monotonic increasing domain values.
TODO Desc... | 2.484375 | 2 |
lexos/managers/file_manager.py | WheatonCS/Lexos | 107 | 12785878 | <gh_stars>100-1000
import io
import os
import shutil
import zipfile
from os import makedirs
from os.path import join as pathjoin
from typing import List, Tuple, Dict
import numpy as np
import pandas as pd
from flask import request, send_file
import lexos.helpers.constants as constants
import lexos.helpers.general_fun... | 2.65625 | 3 |
render.py | MikeSpreitzer/queueset-test-viz | 0 | 12785879 | #!/usr/bin/env python3
import argparse
import cairo
import parse_test
import subprocess
import typing
def hue_to_rgb(hue: float, lo: float) -> typing.Tuple[float, float, float]:
hue = max(0, min(1, hue))
if hue <= 1/3:
return (1 - (1-lo)*(hue-0)*3, lo + (1-lo)*(hue-0)*3, lo)
if hue <= 2/3:
... | 2.390625 | 2 |
sito_io/manifest.py | xkortex/sito-io | 0 | 12785880 | from collections.abc import MutableMapping
from .fileio import ManifestMap
class MutableManifestTree(MutableMapping):
"""An abstract (but possibly concrete) representation of a collection of resources
MMT acts much like a dict, but manages side-effects and invariants
todo: we may want to lazily eval Reso... | 2.984375 | 3 |
Fall 2016/Homeworks/HW2/Solutions/problem9.py | asmitde/TA-PSU-CMPSC101 | 0 | 12785881 | # Name: <NAME>
# ID: aud311
# Date: 09/20/2016
# Assignment: Homework 2, Problem 9
# Description: Program to convert a 6-bit binary number to decimal
# Prompt the user to enter a 6-bit binary number
binary = int(input('Enter a 6-bit binary number: '))
# Extract the bits and form the decimal number
decimal =... | 4.28125 | 4 |
tests/extentions/test_manager.py | artsalliancemedia/awsome | 1 | 12785882 | <reponame>artsalliancemedia/awsome
from AWSome.executor import Executor
from AWSome.extentions import Extention
from AWSome.extentions import SkipException
from AWSome.extentions.manager import ExtentionsManager
import pytest
from tests.fixtures import options
class MockCommand(object):
def __init__(self):
se... | 2.125 | 2 |
hashdd/algorithms/algorithm.py | hashdd/pyhashdd | 20 | 12785883 | """
algorithm.py
@brad_anton
License:
Copyright 2015 hashdd.com
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 a... | 2.59375 | 3 |
main.py | divishrengasamy/EFI-Toolbox | 0 | 12785884 | <filename>main.py
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 06:05:37 2021
@author: <NAME>
"""
import data_preprocessing as dp
import pandas as pd
import os
import interpretability_methods as im
import classification_methods as clf_m
import fuzzy_logic as fl
import results_gen_methods as rgm
import user_xi as u... | 2.359375 | 2 |
SMS_handler.py | alexfromsocal/PhoneVote | 0 | 12785885 | <reponame>alexfromsocal/PhoneVote
#from flask import Flask, request, redirect
#from twilio.twiml.messaging_response import MessagingResponse as MR
from twilio.rest import Client
from flask import url_for, session, Flask, request
from configparser import ConfigParser
from twilio.twiml.messaging_response import Mess... | 2.6875 | 3 |
Python3/547.py | rakhi2001/ecom7 | 854 | 12785886 | __________________________________________________________________________________________________
sample 192 ms submission
class Solution:
def findCircleNum(self, M: List[List[int]]) -> int:
seen = set()
def visit_all_friends(i: int):
for friend_idx,is_friend in enumerate(M[i]):
... | 3.359375 | 3 |
src/calculate_features/helpers/features/size.py | flysoso/NetAna-Complex-Network-Analysis | 3 | 12785887 | '''
Total number of edges n the graph (graph size):
m = |E|
'''
import networkx as nx
def calculate(network):
try:
n = network.size()
except:
n = 0
return n
| 3.28125 | 3 |
blockchat/app/blockchain.py | Samyak2/blockchain | 0 | 12785888 | import os
import logging
import json
import asyncio
from collections import defaultdict
import nacl
from quart import Quart, jsonify, request, websocket
from quart_cors import cors
from blockchat.utils import encryption
from blockchat.types.blockchain import Blockchain, BlockchatJSONEncoder, BlockchatJSONDecoder
from... | 2.015625 | 2 |
backend/doppelkopf/db.py | lkoehl/doppelkopf | 0 | 12785889 | <reponame>lkoehl/doppelkopf
import click
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import doppelkopf
db = SQLAlchemy()
migrate = Migrate()
@click.command("seed-data")
@with_appcontext
def seed_data_command():
doppelkopf.events.EventType.insert... | 2.1875 | 2 |
Lesson05/pepsearch.py | xperthunter/pybioinformatics | 0 | 12785890 | #!/usr/bin/env python3
import gzip
import sys
# Write a program that finds peptidies within protein sequences
# Command line:
# python3 pepsearch.py IAN
"""
python3 pepsearch.py proteins.fasta.gz IAN | wc -w
43
"""
| 2.9375 | 3 |
pygame/animation.py | Tom-Li1/py_modules | 0 | 12785891 | <filename>pygame/animation.py<gh_stars>0
import pygame, sys, time
from pygame.locals import *
pygame.init()
WINDOWWIDTH = 800
WINDOWHEIGHT = 1000
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
pygame.display.set_caption('Animation')
DOWNLEFT = 'downleft'
DOWNRIGHT = 'downright'
UPLEFT = ... | 2.375 | 2 |
timeshifter-agents/timeshifter-agents/roller_ball.py | SwamyDev/ML-TimeShifters | 0 | 12785892 | from reinforcement.agents.td_agent import TDAgent
from reinforcement.models.q_regression_model import QRegressionModel
from reinforcement.policies.e_greedy_policies import NormalEpsilonGreedyPolicy
from reinforcement.reward_functions.q_neuronal import QNeuronal
from unityagents import UnityEnvironment
import tensorflow... | 2.09375 | 2 |
src/arbiter/eicar.py | polyswarm/polyswarm-client | 21 | 12785893 | <reponame>polyswarm/polyswarm-client<gh_stars>10-100
import base64
import logging
from polyswarmartifact import ArtifactType
from polyswarmclient.abstractarbiter import AbstractArbiter
from polyswarmclient.abstractscanner import ScanResult
logger = logging.getLogger(__name__) # Initialize logger
EICAR = base64.b64d... | 2.375 | 2 |
models/model.py | AnnLIU15/SegCovid | 0 | 12785894 | import torch
import torch.nn as nn
from .layer import *
##### U^2-Net ####
class U2NET(nn.Module):
'''
详细见U2Net论文(md中有链接)
'''
def __init__(self, in_channels=1, out_channels=3):
super(U2NET, self).__init__()
self.stage1 = RSU7(in_channels, 32, 64)
self.pool12 = nn.MaxPool2d(2,... | 2.53125 | 3 |
get_dark_files.py | jprchlik/find_contaminated_darks | 0 | 12785895 | import os,sys
import datetime as dt
import numpy as np
try:
#for python 3.0 or later
from urllib.request import urlopen
except ImportError:
#Fall back to python 2 urllib2
from urllib2 import urlopen
import requests
from multiprocessing import Pool
import drms
from shutil import move
import glob
###Rem... | 2.546875 | 3 |
src/parser.py | Bolinooo/hint-parser | 0 | 12785896 | from .regex_patterns import *
from bs4 import BeautifulSoup
import datetime
import re
def parse(response, option):
"""
Function to extract data from html schedule
:return: Parsed html in dictionary
"""
soup = BeautifulSoup(response.content, 'html.parser')
title_blue_original = soup.find("fon... | 3.046875 | 3 |
research/mobilenet/mobilenet_v1.py | luotigerlsx/models_archive | 0 | 12785897 | # Copyright 2020 The TensorFlow Authors. 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 applicable ... | 2.578125 | 3 |
tests/test_stopper.py | tech-sketch/SeqAL | 0 | 12785898 | from unittest.mock import MagicMock
import pytest
from seqal.stoppers import BudgetStopper, F1Stopper
class TestF1Stopper:
"""Test F1Stopper class"""
@pytest.mark.parametrize(
"micro,micro_score,macro,macro_score,expected",
[
(True, 16, False, 0, True),
(True, 14, Fa... | 2.578125 | 3 |
Code/CCIPCA.py | arturjordao/IncrementalDimensionalityReduction | 3 | 12785899 | """Candid Covariance-Free Incremental PCA (CCIPCA)."""
import numpy as np
from scipy import linalg
from sklearn.utils import check_array
from sklearn.utils.validation import FLOAT_DTYPES
from sklearn.base import BaseEstimator
from sklearn.preprocessing import normalize
import copy
class CCIPCA(BaseEstimat... | 2.375 | 2 |
kr_fashion_mnist.py | mjbhobe/dl-keras | 0 | 12785900 | <reponame>mjbhobe/dl-keras<filename>kr_fashion_mnist.py
<<<<<<< HEAD
#!/usr/bin/env python
""" Fashion MNIST multiclass classification using Tensorflow 2.0 & Keras """
import sys
import os
import random
# import pathlib
# import json
# import glob
# import tarfile
import numpy as np
import pandas as pd
import matplotli... | 2.984375 | 3 |
02 - Estruturas de controle/ex044.py | epedropaulo/MyPython | 0 | 12785901 | <reponame>epedropaulo/MyPython
cores = ['\033[m', '\033[31m', '\033[34m']
print(f'{cores[1]}-=-' * 7)
print(f'{cores[2]}FORMAS DE PAGAMENTO.')
print(f'{cores[1]}-=-{cores[0]}' * 7)
print('')
preco = float(input('Quanto é o produto? R$'))
print('')
print(f'Digite [{cores[2]} 1 {cores[0]}] para {cores[2]}sim{cor... | 3.25 | 3 |
cmz/cms_core/urls_helpers.py | inmagik/cmz | 1 | 12785902 | <filename>cmz/cms_core/urls_helpers.py
from django.conf.urls import url, include
from .views import CmsView
def create_urls(pages):
out = []
empty_urls = []
for page_name in pages:
page = pages[page_name]
extra_modules = page.get('extra_modules', [])
if 'url' in page and page['u... | 2.53125 | 3 |
Application/errors_module/errors.py | GraphicalDot/datapod-backend-layer | 0 | 12785903 | <gh_stars>0
from loguru import logger
from sanic.response import json
from sanic import Blueprint
from sanic.exceptions import SanicException
ERRORS_BP = Blueprint('errors')
DEFAULT_MSGS = {
400: 'Bad Request',
401: 'Unauthorized',
403: 'Forbidden',
404: 'Not Found',
501: 'Not Implemented',
... | 2.328125 | 2 |
Modules/LeetCode/Task5.py | Itsuke/Learning-Python | 0 | 12785904 | '''
https://leetcode.com/discuss/interview-question/1683420/Facebook-or-Online-or-USA-or-E5
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two
nodes p and q as the lowest node in... | 3.546875 | 4 |
second_step/s7.py | relax-space/python-xxm | 0 | 12785905 | import pymongo
"""
mongo数据库的增删改查
1.首先本地启动mongodb: docker-compose -f second_step/example/mongo.yml up
2.运行以下命令
python.exe .\second_step\s7.py
参考:https://www.runoob.com/python3/python-mongodb.html
"""
class Model:
def __init__(self):
client = pymongo.MongoClient("mongodb://localhost:27017")
self.db... | 3.625 | 4 |
tests/test_individuals/test_mixed_individual.py | alessandrolenzi/yaga | 0 | 12785906 | from yaga_ga.evolutionary_algorithm.genes import IntGene, CharGene
from yaga_ga.evolutionary_algorithm.individuals import (
MixedIndividualStructure,
)
def test_initialization_with_tuple():
gene_1 = CharGene()
gene_2 = IntGene(lower_bound=1, upper_bound=1)
individual = MixedIndividualStructure((gene_1... | 2.640625 | 3 |
test/test_numeric.py | radovanhorvat/gonzales | 0 | 12785907 | <reponame>radovanhorvat/gonzales
import numpy as np
import gonzales.lib.physics as phy
def test_com():
# test center of mass calculation
# 1. case
r = np.array([[0., 0., 0.], [1., 0., 0.], [1., 1., 1.]])
m = np.array([1., 2., 3.])
com = phy.calc_com(r, m)
np.testing.assert_almost_equal(com, n... | 2.390625 | 2 |
window/viewport.py | jeffa/window-viewport | 0 | 12785908 | <gh_stars>0
__version__='0.0.1'
class viewport:
def __init__( self, Wb=0, Wt=1, Wl=0, Wr=1, Vb=-1, Vt=1, Vl=-1, Vr=1 ):
self.Sx = ( Vr - Vl ) / ( Wr - Wl )
self.Sy = ( Vt - Vb ) / ( Wt - Wb );
self.Tx = ( Vl * Wr - Wl * Vr ) / ( Wr - Wl );
self.Ty = ( Vb * Wt - Wb * Vt ) / ( Wt - W... | 2.390625 | 2 |
ava/preprocessing/__init__.py | mdmarti/autoencoded-vocal-analysis | 0 | 12785909 | <gh_stars>0
"""
AVA preprocessing module
Contains
--------
`ava.preprocessing.preprocess`
Preprocess syllable spectrograms.
`ava.preprocessing.utils`
Useful functions for preprocessing.
"""
| 0.90625 | 1 |
ascii_video.py | FabulousCodingFox/AsciiVideo | 0 | 12785910 | from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import cv2,time,os
from moviepy.editor import *
from tkinter import filedialog as fd
def im_to_ascii(im:Image,width:int=640,keepAlpha:bool=True,highContrastMode:bool=False,fontResolution:int=5):
ratio:float = width/im.size[0]
... | 2.75 | 3 |
wrappers/python_2-7/runProducerCallbacksOWP.py | UpperLEFTY/worldpay-within-sdk | 0 | 12785911 | <filename>wrappers/python_2-7/runProducerCallbacksOWP.py
import WPWithinWrapperImpl
import WWTypes
import time
class TheEventListener():
def __init__(self):
print "Inialised custom event listener"
def beginServiceDelivery(self, serviceId, serviceDeliveryToken, unitsToSupply):
try:
... | 2.3125 | 2 |
UI_flask_javascript_soundcloud_app/app.py | AdiletGaparov/sentiment-based-song-recommender | 0 | 12785912 | <reponame>AdiletGaparov/sentiment-based-song-recommender
from flask import Flask, request, render_template
import pandas as pd
import numpy as np
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
subject = None
level = None
selected_choice = ""
songs = []
lyrics = pd.rea... | 2.984375 | 3 |
plugins/modules/oci_database_external_database_connector_facts.py | LaudateCorpus1/oci-ansible-collection | 0 | 12785913 | <reponame>LaudateCorpus1/oci-ansible-collection<filename>plugins/modules/oci_database_external_database_connector_facts.py
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General P... | 1.476563 | 1 |
source/lib/conditional_resource.py | Snehitha12345/mlops-workload-orchestrator | 20 | 12785914 | <gh_stars>10-100
# #####################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | 1.539063 | 2 |
JDI/web/selenium/elements/api_interact/find_element_by.py | jdi-testing/jdi-python | 5 | 12785915 | <filename>JDI/web/selenium/elements/api_interact/find_element_by.py
from selenium.webdriver.common.by import By as Selenium_By
class By:
@staticmethod
def id(by_id):
return Selenium_By.ID, by_id
@staticmethod
def css(by_css):
return Selenium_By.CSS_SELECTOR, by_css
@staticmethod... | 2.328125 | 2 |
srae.py | MHHukiewitz/SRAE_pytorch | 0 | 12785916 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Callable
# TODO: Merging and resetting features
# TODO: Plots of layer activities
# TODO: Stack RAEs for deep network
device = 'cuda' if torch.cuda.is_available() else 'cpu'
print(f"Using {device} to train networks.")
... | 2.609375 | 3 |
spectrometer_functions.py | jhoyland/spectrum-workshop | 0 | 12785917 | # Find the slit. This function finds the location of the slit in the photograph of the spectrum
# The function takes a single line of the data and scans it to find the maximum value.
# If it finds a block of saturated pixels it finds the middle pixel to be the slit.
# The function returns the column number of the slit.... | 3.46875 | 3 |
ramscube/ramscube.py | freemansw1/ramscube | 0 | 12785918 | import warnings
warnings.filterwarnings('ignore', category=UserWarning, append=True)
RAMS_Units=dict()
# winds
RAMS_Units['UC']='m s-1'
RAMS_Units['VC']='m s-1'
RAMS_Units['WC']='m s-1'
# potential temperature
RAMS_Units['THETA']='K'
RAMS_Units['PI']='J kg-1 K-1'
RAMS_Units['DN0']='kg m-3'
# water vapour mixing ratio... | 1.945313 | 2 |
recipe/run_test.py | regro-cf-autotick-bot/fractopo-feedstock | 0 | 12785919 | <reponame>regro-cf-autotick-bot/fractopo-feedstock
"""
Simple test case for fractopo conda build.
"""
import geopandas as gpd
from fractopo import Network
kb11_network = Network(
name="KB11",
trace_gdf=gpd.read_file(
"https://raw.githubusercontent.com/nialov/"
"fractopo/master/tests/sample_dat... | 1.703125 | 2 |
unittest/t_region_reference.py | bendichter/api-python | 32 | 12785920 | <gh_stars>10-100
#!/usr/bin/python
import sys
from nwb import nwb_file
from nwb import nwb_utils as utils
from nwb import value_summary as vs
import numpy as np
import h5py
from sys import version_info
import re
# Test creation of region references
# Region references are references to regions in a dataset. They can... | 2.390625 | 2 |
src/pretix/control/forms/renderers.py | pajowu/pretix | 1 | 12785921 | from bootstrap3.renderers import FieldRenderer
from bootstrap3.text import text_value
from django.forms import CheckboxInput
from django.forms.utils import flatatt
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import pgettext
from i18nfield.forms i... | 1.960938 | 2 |
tests/integration/dao/test_dao_aluno.py | douglasdcm/easy_db | 0 | 12785922 | from src.dao.dao_aluno import DaoAluno
from tests.massa_dados import aluno_nome_1
from src.enums.enums import Situacao
from src.model.aluno import Aluno
from tests.massa_dados import materia_nome_2, materia_nome_3
class TestDaoAluno:
def _setup_aluno(self, cria_banco, id=1, nome=aluno_nome_1, cr=0,
... | 2.4375 | 2 |
calaccess_processed/models/tracking.py | dwillis/django-calaccess-processed-data | 1 | 12785923 | <reponame>dwillis/django-calaccess-processed-data
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Models for tracking processing of CAL-ACCESS snapshots over time.
"""
from __future__ import unicode_literals
from django.db import models
from hurry.filesize import size as sizeformat
from django.utils.encoding import p... | 1.90625 | 2 |
examples/mt_model.py | Jincheng-Sun/Kylearn | 0 | 12785924 | <filename>examples/mt_model.py
from framework.model import Model
import tensorflow as tf
class Mt_model(Model):
def __init__(self, Network, ckpt_path, tsboard_path, x_shape, num_classes):
super().__init__(Network, ckpt_path, tsboard_path)
with tf.name_scope('inputs'):
self.features = t... | 2.859375 | 3 |
orders/tasks.py | SergePogorelov/myshop | 0 | 12785925 | <reponame>SergePogorelov/myshop
from celery import task
from django.core.mail import send_mail
from .models import Order
@task
def order_created(order_id):
""""Задача отправки email-уведомлений при успешном оформлении заказа."""
order = Order.objects.get(id=order_id)
subject = f"order.nr. {order.id}"
... | 2.328125 | 2 |
nblog/core/views.py | NestorMonroy/BlogTemplate | 0 | 12785926 |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from django.views.generic import TemplateView
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.mail import send_mail
from django... | 2.046875 | 2 |
oi/Contest/self/IOI-Test-Round/puzzle/data/checker.py | Riteme/test | 3 | 12785927 | #!/usr/bin/env python
#
# Copyright 2017 riteme
#
from sys import argv, version
from os.path import *
if version[0] == '3':
xrange = range
if len(argv) == 1 or "--help" in argv or "-h" in argv:
print("Participate answer checker & grader.")
print("Usage: %s [ID] [--no-limit] [--help/-h]" % argv[0])
p... | 3.515625 | 4 |
src/drugstone/scripts/add_edges_to_genes.py | realugur/drugst.one-py | 0 | 12785928 | <gh_stars>0
def add_edges_to_genes(
genes: list,
edges: list, ) -> dict:
for gene in genes:
if "netexId" in gene:
netex_edges = [n["proteinB"] for n in edges if gene["netexId"] == n["proteinA"]]
symbol_edges = []
for e in netex_edges:
fo... | 2.875 | 3 |
star_realms_cards/all_cards.py | samervin/star-realms-database | 5 | 12785929 | <filename>star_realms_cards/all_cards.py<gh_stars>1-10
# Fields
NAME = 'name'
FLAVOR = 'flavor'
FACTION = 'faction'
TYPE = 'type'
SHIELD = 'shield'
COST = 'cost'
SET = 'set'
QUANTITY = 'quantity'
ABILITIES = 'abilities'
ALLY_ABILITIES = 'ally-abilities'
SCRAP_ABILITIES = 'scrap-abilities'
TRADE = 'trade'
COMBAT = 'co... | 1.945313 | 2 |
authlib/client/errors.py | moriyoshi/authlib | 0 | 12785930 | <filename>authlib/client/errors.py
from authlib.integrations.base_client import *
| 1.148438 | 1 |
ovpr_atp/awards/models.py | ravikumargo/awdportal | 0 | 12785931 | # Defines the data models used within the application
#
# See the Django documentation at https://docs.djangoproject.com/en/1.6/topics/db/models/
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.db import models
from django.db.models... | 2.75 | 3 |
dnplab/io/vna.py | DNPLab/dnpLab | 0 | 12785932 | <reponame>DNPLab/dnpLab
# TODO: remove unused imports
import numpy as np
import os
import re
from matplotlib.pylab import *
from .. import DNPData
def import_vna(path):
"""Import VNA data and return dnpdata object"""
x, data = import_snp(path)
# Not General
dnpDataObject = DNPData(data, [x], ["f"], {... | 2.078125 | 2 |
im3components/utils.py | IMMM-SFA/im3components | 0 | 12785933 | <filename>im3components/utils.py
import yaml
def read_yaml(yaml_file: str) -> dict:
"""Read a YAML file.
:param yaml_file: Full path with file name and extension to an input YAML file
:type yaml_file: str
:return: Dictionary
"""
with open(... | 3.3125 | 3 |
parkings/api/utils.py | klemmari1/parkkihubi | 12 | 12785934 | <filename>parkings/api/utils.py
import dateutil.parser
from django.utils import timezone
from rest_framework.exceptions import ValidationError
def parse_timestamp_or_now(timestamp_string):
"""
Parse given timestamp string or return current time.
If the timestamp string is falsy, return current time, othe... | 2.890625 | 3 |
lambeq/text2diagram/spiders_reader.py | CQCL/lambeq | 131 | 12785935 | # Copyright 2021, 2022 Cambridge Quantum Computing Ltd.
#
# 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.5 | 2 |
CellProfiler/tests/modules/test_measureimageskeleton.py | aidotse/Team-rahma.ai | 0 | 12785936 | <reponame>aidotse/Team-rahma.ai
import numpy
import pytest
import cellprofiler_core.measurement
from cellprofiler_core.constants.measurement import COLTYPE_INTEGER
import cellprofiler.modules.measureimageskeleton
instance = cellprofiler.modules.measureimageskeleton.MeasureImageSkeleton()
@pytest.fixture(scope="mod... | 1.960938 | 2 |
invoicing/filters.py | cumanachao/utopia-crm | 13 | 12785937 | <gh_stars>10-100
from datetime import date, timedelta
import django_filters
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q
from .models import Invoice
CREATION_CHOICES = (
('today', _('Today')),
('yesterday', _('Yesterday')),
('last_7_days... | 1.984375 | 2 |
src/rules/entity/actor_plugins/__init__.py | FrozenYogurtPuff/iStar-pipeline | 0 | 12785938 | <reponame>FrozenYogurtPuff/iStar-pipeline
from .be_nsubj import be_nsubj
from .by_sb import by_sb
from .dative_PROPN import dative_propn
from .dep import dep_base as dep
from .ner import ner
from .relcl_who import relcl_who
from .tag import tag_base as tag
from .word_list import word_list
from .xcomp_ask_sb_to_do impor... | 0.917969 | 1 |
bin/evaluate.py | mwang87/FalconClusterWorkflow | 0 | 12785939 | <gh_stars>0
import pandas as pd
import sys
input_csv = sys.argv[1]
df = pd.read_csv(input_csv, sep=',', comment='#')
print(df) | 3.046875 | 3 |
app/main/__init__.py | AlchemistPrimus/data_crunchers_knbs | 0 | 12785940 | import flask
import pandas
| 1.03125 | 1 |
deployer/stack.py | bwood/deployer | 1 | 12785941 | <filename>deployer/stack.py
from deployer.cloudformation import AbstractCloudFormation
from deployer.decorators import retry
from deployer.logger import logger
from deployer.cloudtools_bucket import CloudtoolsBucket
import signal, pytz
from collections import defaultdict
from botocore.exceptions import ClientError, W... | 1.90625 | 2 |
safe_grid_agents/spiky/agents.py | jvmancuso/safe-grid-agents | 21 | 12785942 | """PPO Agent for CRMDPs."""
import torch
import random
import numpy as np
from typing import Generator, List
from safe_grid_agents.common.utils import track_metrics
from safe_grid_agents.common.agents.policy_cnn import PPOCNNAgent
from safe_grid_agents.types import Rollout
from ai_safety_gridworlds.environments.tomat... | 2.296875 | 2 |
cmake_tidy/commands/analyze/analyze_command.py | MaciejPatro/cmake-tidy | 16 | 12785943 | <gh_stars>10-100
###############################################################################
# Copyright <NAME> (<EMAIL>)
# MIT License
###############################################################################
from cmake_tidy.commands import Command
from cmake_tidy.utils import ExitCodes
class AnalyzeComm... | 2.203125 | 2 |
customer/migrations/0003_auto_20210713_1716.py | RFNshare/StraightIntLtd | 0 | 12785944 | # Generated by Django 3.0.7 on 2021-07-13 11:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customer', '0002_customer_address'),
]
operations = [
migrations.AlterField(
model_name='customer',
name='id',
... | 1.78125 | 2 |
combine.py | ychenbioinfo/msg | 0 | 12785945 | <gh_stars>0
"""
Combines each individual's hmmprob.RData file into two summary files
(linearly interpolating missing values)
Usage:
python msg/combine.py
msg/combine.py -d /groups/stern/home/sternd/svb_mausec2/hmm_fit
"""
import os
import sys
import csv
import glob
import optparse
import subprocess
import uuid
impo... | 2.484375 | 2 |
fake-logs.py | vdyc/fake-logs | 11 | 12785946 | # pylint: disable=C0103
from fake_logs.fake_logs_cli import run_from_cli
# Run this module with "python fake-logs.py <arguments>"
if __name__ == "__main__":
run_from_cli()
| 1.320313 | 1 |
implicit_solver/lib/dispatcher.py | vincentbonnetcg/Numerical-Bric-a-Brac | 14 | 12785947 | """
@author: <NAME>
@description : command dispatcher for solver
"""
# import for CommandSolverDispatcher
import uuid
from core import Details
import lib.system as system
import lib.system.time_integrators as integrator
from lib.objects import Dynamic, Kinematic, Condition, Force
from lib.objects.jit.data import Node... | 2.109375 | 2 |
database/models.py | Alweezy/ride-my-way-python | 0 | 12785948 | <filename>database/models.py
from datetime import datetime, timedelta
import jwt
from flask_bcrypt import Bcrypt
from flask import current_app
from api.app import db
class User(db.Model):
"""Creates a user model
"""
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username ... | 2.9375 | 3 |
actions/utils.py | anubhav231989/bookmarks | 0 | 12785949 | <gh_stars>0
from .models import Action
from django.utils import timezone
from datetime import timedelta
from django.contrib.contenttypes.models import ContentType
def register_action(user, verb, target=None):
last_hour_ago = timezone.now() - timedelta(hours=1)
similar_actions = Action.objects.filter(user=user,... | 2.359375 | 2 |
python/jobbole/jobbole/pipelines.py | LeonMioc/CodeUnres | 0 | 12785950 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from pymongo import *
from scrapy.conf import settings
class MongoDBPipeline(object):
_mongo_conn = dict()
_mongod = '... | 2.359375 | 2 |