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
01bfb7ae77b5d41d43cf198c720c7342e3b1179f
PreshitaDave/Bioinformatics_coursera
/bioinfo1/w3_greedyalgo.py
UTF-8
1,015
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jul 26 11:55:00 2020 @author: Presh """ # to find probability of consensus sequence def Pr(Text, Profile): pr = 1 k = len(Profile['A']) for i in range(0, k): pr1 = 1 for l in Profile.keys(): if Text[i] == l: ...
true
a5f5969ab3f0663da2bc81b322a38e58f58ef61d
SnehaKarthikeyan/problems-monotonicarray
/Code.py
UTF-8
267
3.421875
3
[]
no_license
Coding: def isMonotonic(A): return (all(A[i] <= A[i + 1] for i in range(len(A) - 1)) or all(A[i] >= A[i + 1] for i in range(len(A) - 1))) n=int(input()) A = list(input().split()) if(isMonotonic(A)==True): print("YES") else: print("NO")
true
45d796b0a7f807c0cee38817da38302ce65d32e6
JoeStallibrass/Rabbit_Project
/test_group1/test_2.py
UTF-8
1,355
2.84375
3
[]
no_license
from rabbit_project.Female_Rabbit import * from rabbit_project.Male_Rabbit import * from rabbit_project.Enclosure import * from rabbit_project.Breeding import * class breeding_test(unittest.TestCase): breeding = RabbitBreeding() def test_init(self): self.assertFalse(self.breeding.new_rabbit_list) ...
true
db165825783aed6eff9e8f532d0c0f0deb4d42d0
alexandraback/datacollection
/solutions_5640146288377856_1/Python/upppi/gcjc1.py
UTF-8
470
3.125
3
[]
no_license
from __future__ import print_function import fileinput def battle(r, c, w): simple = r * (c / w) ship = (w - 1) if(c % w): ship += 1 return simple + ship def solve(line): r, c, w = map(int, line.split()) return battle(r, c, w) def main(): for idx, line in enum...
true
a5e72301b9a4cfb0d02e8765416ece5a1758aca0
xiedaokun/scrapy-python
/ArticleSpider/test.py
UTF-8
192
2.609375
3
[]
no_license
import datetime try: create_date = datetime.datetime.strptime("2019/07/05", "%Y/%m/%d").date() except Exception as e: create_date = datetime.datetime.now().date() print(create_date)
true
155c0c48119b17e6d732e159a8796514b2f36743
kt8506/Leetcode
/try2.py
UTF-8
1,196
3.953125
4
[]
no_license
a = 1 b = 1 print(a is b) # True import collections n1 = '2500' n2 = '0052' print(collections.Counter(n1)==collections.Counter(n2)) str1 = "w20930" print(str1.split('0')) alist = [1,2,3,4,5] for _ in range(len(alist)): print(alist.pop()) """ 二分查找 def BiSearch(nums,k): nums = sorted(nums) print(nums)...
true
b7110b0edde2d92b6e8a9d8d7d92dc7ef7397f54
inimitabletim/iii
/Numpy/18_save.py
UTF-8
278
2.796875
3
[]
no_license
# --- 存檔 page.51 import numpy as np a = np.random.randint(1, 20, 16).reshape(4, 4) print(a) print('') b = np.sort(a, axis=0) print(b) print('') c = np.sort(b, axis=0) print(c) print('') np.save('c', c) np.savetxt('c', c) d = np.load('c.npy') print(d)
true
0569be8bb232cebe39d6e1c85583d7cae6a4eff0
josejpalacios/codecademy-python3
/Lesson 02: Functions/Lesson 1: Introduction to Functions/Exercise 10: Scope.py
UTF-8
459
4.15625
4
[]
no_license
# Created current_year as a global variable current_year = 2048 # Removed current_year as a parameter def calculate_age(birth_year): age = current_year - birth_year return age # Attempt to print current_year outside scope # print(current_year) # Results in NameError # Attempt to print age outside scope # print...
true
71ba4ecc763e8293d68afc2bba002eef409ff415
KyrusMama/EvoCom
/board.py
UTF-8
11,616
2.953125
3
[]
no_license
import tkinter as tk import numpy as np import animal shouldDraw = True canvas_width = 1600 canvas_height = 800 if shouldDraw: master = tk.Tk() sound_vol = 20 linear_falloff = 1 age_loss_bound = 50 move_sound_angle = [] n_species = 2 species_color_dict = ["red", "orange", "yellow", "green", "blue", "purple", "bla...
true
0af6a95e7995776fbdda8a1bf917bf8dd8302b0c
pritishyuvraj/profit-from-stock
/models/model.py
UTF-8
1,371
3.265625
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import numpy as np class LSTM(nn.Module): def __init__(self, input_size=3000, hidden_layer_size=100, output_size=1): super().__init__() self.hidden_layer_size = hidden_layer_size self.lstm = nn.LSTM(input_size, hidden_layer_size) self.linear = nn...
true
18cf19218698f751d7bb626cd8020c5439bd7cff
barbaniahra/dns_cached_resolver
/main/listeners.py
UTF-8
3,556
2.6875
3
[]
no_license
import socket from pykka import ThreadingActor from abc import abstractmethod from main.utils import recv_tcp_message, send_tcp_message from main.messages import DNSMessage import logging class BaseListener(ThreadingActor): def __init__(self, host, port, resolver_ref): super().__init__() self._hos...
true
d98b777c6d1e09b31af7f1f02f056b97156f41ac
ehouguet/ehouguet-snake-ia
/neuralNet.py
UTF-8
1,175
2.96875
3
[]
no_license
from matrix import Matrix class NeuralNet: # contructeur def __init__(self, nb_input, nb_output): self.nb_input = nb_input self.nb_output = nb_output self.matrixInOut = Matrix(nb_output + 1, nb_input) @classmethod def createWithMatrix(self, matrix): neuralNet = NeuralNet(matrix.nb_rows, ma...
true
26f0caea41350080d3ce0f007690d651bc624151
andrewgy8/advent_of_code_2017
/day_11/script.py
UTF-8
866
3.109375
3
[]
no_license
from math import floor coords = [('n', 0, 1, -1), ('s', 0, -1, 1), ('ne', 1, 0, -1), ('nw', -1, 1, 0), ('se', 1, -1, 0), ('sw', -1, 0, 1)] def get_file_and_format(): with open('day_11/input.txt') as f: return f.read() def main(inputs): origin = (0, 0, 0) max_dist = 0 for d in inputs: ...
true
b2e51d83952e161215ca068c4eb321ebd234cdc0
GeiselBiofilm/Collins-MapA
/Plotting/Figure_11/Inner_ring_colors/create_Fig_11_inner_ring.py
UTF-8
2,731
2.90625
3
[]
no_license
import re import sys def main(TreeFile, No_LapDGFile, LapACountFile, OutFile): """ Creates color strip dataset for iToL given a treefile to annotate and files containing information about the presence/absence of LapD and LapG and the number of LapA-like proteins encoded. The input files can contain taxa not inclu...
true
9300af5b3b9feb664ba793d93f83e115e8c3fb39
ankitjain87/exercise
/FAAMGU/twilio_hackerrank.py
UTF-8
1,996
2.875
3
[]
no_license
def firstOccurrence(s, x): if len(s) < len(x): return -1 first = -1 i, j = 0, 0 while i < len(s): if x[j] == "*" or s[i] == x[j]: first = i start = i while j < len(x): if x[j] == "*" or s[start] == x[j]: start += 1 ...
true
5fefd6d4c3cb83765511e44e5a1889fa2866eb1a
sebutz/python101code
/Chapter 2 - Strings/2_2_string_concatenation.py
UTF-8
445
3.609375
4
[]
no_license
# the following demonstrates how to join two strings string_one = "My dog ate " string_two = "my homework!" string_three = string_one + string_two # we can go further on string_three = string_one + " " + string_two print("string_three:", string_three) string_three = string_one + ' / ' + string_two print("string_th...
true
b607a90d970df51d54391009a36790225de12ab0
NurlanRazak/python-exercises
/lab2/lab2-5-RN.py
UTF-8
1,630
2.84375
3
[]
no_license
from tkinter import * root = Tk() can = Canvas(root, bg = "white") can.grid(row=0, column=4, columnspan=2, rowspan=2) def make_circle(event): can.create_oval(event.x, event.y, event.x+20, event.y+20) def make_square(event): can.create_rectangle(event.x, event.y, event.x+20, event.y+20) def make_line(event): ...
true
57697d918f35f763b20d3e267e338dffacef57b5
jfelectron/user_analytics
/user_adoption/adoption_predictor.py
UTF-8
5,407
2.53125
3
[]
no_license
import pdb import os from operator import itemgetter import time from pprint import pformat import pandas as pd import numpy as np from sklearn.grid_search import RandomizedSearchCV from sklearn.cross_validation import LabelKFold from sklearn.ensemble import RandomForestClassifier from scipy.stats import randint as sp...
true
117b2c22ec1f8990fbf3eb02886230e660b8df18
naufalmukhbit/titanic-kaggle
/titanic/data/load.py
UTF-8
434
2.625
3
[]
no_license
import os import pandas as pd # Load the training data # Path defaults to the 'train.py' file in the same folder def train_data(path=os.path.join(os.path.dirname(__file__), "train.csv")): data = pd.read_csv(path) return data # Load the testing data # Path defaults to the 'test.py' file in the same folder def...
true
ca033f324318bb2519c32b2db0501122fdeea174
adoniscs/faculdade-linguagem-de-programacao
/urijudge-AC01/1124_jodo_par_impar.py
UTF-8
151
3.671875
4
[]
no_license
numero = int(input()) if numero >= 2 and numero % 2 == 0: print(f'{numero - 1} {numero + 2}') else: print(f'{numero - 2} {numero + 1}')
true
a2f9460d948fbef4b87243dea0d2f70c75ca802b
jashworth-UTS/scripts
/CDSseqs_from_gtf.py
UTF-8
1,316
2.625
3
[]
no_license
#!/usr/bin/env python3 import sys import re from Fasta import FastaSeqs from AshworthUtil import rvs_comp_str # braker didn't output spliced CDS sequences, so parse the gtf file and create them def msg(msg): sys.stderr.write('%s\n' %msg) class Gene(dict): def __init__(self): dict.__init__(self) parts = [ 'CDS'...
true
c30c9cd19228e864c1f01e44902d47e16754e18f
ray-project/ray
/python/ray/data/_internal/memory_tracing.py
UTF-8
5,861
2.8125
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
"""Utility for debugging object store memory eager deletion in Datasets. NOTE: the performance overhead of tracing object allocation is fairly substantial. This is meant to use in unit test for debugging. Please do not enable in production, without performance optimization. Enable with RAY_DATA_TRACE_ALLOCATIONS=1. ...
true
a82272e9094e102404a30ffe159a2210b1364dac
mfbx9da4/mfbx9da4.github.io
/algorithms/2.06_pallindrome.py
UTF-8
948
3.6875
4
[]
no_license
class Node(): def __init__(self, val = None, next = None): self.val = val self.next = next def list_to_linked_list(arr): prev = None for val in arr: node = Node(val) if prev: prev.next = node else: head = node prev = node return head def print_list(node): l = list() whi...
true
b131fb849243fef2f4cac99842d0f4122dabc7f1
Karn39/OpenCV6_Practice
/HoughCircles.py
UTF-8
560
2.65625
3
[]
no_license
import cv2 import numpy as np img = cv2.imread('./trainImg/0.0015.jpg',0) img = cv2.medianBlur(img,5) cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR) circles = cv2.HoughCircles(img,cv2.HOUGH_GRADIENT,2,317, param1=100,param2=30,minRadius=20,maxRadius=0) circles = np.uint16(np.around(circles)) for i in circles[0,:]: ...
true
e81199e3c90ae55e236dc7aeb86afad5fb6da2e7
naveen5a0/TradingSystem
/trading system/trading_system.py
UTF-8
4,402
3.25
3
[]
no_license
import datetime import math import re class TradingSystem(object): def __init__(self): self.total_edge = 0 #Function to fetch the sample data from the text file to be used in this project def get_data_dict(self): #Opening the file where sample data is located f = open('data.txt') data_array = [] data_d...
true
1a468a215cc270a34d9cdf2698d651f4c88960cb
hitarth-pixel/class97
/class97Program5.py
UTF-8
121
3.859375
4
[]
no_license
# write a program to print 10- 1 using while loop count=10 while (count>=0): print(count) count=count-1
true
8740c7f696b53b67ac56ca6b6601693c7ca3bb45
vader-coder/Search
/button.py
UTF-8
540
2.640625
3
[]
no_license
#is-primary, is-danger, is-white, is-black html = """ """ rows = range(7) rows = [str(i) for i in rows] cols = range(7) cols = [str(i) for i in cols] for row in rows: html += """<div class="buttons">\n""" for col in cols: html += """ <button id=\"""" + row + "_" + col + \ """\" class = ...
true
afbdd470ce64c90d693e35033c06372b0eb7800b
Shraman-jain/PenguinClassifier
/firstpage.py
UTF-8
2,392
3.21875
3
[]
no_license
import streamlit as st import urllib.request from PIL import Image def app(): st.write("# Penguin Prediction App") st.write(""" This web application predicts the **Palmer Penguin** species in which you can classify penguin in two ways- either by using an **IMAGE** of a penguin or by adding spe...
true
3e931289088b426b9727b2f66e8c46ea002c5d9f
kjw9899/OpenCV-study
/OpenCV - 20. 이미지 피라미드(Image Pyramid).py
UTF-8
1,560
3.46875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # ### 가우시안 피라미드 # In[ ]: ''' dst = cv2.pyrDown(src, dst, dstsize, borderType) dst = cv2.pyrUp(src, dst, dstsize, borderType) src: 입력 영상 dst: 결과 영상 distsize: 결과 영상 크기 borderType: 외곽 보정 방식 ''' # In[ ]: # 가우시안 이미지 피라미드 import cv2 img = cv2.imread('C:/cdd/moons1.jpg') # 가우...
true
d814878e8f3744982237802a85932736264db867
eognianov/PythonProjects
/PythonBasics/exam/special-numbers.py
UTF-8
410
3.375
3
[]
no_license
magic=int(input()) for _1 in range(1,10): if magic % _1 != 0: continue for _2 in range(1,10): if magic % _2 != 0: continue for _3 in range(1, 10): if magic % _3 != 0: continue for _4 in range(1, 10): if magic % _4 != 0: ...
true
79e10a7a8820f68c492044e3d38be76ec5ffed46
vltr/sslproto37
/examples/with_backport_client.py
UTF-8
1,248
2.53125
3
[ "Unlicense" ]
permissive
import asyncio import os import ssl import sys sys.path.append(os.path.join("..")) from sslproto37 import SSLProtocolBackportLoopPolicy root_path = os.path.dirname(os.path.abspath(__file__)) ssl_cert = os.path.join(root_path, "server.crt") def dumb_ssl_context(): ctx = ssl.create_default_context(ssl.Purpose.SE...
true
01352ae04db76e977f149953b2a0adcc26f734f9
Cloving/NetEase-Spider
/网易云音乐榜单/requests_NetEaseMusic.py
UTF-8
3,830
2.796875
3
[]
no_license
import json import math import re import pymysql import requests from urllib import parse class NeteaseCloudMusic(): def __init__(self): self.count = 1 self.url = "https://music.163.com/discover/toplist" self.host = "127.0.0.1" self.user = "root" self.password = "******" self.db = "spider" ...
true
67ebe99ccc454f523a6d862ec794b503781cb493
aws-samples/amazon-textract-code-samples
/python/10-tables.py
UTF-8
637
2.609375
3
[ "MIT-0" ]
permissive
import boto3 from trp import Document # Document documentName = "employmentapp.png" # Amazon Textract client textract = boto3.client('textract') # Call Amazon Textract with open(documentName, "rb") as document: response = textract.analyze_document( Document={ 'Bytes': document.read(), ...
true
ee6407eb443a4b2d23bcd5fe549cf9df6dd9b3e6
JeffreykAndersen/Login_registration
/login_app/models.py
UTF-8
3,119
2.546875
3
[]
no_license
from django.db import models import re import bcrypt #regex import #Pass in a pattern that email must match from the imported re EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') #regex email format class UserManager(models.Manager): def basic_validator(self, postData): errors = ...
true
080d5c4ea27bb1ee01ec80cbdb998459725a8b0b
gustapia06/Yelp-Web-Crawler
/src/app/views.py
UTF-8
7,092
2.671875
3
[]
no_license
from app import app from flask import render_template from flask import request as rq from bs4 import BeautifulSoup import requests import json from fuzzywuzzy import fuzz, process import re import os # Yelp API urls and constants API_HOST = 'https://api.yelp.com' WEBSITE_HOST = 'https://www.yelp.com/biz/' SEARCH_PAT...
true
b57037b34e10b39659a7479bc878c0c8d3d00b1a
slept24hours/Tsinghua-Deep-Learning-Summer-School
/MLP/Project2/layers/fc_layer.py
UTF-8
2,326
3.265625
3
[]
no_license
import numpy as np class FCLayer(object): def __init__(self, num_input, num_output, act_function='relu', trainable=True): """ Apply a linear transformation to the incoming data: y = Wx + b Args: num_input: size of each input sample num_output: size of each output s...
true
dcaae0734e09020f3eb6aba365c70b26ac9e8ef3
cclauss/MySql-Database-Creation-Tool
/database_creation.py
UTF-8
6,494
3.703125
4
[]
no_license
""" This is how the user will be able to create any new module with the fields that they want to use. When adding a module you will just need to use the database name again in order to connect to the database and make a new table. """ import mysql.connector from configparser import ConfigParser # Here we are se...
true
3b42d5d0d60e4852e0cbd3be2cff303092893c3a
pocca2048/DL-Go-Book
/human_v_bot.py
UTF-8
1,088
2.796875
3
[]
no_license
from copy import Error from dlgo import goboard, gotypes from dlgo.agent import naive from dlgo.utils import print_board, print_move, point_from_coords def main(): board_size = 9 game = goboard.GameState.new_game(board_size) bot = naive.RandomBot() while not game.is_over(): print(...
true
b7894d930fa95ee1dfe0055120e428e3fb2384cf
chlomcneill/advent-of-code-2015
/Day3/Day3Part1.py
UTF-8
883
3.40625
3
[]
no_license
f = open("/Users/mcneillc/Documents/advent-of-code-2015/Day3/Day3input.txt","r") directions = f.readlines() f.close() def houses_visited(): journey = directions[0] locations = [[0,0]] x_position = 0 y_position = 0 for move in journey: if move == "^": y_position += 1 ...
true
bdde76fcced7c23a62fdf6d2d21b0130be6081a2
johnjgh/LeetCode_exercise
/leetcode_exercise8.py
UTF-8
968
3.125
3
[]
no_license
class Solution: def myAtoi(self, str): """ :type str: str :rtype: int """ #bbb y = 0 str = str.strip() if str in ['', '-', '+'] or (len(str)>2 and str[1] in ['-', '+']): return 0 if str[0]=='-': str = str[1:] ...
true
05b121f313274323060dec00e3bad0dc240c0a96
TheoBoyer/TMForge
/core/OpenPlanetBridge.py
UTF-8
4,024
3.203125
3
[]
no_license
""" Handler for the communication with the in-game data aka Openplanet """ import socket import json import threading import config class OpenPlanetBridge: """ Handler for the communication with the in-game data aka Openplanet """ def __init__(self): # Create the socket self...
true
02f6329d0b405a73afd277d35b03f8bf28c77e7c
andyDW88/PiNetworkSensor
/main.py
UTF-8
1,964
2.5625
3
[]
no_license
import csv import pandas as pd import math import time from scapy.all import * from random import randrange recipients_mac_adress= 'ff:ff:ff:ff:ff:ff' your_mac_adress= 'aa:bb:cc:dd:ee:ff' ssid = 'testAP' channel = chr(11) interface = 'wlxd037457d5f14' fc=0 probeNodeDic = {} processedDf = pd.read_csv('/Users/andywang/...
true
a153fda9987eb4ff9a8420ca361fc9d6b4baeae5
gpedote/asa
/test/test_util.py
UTF-8
2,103
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- import os import unittest import numpy as np import pandas as pd from .context import Leitor from .context import calcular_matriz_cr, calcular_ari, obter_numeros_particoes def verifica_se_eh_simetrica(a, tol=1e-8): return np.allclose(a, a.T, atol=tol) class TestMatriz...
true
4dad0f3bb28a8258d9e2b036aac53692791d9af6
raket124/Make-your-own-neural-network
/Code/Experiment4/Train.py
UTF-8
731
2.546875
3
[]
no_license
import numpy as np import Utils as utils def Train(data_preparer, neural_network, debugInfo): epochs = 15 learning_rates = np.array([0.025, 0.05, 0.075, 0.1, 0.15, 0.2, 0.25, 0.3]) for learning_rate in learning_rates: if debugInfo: print("Learning rate: " + str(learning_rate)) ...
true
189d72903427206b1eeeba8ba3b091ab0570611e
maxnis/Hangman
/hangman game.py
UTF-8
7,457
3.21875
3
[]
no_license
#--------------------------------------------------------- # File Name: hangman.py # Description: Starter for Hangman project - ICS3U #--------------------------------------------------------- from os import system import random import pygame # initialize global variables/con...
true
4a6c1179775f933b3ba5c296322d598633388e6e
FredericoNesti/ANN_DeepArch
/NN/dataset_class_norm.py
UTF-8
3,132
3.171875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from numpy.random import randn class Dataset(): """ represents a multivariate normal distribution """ def __init__(self, n, mA, sigmaA, mB, sigmaB, batchSize, shuffleDataset=True): self.n = n # number os points fo...
true
782a269a707cfc33f084b9d2be95b3f782364f1b
whaleygeek/robot-controller
/src/robot.py
UTF-8
2,581
3.75
4
[ "MIT" ]
permissive
# robot.py 15/01/2021 D.J.Whale # Simple simulation of a robot - replace with your own robot routines. import turtle # import thread class VisualRobot(): STOP = "s" FORWARD = "f" BACKWARD = "b" BOUNCE = 10 def __init__(self): turtle.forward(0) # cause turtle canvas to display ...
true
07e201a71a3fbcd54516095ca4d00e428a563f24
yftsai/uva-online-judge
/contest_volumes/volume_115/11565.py
UTF-8
544
3.40625
3
[]
no_license
# #easy from math import sqrt def search(a, b, c): xm = int(sqrt(c)) for x in range(-xm, xm + 1): ym = int(sqrt(c - x**2)) for y in range(max(-ym, x + 1), ym + 1): z = a - x - y if y < z and x * y * z == b and x**2 + y**2 + z**2 == c: return (x, y, z) ...
true
fbd90bb9d8a104345e20cb3517d62ffc5d22151f
zalincaclaudiu/networkdefenseclassifier
/DatasetUtils.py
UTF-8
3,613
2.671875
3
[]
no_license
from urllib.parse import unquote import re from sklearn.model_selection import train_test_split import numpy as np normal_path = 'dataset/normalTrafficTraining.txt' anom_path = 'dataset/anomalousTrafficTest.txt' def getFeatures(reqType, request): parts = request.split('\n') url1 = unquote(unquote(parts[0].spl...
true
56806dd32f36898760b9aba08f489004efd90f2d
andynguyencuu/FuelPricer
/fuelpricer/core/serializers.py
UTF-8
2,144
2.578125
3
[]
no_license
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer from django.contrib.auth.hashers import make_password from rest_framework import serializers from .models import CustomUser, FuelQuote class CustomUserSerializer(serializers.ModelSerializer): """ Currently unused in preference of the be...
true
ac121d43a5abd042876c08c0b57a112edef58104
adityakhanna1999/Behavioral-Modelling
/RanFor.py
UTF-8
2,100
2.90625
3
[]
no_license
import pandas as pd import numpy as np from sklearn import linear_model from sklearn import preprocessing from sklearn.metrics import r2_score, mean_squared_error from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from sklearn.model_selection ...
true
7b3348516693c011dfd6e23a325683aa0b4c5c9d
j143/systemds-entity-resolution-data
/preprocess.py
UTF-8
8,269
2.75
3
[]
no_license
import argparse import csv import html import lzma import string from collections import Counter from contextlib import ExitStack from pathlib import Path from typing import Tuple, Dict import numpy as np def tokenize(text: str, html_unescape: bool, trans_table): if html_unescape: text = html.unescape(te...
true
24b38807c4c3d137d170f3fa85c4156e9fce3f48
jell0213/MUNIT_DataHiding
/方法一/MUNIT嵌密-MOD.py
UTF-8
6,980
2.515625
3
[ "Unlicense" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- from skimage import io,color,img_as_ubyte import random import os from 畫直方圖 import PH random.seed(100) def Embed_mod(in_dir,out_dir,edge_dir,num,mod_num): if not os.path.exists(out_dir) : #建立...
true
1967fe01a0ee4085b42b840e3634fa622d755ea3
eufmike/wu_data_bootcamp_code
/course/w21/1/test.py
UTF-8
2,894
2.953125
3
[]
no_license
# %% import warnings warnings.simplefilter('ignore') # %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd # %% brain = pd.read_csv('/Volumes/MacProSSD2/code/wu_data_bootcamp_code/course/w21/1/Resources/brain_categorical.csv') brain.head() X = brain[["gender", "age", "size"]] y ...
true
bf2dd63fe45d74382b5718c4af9b64c3ef4b0af9
heseek/weizman_heseek
/qqqqqq.py
UTF-8
1,093
3.53125
4
[]
no_license
# a = 123 # print(type(a)) # # a = int(123) # print(type(a)) # # # a = 123. # b = 123.12 # print(type(a),type(b)) # # a = float(123) # b = float(123) # print(type(a),type(b)) # print(a, b) # score=80 # # sen='good' # print('당신의 점수는 %d 입니다.%s'%(score,sen)) # print('당신의 점수는 {} 입니다.{}'.format(score,sen)) # print('당신의 점수는...
true
aa9f37d1df2e7f2b538096889abe72b9bdf221f8
h0rn3t/asyncio-examples
/parallel_examples.py
UTF-8
969
3.1875
3
[ "MIT" ]
permissive
import asyncio @asyncio.coroutine def waitn(n): asyncio.sleep(n) return "I waited {}".format(n) @asyncio.coroutine def run_parallel(): # Results will be in order called results = yield from asyncio.gather(waitn(3), waitn(1), waitn(2)) print("Results: {}".format(results)) @asyncio.coroutine def ru...
true
a7cbd97f47623d0fe7bd2e7ab80303e062d7ff11
Jingoo88/CA2
/bullshit.py
UTF-8
1,718
2.8125
3
[]
no_license
@staticmethod def distance_to_column(x, y, method="Euclide"): # assert method is valid # deprecated as of today assert(type(y) == pd.core.series.Series), "ONE OR BOTH VECTORS IS NOT A PANDA SERIES" assert(type(x) == pd.core.series.Series), "ONE OR BOTH VECTORS IS NOT A PANDA S...
true
211f1f50d90b5d3026fc525d3e8eb602a580a194
dsnopek/release-scripts
/tests/test_microbuild.py
UTF-8
910
3.21875
3
[]
no_license
from Microbuild import Environment import unittest class EnvironmentTest(unittest.TestCase): def test_basics(self): env = Environment({'a': 1, 'b': 2}) self.assertEquals(env['a'], 1) self.assertEquals(env['b'], 2) def unknown(): return env['c'] self.assertRais...
true
c63945aa4ff46a04bbc419394d8da32ab9522fd7
asher-lab/cloudkeeper
/ckcore/tests/core/db/entitydb.py
UTF-8
1,285
2.671875
3
[ "Apache-2.0" ]
permissive
from typing import Union, Optional, AsyncGenerator, Type, Callable, Dict, List from core.db.entitydb import EntityDb, T from core.model.typed_model import from_js, to_js from core.types import Json class InMemoryDb(EntityDb[T]): def __init__(self, t_type: Type[T], key_fn: Callable[[T], str]): self.items...
true
3929c287142d1e267e37082869d36c55d181ad72
KeiKawano/Example
/python/scraping/save_sqlite3.py
UTF-8
948
3.59375
4
[]
no_license
import sqlite3 conn = sqlite3.connect('top_cities.db') # c = conn.cursor() # # # c.execute('DROP TABLE IF EXISTS cities') # c.execute(''' CREATE TABLE cities ( rank integer, city text, population integer ) ''') # # c.execute('INSERT INTO cities VALUES (?,?,?)',(1, '上海', 2415000)) # c.execu...
true
c2269884e3c296ac3d65a972b10e72c0c42434e4
bosshentai/pythonLearning
/modules/exemple1/utility.py
UTF-8
137
2.53125
3
[]
no_license
print(__name__) def multiply(num1,num2): return num1*num2 def divide(num1, num2): return num1/num2 def max(): return 'oops'
true
6a7224ffe0f1ebfe3ce3707c8d2cf3b37dd16a19
jskimmons/LearnGit
/Desktop/HomeWork2017/ClassNotes.py
UTF-8
758
3.234375
3
[]
no_license
# script to create a new file each time it is run, already with a header # file name follows the format (CLASS)-(DATE).txt ''' header follows the format: CLASS DATE ''' import sys import os import time # 1. take in argument from user for class name className =...
true
f0a35ed45fde4ce34fe144a6e0da13114c5823e2
metalan/ejemplos_objetos
/ej1/romanos.py
UTF-8
1,442
4.21875
4
[]
no_license
# Author Vladimir SR # Escribir una clase en python que convierta un número entero a número romano class Romano(object): original = "0" __romanos = {1: "I", 5: "V", 10: "X", 50: "L", 100: "C", 500: "D", 1000: "M"} # Privado para convertir __romanos2 = ["0", "I", "II", "III", "IV", "V", "VI", "VII", "VIII...
true
a0dff08c0631a5629a60c06cec2ff32075c5a65c
duke-iml/ece490-s2016
/apc2016/Integration/perception/grid_nn.py
UTF-8
2,290
3.109375
3
[]
no_license
import itertools import numpy as np class GridPointLocation: def __init__(self,points,cellsize=0.1): points = np.array(points) self.data = points self.grid = {} self.cellsizeinv = 1.0/cellsize for i in xrange(points.shape[0]): c = self.index(points[i,:]) try: self....
true
74dd2ddbeb104eaf23718ddc28b90b00476b9347
born-to-be-mad/python-for-java-devs
/03_user_input.py
UTF-8
352
4.15625
4
[]
no_license
# Input data from console # use raw_input in python 2.7 name = input("What is your name?") print("Hi " + name + ". What is your age?") age = int(input()) print("You are " + name + " " + str(age) + " years old. What is you height?") height = float(input()) print("You are " + name + " " + str(age) + " years old and ...
true
c603bba2537db09d1c5feff97d864290aa21e29c
thit-ga-luoc/agnam
/lib/html-parser-tttuan.py
UTF-8
7,611
2.5625
3
[]
no_license
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- from sys import argv import re from urllib2 import urlopen from BeautifulSoup import BeautifulSoup from HTMLParser import HTMLParser HtmlCodeParse = HTMLParser() ## Convert HTML code to UTF-8 key_check = ['tập','chap','chương'] key_check_phan=['phần','phan','II'] #,'-2-' ...
true
91fc284eabd18cb5236decf9f46bfcc079f2bdcb
zmh19941223/heimatest2021
/04、 python编程/day01/3-code/买苹果10斤返5块.py
UTF-8
174
3.578125
4
[]
no_license
price = 8.5 weight = 10 money = price * weight # 变量定义之后,再=号赋值,只是改变变量的值而已 money = money - 5 # 改变了money变量 的值 print(money)
true
b94c8371b021fdccc5205f76560dd21a09e49bd6
ktravis/hangout_notify
/util/get_time_since
UTF-8
827
3.21875
3
[]
no_license
#!/usr/bin/python2.7 import sys, os, time format_string = "%s" def usage(): print 'Usage:' print ' $ get_time_since [ (-f | --format) "format string"] /path/to/file' sys.exit(0) if len(sys.argv) == 4: if "-f" in sys.argv[1]: format_string = sys.argv[2] else: usage() elif len(s...
true
cfcfa2b130326d11d780f46dea49ff0ac5560062
ymy513/show-me-the-code
/0013/itertools_count.py
UTF-8
342
3.234375
3
[]
no_license
# https://docs.python.org/2/library/itertools.html#itertools.count # encoding=utf-8 class itertoos(object): # count(10)-->10,11,12,13,…… # count(2.5,0.5)-->2.5,3,3.5,4,…… def count(self,start,step): n = start while True: yield n n +=step # start + step * i fo...
true
0b4637ca1fe6fea123c70762146c5d479eebabe0
Aasthaengg/IBMdataset
/Python_codes/p03029/s079493327.py
UTF-8
284
2.515625
3
[]
no_license
import sys from bisect import * from heapq import * from collections import * from itertools import * from functools import * from math import * sys.setrecursionlimit(100000000) input = lambda: sys.stdin.readline().rstrip() A, P = map(int, input().split()) print((P + A * 3) // 2)
true
428ad393e61ca4bf5feae14b3c4d27d485f440c8
woohyun212/Data_Science_and_AI_introductory_Coding_Solution
/chapter9/ch_2.py
UTF-8
362
3.484375
3
[]
no_license
t = "It's Not The RIght Time To Conduct Exams. MY DEMAND IN BOLD AND CAPITAL." \ " NO EXAMS IN COVID!!!" capital_count = 0 exclamation_mark_C = 0 for i in list(t): if str(i).isupper(): capital_count += 1 elif str(i)=="!": exclamation_mark_C +=1 print("느낌표 개수:", exclamation_mark_C) print("대문자...
true
7509180a92edbfa0b7047f5c0b72fa63d320afeb
Mozilla-GitHub-Standards/7546934686b75ca008957582e493315387295bb2f525cb13ce265d7db3604dae
/walint/wizard.py
UTF-8
4,492
2.921875
3
[]
no_license
"""Wizard to create a config file""" import os from walint.util import METHS import sys from ConfigParser import ConfigParser OK = '\033[92m' FAIL = '\033[91m' BLUE = '\033[94m' LGRAY = '\033[0;37m' ENDC = '\033[0m' def help(msg): print(LGRAY + msg + ENDC) def error(msg): print(FAIL + msg + ENDC) def as...
true
8b9970981dac0f88ae8cd5caf6a13c25d10f64cc
chrisvxd/api-test
/myapi.py
UTF-8
677
3.5625
4
[]
no_license
def functional_method(first_arg, second_arg='Test'): """ @api {get} functional_method(first_arg,second_arg) Functional Method @apiName FunctionalMethod @apiGroup TestApi @apiDescription This is a test apiDoc method. This should be the description. @apiParam {Number} first_arg Some number. ...
true
4a17005237a942b3f32871099cade29eb9918718
dpvazquez20/ComicLib
/handlers/users/elements.py
UTF-8
1,319
2.84375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import webapp2 from handlers.elements.sessions import BaseHandler """ Handler that allows the user to change the number of elements shown in the page Get: redirect to the users home page Post: it's responsible for changing the number of elements""" c...
true
2849169e7e82bb6d8c1c3e84d846391a2909465f
mariyam18/BasicPython
/demo.py
UTF-8
1,870
2.90625
3
[]
no_license
import pymysql connection = pymysql.connect('localhost','root','root','student') cursor=connection.cursor() def login(): user1="admin" pass1="admin" user2=input("ENTER THE USERNAME:") pass2=input("ENTER THE PASSWORD:") if(user2 == user1 and pass2 == pass1): print("-----------!!!!!!WELCOME-ACCESS GRANTED!!!!!...
true
8f61c9ba6d6a9a3af4f47b923cc2d1172e840cbf
ashleylst/DSDPy
/src/basics/generate_pysbmodel.py
UTF-8
3,826
2.75
3
[ "MIT" ]
permissive
from pysb import * def generate_monomer(species, monomerdict, initlen, initnames, tbobs): """ generate a PySB monomer based on species :param species: a Species object :param monomerdict: a dictionary with all monomers linked to their species id :param initlen: number of the initial species :...
true
4f2cd1046006e57a82965248b2a2c30f867dfe67
AndrewParisee/prog1700-cet-ap-master-python-
/Assignments/Assignment2/Program1.py
UTF-8
1,875
4.5625
5
[]
no_license
# Program 1 - PC Repair Shop # McNair’s PC Repairs is a computer repair shop. Customers are billed at a rate of $65 per hour for labour. # Costs for parts and supplies are subject to a 15% sales tax. # You have been asked to develop a console application solution that will enable the company’s retail staff to track cus...
true
5ae809cab68f287be29fce8c4c974a892a58c132
emilianomfortes/Data_Analytics_Space-missions-project
/scripts/plot_scripts/plot_2_sunburst_missions.py
UTF-8
1,143
2.75
3
[]
no_license
# This script creates a sunburst chart to provide general information about the data #Dictionary of color per country colorMapSubset = data[['Country','Color']].drop_duplicates().reset_index(drop=True) colorMapSubset = dict(zip(colorMapSubset.Country, colorMapSubset.Color)) fig = px.sunburst(data, path=['Country', 'O...
true
8722df226d8fcd69414104c14ff4da9929be9869
rayzamgh/pythonFileTransferUDP
/clientreceiver.py
UTF-8
3,087
3.109375
3
[]
no_license
import socket import sys import threading MAXPACKETSIZE = 40000 def xorBytes(xorMaterial): returnXor = xorMaterial[0] for x in range(0, len(xorMaterial) - 2, 2): returnXor = returnXor ^ xorMaterial[x+2] return returnXor def checksum(xorMaterial): return (bytes([xorBytes(xorMaterial)]) + byte...
true
87a3ec145dfead726a168a760cc330213ffdc959
dgillis91/comp4
/staticsem.py
UTF-8
815
3
3
[]
no_license
class SemanticError(Exception): pass declared_tokens = set() def semantic_analysis(tree, level=0): if tree is None: return if tree.label == 'variables': for token in tree.tokens: if token in declared_tokens: raise SemanticError('{} defined here: l...
true
73749b5385cf549cd62286f3596857722f1699ec
mxv2/python3-examples
/ch01_intro/awfulpoetry_ans.py
UTF-8
649
3.21875
3
[]
no_license
#!/usr/bin/env python3 import random import utils _ARTICLES = ("the", "a") _SUBJECTS = ("cat", "dog", "man", "woman") _VERBS = ("sang", "ran", "jumped") _ADVERBS = ("loudly", "quietly", "well", "badly") _STRUCTURES = [ [_ARTICLES, _SUBJECTS, _VERBS, _ADVERBS], [_ARTICLES, _SUBJECTS, _VERBS] ] max_sentences ...
true
e9e80f57eb3430e5cb2e23cdf54de442b99f757e
Akki19hzb/tweet-analysis
/tweet-fetch.py
UTF-8
2,670
3.125
3
[]
no_license
import tweepy import csv, sys import os.path,time # Fill the X's with the credentials obtained by # following the above mentioned procedure. consumer_key = "sSQP5PVBS7J9dYlNIlOJZUHEl" consumer_secret = "5rec9aHRnSPXhVmkv3HAbnUKaFm5eeEPMyQmWvNotTEoUrQn6S" access_key = "284617609-wVPtfT8fysUOMw04anf2dGAAI4puTFR0kSKqkhU0"...
true
75bc169f2e6756773cda11d46d2c5675e2706190
michael-gif/Python
/2d Array python.py
UTF-8
770
3.671875
4
[]
no_license
# This code was designed for the python editor online: https://python.codnex.net/ # However any other Python editor may be used that uses two spaces as an indent. # All indents found in this code are two spaces. # WHEN INDENTING ANYTHING, MAKE SURE YOU DON'T USE THE TAB KEY. ALWAYS USE THE SPACE BAR import time ...
true
2ed80ae36e13b65ace4fdd6e7dcba2a7f6d93961
Eidocode/OC_Project8
/favorites/views.py
UTF-8
2,999
2.71875
3
[]
no_license
from django.shortcuts import get_object_or_404, redirect, render from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from unidecode import unidecode from products.models import Favorite def favorites(request): """ Used when displaying the current user's favorites """ cur_user = r...
true
528b00fe7c2a1e1b3d66f17c6cc5de64f3948f90
xzfn/mmdps
/mmdps/utils/result_utils.py
UTF-8
997
2.59375
3
[]
no_license
""" Result """ import os from matplotlib import pyplot as plt from mmdps.loadfile import load_csvmat class ResultGenerator: def __init__(self, boldPath, template, resultPath): self.boldPath = boldPath self.template = template self.resultPath = resultPath # 'E:/Results/Beijing Zang FC Analysis/' def get_all_...
true
6b58bfbfd148323b9d64bb030792a39d9082ca0f
1120101929/learnpython
/list.py
UTF-8
296
3.421875
3
[]
no_license
classmates = ["Michael", "Bob", "Tracy"]; print(classmates); print(len(classmates)); classmates.append("Adam"); print(classmates); print(len(classmates)); classmates.insert(1, "Jack"); print(classmates); print(len(classmates)); print(classmates.pop()); print(classmates); print(len(classmates));
true
2b8d2b7fda1f6d6b03e1a3a762fe335e3e32520e
Liviagcf/KnEDLe
/test.py
UTF-8
243
2.9375
3
[]
no_license
list2 = [[0,1], [0,0,2], [3,3,4]] l = [] for list in list2: best = list.pop(list.index(max(list))) second_best = list.pop(list.index(max(list))) print(best, second_best, best-second_best) l.append(best-second_best) print(l)
true
7db8cb60750e0c9cc442685da423806204a488f2
securestep9/kubehunter
/tests/core/test_subscribe.py
UTF-8
1,225
2.578125
3
[ "Apache-2.0" ]
permissive
import time from kube_hunter.core.types import Hunter from kube_hunter.core.events.types import Event, Service from kube_hunter.core.events import handler counter = 0 class OnceOnlyEvent(Service, Event): def __init__(self): Service.__init__(self, "Test Once Service") class RegularEvent(Service, Event)...
true
66389ebe955e1063f253706d9efbaac87de13cbe
allenair/pystudy
/leetcode/n51-60/canJump.py
UTF-8
539
3.234375
3
[]
no_license
# -*- coding:utf-8 -*- class Solution: def canJump(self, nums: [int]) -> bool: length = len(nums) if length <= 1: return True n = length - 1 while n > 0: tmp = n - 1 flag = False while tmp >= 0 and not flag: if nums[tmp...
true
44d2a01351274426f3dbe2c88ceaa1bd84f4847f
h-betz/flix
/flix_api/aggregation/sync.py
UTF-8
2,016
2.828125
3
[]
no_license
from aggregation.aggregators import netflix, hulu, hbo, amazon_prime, genres from aggregation import db_api, format_data from showvies.models import Media, Genre, MediaGenre, Provider from threading import Thread import json def sync_genres(): """ Sync the list of available genres :return: """ gen...
true
5781f2de3686212cfeddb79cc2b355742a4c0048
anthonynguyen/kattis
/volim.py
UTF-8
314
2.828125
3
[]
no_license
#!/usr/bin/env python3 K = int(input()) N = int(input()) answers = [] for _ in range(N): p = input().split() answers.append((p[1], int(p[0]))) m = 210 t = 0 for a in answers: if m > t and m < t + a[1]: if not K % 8: print(8) else: print(K % 8) break else: if a[0] == "T": K += 1 t += a[1]
true
85e1927c1b93f18781e2a2d4858dbf0a34eff3e6
yunjinghu226/CASA0007QM
/multiple_regression_python.py
UTF-8
2,351
3.640625
4
[]
no_license
# This program performs a multiple linear regression from data stored in a csv file. # The data file must be in columns of numbers - no column labels, etc. # The first column is the y values, the following columns are the predictors x1, x2, x3, etc. # This data must be saved as a csv file (e.g. use "Save As" in Excel...
true
16170ba309ae80173dad5ef4fdaabeb0e20e4cdc
chtu/SDUTDPRev3
/MachineLearning/FixingLabels.py
UTF-8
380
2.78125
3
[]
no_license
import csv with open('Set2/labels.csv','r') as csvinput: with open('Set2/FixedLabels.csv', 'w') as csvoutput: writer = csv.writer(csvoutput) for row in csv.reader(csvinput): if row[1] == "1": row.append("0") writer.writerow(row) else: ...
true
30a23f2259eceaa57a699c8867f6d31e59e14c6d
mmk-uk/OpenPose_Python
/text_display.py
UTF-8
1,090
3.03125
3
[]
no_license
import sys import threading import time import tkinter as tk root = tk.Tk() root.title("認識結果") root.geometry("600x600+1200+50") rootFlag = True canvas = tk.Canvas(root,width=600,height=600) canvas.grid() canvas.create_text(300,300,text='5',font=('',250)) def display(root): global rootFlag ...
true
a1837abc107c5c4cb7169fd684419068c063bcd5
kopanswer/gao
/exercise/class_four_exercise/utility.py
UTF-8
1,710
3.453125
3
[]
no_license
# --*-- coding:utf8 --*-- """ 用途: 输入: 第三方库 输出: 通用函数 """ import random import time import requests from lxml import etree class Utility(object): def __init__(self): pass def fetch_html(self, url, timeout=20, retry=1000): """ 特性 响应时间: 调整网页的默认最大响应时间为 tim...
true
62f0531453c4cfc93422ef28317d66d37a03e3ba
namani-karthik/Python
/pd_first.py
UTF-8
166
3.65625
4
[]
no_license
for a in range(5): if(a%2==0): print('i is even') else: print('Not even') if(a==1): print('One') print('Out of For loop')
true
609e2b5b0c2d9139efa79464df7c34b02fd54e18
ronachong/airbnb_clone
/api/tests/index.py
UTF-8
1,834
2.8125
3
[]
no_license
import json import unittest from datetime import datetime from app import app from app.views import index # validates GET request to index returns 200, JSON status is OK, and time codes class indexTestCase(unittest.TestCase): def setUp(self): """ Overload def setUp(self): to create a test clien...
true
432f024b94d043b3b6c521951cbfb2b4b5fbe36c
ozonuweg/BYUI
/CSE 110 - Programming Building Blocks/prove01-1.py
UTF-8
617
4.09375
4
[]
no_license
""" File: prove01.py Topic: Favorite Color Author: Glory Ozonuwe Purpose: Asks user for name and favorite color and displays it on the screen. """ name = input("Hello, what is your name? ") print ("") favoriteColor = input("Please type your favorite color: ") print ("") print("Your favorite color is " + favoriteColo...
true
894565bcc693709fb70b604df3d5118a0ffedbbd
Fredster64/Randomly-Generated-Maze
/Drawing_Maze.py
UTF-8
2,048
3.40625
3
[ "MIT" ]
permissive
""" Drawing the Maze """ import pygame import math pi = math.pi from Objects import * #define a rotation of a vertex about a given centre - used for maze drawing def rot(theta, vertex, centre): centeredv = vertex - centre rotatedv = v(centeredv[0]*math.cos(theta) - centeredv[1]*math.sin(theta), ...
true
05a9f2badb5ea2845a8e46e9b26162cb6c8f7c32
mcreaded/6.835
/miniprojects/project4/visualization_gui.py
UTF-8
2,727
3.328125
3
[]
no_license
import numpy as np import tkinter from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import tkinter EMOTION_OPTIONS = [ "0 - angry", "1 - disgust", "2 - fear", "3 - happy", "4 - sad", "5 - surprise", "6 - n...
true