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
7c905b49cf900f540a716a08584376faa98967f0
phovea/phovea_clustering
/phovea_clustering/clustering_service.py
UTF-8
5,753
2.5625
3
[]
no_license
import numpy as np from clustering_hierarchical import get_clusters __author__ = 'Michael Kern' __version__ = '0.0.1' __email__ = 'kernm@in.tum.de' ######################################################################################################################## def load_data(dataset_id): """ Loads the ge...
true
b1d87f43784be4ced91ef4bbaa5faf454d2932cb
evanren2003/beginningcv
/textbook_stuff/couting_coins.py
UTF-8
1,585
2.6875
3
[]
no_license
from __future__ import print_funtion import numpy as np import argparse import cv2 def grab_contours(cnts): if len(cnts) == 2: cnts = cnts[0] elif len(cnts) == 3: cnts = cnts[1] else: raise Exception(("Contours tuple must have length 2 or 3," "otherwise OpenCV changed their c...
true
068f4aa483f645f5258c8262a6ba84bdedc3437e
welion/python-xy
/img2mongo.py
UTF-8
1,550
2.578125
3
[]
no_license
#!/usr/bin/env python import os import sys import pymongo import bson.binary from cStringIO import StringIO import datetime class img2mongo(): def __init__(self): self.BASE_PATH = '/home/welion/Pictures' self.connect = pymongo.MongoClient(host='127.0.0.1', port=27017) self.db = self.con...
true
aca8de28792003ec12a8b3246d1b57e0a738e371
mmosc/pyph
/2/2-5loesung.py
UTF-8
1,237
3.640625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 26 10:21:11 2020 @author: marta """ """Darstellung und Flächenberechnung eines Blumenbeets. """ import numpy as np import matplotlib.pyplot as plt # Koordinaten der Eckpunkte [m]. x = np.array([0.0, 0.0, 1.0, 2.2, 2.8, 3.8, 4.6, 5.7...
true
50cfd2a1654fac864714e73224cbe1e65fa417a9
Jeffvos/user-activity-to-db
/get_jira_users.py
UTF-8
2,001
2.578125
3
[]
no_license
import urllib2 import sys import base64 import json import urllib from clients import psql as DB from config import config config = config() DB = DB.Client() class GetUsers: def __init__(self): self.url = config['jira']['userexp_url'] user = config['jira']['basic_auth']['username'] passw =...
true
51adecc1fe1dd86055f28cc6fb65bab7064909c9
extazzy2k21/SeelTools
/seeltools/utilities/game_path.py
UTF-8
2,349
2.75
3
[]
no_license
import os import winreg from seeltools.utilities.log import logger from seeltools.utilities.constants import FALLBACK_WORKING_DIRECTORY def get_game_path(): steam_install_reg_path = r"SOFTWARE\WOW6432Node\Valve\Steam" hklm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) try: # ...
true
54746860f074235469f7d996e39de0d9c63302df
iharnoor/Machine-Learning-Udemy
/Python/PreProcessing/Splitting.py
UTF-8
1,573
3.59375
4
[]
no_license
# import numpy as np # import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import Imputer dataset = pd.read_csv('Data.csv') # print(dataset) X = dataset.iloc[:, :-1].values # everything except the last column # print(X) y = dataset.iloc[:, 3].values # just the last column # Fixing the Mis...
true
a81e9673c7a42bbf3b083ecd4198daff265913f4
gostevehoward/phpython
/phpython.py
UTF-8
26,351
2.671875
3
[]
no_license
#!/usr/bin/env python import argparse import ast import contextlib import itertools import logging import os import pprint import string import subprocess import sys import types from xml.etree import ElementTree import unparse PARSE_PHP_SCRIPT = os.path.join(os.path.dirname(__file__), 'parse.php') NS_NODE = '{http:...
true
1a3e6472992c580cd1b91e4542867aa965263dbb
ksenijaa21/Homework02
/task3.py
UTF-8
636
3.796875
4
[]
no_license
""" =================== TASK 3 ==================== * Name: Roulette * * Write a script that will simulate casino game - * Roulette but only for red, black or green (zero) * fields. On each run, the script should return * 'red', 'black' or '0'. * * Note: Please describe in details possible cases * in which your so...
true
e77b8e0834f1dbc17505a39fdf58c63e7e0938ab
bdhammel/bdhammel.github.io
/assets/ml-naive-bayes/naive_bayes.py
UTF-8
2,445
3.484375
3
[]
no_license
import numpy as np from scipy.stats import norm, multivariate_normal from sklearn.datasets import fetch_openml from sklearn.model_selection import train_test_split class NaiveBayes: def __init__(self): self.params = {} def fit(self, X, Y, epsilon=1e-2): """Fit NB classifier assuming a no...
true
68ad7528289e38f57cae01729d7ce1a4554666f9
kailunfan/lcode
/106.从中序与后序遍历序列构造二叉树.py
UTF-8
1,763
3.65625
4
[]
no_license
# # @lc app=leetcode.cn id=106 lang=python # # [106] 从中序与后序遍历序列构造二叉树 # # https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/description/ # # algorithms # Medium (67.87%) # Likes: 204 # Dislikes: 0 # Total Accepted: 36.3K # Total Submissions: 52.9K # Testcase Example: '[9,...
true
25cc23e575566820d37bc7cbdef9833f3e620b1f
baeksangha/python_sw
/7588_직선의삽입과삭제/source.py
UTF-8
882
2.875
3
[]
no_license
import sys def solution(cmds): arr = [] answer = [] for cmd in cmds: flag = cmd[0] if flag == 1: arr.append((cmd[1], cmd[2])) elif flag == 2: target = cmds[cmd[1]-1] if (target[1], target[2]) in arr: arr.remove((target[1], target[...
true
fd7a9c63d86c1c6bac846ddc1eaf0f848bbb9e75
rogeriodelphi/drf_escola
/teste_get.py
UTF-8
679
2.90625
3
[ "MIT" ]
permissive
import requests headers = {'Authorization': 'Token b49fda9706f293de268f4a9683f4208171defc7b'} url_base_cursos = 'http://127.0.0.1:8000/api/v2/cursos/' url_base_avaliacoes = 'http://127.0.0.1:8000/api/v2/avaliacoes/' resultado = requests.get(url=url_base_cursos, headers=headers) # print(resultado.json()) # print(res...
true
d4f750179933b88881bc5692d516a1f69531d246
dannywerner2910/VA
/mathmod.py
UTF-8
1,173
3.734375
4
[]
no_license
def prime_or_not(a): for i in range(2, a): if a%i == 0: return "not prime" else: return "prime" def divisor(a): for i in range(1, a + 1): if a%i == 0: print(i) def factorize(a): if prime_or_not(a) == "prime": print('%d is a prime number'%a) else: for i in range(2, a): if a%i == 0 and prim...
true
8faa64b80abc1ba4c2a569ab8009a0917fb88817
stikos/rosalind
/Bioinformatics_Stronghold/hamm.py
UTF-8
300
2.71875
3
[]
no_license
# my solution if __name__ == '__main__': input_lines = open('rosalind_hamm.txt', 'r').readlines() print(sum([int(i != j) for i, j in zip(input_lines[0], input_lines[1])])) # best solution # generator, not tuple (zip), great for memory AND faster import operator sum(map(operator.ne, s1, s2))
true
cd7137f162b791437376bad7d14d350472044055
GrantingLiu/Soft
/test.py
UTF-8
1,512
2.65625
3
[]
no_license
# coding=utf-8 # @Author : LYG # @Time : 2019/2/28 11:12 # @Name : server.py # coding: utf-8 import select import socket server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) server.bind(('localhost',1234)) server.listen(1) inputs = [server,] outputs = [] errors = [] print("服务器的socket:",serve...
true
825b45c7a8d1d290ce414660ee2679d3d367eb11
andarinneo/JointEmbedding
/semanticFCN/surgery.py
UTF-8
6,688
2.796875
3
[ "BSD-2-Clause" ]
permissive
from __future__ import division import caffe import numpy as np def transplant(new_net, net, suffix=''): """ Transfer weights by copying matching parameters, coercing parameters of incompatible shape, and dropping unmatched parameters. The coercion is useful to convert fully connected layers to their...
true
3c66a1dfc6cb809fe1b8b461e925c45498d94909
yaos2010/PFE
/Sources/Classes/Distribution_Nourriture.py
UTF-8
1,848
2.75
3
[]
no_license
#!/usr/bin/env python ''' Created on Oct. 21, 2019 @author: philip ''' from Classes.enums import Niveaux from Classes.Actionneurs import Moteur from Classes.Capteurs import Niveau from Classes.Actionneurs import Sirene import threading.Thread import datetime import time class Distribution_Nourriture(threading.Thread...
true
dfd2c51f9fcf27c878669f47bd33a2ebca1e3986
ellynhan/challenge100-codingtest-study
/hall_of_fame/lysuk96/Week10/10_BOj_중량제한.py
UTF-8
741
3
3
[]
no_license
from collections import deque, defaultdict def is_promising(x): q= deque([start]) visit = [False] * (N+1) while q: tmp = q.popleft() if tmp == end: return True for island, limit in v[tmp]: if not visit[island] and limit>=x: visit[island] = Tru...
true
bc1a2bf183af6a87032a0cc0b5c0648cf24c22de
pchelkanat/CMoIS
/BSGS/bsgs.py
UTF-8
1,474
3.0625
3
[]
no_license
import math import os import sys from PyQt5 import uic from PyQt5.QtWidgets import QMainWindow, QApplication def bsgs(g, betha, n): g,betha,n=int(g), int(betha),int(n) m = math.floor(math.sqrt(n)) + 1 # print(m) # Giant a = [] for i in range(1, m + 1): #O(m) a.append(g ** (m * i) % n...
true
4c560e16e66fc5a9484fb150c60819acd6aef0c2
tongxindao/notes
/shiyanlou_plus/week_01/day_04/2_slice.py
UTF-8
352
3.75
4
[]
no_license
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] print("letters[1:3] value is: {0}".format(letters[1:3])) print("letters[1:-4] value is: {0}".format(letters[1:-4])) print("letters[:4] value is: {0}".format(letters[:4])) print("letters[4:] value is: {0}".format(letters[4:])) copy = letters[:] print("copy from letters, the ...
true
ab7886090d599898c29115ec135c9c47dd20c773
ChrisHoder/Projects
/Data Visualization (Python)/Analysis.py
UTF-8
5,319
3.125
3
[]
no_license
import Tkinter, tkFileDialog import math import random import numpy as np import matplotlib as mpl import csv from csvWriter import * mpl.use('macosx') import pylab import math # This class does data analsis class Analysis: def __init__(self, name, data, filename = 'test.csv', writeFile = False): #A...
true
27dec752daae7c4856a792f1e22fe6e6b9617dca
ankitk29kothari/Step2success
/Python/9. for loop/forelse.py
UTF-8
144
2.984375
3
[]
no_license
a=[1,2,3,4,5,6] for i in a: print(i*i) if i==5: if i==7: break else: print('for loop exe completed') print('for loop exe completed')
true
ea40e9d5724036be27c542ecbcac5c2a2d211ae2
Coloquinte/torchSR
/torchsr/datasets/reds.py
UTF-8
2,846
2.640625
3
[ "MIT" ]
permissive
import os from typing import Callable, List, Optional, Tuple, Union from .common import FolderByDir, pil_loader class REDS(FolderByDir): """`REDS <https://seungjunnah.github.io/Datasets/reds>` Superresolution Dataset Args: root (string): Root directory for the dataset. scale (int, optional):...
true
586d3981aeaddf93dd5e963753b6b2a8fd89a6ab
wdxfairy/algorithms
/6.2-5.py
UTF-8
698
3.296875
3
[]
no_license
__author__ = 'wdx' def left(i): return 2*i+1 def right(i): return 2*i+2 def max_heapify(a, i): largest = i+1 nummax = len(a) num = i while largest != num: largest = num if left(num) > nummax - 1: pass elif a[left(num)] > a[num]: largest = lef...
true
fec6530237ca84319e95704eb75dcb76b2973e4b
CVUA-RRW/taxidTools
/taxidTools/Node.py
UTF-8
9,949
3.359375
3
[ "BSD-3-Clause" ]
permissive
""" Node objects definition. Should be used internally only. """ from __future__ import annotations import os from typing import Union, Optional from .utils import _rand_id class _BaseNode: """ Base object for Node classes """ def __init__(self, taxid: Union[str, int] = None, ...
true
f8823f409d68cef332193fcf60ec0afbd3c9af12
akhuettel/code
/net/setptr
UTF-8
1,589
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import argparse import dns.name import dns.resolver import ipaddress import subprocess parser = argparse.ArgumentParser() parser.add_argument("-g", "--gss", action="store_true", help="use Kerberos authentication via GSS-TSIG") parser.add_argument("-d", "--debug", action="stor...
true
e7e7b870f36196602133791e4411ed51ea26f5af
gwilding/adventofcode2019
/aoc_fun.py
UTF-8
8,806
2.765625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 9 12:08:43 2019 @author: georg """ def mode_intcode_IO(opcode,inputs=None): opcode_out = opcode.copy() if inputs != None: write_output= True outputs=[] else: write_output = False k = 0 # print(k) ...
true
236b4fe0f6d9576b721630ac55d5eeb47c3affc1
KivenCkl/DataStructures_Python
/Stacks/stack.py
UTF-8
1,523
4.03125
4
[]
no_license
class Stack_1: """ Stack ADT, using a python list """ def __init__(self): self._items = list() def isEmpty(self): return len(self) == 0 def __len__(self): return len(self._items) def peek(self): assert not self.isEmpty() return self._items[-1] ...
true
3cae9d5cb0f90a2dd9b1847f3b14e5a2524e8f98
Yuyats/AtCoderAnswers
/past/abc/0to99/97/C.py
UTF-8
1,541
2.546875
3
[]
no_license
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10 ** 20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI()...
true
864ce6af7b41101dff5d2768dcaf50e3de9aff0a
lucasoskorep/thalia-bot-discord
/dbmanager/dbmanager.py
UTF-8
6,292
2.546875
3
[]
no_license
from sqlalchemy import create_engine, desc from sqlalchemy.orm import scoped_session from sqlalchemy.orm import sessionmaker from dbmanager.tables import User, Server, Channel, Message, _base class session_manager_wrapper(object): def __init__(self, session): self.session = session def __enter__(self...
true
3983153c4437f555441c8dc067d7e6c1a3243a9c
ijcaiworkshop2020/freqnet
/FreqNet/code/basic_utils.py
UTF-8
5,804
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- # File: basic_utils.py import numpy as np import os from os import path from sklearn.decomposition import PCA, IncrementalPCA from sklearn.preprocessing import StandardScaler from scipy import ndimage from sklearn.linear_model import LogisticRegression from sklearn.svm import LinearSVC from skl...
true
cc4c8c1683ebdd009f09bb818ea4f3b387e21827
CalamusRoot/anatol_spiel
/Character.py
UTF-8
253
2.84375
3
[]
no_license
class Character(): def __init__(self, name, hp, xp, dmg, defense, x, y): self.name = name self.hp = hp self.xp = xp self.dmg = dmg self.defense = defense self.location_x = x self.location_y = y
true
ac50328d2be09c20314f100920b6dee07346c14a
riccardovandra/Learn-Python-for-Data-Science
/Stock Prediction/challenge.py
UTF-8
1,355
3.53125
4
[]
no_license
import csv import numpy as np from sklearn.svm import SVR #Support Vector Regression import matplotlib.pyplot as plt import tweepy from textblob import TextBlob from config import consumer_key,consumer_secret,access_token,access_secret #configure Twitter Access auth = tweepy.OAuthHandler(consumer_key, consumer_secret)...
true
e1f7ec6d488c703a98c323044f002500b4fa2197
JeffersonLab/hd_utilities
/launch_scripts/process/mysql_test.py
UTF-8
562
2.5625
3
[]
no_license
import MySQLdb # set up db_conn = MySQLdb.connect(host='hallddb.jlab.org', user='datmon', passwd='', db='data_monitoring') db = db_conn.cursor() test_data = [ (1,"sean",2.), (2,"paul",5.), (3,"ryan",20.) ] # test #db.execute('CREATE TABLE IF NOT EXISTS test (id integer, name text, face re...
true
dbd1fbe99b8c5dbe44f717d79072147f947790a7
Hrishikesh-3459/leetCode
/prob_557.py
UTF-8
227
3.109375
3
[]
no_license
class Solution: def reverseWords(self, s: str) -> str: x = [] for i in s.split(): x.append(i[::-1]) y = "" for i in x: y += i + " " return y[:-1]
true
ff64e5e59f22533def26179c16dadcbfcbe13d23
khaun79/Programming
/งานพิมพ์ใบเสร็จ.py
UTF-8
777
2.828125
3
[]
no_license
print("-------- Welcome to khaun shop ---------") print("----------- ใบเสร็จรับเงินอย่างย่อ -----------------") print("แบรนด์ซุปไก่ 42 cc 1 ชิ้น 37 THB","รวม",1*37,"THB") print("อิชิตันน้ำผึ้งมะนาว 2 ชิ้น 20 THB","รวม",2*20,"THB") print("น้ำดื่มคริสตัล 1 ชิ้น 14 THB","รวม",1*14,"THB") p...
true
7ef70a1750ebfeea5114398ba1ba41f3dc184e26
meliksahdipcin/PythonBasicsFromYoutube
/PythonBasics.py
UTF-8
2,293
4.09375
4
[]
no_license
""" Merhaba Dünya! """ #Yorum satırı """ tamSayi = 1 #int virgulluSayi = 1.5 #float karakterDizisi = "1" #string dogruYanlis = True #boolean sayi1, sayi2, sayi3, sayi4 = (1, 2, 3, 4) print(int(karakterDizisi) + tamSayi) print(sayi1, sayi2, type(sayi1)) cikarma = tamSayi - virgulluSayi carpim = tamSayi - virgulluS...
true
7579fedf6307f9a1f5df67dbb0f7d8b5ac8acdf6
YingjieQiao/WebScraping
/mergepdf.py
UTF-8
951
2.96875
3
[ "MIT" ]
permissive
import PyPDF2, os # Get all the PDF filenames. pdfFiles = [] path = r'D:\Onedrive\OneDrive - Singapore University of Technology and Design\Term 2\UROP unsupervised learning\scraping\pdf test' for filename in os.listdir(path): if filename.endswith('.pdf'): pdfFiles.append(filename) pdfFi...
true
db04b7fb3db461737c62546b5a28d0d18ce880b2
yonseimemslab/AIseminar
/머신러닝 공부/LG_current_detection/CoilDetection-e71be1a659d7706d8aedb12f745764b3d2e15970/__init__.py
UTF-8
1,949
2.8125
3
[]
no_license
############################################################################################# # Author: Jun Gong # Function: Fetch Data from 4 by 4 coil matrix # Date: 05/07/2018 ############################################################################################# from MSP430 import MSPComm import socket impo...
true
55242f77ee855392e2f92497e0a9b8e618f0990b
Nerd911/University-1
/sztuczna_inteligencja/2-lab/komandos.py
UTF-8
3,529
2.53125
3
[ "MIT" ]
permissive
from sokobanASTAR import taxiDistance from IO_SI import * from sokoban import * targets = set() board = [] _dirs = {'U': (-1, 0), 'D': (1, 0), 'R': (0, 1), 'L': (0, -1)} d = {} def showBoard(state): for i in range(len(board)): for j in range(len(board[i])): tup = (i, j) if tup in ...
true
dc2c5ca4b4553f688d1aa284ef90dea9aa639971
TawsEspol/MongoDB
/mongo.py
UTF-8
1,242
3.03125
3
[]
no_license
from pymongo import * import json # Me conecto a la base de datos client = MongoClient('localhost', 27017) db = client['airlines'] # Elimino la coleccion para que no se dupliquen documentos al cargar db.drop_collection("airlines") # Cargo el archivo con mis datos en memoria f = open('airlines.json', 'r') documents =...
true
27eeed4330ed313c0e5d88fc3dcdec42a55eb690
japneet121/Python-Design-Patterns
/composite.py
UTF-8
733
4.15625
4
[ "Apache-2.0" ]
permissive
''' Composite pattern is a type of structural design pattern in which a class composes of group of objects of it's own types. For example: An employee class has the objects of it own type to store manager and subordinates details ''' class Employee: def __init__(self,name,dept,manager=None): self.name=nam...
true
8876a91c9673f6cecc8e9f0e9bbb51eef64671a6
hruskaz/python
/cv1/cv1/cv1.py
UTF-8
2,075
3.109375
3
[]
no_license
import re import operator authourCounts = {} centuryCounts = {} ccount = 0; #if you find C minro in title use this to skip 'Key:' line search skip = 0; file = open("scorelib.txt", "r", encoding="utf-8") line = file.readline() while line: #authors match = re.search(r"Composer: (.*)", line) if(match): ...
true
54ab0e920d640bfaf1c14c5d0f5f29fb9efae0f3
NazmulHaque/letskodeit
/pages/main_nav.py
UTF-8
1,060
2.578125
3
[]
no_license
import time from pages.locators import MainNavLocators, CoursesPageLocators, HomePageLocators from common.waits import DriverWaits class MainNavigation(object): def __init__(self, driver): self.driver = driver self.driver_waits = DriverWaits(self.driver) def go_to_all_courses_page(self): ...
true
08d73cae2562b72cf674ac035c281b43523c385c
CVandermies/Labyrinth
/Code_raspberry/utility.py
UTF-8
775
2.546875
3
[]
no_license
class Utility: """ Variable permettant de sélectionner les données que l'on veut recevoir de l'arduino """ dataWheelLeft = "WheelLeft" dataWheelRight = "WheelRight" dataFrontUsSensor = "FrontUsSensor" dataRightUsSensor = "RightUsSensor" #---------------------------------------------...
true
c48c1e3581e35327492b5e62d86d355174aaf659
wavestoweather/enstools-encoding
/enstools/encoding/variable_encoding.py
UTF-8
13,029
2.765625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
""" This module provides utility classes and functions for compression in Enstools. This module defines various encodings and exceptions for compression, as well as utility functions. """ import logging from typing import Mapping, Union import hdf5plugin from enstools.encoding import rules, definitions from enst...
true
507c3bb78917193855a3494118477c1801f4b66c
cleosilva/desafios_Python
/6_quantasVezes.py
UTF-8
363
4.0625
4
[]
no_license
# Dados um número inteiro n, n > 0, e um dígito d. 0 <= d <= 9, determinar quantas vezes d ocorre em n. n = int(input('Digite o valor de n:')) d = int(input('Digite o valor de d [0 a 9]:')) num = n cont = 0 while n != 0: resto = n % 10 if resto == d: cont = cont + 1 n = n // 10 # Novo valor de n ...
true
a15712cd22e6909327cd1aceb786cf26ac546c7e
imshashank/dm5
/code5/jaccard.py
UTF-8
1,543
3.015625
3
[]
no_license
import threading import time #number of docs n = 21000 #n = 21000 #length of feature vector s_n = 2974 #value of k k=10 print "loading the feature vector in memory" time1 = time.time() #loading feature vector s= [] filename = 'feature_matrix.pytext' i=0 for line in open(filename): record = eval(line) temp =...
true
9aa9b87cb914db1e68a5e2c6757f1711b5ae8072
Statu11/Computer-vision-tracking-and-localisation
/Localisation/Main.py
UTF-8
1,430
2.890625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function import cv2 as cv import numpy as np from math import sqrt from Homography import PerspectiveCorrection from Tracking import Tracker from PoseEstimation import PoseEstimator #height_px = 1080# size in pixels along Y #width_px = 1920#...
true
7d215584abfd6f40894348a77591b5e8011e3013
adagio/advent-of-code
/source/day02/modules/commonchars.py
UTF-8
289
3.4375
3
[]
no_license
def process(id1, id2): """ Given 2 IDs, that differ by exactly by 1 char Return common chars """ length = len(id1) common = '' for i in range(0, length): if id1[i] != id2[i]: common = id1[0:i] + id1[i+1:] break return common
true
a3144293c7622f92de3604889cff1feda092fdbf
utep-cs-systems-courses/video-player-Nicole-favela
/VideoPlayer.py
UTF-8
3,452
3.09375
3
[]
no_license
#!/usr/bin/env python3 import threading import cv2 import os import base64 import queue mutex = threading.Lock() class ProducerConsumerQ(): def __init__(self): self.semaphore = threading.Semaphore(10) self.queue = queue.Queue() #add to queue def put(self,frame): self.semaphore.acqu...
true
d571ae6216e4f4d56ebcc86138438ffb4c8368b3
Daniel-Walpole/SystemSimulationProject2
/Project2.py
UTF-8
3,717
3.203125
3
[]
no_license
import simpy import random #Daniel Walpole #Project 2 #System Simulation #Assignment is to make a simulation of a fast food resturant with 1 ordering window, 1 pickup window, and 1 payment window #The Pickup line has 7 spots to include the pickup window and payment window #The program will find the average t...
true
010f2163a7a38d80c799d106ce80307681462e1e
lmgibson/MyRate
/src/freelance_scrape/scrape.py
UTF-8
6,287
3.1875
3
[]
no_license
# # Packages for Scraping from bs4 import BeautifulSoup import requests import random # Packages for cleaning Data import re import pandas as pd import numpy as np import time import itertools # Packages for PostgreSQL Import import os class FreelanceScrape: def __init__(self, freelancer): self.freelan...
true
74b8c60abd88d3a610e8e045c30455f9b6da0a12
fanfanfeng/rasa_nlu_qiu
/rasa_nlu_third/utils/text_utils.py
UTF-8
1,607
3.15625
3
[]
no_license
# create by fanfan on 2019/9/24 0024 import jieba def full_to_half(s): """ Convert full-width character to half-width one """ n = [] for char in s: num = ord(char) if num == 0x3000: num = 32 elif 0xFF01 <= num <= 0xFF5E: num -= 0xfee0 char = c...
true
477cef9bdcf144e7e014b3c9bc32dadb56dcf43e
TurboBelka/football
/teams/forms.py
UTF-8
1,679
2.53125
3
[]
no_license
from PIL import Image from django.forms import ModelForm, ValidationError from teams.models import Team from tournament.models import Tournament from users.models import Users class CreateTeamForm(ModelForm): class Meta: model = Team fields = ['first_user', 'second_user', 'logo'] def __init__...
true
2b1c0825484d0204703cb216d0b7a74f48d27fca
Garfield247/EDU
/day01/code/4_urllib_response.py
UTF-8
753
3.171875
3
[]
no_license
# _*_ coding:utf-8 _*_ #导包 import urllib.request # 定义URL,情求的页面的URL,数据类型为String url = 'https://baike.baidu.com/item/python' # 定义一个Header数据类型为Dict headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', } # 构造情求 request = urllib.request...
true
3c59f5f714d840964c5302f2faa2b953c2172dc6
Evaldo-comp/Processing
/Mod_Python/Draw/bandeira/bandeira.pyde
UTF-8
333
3.265625
3
[ "MIT" ]
permissive
#Através da construção de figuras geométricas é possível montar qualquer outro desenho size (480, 240) quad(120, 30,360,30, 360, 150, 120, 150) #precisa de 8 parametros line(120,90, 240, 30) #precisa de 4 parametros line(240,30,360,90) line(360,90,240,150) line(240,150,120,90) ellipse(240,90,80,80) #precisa de 4 para...
true
3ad5aadddb71767c05c8ae4293677bc1c427a4b4
dendisuhubdy/Xpedite
/scripts/lib/xpedite/analytics/treeCollections.py
UTF-8
8,478
3.828125
4
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
""" Module to build a hierarchical categories of collections TreeCollection is a hierarchical structure, where a collection is recursively broken into sub-collections, based on arbitrary classifiers. The sub-collections are stored as children of the source collection and will only contain a subset of object in the sou...
true
9eaaf06e4f2ec506163150eaba8d864a5f0dc22d
nxmatic/tod
/pytod/python-project/src/testcase/socket/server.py
UTF-8
358
2.53125
3
[]
no_license
import socket from xdrlib import Unpacker host = 'localhost' port = 8000 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind((host,port)) s.listen(5) conn, addr = s.accept() print 'conectado por', addr while 1: data = conn.recv(1024) un = Unpacker(data) if not data: break data = un.unpack_int() ...
true
905f177bd5bbb2af4538acb9cb5d6cc30c27cf0a
GravityForPresident/website_explorer
/webpageExplorer.py
UTF-8
1,849
2.546875
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys def getLinkList (url, szint): driver.get(url) elems = driver.find_elements_by_tag_name('a') tempfile = open('tempFile.txt', "a") for elem in elems: my_string = str(elem.get_attribute("href")) if my_string.find("http") > -1:...
true
1c0367f294434cc82221bdf22821987d99eb3b07
yumi2198-cmis/vanda2027-cmis-cs2
/structure.py
UTF-8
590
4.25
4
[ "CC0-1.0" ]
permissive
import math Momentum is the quantity of motion in a body. To find the momentum, you will have to know the mass and the velocity in an object. def mul(m,v): return m*v def output(name,v1,p1): momentum = """ Hey {}! The momentum of the ball is {} {} * {} = {} """.format(name,v1,p1) return momentum def main(): ...
true
c557234db39687bd2c886b2301c7a8e6b054d7a4
rafhaeldeandrade/learning-python
/3 - Estruturas Lógicas e Condicionais em Python/exercicios/ex40.py
UTF-8
938
3.78125
4
[]
no_license
""" 40. O custo ao consumidor de um carro novo é a soma do custo de fábrica, da comissão do distribuidor, e dos impostos. A comissão e os impostos são calculados sobre o custo de fábrica, de acordo com a tabela abaixo. Leia o custo de fábrica e escreva o custo ao consumidor. CUSTO DE FABRICA % DO DISTRIBUI...
true
d7f39ae3d094307b6e4c6b4b3fbae291951d3dbd
wsjhk/wasm-python-book
/src/develop_code/test/text/num_parser_test.py
UTF-8
1,313
2.828125
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @author: HuRuiFeng @file: num_parser_test.py @time: 2020/9/1 19:19 @project: wasm-python-book @desc: """ import math import unittest from interpreter import uint32, uint64, float32, float64 from text.num_parser import parse_f32, parse_f64 class TestNumParserFunc(unittest.T...
true
41b9fcebdff6fc4af347e05003fd7fad969acdeb
pgfjunior/Exercicios
/ex2.3.py
UTF-8
168
3.84375
4
[ "MIT" ]
permissive
def main(): n = int(input('digite um inteiro: ')) k = int(input('digite um inteiro maior que zero: ')) print(n, 'elevado a', k, 'é igual a', n**k) main()
true
62d514fe312a2e8d69d88354b70b62fb10c412c3
pfirsich/ComputationalPhysicsExercises
/exercise2/randomwalk.py
UTF-8
873
2.96875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt N_PART = 10000 N_JUMPS = 1000 part_pos = np.zeros(N_PART, dtype=np.int32) # Matricle number 309231 np.random.seed(9231) plt.rc('text', usetex=True) var = np.zeros(N_JUMPS) for i_jump in range(N_JUMPS): for i_part in range(N_PART): if np.random.random()...
true
ba95bee98dd10d0d3b37936bc73fa3ae461e6bdb
akshaynikam/hello-world
/python/jump_statement_break.py
UTF-8
301
3.578125
4
[]
no_license
#!/usr/bin/python def break_example(): sum = 0 print("keep entering the numbers, enter 0 to stop") while 1: i = input() if not i: break sum += i print("Sum : %d" % (sum)) def main(): break_example() if __name__ == "__main__": main()
true
58e0c012d14083ad0bddb4132551fdcfd8bedefc
amlalejini/Aagos
/analysis/2020-05-20--mut-rates/test-max-aligned-similarity.py
UTF-8
1,348
3.3125
3
[ "MIT" ]
permissive
def max_aligned_similarity(a, b): if len(a) != len(b): print("Must be equal length!") exit(-1) # perfectly aligned num_bits = len(a) max_similarity = -1 # right_shift_alignments = {} # left_shift_alignments = {} for shift in range(0, num_bits): right_alignment_simila...
true
72e90657974a05a5fa66e34ba37aa12b1678b37c
yuus95/algorithm
/소프트스퀘어드 알고리즘 스터디/4주차/1963번 소수 경로/AA.py
UTF-8
882
2.859375
3
[]
no_license
import sys from itertools import permutations sys.stdin=open("00.txt","r") from collections import deque d = [False] *10000 prime= [] for i in range(2,10000): if d[i]== False: if i >=1000: prime.append(i) j = 2 while i*j < 10000: d[i*j] =True j+=1 ...
true
965827efc7e78665c0992e0ca56f32a5c049c987
chriklev/dnd-5e_tools
/combat_manager/wall-graph.py
UTF-8
455
3.453125
3
[]
no_license
class WallGraph(): def __init__(self): class Node(object): """ docstring """ neighbors = [] def __init__(self, pos_x, pos_y): """ Initializes a new Node with a given position """ self.pos_x = pos_x self.pos_y = pos_y @staticmethod def connect_nodes(node1, n...
true
176eebdb0735689e1a7b9095654cd8ccd3e7426f
ErikOrm/Masters
/DATread.py
UTF-8
2,175
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 15 16:28:24 2017 @author: Snok """ import numpy as np import random import math # getT is to import data files for the map and create a distance matrix. If you want to create random maps, use getT2. def getT(): f = open(r'D:\MasterThesis\DATA\1P2.DAT','r...
true
f6f5fe91d60e742f2558d18b2730e60829678efd
sutulovat2611/Algorithms-and-Data-Structures
/Radix and Count Sort/words_with_anagrams.py
UTF-8
10,229
4.25
4
[]
no_license
""" __author__ = "Tatiana Sutulova" date: 21/3/2021 """ #%% Task 2 def words_with_anagrams(list1, list2): """ pre-condition: neither list contains duplicate strings input: list1 and list2 - lists of strings qith all characters are lowercase a-z.. output: output - a list of strings f...
true
4bd2a026d6cd68d27a7bad3e123a37b7ff65ae79
harris-ippp/hw-6-TCurran4589
/e1.py
UTF-8
1,101
3.140625
3
[]
no_license
import requests from bs4 import BeautifulSoup as bs import pandas as pd from selenium import webdriver #address to scrape: addr = "http://historical.elections.virginia.gov/elections/search/year_from:1924/year_to:2016/office_id:1/stage:General" resp = requests.get(addr) html = resp.content soup = bs(html, "html.parser"...
true
5c3edc61ab8cd2fe90b0d8e8b05b25ddc3d923c6
shiki7/Atcoder
/indeednow-qualb/A.py
UTF-8
115
3.125
3
[]
no_license
a = list(map(int, input().split())) b = list(map(int, input().split())) print(abs(a[0]-b[0]) + abs(a[1]-b[1]) + 1)
true
e3913cfe832e8b933abab177a3c51305590ec077
pisomnia/LeetCode
/Algorithms/Array/84_Largest Rectangle in Histogram.py
UTF-8
607
3
3
[]
no_license
class Solution(object): def largestRectangleArea(self, heights): """ :type heights: List[int] :rtype: int """ stack=[] area=0 heights=heights+[0] for index in range (len(heights)): while stack and heights[index]<=heights[stack[-1]]: ...
true
3e20fa462520ebc8e257d36caa36534ef0f764e8
awaemmanuel/thinkful_datascience
/U2L5_multivariate_analysis.py
UTF-8
1,993
3.21875
3
[]
no_license
import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf import numpy as np import matplotlib.pyplot as plt from helper_modules import processing_loan_data as pld # Load data into pandas df = pd.read_csv('LoanStats3a.csv') # Clean up Interest Rate. Remove % sign, convert str -> float a...
true
32e0341141294145e1ecee6707dc73ff06315205
Nirvi1/project
/src/figure/pltplot.py
UTF-8
1,265
3.25
3
[]
no_license
# -*- coding:utf-8 -*- """Draw line plots File: pltplot.py File Created: 2021-04-10 Author: Nirvi Badyal """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt def plot_dual(los_tra, los_val, acc_tra, acc_val): """ Plot dual lines of loss and accuracy. Args: los_lst (list of ...
true
45a0b41a5f0d3048504225653ae892c1b310c603
jiriVFX/space_invaders
/scoreboard.py
UTF-8
3,265
3.328125
3
[]
no_license
from constants import * import pygame import json class Scoreboard(pygame.sprite.Sprite): def __init__(self): super().__init__() self.hi_score = 0 # load hi-score self.load_hi_score() self.score = 0 self.lives = LIVES self.font = pygame.font.SysFont("Consola...
true
aace6d36e920b1c29544d18aee6581cefb05be49
opengaming/osgameclones
/scripts/check_links.py
UTF-8
1,287
2.90625
3
[ "Python-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-4.0", "MIT" ]
permissive
""" Check game URLs and repos for broken links To run, install from pip: - aiohttp """ import aiohttp import asyncio from scripts.utils import games async def check_link(q): async with aiohttp.ClientSession() as session: while True: game, url = await q.get() async with session.ge...
true
e875781e152afe7cda5fc4f0e66ebde48ae0b846
elutk/work
/35.py
UTF-8
1,043
3.234375
3
[]
no_license
# имя проекта: work # номер версии: 1.0 # имя файла: 35.py # автор и его учебная группа: Е. Уткина, ЭУ-120 # дата создания: 26.11.2019 # дата последней модификации: 26.12.2019 # описание: Дан одномерный массив числовых значений, насчитывающий N элементов. Поменять местами группу из M элементов, начинающихся с поз...
true
d087576e759fb4d66fcee58006c3016ffda6464e
MatthewJFisher/advent-of-code-2017
/day13.py
UTF-8
658
2.640625
3
[]
no_license
# inFile = open("test.in", "r") inFile = open("day13.in", "r") inString = inFile.read() inList = inString.splitlines() fwDict = {} for entry in inList: newEntry = entry.split(':') fwDict[int(newEntry[0])] = int(newEntry[1].strip()) timeEnd = max(fwDict.keys()) severity = 0 done = False delay = 0 while not d...
true
baad4888196ee8381f4bbf7c6c4b4fc5d23845bf
Naim08/Tweet-Scraper
/scaper.py
UTF-8
1,092
2.65625
3
[]
no_license
import time from selenium import webdriver from selenium.webdriver.common.keys import Keys import math import random def constantTimer(min, max): return math.floor(random.randint(min,max)) + min #change directory accordingly. Also make sure the right driver is being used browser = webdriver.PhantomJS('/Users/Naim/De...
true
86a055aaad14bf0c4a2c26fb86b7d605e5834aa8
scMarth/Learning
/colors/color-theory/tetradic_schemes.py
UTF-8
1,324
2.921875
3
[]
no_license
colors = [ 'red', 'red-purple', 'purple', 'blue-purple', 'blue', 'blue-green', 'green', 'yellow-green', 'yellow', 'yellow-orange', 'orange', 'red-orange' ] for i in range(0, len(colors)): split_hue1 = (i + 1)%12 split_hue2 = (i + 11)%12 split_complement1 = (...
true
cb5d6565b0868c372accbf65d8cb18f4e12bfe2a
phoomct/Comprohomework
/Banknote.py
UTF-8
542
4.15625
4
[]
no_license
""" Banknote """ def main(): """ In a BankBank land, there are 5 banknotes as $800, $200, $150, $60 and $10. Write a program that helps the BB Bank to count the number of each banknote from the total amount of value, where the bank will always try to return the biggest bank notes first.""" money = i...
true
33efaf02a15f7e01fafcf27667d12a178240def0
JimInCO/typhon
/typhon/cloudmask/aster.py
UTF-8
27,344
2.671875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Functions to work with ASTER L1B satellite data. """ import datetime import logging import os from collections import namedtuple import gdal import numpy as np from skimage.measure import block_reduce from typhon.math import multiple_logical __all__ = [ 'ASTERimage', 'cloudtopheig...
true
c0b747a61c267d9d2c05088f40825a66e022daa9
DoranLyong/CSE-python-tutorial
/Coding-Test/CodeUp/Python/047_bitOperation.py
UTF-8
185
3.421875
3
[]
no_license
""" [ref] https://codeup.kr/problem.php?id=1047 Question: 1. take one integer 2. multiply it by 2 times 3. print it out """ a = int(input()) print(a<<1) # expend bit
true
19e5cb72742aee981ddb0bcbbeba2b26f17559a4
YJ-Tsai/pytickersymbols
/src/pytickersymbols/__init__.py
UTF-8
4,735
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ pytickersymbols Copyright 2019 Slash Gordon Use of this source code is governed by an MIT-style license that can be found in the LICENSE file. """ import os import json class Singleton(type): def __init__(cls, name, bases, my_dict): super(Singleton, c...
true
fa0a959aa9ac422a3b46193407105273d48931ed
HarshaVenkat17/Canny-Edge-Detection-on-Live-video
/CannyEdgeDetectionOnLiveVideo.py
UTF-8
708
2.6875
3
[]
no_license
import cv2 import numpy as np capture=cv2.VideoCapture(0) while(True): rect,frame=capture.read() changed=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) #define range of red color in HSV minval=np.array([30,150,50]) maxval=np.array([255,255,180]) #create a red HSV color boundary and threshold H...
true
385cfaca6f21d1a25a52aa0bdd7815d7fbd77a7c
agrant876/knowledge
/webscraper/word_counter.py
UTF-8
527
2.5625
3
[]
no_license
import sys sys.path.append('/Users/andrewgrant/anaconda3/lib/python3.5/site-packages') from lxml import html import requests page = requests.get('https://en.wikipedia.org/wiki/Kingston,_Jamaica') #tree = html.fromstring(page.content) if population in page.text: print('yes') #wordcount = {} #for word in page.t...
true
03502f07f67ecd638df8b1c216861097f88b116c
oogles/aoc_2020
/puzzles/day15/puzzle.py
UTF-8
1,073
3.40625
3
[]
no_license
from ..aoc import Puzzle def play_game(input_data, max_turn): # Map each spoken number to the previous turn it was spoken history = {n: i for i, n in enumerate(input_data)} last_number = input_data[-1] for i in range(len(input_data), max_turn): last_spoken = history.get(last_num...
true
9802e6b472e5a8be307c494017daaa03bf545946
umlfri-old/addon_profiles
/plugin/profiles/gui/SelectProfilesDialog.py
UTF-8
1,252
2.6875
3
[]
no_license
import os from imports.gtk2 import gtk class CSelectProfilesDialog(object): gladeFile = os.path.join(os.path.dirname(__file__), "selectProfilesDialog.glade") def __init__(self): self.wTree = gtk.Builder() self.wTree.add_from_file(self.gladeFile) self.__dialog = self.wTree.get_objec...
true
b980c1acec90ff97dd3e2c00bf244c565cc9c48f
rlnx/adaptive-ags
/examples/python/minimize.py
UTF-8
1,603
3.234375
3
[]
no_license
import numpy as np import adaptive_ags as ags def minimize_premade_function(params): # Minimize pre-made function, for example # https://www.sciencedirect.com/science/article/pii/S1877050915010248 result = ags.minimize('grishagins:1', **params) print('Grishagin function:') print('f_min =', result....
true
2e9c1ffac8e4de616d8f326e8cf9ccb12aed7e87
luis-wang/project_ribo
/bak/opencv_proc.py
UTF-8
9,192
2.75
3
[]
no_license
#coding:utf8 ''' Created on 2014-2-19 @author: Administrator ''' import cv2 import math import cv2.cv as cv import numpy as np import random from PyQt4.QtGui import QImage font = cv2.FONT_HERSHEY_SIMPLEX class IplQImage(QImage): """ http://matthewshotton.wordpress.com/2011/03/31/python-ope...
true
3b548495a138a9c572ea7057ab44f50adcdc5146
StakhovetsEE/pythonintask
/IVTa/2015/new 4.py
UTF-8
1,084
4.09375
4
[ "Apache-2.0" ]
permissive
# Задача №4, 17 Вариант # Программа выводит имя, под которым скрывается Грета Густафсон и дополнительно выводит область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти) # Stakhovets E.E. # 17.09.2016 print ( " Гр...
true
8abfa027b522885a246a721500b4dda55864a05c
larsga/py-snippets
/tic-tac-toe/players.py
UTF-8
5,389
3.140625
3
[]
no_license
''' Implementations of the players. ''' import random, operator, math class Player: def set_number(self, number): self._number = number def get_number(self): return self._number def get_move(self, board): pass def done(self, winner): pass def save(self): ...
true
944fd705fd3dfa99aff80dfbe30ee25bdc83dd5d
OmarEl-Haloush/Exercises
/Q2-3.py
UTF-8
134
3.15625
3
[]
no_license
w=width=17 h=height=12.0 d=delimeter="." print('1.=',w/2) print('2.=',w/2.0) print('3.=',h/3) print('4.=',1+2*5) print('5.=',d*5)
true
7c29522225cbc15792a6fd4c4aea07ee5ac18871
getting-things-gnome/GTGOnline
/Tools/dates.py
UTF-8
2,774
2.75
3
[]
no_license
from datetime import datetime, timedelta from User_backend.user import get_time_format from constants import * def get_datetime_object(input_str): #elif input_str.lower() in FUZZY_DATES: # return fuzzy_str_to_datetime(input_str) #elif input_str[-2:].lower() == 'am' or input_str[-2:].lower() == 'pm': ...
true
51ee052f50a1ecbe6d235987701b83dc92d70493
Manoj-t/PythonExamples
/Modules/ceil.py
UTF-8
134
3.3125
3
[]
no_license
import math print(math.ceil(5.2754)) print(math.ceil(5.8654)) # floor function print(math.floor(5.8654)) print(math.floor(5.3654))
true
592e01b7af8ae8e04dbca0d2db70e122300ac866
LiviuCP/goToScriptsPython
/recursive_transfer.py
UTF-8
6,114
3.109375
3
[]
no_license
import os, system_functionality as sysfunc, display as out from os.path import expanduser, isdir home_dir = expanduser("~") + "/" class RecursiveTransfer: def __init__(self): self.inPath = home_dir + ".store_input" self.outPath = home_dir + ".store_output" self.eraseTargetDir() def era...
true
f0222dd6181df08672bbc8429a40a6421fd660ee
github653224/GitProjects_DjangoInterfaceTestProject
/DjangoProjectsFiles/guest/Test/OtherTests/demo.py
UTF-8
211
3.140625
3
[]
no_license
class Host(object): """say good morning to user""" def goodmorning(self,name): return "good morning %s" % name if __name__=="__main__": h=Host() hi=h.goodmorning("zhangsan") print hi
true