blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
18ed8c811db3d1cbb489c3982b42989b84b0dddf
hattan/ccbot
/tests/test_dogme.py
UTF-8
1,436
2.515625
3
[]
no_license
import sys sys.path.append("ccbot") from ccbot.commands.dogme import DogMe from ccbot.services.reddit_client import RedditApiClient from mock import MagicMock def test_dogme_url_is_puppies_subreddit(): dogme = DogMe() assert dogme.url == "https://www.reddit.com/r/puppies.json" def test_dogme_commandtext...
true
a499edf5ec517820992285d8d406dcaec70460ad
Cpharles/Python
/CursoEmVideo/Aula_12/ex038-COmparando Numeros.py
UTF-8
497
4.59375
5
[]
no_license
"""Exercício Python 038: Escreva um programa que leia dois números inteiros e compare-os, mostrando na tela uma mensagem: - O primeiro valor é maior - O segundo valor é maior - Não existe valor maior, os dois são iguais""" num1 = int(input('Primeiro número:_')) num2 = int(input('Segundo número:_')) if num1 > num2: ...
true
a5ffdaec905f228131c291b77b1388e17af0e90f
jnissin/semantic-segmentation
/src/utils/dataset_utils.py
UTF-8
54,892
2.65625
3
[]
no_license
# coding=utf-8 import os import random import multiprocessing import time import numpy as np from PIL import Image from joblib import Parallel, delayed from image_utils import load_img, img_to_array, ImageTransform from .. import settings from ..data_set import ImageFile from ..enums import CoordinateType, ClassWe...
true
784f256c2ed92466981feb4e04b2f3a66db75c50
Asbert75/dbwebb-kurser
/python/kmom10/adventure/game.py
UTF-8
3,915
3.46875
3
[]
no_license
#!/usr/bin/env python3 """ This is the game "engine". This file contains most of the actual game. """ import data def loadFiles(): """ Check for wether or not the game is saved previously. """ #if not data.saved: # data.initialize() #else: # print("Loading Saved Files") data.init...
true
97ec1497d8fa8debdcb5edcb60f61eedd965ab69
uzi06263614/J
/Test_TPshop/case/test_tpshop.py
UTF-8
2,677
3.0625
3
[]
no_license
""" 编写unittest有关实现 """ # 导包 import json import unittest import requests from Test_TPshop import app from Test_TPshop.api.user_api import UserLogin # 参数化步骤1,导包 from parameterized import parameterized def read_json(): data = [] with open(app.PRO_PATH + "/data/login_data.json", "r", encoding="utf-8")as f: ...
true
780e8956ec1c42c64ee12c5331360e879f776c1c
AlanPoveda/ope-1
/ope-backend/src/core/use_cases/product_use_cases/list_products_use_case.py
UTF-8
332
2.640625
3
[ "CC0-1.0" ]
permissive
class ListProducts: def __init__(self, item_repository): self.item_repository = item_repository def list(self): try: response = self.item_repository.list_products() return response except: return {"data": None, "status": 400, "errors": ["Erro na requ...
true
c47297a176a50d2dde90dee6742ca5731054bcd6
DialBird/argo
/yukiko/python/43_baseball_game.py
UTF-8
969
2.953125
3
[]
no_license
N = int(input()) score_board = [0]*N results = [] candidate_orders = set([]) def calc(): point = score_board[0] sort_borad = sorted(score_board) cnt = 1 for i in sort_borad: if point < i: cnt += 1 point = i candidate_orders.add(cnt) def check(x, y): if x == N: ...
true
deb53cb7d79265f00d9e1c38965bb67cb465ed86
yebuahk/PlayerRatingPredict
/lr_predictioniModel.py
UTF-8
2,309
3.203125
3
[]
no_license
"""author Kevin Yebuah 7.6.2019 This is to predict player rating based on features """ import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt df = pd.read_csv('datafifa.csv') """data pre-processing and insights""" df.columns df.head(10) # take a look at first 10 rows df.describe...
true
2c03c75c014779f1ad599cd5ac06431f3dd70e89
lmun/competitiveProgramingSolutions
/uva/11559.py
UTF-8
294
2.8125
3
[]
no_license
try: while True: n, b, h, w = map(int,input().split()) res = 2 * b for i in range(h): c = int(input()) if max(map(int, input().split())) >= n: res = min(res, n*c) if res <= b: print(res) else: print("stay home") except Exception as e: pass else: pass finally: pass
true
633838e5f113cbd65092d0b595b77b2971ded4c6
AdamZhouSE/pythonHomework
/Code/CodeRecords/2538/60624/275138.py
UTF-8
444
2.765625
3
[]
no_license
def func3(): nums = list(map(int, input()[1:-1].split(","))) length = len(nums) flag = True for i in range(length): while 0 < nums[i] <= length and nums[nums[i] - 1]!=nums[i]: nums[nums[i]-1], nums[i] = nums[i], nums[nums[i]-1] for i in range(length): if nums[i] != i + 1:...
true
a5641fe47ae45bf281a21239d6b8033728021309
truseva/python-retrospective-master
/task3/solution.py
UTF-8
1,936
3.6875
4
[]
no_license
people = [] class Person: def __init__(self, name, gender, birth_year, father=None, mother=None): self.name = name self.gender = gender self.birth_year = birth_year self.father = father self.mother = mother people.append(self) def __setattr__(s...
true
40e26bbd927b19a78038f895781800637d75071b
PengLU1101/tagger
/Layer/CNN_Layer.py
UTF-8
2,279
2.84375
3
[]
no_license
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.autograd import Variable from WeightNorm import WeightNormConv2d import math SCALE_WEIGHT = 0.5 ** 0.5 def shape_transform(x): """ Tranform the size of the tensors to fit for conv input. """ return torch...
true
3eca9dce01e5bc723b23c1b2531c05910230fc62
BogdanPasterak/equation-of-two-circles
/comp_languages/python/main.py
UTF-8
946
3.5
4
[ "MIT" ]
permissive
import math class Point: def __init__(self,x,y): self.x=x self.y=y def display(self,p): print("%s ( %.2f, %.2f )"%(p,self.x,self.y)) # Intersection points of two circle. def equation(A,r,B,R): points=[Point(0,0),Point(0,0)] # Move the layout to the coordinates of the first circle C=...
true
515c63a340c9d8224267975a7388c42d004a7330
dshvets/EAPSI_2016
/NLP_Abstracts/Sentence_Classification/testing_prep.py
UTF-8
1,725
2.84375
3
[]
no_license
import re #script for creating the testing data set #using the 4 manually curated files will build testing set where sentences match the patterns in the 4 curated files file_array = ['../Associations.txt','../Is_A.txt','../Found_In.txt','../Involvement.txt'] assoc_list = [] involve_list = [] found_list = [] is_list = ...
true
fe164164cece1bde1390a07c2dcdf91868e9ad7a
PNikolin/python_selenium_test
/src/test_gmail.py
UTF-8
1,254
2.765625
3
[]
no_license
import time from selenium import webdriver from src.pages.sign_in_page import SignInPage from src.pages.create_account_page import CreateAccount driver = webdriver.Chrome("D:\Downloads\Python\chromedriver.exe") driver.get("https://accounts.google.com/") validator_error = "Имя пользователя может включать латинские бук...
true
bd2b9d6bd094bd4f706b6bfe2f8ea99c785d6fd6
andressalinas98/banda-de-musicos
/Logica/Banda.py
UTF-8
682
2.890625
3
[]
no_license
from Instrumentos import * from random import choice from random import randint from flask import Flask, render_template, request app = Flask(__name__) class Banda(): def inicio(): app.run(debug = True) @app.route('/') def crearBanda(): cantidad=3 Lista=[] InstrumentosList=[Violin(),Guitarra(),Trompeta()] ...
true
8c9b9a7c891f4fd3260334ef3a97680c9f134763
wangfengfighting/GPS_Similar
/plot_dbscan.py
UTF-8
5,120
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics from sklearn.datasets.sample...
true
4093930728781115ab94fae98e5147b8dd1e73dd
andiebalverde/librarymanagement
/myproject/libraries/forms.py
UTF-8
487
2.546875
3
[]
no_license
from flask_wtf import Form from wtforms import StringField, IntegerField, SubmitField class AddForm(Form): library_id = IntegerField("Id of Library: ") name = StringField('Name of Library:') city = StringField('City of Library:') state = StringField('State:') postal_code = StringField('Postal Code...
true
6d925309cb71f3900df0a97eb41c8e9c8cc24511
mukesh-jogi/python_repo
/Sem-5/pythonmysql/readdata.py
UTF-8
473
3.4375
3
[]
no_license
import mysql.connector as con mydb = con.connect( host = "localhost", user = 'root', password = '', database = 'python_example_db' ) mycursor = mydb.cursor() mycursor.execute("select * from student") firststudent = mycursor.fetchone(); print(firststudent) students = mycursor.fetchall() print("List...
true
1677937e1d58e51df0eba588d409db53c5d4ba45
garrisonblair/x-rudder
/venv/x-rudder/main.py
UTF-8
1,991
3.59375
4
[]
no_license
from game import * from player import * from random import randint def main(): print("################################################") print("##### X - R U D D E R #####") print("################################################") while True: print("\nHow many are playin...
true
551ccc656a4309012205478a1264d9697a2fada9
lucasolifreitas/ExerciciosPython
/secao17/exerc7.py
UTF-8
1,164
4.46875
4
[]
no_license
""" Escreva um código que apresente a classe Circulo, com atributos raio, área e perímetro e, os métodos calcularArea, calcularPerimetro e imprimir. Os métodos calcularArea e calcularPerímetro devem efetuar seus respectivos cálculos e colocar os valores nos atributos área e perimetro. O método imorimir deve mostrar na ...
true
6337459709d0fec77f171170d3f68d227613f1dc
krwiniarski/Py-Practice
/StudentsDictionary.py
UTF-8
1,666
3.78125
4
[]
no_license
#utilizing dictionaries #dictionaries for each subject English = {} History = {} Math = {} Biology = {} Spanish = {} #reads data from file and puts last name and score into correct dictionary with open('Students.txt') as f: for line in f: listedline = line.split() if len(listedline) > 1: English[li...
true
e81fc512c8e1edb40cb515a38d81704f9265744e
gsy/leetcode
/int_to_roman.py
UTF-8
1,901
3.703125
4
[]
no_license
# -*- coding: utf-8 -*- class Solution: def __init__(self): self.thousands_mapping = { 0: '', 1: 'M', 2: 'MM', 3: 'MMM', } self.hundrends_mapping = { 0: '', 1: 'C', 2: 'CC', 3: 'CCC', ...
true
2fd2e49d07f2bf5a3c00b18f5f0928ce05170f1f
acaciooneto/cursoemvideo
/ex_videos/ex-113.py
UTF-8
909
4.125
4
[]
no_license
def readint(msg): while True: try: inside = int(input(msg)) return inside except KeyboardInterrupt: print("\n\033[31mERROR! The user didn't want to complete the task, i'll assume the value as 0.\033[m") return 0 except: print("\033[...
true
74e4b74100631f741c5727e56e0faf572d3d1bcc
SUSE/teuthology
/teuthology/task/proc_thrasher.py
UTF-8
2,404
2.84375
3
[ "MIT" ]
permissive
""" Process thrasher """ import logging import gevent import random import time from teuthology.orchestra import run log = logging.getLogger(__name__) class ProcThrasher: """ Kills and restarts some number of the specified process on the specified remote """ def __init__(self, config, remote, *pr...
true
32a0a2c6685e3a7f59c53b59079a0282d2da22e6
MauriceDonner/CompPhys
/2_Exerc/Blatt2_2b.py
UTF-8
4,683
2.796875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def rk4_step(y0, x0, f, h, f_args = {}): k1 = h * f(y0, x0, **f_args) k2 = h * f(y0 + k1/2., x0 + h/2., **f_args) k3 = h * f(y0 + k2/2., x0 + h/2., **f_args) k4 = h * f(y0 + k3, x0 + h, **f_args) xp1 = x0 + h yp1 = y0 + 1./6.*(k1 + 2.*k2 +...
true
d2fa8b784f49fe6d545d75c86c66d94e92ecf25f
brunoterkaly/linux-perfmon
/ParseFreeMemStat.py
UTF-8
1,805
2.703125
3
[]
no_license
import subprocess from shutil import copyfile import sys import time import socket import datetime def printMessage(s): print("--------------------------------------------------------") print(" ", s) print("--------------------------------------------------------") def addToFreeMemFile(line): with open("fre...
true
435740f22f5466932e0a8845ea9c11fc4c74d4d9
Dikarsky/suffixtree
/suffixtree.py
UTF-8
5,568
3
3
[]
no_license
from dataclasses import dataclass, field from typing import List, Dict, Hashable, Union from networkx import DiGraph @dataclass class Node: id: int link: Dict = field(default_factory=dict) def __hash__(self): return self.id.__hash__() def __str__(self) -> str: return str(self.id) c...
true
0ff41a3e9300dd710c0c525fbefa6d009eb9d53a
aiyhome/tempZone
/pytools/ExportConfig/ExportXlxs2Config.py
UTF-8
21,228
2.546875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import sys import string import signal import os import re import json from openpyxl import load_workbook from enum import Enum import time import configparser def siginit(sigNum, sigHandler): print("byebye") sys.exit(1) signal.signal(signal.SIGI...
true
956f90818e8e297087daf9b221b33c7aaef8d721
willgdjones/Fine-mapping
/src/models/bayes_factors.py
UTF-8
7,967
2.9375
3
[]
no_license
# coding: utf-8 # In[1]: import numpy import itertools import math from copy import copy import pdb ### Create selection of SNPs def select_snps(z, subset): """ Given a gene subset and a vector of z-scores, extract out the appropriate z-scores. """ return [z[i] for i in subset] #example # for subse...
true
d8730d9894d7523dafd86d40b05539b60ab38680
greenDNA/Python-Crash-Course
/Exercises/Chapter 6/8.py
UTF-8
248
3.578125
4
[]
no_license
lucky = { 'animal' : 'dog', 'owner' : 'joe' } gato = { 'animal' : 'cat', 'owner' : 'tray' } pets = [lucky, gato] for pet in pets: for trait, value in pet.items(): print("I know that your {} is: {}".format(trait, value))
true
7022f900ce6070398e31508e99996b50c2de4371
kangkang09/python_class
/Day4/p4.py
UTF-8
82
3.015625
3
[]
no_license
p = 'As long as you love me' array = p.split(' ') length = len(array) print length
true
37b2e04569d1b898d3100eb70d5f48d8215e2ffd
Gyutae-Jo/algorithm
/algoTIL/D10/반복문자지우기_조규태.py
UTF-8
533
3.484375
3
[]
no_license
T = int(input()) for tc in range(1, T+1): string = input() while True: s = [""] * len(string) top = -1 top += 1 s[top] = string[0] for i in range(1, len(string)): if string[i] == s[top]: s[top] = "" top -= 1 else: ...
true
d6342baf3e55b94941a1ca9d788f6ec9b6c69278
qianjinfighter/py_tutorials
/earlier-2020/python_mod_tutorials/py_thread/thread_communication.py
UTF-8
842
3.578125
4
[ "Apache-2.0" ]
permissive
#coding:utf-8 from queue import Queue from threading import Thread import time # A thread that produces data def producer(out_q): while True: # Produce some data # ... data = 'a str' out_q.put(data) # A thread that consumes data def consumer(in_q): while True: # Get som...
true
f20ec6118104961b01959ff25068df181a9c2103
NYU-Millimeter-Wave/Roomba-Control
/tarek/turt.py
UTF-8
1,139
2.765625
3
[]
no_license
from __future__ import division import Tkinter as tk import numpy as np import turtle #wn= turtle.Screen() #lam= turtle.Turtle() app = tk.Tk() cv = turtle.ScrolledCanvas(app) cv.pack() screen=turtle.TurtleScreen(cv) screen.screensize(1500,1500) lam= turtle.RawTurtle(screen) tabdist = [-4, -156, 2, 0, -8, -211, 0, -5...
true
9dbadb900ea475712ab2447020f62996fa54742b
zhilonglu/kdd_new
/training_weather.py
UTF-8
4,121
2.515625
3
[]
no_license
__author__ = 'zhilonglu' from datetime import date,datetime,timedelta file_suffix = '.csv' path = 'C:\\Users\\zhilonglu\\Desktop\kdd\\KDDCUP\\' def transform(in_file1,in_file2): in_file_name1 = in_file1 + file_suffix in_file_name2 = in_file2 + file_suffix # not differ tollgate volume_total_dict={} p...
true
27b251e13a6c7033cd0d52e75630ff4dadcd3248
WonderBo/PythonLearningDemo
/src/Argument.py
UTF-8
1,473
4.09375
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python #coding:utf-8 #传入函数的参数可以为整型,字符串,元组,列表,字典 def fun(x): print x fun(x="jack") fun(("jack",23,"male")) fun(["jack",23,"male"]) fun(range(10)) #range函数返回列表 fun({"name":"jack","age":23,"gender":"male"}) #传入函数的参数为元组或者字典,可以利用*或者**取元组或字典所有值为多个形参赋值 注意:所有值 print "\n" def fun_1(name,age): ...
true
b0704e42f0e6bea7f33b905ec6e6ab6bcdb45176
foucar-manms/TP-DL2
/code/principal_DBN_alpha.py
UTF-8
8,081
3.03125
3
[]
no_license
""" On complètera un script principal_DBN_alpha permettant d’apprendre les caractères de la base Binary AlphaDigits de votre choix via un DBN et de générer des caractères similaires à ceux appris. La construction de ce programme nécessite les fonctions suivantes """ import sys import os import numpy as np impo...
true
57382ada8496390c319e3be9a374e6f81e188fd8
vvkond/QGIS
/tig_loader/utils.py
UTF-8
754
2.625
3
[]
no_license
class StrictInit(object): def __init__(self, **kw): assert not set(kw).difference(dir(self.__class__)), '{0} does not declare fields {1}'.format(self.__class__, list(set(kw).difference(dir(self.__class__)))) self.__dict__.update(kw) class Args(StrictInit): args = None class Exc(Exception):...
true
430dd3d2dbe05ed37bfa824e0c35c3d1631274f8
hyein99/Algorithm_programmers
/단계별/Level 2/[1차] 뉴스 클러스터링.py
UTF-8
980
3.328125
3
[]
no_license
def split_str(s): str_list = [] sub_s = '' for i in range(len(s)): sub_s += s[i] if len(sub_s) == 2: if sub_s.isalpha(): str_list.append(sub_s.lower()) sub_s = sub_s[1] return str_list def solution(str1, str2): # 다중집합 만들기 str1_list = sor...
true
aec3367438c1a074f51701bd2addd48ab71c858b
Nilutpal-Gogoi/LeetCode-Python-Solutions
/LinkedList/Easy/876_MiddleOfTheLinkedList.py
UTF-8
1,879
4.25
4
[]
no_license
# Given a non-empty, singly linked list with head node head, return a middle node # of linked list. If there are two middle nodes, return the second middle node. # Example 1: # Input: [1,2,3,4,5] # Output: Node 3 from this list (Serialization: [3,4,5]) # The returned node has value 3. (The judge's serialization ...
true
4373b1ca421603099a2ed2d424d25266eb8900aa
eggduzao/Costa_TfbsPrediction
/Code/Footprint/footprintTagCount.py
UTF-8
2,999
2.5625
3
[]
no_license
################################################################################################# # Receives as input a file with foorprints and outputs the same file but with the tag count # score (number of DNase reads around that region). ##############################################################################...
true
eff45fa6dd45f3df923ca4e63c32551349c38b80
ingmarliibert/dashcam-danger-detection
/presentation-collisions.py
UTF-8
2,098
2.578125
3
[]
no_license
import cv2 import tensorflow as tf from PIL import Image import numpy as np from object_detection.utils import ops as utils_ops import warn_user from collisions import get_collisions from model.app import object_detection_factory, object_detection_visualize_factory # CONSTANTS NB_COLLISION_FRAMES = 3 #frames COLLISIO...
true
99e68f5f1c748190f3a827b5831c28597f8f322b
makerlee/web_weixin_api
/wxbot_demo_py3/save_message.py
UTF-8
725
2.578125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # coding: utf-8 import pymysql """ jiyang.li create at 2018-01-25 保存历史聊天记录: 文字类型的聊天记录保存到mysql 图片视频的聊天记录保存到硬盘(后期会保存到文件服务器) """ class MysqlDao(object): def __init__(self): self.host = 'localhost' self.user = 'root' self.passwd = 'root' self.db = 'vdr'...
true
86864dafb11ade92fb83cce2fff690a5b66aa8c8
Mulokoshi/Simon-Assignment-1
/Tut2.Q2 integralcosx.py
UTF-8
1,542
3
3
[]
no_license
Python 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] on linux2 Type "copyright", "credits" or "license()" for more information. >>> import numpy as np >>> import matplotlib.pyplot as plt >>> np.linspace(0.0, np.pi/2,num=10) array([ 0. , 0.17453293, 0.34906585, 0.52359878, 0.6981317 , ...
true
02674999d13aaabbd6c16312390d77597f636058
liuzuxin/Deep-Q-Network-and-Model-Predictive-Control-Project
/DQN/DQN-Double/test.py
UTF-8
1,768
2.65625
3
[ "MIT" ]
permissive
# coding: utf-8 from DQN import * import gym from quanser_robots.common import GentlyTerminating import time def test(): config_path = "config.yml" print_config(config_path) config = load_config(config_path) training_config = config["training_config"] config["model_config"]["load_model"] = True ...
true
731a01db4b109ecaddff302c590eb0bbf29cc7cc
mitan9596/baiduTieba
/baidu.py
UTF-8
3,679
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- import urllib.error import urllib.request import re from tool import tool # 百度贴吧爬虫类 class Baidu: # 初始化 def __init__(self): # 传入所要爬取得贴吧地址 self.baseURL = input('请输入你想要爬取的贴吧页面:') # 判断是否只看楼主 judgement = input('是否只看楼主(y/n)') if judgement == '...
true
81c2e6fefce93a4a1be609da3c0bd930eb7378ec
mtourne/raspicam_ir_cut
/create_dataset.py
UTF-8
2,470
2.9375
3
[]
no_license
import argparse import tty, termios import sys import os import time from picamera import PiCamera import ir_cut def getch(): """getch() -> key character Read a single keypress from stdin and return the resulting character. Nothing is echoed to the console. This call will block if a keypress is not...
true
9ee89eebd24ba86f08980a29d0ac0985cef458a0
mertcerciler/Fall-Detection
/src/projectW13.py
UTF-8
7,370
3.375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 9 00:02:52 2020 @author: Mert """ import csv import numpy as np import pandas as pd from matplotlib import pyplot as plt # First of all, it is needed to load to data. # Our dataset contains 308 columns including the index number, label and 306 features, with 566 rows...
true
defd0e4fe924ef4ee0c312bf9ad6339c707c0dc4
shin-kanouchi/NLP_Tutorial
/train/train04_test.py
UTF-8
2,567
2.578125
3
[]
no_license
#!/usr/bin/python #-*-coding:utf-8-*- #2014/10/07 22:11:08 Shin Kanouchi """ shin:train kanouchishin$ ../script/gradews.pl ../data/wiki-ja-test.word train04.result Sent Accuracy: 23.81% (20/84) Word Prec: 71.88% (1943/2703) Word Rec: 84.22% (1943/2307) F-meas: 77.56% Bound Accuracy: 86.30% (2784/3226) """ import argpar...
true
68279ee129a0a321aee92d1387383e5f790abdaf
juzb/DeeProtein
/DeeProtein/helpers/dataset_gen.py
UTF-8
9,365
2.65625
3
[ "MIT" ]
permissive
import tensorflow as tf import logging class Dataset_Gen: """Reads a csv containing name, sequence and GO-terms for one protein per line (from datatpreprocessing) gives batches to model efficiently""" def __init__(self, FLAGS, go_info, train=True, data='seq', mask_width=1, seq=None): """Sets att...
true
4dedb88cb632f6b8c554b516a90f5970e96d6d00
rysa03/part2_all_task
/part2_task3.py
UTF-8
96
3.8125
4
[]
no_license
n=int(input('Input numbers: ')) print('Previous numbers is: ',n-1) print('Next number is: ',n+1)
true
347fcb8cfb78d0103049e12a9b7fe1e86a5eb9d3
Aditya239233/Algorithms
/Binary Trees/branchSums.py
UTF-8
614
3.671875
4
[]
no_license
''' Given a Binary Tree, return the sum of all the branches in the Binary Tree. ''' from .construction import BinaryTree def branchSums(root: BinaryTree) -> list: sums = [] calculateBranchSums(root, 0, sums) return sums def calculateBranchSums(node: BinaryTree, runningSum: int, sums: list): if no...
true
6ecb0cb4a6949ea0e963edc82c8e2e80f5240d7d
nhnam1105/SpotifyMusicAnalysis
/assignment.py
UTF-8
1,603
2.59375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 27 21:44:38 2020 @author: namnguyen """ from data_handling import read_data import setting as s import pandas as pd from sklearn.metrics import classification_report import MLELinear as mlel import plotting as p import bootstrapping import clusteri...
true
fe69ac5d9e2a20c098ef2fc422e6415f9b941851
Cbkhare/Challenges
/LC_Course_schedule.py
UTF-8
1,142
3
3
[]
no_license
class Solution(object): def createGrp(self, L): g = {} for pair in L: if pair[0] not in g: g[pair[0]] = set([pair[1]]) else: g[pair[0]].update([pair[1]]) return g def checkCycle(self, g, cn, visitd, recSt): #print (visi...
true
78303bdd5979990cc017047ea348e1f3e4b5004d
hireach/xxmonitor
/tests/api/lib/test_utils.py
UTF-8
1,190
2.96875
3
[]
no_license
import unittest from api.lib.utils import verification_string_is_json, object_to_json from api.models import App class TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual('foo'.upper(), 'FOO') def test_isupper(self): self.assertTrue('FOO'.isupper()) self.asse...
true
12138bb05044f2547bf724fda726e7538fb9a695
JonathanKTH/Colorful-Colarization-Project
/convNet.py
UTF-8
4,308
2.671875
3
[]
no_license
import numpy as np import cv2 import tensorflow as tf import skimage.color as color import skimage.io as io from skimage import img_as_ubyte import os, sys def create_weights(shape): return tf.Variable(tf.truncated_normal(shape, stddev=0.1)) def create_bias(size): return tf.Variable(tf.constant(0.1, shape = ...
true
f559274ee18c1a3599efe16284964f74d2762d51
mahatmaWM/leetcode
/leetcode/editor/cn/377.组合总和-ⅳ.py
UTF-8
1,278
3.5625
4
[]
no_license
# # @lc app=leetcode.cn id=377 lang=python3 # # [377] 组合总和 Ⅳ # # https://leetcode-cn.com/problems/combination-sum-iv/description/ # # algorithms # Medium (42.21%) # Likes: 153 # Dislikes: 0 # Total Accepted: 12.2K # Total Submissions: 29K # Testcase Example: '[1,2,3]\n4' # # 给定一个由正整数组成且不存在重复数字的数组,找出和为给定目标正整数的组合的...
true
3eda34e391faa91b06b86a3f98cb8db8bca7301e
jrnijboer/AdventOfCode
/2020/python/day19.py
UTF-8
1,018
2.515625
3
[]
no_license
import re def solve(extendForB): rules, input = [line.strip() for line in open("../input/day19.input").read().split("\n\n")] rules = {k : v.split(" ") for k,v in [r.split(": ") for r in rules.split("\n")]} if extendForB: rules["8"] = ["42", "{1,}"] rules["11"] = ["42", "{1}", "31", "{1}", "|", "42", "{2}...
true
d3e267f190e670ae1d975eb4cd8773018c83326c
likunhong01/PythonDesignPatterns
/函数式编程3个高阶函数.py
UTF-8
566
3.390625
3
[]
no_license
# coding=utf-8 # Version:python3.7.0 # Tools:Pycharm 2019 # Author:LIKUNHONG __date__ = '' __author__ = 'lkh' # map用法 list(map(lambda x: x * 2, range(10))) # 和列表生成式结果一样,还是推荐用列表生成式 [i * 2 for i in range(10)] # reduce归约用法 from functools import reduce reduce(lambda x, y: x + y, range(1, 6)) # 相当于从1开始,1,2作为xy,加起来,然后再把结果...
true
b0d9339527d19067c46151b55e50276e00350458
leovam/cnvkit
/cnvlib/segmentation/hmm.py
UTF-8
5,983
2.9375
3
[ "Apache-2.0" ]
permissive
"""Segmentation by Hidden Markov Model.""" import collections import logging import numpy as np import pandas as pd import scipy.special import pomegranate as pom from ..descriptives import biweight_midvariance from ..segfilters import squash_by_groups def segment_hmm(cnarr, method, window=None, processes=1): "...
true
2124cfb49d0a116469ddaa7c143fae668defcb8b
XQLong/DataEx
/cross_val_predict.py
UTF-8
781
3.375
3
[]
no_license
from sklearn import linear_model, datasets from sklearn.model_selection import cross_val_predict import matplotlib.pyplot as plt # 定义一个线性回归对象 lr = linear_model.LinearRegression() # 加载数据 boston = datasets.load_boston() # ‘target’, the regression targets y = boston.target # cross_val_predict returns an array of the sam...
true
519397cc76c5a4700f8f64bbf02f5da21bbe8eb2
kroneyen/works
/Stock/daily_divident_right.py
UTF-8
3,320
2.875
3
[]
no_license
# -*- coding: utf-8 -*- import pandas as pd import datetime import time ## 108年07月22日 def trans_date(sttr_list): trans_date = '' str_split_list = '' for sttr in sttr_list: row_str_split = sttr.split('年') ## 108 年07月22日 trans_date = str(int(row_str_split[0]) + 1911) + '/' ##str_sp...
true
10d977d860bfa5c600a7d2cff99e4f83a837b0ff
oelbarmawi/Ehab
/Session3/FormattingString.py
UTF-8
203
3.859375
4
[]
no_license
def greet(first_name, last_name): greeting = "Hi my name is {} {}".format(first_name, last_name) print(greeting) greet("omar", "elbarmawi") print() age = 50 print("I am {} years old".format(age))
true
fe44d5ff64fea35d5c5e4f16b0cfe175fa4b63b1
askap-vast/askap_surveys
/askap_surveys/__init__.py
UTF-8
939
2.609375
3
[]
no_license
import importlib.resources from pathlib import Path from typing import Optional moc_register = {} def _register_moc(moc_path: Path, name: Optional[str] = None): """Add a MOC to the internal register to make them easily accessible. Args: moc_path: Path to the FITS MOC file. name: Name of the...
true
8c66d6d61ee81d16afff3ee3afab61c4f1bf7ba2
clikonco/480Project2
/euclidmodule.py
UTF-8
2,957
3.171875
3
[]
no_license
import numpy as np import math #Second Method def euclidmain(): NOT = [(2, 10),(2, 5),(8, 4),(5, 8),(7, 5), (6, 4), (1, 2), (4, 9)] p = [(1,1),(2,1),(4,3),(5,4)] NOT=[(1,6.5),(1,7),(1,6),(2,5),(2,4.5),(2,4),(3,9),(3,8),(4,6.8),(4,7),(5,8)] p2 = p #choose n number of clusters(cen...
true
fb2751bc4073fdf86a1271a576682d16ac90abec
buck54321/winatoms
/offline/create.py
UTF-8
2,005
2.8125
3
[]
no_license
""" Copyright (c) 2020, The Decred developers """ import sys from base58 import b58encode from decred.util.encode import ByteArray from decred.crypto import crypto, opcode from decred.dcr import nets, txscript from decred.dcr.addrlib import AddressScriptHash from decred.crypto.secp256k1.curve import generateKey from...
true
3431072dee56e0a99505421f9fd96607c99375d2
Sthaim/ExerciceAlgo_Python_GD1.2
/main.py
UTF-8
5,108
2.859375
3
[]
no_license
from os import system import time def isBissextile(ann): test="false" if ann%4==0 and ann%100>0: test='true' return test def isValidCardNumber(number): retur="false" finale=[number//1000] ver=0 number=number-(number//1000)*1000 finale.insert(0,number//100) number=number-(nu...
true
cc55db3e611c728e1feb2e276c2788d5b06bcaf6
avastmick/cryptographon
/cipher-one/test_one.py
UTF-8
650
3.03125
3
[]
no_license
""" importing the one.py code""" import one import pytest def test_encode(): """Tests the one.encode function""" assert one.encode( "Hello World") == "11481249678067805698 10695698668367809533" def test_bad_encode(): """Tests for bad input""" with pytest.raises(one.EncodingException) as e_in...
true
20bbdb8100e1b6d078e8894882690ae80a6703bb
FiodarM/Term4Lab6
/pde.py
UTF-8
945
2.84375
3
[]
no_license
__author__ = 'fiodar' import numpy as np def dirichlet_problem_2d(x_bounds, y_bounds, conditions_x, conditions_y, n_x=50, n_y=50, tol=0.01): x = np.linspace(x_bounds[0], x_bounds[1], n_x) y = np.linspace(y_bounds[0], y_bounds[1], n_y) phi = conditions_x[0](x), conditions_x[1](x) psi = conditions_y[0...
true
9b91fcb32905b44605a9314209572a5f1c712dfd
lixumichael/Data-analysis-tutorial
/chapter3/code/TsExerciseOne.py
UTF-8
3,392
2.828125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "MambaHJ" import os import pandas as pd def get_data(data_name=''): current_path = os.getcwd() parent_dir = os.path.dirname(current_path) print(parent_dir) for f in os.listdir(parent_dir): print(f) if f.endswith("data"): data_path = os.path.join(pa...
true
74923980d5c03dd470fd102db8ad8ef45a96d9c7
WPI-AIM/NeedleTracker
/tracking.py
UTF-8
16,255
2.625
3
[]
no_license
import cv2 import numpy as np import itertools from collections import deque class TipTracker: def __init__(self, params, image_width, image_height, heading_expected, heading_range, threshold_mag_lower, threshold_mag_upper, roi_center_initial, roi_size, kernel_size, name="camera",...
true
e2308ac21eaf50fc0aac7844b4c0e77ad25f9fc5
NicholasWM-zz/Cursos
/Python/AULAS/Coursera/Semana 05/maximo_3.py
UTF-8
201
3.375
3
[]
no_license
def maximo(a,b,c): if(a > b and a > c): return(a) elif (b > a and b > c): return(b) elif (c > a and c > b): return(c) else: return a print(maximo(7,7,7))
true
0bba169c71efe8e26f20ee9f29caf06ae2737566
e-hall-hoffarth/honours_thesis
/scripts/name_scraper.py
UTF-8
1,317
2.703125
3
[]
no_license
import requests import csv import json import time f = './Privacy_Rights_Clearinghouse-Data-Breaches-Export_2018.csv' out = './data-breaches-with-tickers.csv' with open(f, 'r') as infile, open(out, 'w+') as outfile: data = csv.DictReader(infile) headers = data.fieldnames headers = headers + ['symbol', 'ma...
true
7e76eb43f973de5f7c3d439930b832ded5f28bc5
tquiroga/configui
/configui/utils/coherse_name.py
UTF-8
488
3.78125
4
[]
no_license
import string valid_characters = string.join([string.letters, string.digits, '_'], '') def coherse_name(name): ''' Formats a string to be a valid filename, striping out everything except for letters, digits, and '_' ''' cohersed_name = '' space_replaced_name = name.replace(' ', '_') for cha...
true
2e05c7c3fb110f4fa26f056db4ebc1f08a0afcc8
IstvanOri/adventofcode-2020
/ac2020/days/Day2.py
UTF-8
4,077
3.96875
4
[ "Apache-2.0" ]
permissive
from ac2020.days import AbstractDay class Day2(AbstractDay.AbstractDay): """ Advent of Code 2020 - Day 2 =========================== Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan. The shopkeeper at ...
true
1d78c793efa02147cd01b62db70980b6eb772056
teesamuel/Udacityproblemvsalgorithm
/problem_5.py
UTF-8
2,579
3.65625
4
[]
no_license
class TrieNode(): def __init__(self,char=''): self.character=char self.children={} self.is_last=False def add(self, char): if char not in self.children: # self.children.append(char) self.children[char]='' self.character = char else: ...
true
4c6353d6a0020ed7bec3005e9c95d748cfe7b8e7
txemac/events-api
/src/tests/integration/data/database/zone_test.py
UTF-8
2,550
2.65625
3
[]
no_license
from data.database import Zone from data.schemas import ZoneCreate def test__create(session, data_zone): count1 = session.query(Zone).count() data = ZoneCreate(**data_zone) zone = Zone._create( db_session=session, data=data, ) count2 = session.query(Zone).count() assert count1 ...
true
41a19130d653930579415677e959c8d14a78ca29
cash2one/xai
/xai/brain/wordbase/adjectives/_needy.py
UTF-8
446
2.578125
3
[ "MIT" ]
permissive
#calss header class _NEEDY(): def __init__(self,): self.name = "NEEDY" self.definitions = [u'poor and not having enough food, clothes, etc.: ', u'wanting too much attention and love: '] self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'adjectives' def run...
true
6fc0bb15fecee6b58687d6d870cc34c209357b73
chonkerboi/popen-and-special-fd
/reader.py
UTF-8
256
2.96875
3
[]
no_license
import os import sys fd = int(sys.argv[1]) total = 0 with os.fdopen(fd, 'rb') as fileobj: while True: data = fileobj.read(1024*1024) if not data: break total += len(data) print(total) print('Reader done')
true
114dad1d1866007e4e3eed47483e68cd832fc0a5
ZordoC/tag_handler-
/package/align_process.py
UTF-8
2,949
3.296875
3
[]
no_license
import os def convert_fast_align_process(path_source,path_target,path_output): """ Opens source and target files, and creates a new file with the following format: Source sentence (1) ||| Target sentence (1) Source sentence (2) ||| Target sentence (2) . ...
true
20abcf4b6fd59d1dda63c8349fe50227403693d5
GaganDureja/Python_Learning
/python_mysql.py
UTF-8
2,891
3.171875
3
[]
no_license
import mysql.connector # Create connectionn to database mydb = mysql.connector.connect( host="localhost", user="root", password="Password@123", database="students" #-- if no error means db exist ) #create database mycursor = mydb.cursor() #mycur.execute("CREATE DATABASE students") # list database print("Lis...
true
b3a786e0ed46f9f79dd00f9ccdd4b0ab56730560
tiagocaruso/ciroai
/word-rnn-ltsm.py
UTF-8
2,809
2.953125
3
[]
no_license
import re import sys import string import numpy as np from keras.utils import np_utils from keras.models import Sequential from keras.callbacks import ModelCheckpoint from keras.layers import Dense, Dropout, LSTM from keras.layers.embeddings import Embedding from keras.models import model_from_yaml # Importando o corp...
true
aade24436bd31e561ea5e6e7cd06651fe1684e79
stellaGK/stella
/scripts/upgrade_inputs.py
UTF-8
4,641
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import argparse import dataclasses import difflib from typing import List, Optional import re import io import f90nml @dataclasses.dataclass(unsafe_hash=True) class NamelistKey: namelist: str key: str @dataclasses.dataclass(unsafe_hash=True) class Replacement: old: NamelistKey ...
true
bd7a1e4798d8d882ebb6f398c75412a80fa6bd36
thomastanck/Elemmaclassify
/utils.py
UTF-8
6,105
2.578125
3
[]
no_license
import sys import pickle import functools import itertools import subprocess import shelve import numpy as np def persist_to_shelf(filename): def decorator(original_func): shelf = shelve.open(filename) @functools.wraps(original_func) def new_func(*params): key = str(params) ...
true
6441080a589dfc29039acd1710814037eaf49d03
Garywang0516/machine-learning
/line.py
UTF-8
969
3.5
4
[]
no_license
import numpy as np import sklearn.linear_model as lm import sklearn.metrics as sm import matplotlib.pyplot as mp x,y = [],[] with open('/home/ubuntu/桌面/machine learning/data/single.txt','r') as f: for line in f.readlines(): data = [float(substr) for substr in line.split(',')] x.append(data[:-1]) y.append(data...
true
aeace8f578c2397757ca1f683deae5b0a2d4cc90
SaharAltammemi/task-in-graph
/حلقات من الدوائر.py
UTF-8
746
3.609375
4
[]
no_license
import turtle myTurtle = turtle.Turtle(shape="turtle") myTurtle.color('green') myTurtle.pensize(10) myTurtle.circle(50) myTurtle.penup() myTurtle.setposition(-120,0) # تبعد دائره عن الثانيه myTurtle.pendown() myTurtle.color('red') myTurtle.pensize(10) myTurtle.circle(50) myTurtle.penup() myTurtle.s...
true
4d5e19a0b542a04cfd725705c82c6eb12ecf270a
DaHuO/Supergraph
/codes/BuildLinks1.10/test_input/CJ/16_1_1_DavidJHall_lastword.py
UTF-8
1,174
3
3
[]
no_license
import time infilename ='A-small-attempt0.in' def flipbit(mybit): if mybit: mybit = False else: mybit = True return mybit def solve(word): possibles = 2**(len(word)-1) answers = word[0] for i in range(1,len(word)): # print word[i] # print "...
true
237a6fb9591da0ee5fbfc5c53e1c3762bbeea38e
enfageorge/getQuotes
/getQuotes.py
UTF-8
661
3.15625
3
[]
no_license
import requests from bs4 import BeautifulSoup tag=input("What topic would you like quotes in?") pageno=1 link = "https://www.goodreads.com/quotes/tag/"+tag+"?page="+str(pageno) result = requests.get(link) #print result.text soup = BeautifulSoup(result.text,'lxml') #print soup.text # kill all script and style elemen...
true
81cef2fa9abdc3d817a866104a346c2651a1cad3
RubenProject/NeuralNetworks2
/T1/mnist_cnn.py
UTF-8
3,460
2.765625
3
[]
no_license
'''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import os import keras from keras.datasets import mnist from keras.models import Seque...
true
b5cac6d9a7c1f272ad2a7a29a08fbaafcbcaa5b0
wutong0810/2017-10before
/2017-06/0624态势10min.py
UTF-8
7,259
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 24 10:15:19 2017 @author: wutongshu """ def inOut(upInsec,downInsec,upDire1,upClane1,upDire2,upClane2,downDire,downClane1,downClane2): upInsec.iloc[:,1]=pd.to_datetime(upInsec.iloc[:,1]) downInsec.iloc[:,1]=pd.to_datetime(downInsec.iloc[:,1]) upInsec['day']=u...
true
057dfb8df4aa5107dfbdd7942e39355f5a8b14d6
eleddy/zeo.memcache
/zeo/memcache/cache.py
UTF-8
8,267
2.640625
3
[]
no_license
import xdrlib import BTrees.LOBTree import logging import threading from ZODB.utils import u64, z64 import memcache logger = logging.getLogger("ZEO.memcache") def bpack(saved_oid, tid, end_tid, data): """ Binary pack for a cache item """ p = xdrlib.Packer() p.pack_list([saved_oid, tid, end_tid, ...
true
5c4c2a3ea32f319ecfaf783968932e4be4c2888f
shmhlove/PythonStudy
/ncsoft.credu.com/Python_15_WebScraping_02.py
UTF-8
2,097
2.71875
3
[]
no_license
#--------------------------------------------------- print('---------------------------------------------'); #--------------------------------------------------- import pyautomate from pyautomate import web def search_google(keyword): url = "http://google.com/search?q={0}".format(keyword); html = web.parse_ht...
true
387095e33646898028068710235f6c101d006d95
zhyErick/fengkuang_python
/04/4.3.assert_test.py
UTF-8
118
3.78125
4
[]
no_license
s_age = input("输入您的年龄:") age = int(s_age) assert 20 < age < 80 print("您输入的年龄在20和80之间")
true
e651208b01817ccaefafdfc471484ee1a822ce7b
johannasantos/python
/testsPython/tests.py
UTF-8
558
3.0625
3
[]
no_license
import unittest import carrito class TestCarrito(unittest.TestCase): def test_agregar_producto(self): carrito.agregar_articulo("jabon", 10.78) precio = carrito.carrito["jabon"] self.assertTrue(precio == 10.78, "El precio no es correcto") def test_eliminar_producto(self): carr...
true
610a6aa93366fa0074fbeeb94d4cf3e885cabbd5
kushagra-18/Forged-Image-Detection
/scripts/download_images_from_csv.py
UTF-8
1,173
3.125
3
[]
no_license
# python download_images_from_csv.py '../data/imgur.csv' '../data/fake' import pandas as pd import requests import urllib import os import sys from datetime import datetime CSV_PATH = sys.argv[1] if len(sys.argv) > 1 else 'data/imgur.csv' OUTPUT_PATH = sys.argv[2] if len(sys.argv) > 2 else 'data/fake' def images_fro...
true
53ccbf88d1b65717b8c436d2a10e3ebe6f3430a6
lanchunyuan/Python
/PythonCrashCourse/chapter-8/8-3.py
UTF-8
160
3.5
4
[]
no_license
def make_shirt(size,logo): print("\nI'm going to make a " + size + " t-shirt.") print('It will say, "' + logo + '"') make_shirt('XL','I love Python!')
true
5f5092e435c598dba7b3c908830fc554d5d9547c
Anirudh4444/BOLO-STARK
/check.py
UTF-8
24
2.8125
3
[]
no_license
a=20 b=10 c=b/a print(c)
true
a565427bac9a06b60dcc671f656baa2c014e5d99
Tarun1001/codeforces
/.history/a_helpful_minds_20210606144101.py
UTF-8
36
2.515625
3
[]
no_license
x= str(input().split("+")) print(x)
true
6884a7438cfc5a917b7e6655b53e8042230c4c9b
BarYar/MonopolyGame
/Game/Player.py
UTF-8
2,856
3.75
4
[]
no_license
from Game.Houses import Houses from Game.Character import Character """Player class- parameters: 1.name - The player name (string) 2.money - The player money (float) - can't be negative 3.The character of the player. 4.x (float) - default value=None...
true