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
43f38704501ece557cb30e19809016a8a39c5aaa
phamxuansang241/Thi-Thu-Dai-Cuong
/Build_Pdf_From_Img.py
UTF-8
977
2.515625
3
[]
no_license
import os from PIL import Image, ImageOps root = "Data/" list_branch = [] file_object = open('folder_mssv.txt', 'r') def img_2_pdf(branch): source_dir = root + branch + '/' img_list_name = os.listdir(source_dir) out_pdf_name = "PDF_Data/" + branch + '/' + branch + '.pdf' images = [] ...
true
66718131c0ce1a5116dc69b90f846570b671fb32
VasiliyRodin/CSUEB-MobileNetworkP3
/HomeAgent.py
UTF-8
1,126
2.71875
3
[]
no_license
import socket import sys import time import string import utils def server(port): s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(("",port)) sockName = s.getsockname() print sockName foreignAgentAddress = None foreignAgentPort = None while True: data,address = s.recvfrom(1...
true
4d5e7b130e5bd6aa00bada8b970a3d4117a23602
ati-ozgur/KDD99ReviewArticle
/HelperCodes/create_table_metaTrainingTestSetConfusionMatrix.py
UTF-8
1,906
2.703125
3
[ "MIT" ]
permissive
import ReviewHelper import pandas as pd df = ReviewHelper.get_pandas_data_frame_created_from_bibtex_file() df.metaTrainingSet.str.contains("KDD99Training") # find problematic records df[df.metaTrainingSet.str.contains("KDD99Training").isnull()].ID df[df.metaTestSet.str.contains("KDD99Training").isnull()].ID df[df...
true
da76e19fb14e7c4960db4daaf18bb61eca11222a
cburyta/mtg-ml
/src/preprocessor/card_preprocessor.py
UTF-8
3,648
2.828125
3
[ "MIT" ]
permissive
from multiprocessing import Process import os import math import json from copy import copy from postgres import Postgres from nlp.oracle_text_parser import OracleTextParser class CardProcessorProcess(Process): def __init__(self, cards, db_url): super().__init__() self.db = Postgres(url=db_url) ...
true
212c45679ac77083c26fcf9cad0e89025a52354b
cjeiy/Wumpus
/Wump_Text.py
UTF-8
26,866
3.21875
3
[]
no_license
#Carl-Johan Larsson #910307-3152 #04-11-2013 import random import sys import time import os from random import choice from operator import itemgetter, attrgetter class Run(): """1. Takes in different functions and start values of essential variables 2. Creates sub-class objects and updates strings for ga...
true
e728dbcfdc7d5a18d8cd1d68472983d0b225f67e
jasnap/python_scripts
/test.py
UTF-8
1,756
3.3125
3
[]
no_license
from binarytree import tree, bst, heap from random import randint import numpy as np import itertools my_tree = tree(height=3, is_perfect=True) print my_tree num_of_classes = randint(2, 5) num_of_attr = randint(2, 5) classes = [i for i in range(1, num_of_classes+1)] print "number of classes: ", num_of_classes print(m...
true
a98d58c6023ec5fb79d0f62d19dd6a6628d0f1c1
WinterIsSunny/obfuscated-gradients
/sap/attack_sap.py
UTF-8
13,200
2.625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 30 16:48:18 2018 @author: yusu """ ### SAP import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #%matplotlib inline import cifar10_input from sap_model import SAPModel import torch from wrapper import PyModel class black...
true
de5889d0328f0e3b41f207010eafc95d417bad11
ackoroa/squadnet
/submission/workspace/train.py
UTF-8
5,087
2.65625
3
[]
no_license
print "Imports and Settings" import csv, json, string, re, time from random import shuffle import numpy as np from nltk import word_tokenize from squadnet import * from squadsettings import * print "Read Word Vectors" glove = {} f = open('data/glove.6B.' + str(WORD_VECTOR_SIZE) + 'd.txt', 'rb') reader = csv.reader...
true
4ac9ae5f0b31e74d925e41dd38eaf0df14b4f98d
richardesp/todit
/todo/__init__.py
UTF-8
1,251
2.828125
3
[]
no_license
import os from flask import Flask def create_app(): # Funcion para crear varias instancias de la app y hacer testing (obligatorio en Flask) app = Flask(__name__) # Instancia de la clasde de Flask app.config.from_mapping( # Variables de entorno de configuración # Cambiar por algo mas complicado con un...
true
6916266992c90290ec7d5ffbf439dc9c02d12a1f
MingRuey/KaggleWidget
/TF_Utils/Models/Resnet.py
UTF-8
12,455
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on 9/23/18 @author: MRChou Scenario: For building a resent model to Tensorflow Esitmator API. Modified from tensorflow official models: https://github.com/tensorflow/models/tree/master/official/resnet """ import tensorflow as tf _CHANNEL = 'channels_first' # o...
true
11c7f085ea61c97c4a4c75697428a2cf9cf57ac1
antoinemaz/CARI
/models/budgetService.py
UTF-8
1,460
2.71875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
# coding: utf8 class budgetService(object): # récupération du budget par son id @staticmethod def getBudgetById(unid): rows = db.budget[unid] return rows # récupération de tous les produits d'un budget @staticmethod def getProduitsByBudgetId(unid): query = db(db...
true
9336c492cb38439de9c9f4e05e14038f41e91087
foo290/Virtual-environment-handler
/firstTimeExe.py
UTF-8
782
2.640625
3
[ "MIT" ]
permissive
from directory_manager import base_Directory, firstTExe,default_VE_NAME from tfl_backend import universal_Path_database with open(firstTExe) as file: try: terminator=int(file.read()) except: terminator=0 """ This function checks that whether the software was previously was installed or not. "...
true
fa8c5aae5c547876b086e37173c9b0336a514f6e
telenewbie/test4script
/python/XXXHelo/test.py
UTF-8
618
2.515625
3
[]
no_license
#coding:utf-8 import subprocess p = subprocess.Popen(['adb', 'devices'], stdout=subprocess.PIPE) outstr, errstr = p.communicate() print str(outstr)+r"""\t""" import os fff=os.system("adb devices") print str(fff)+r"""\t""" pipe=os.popen("adb devices") print pipe.readlines() #读取设备列表 def readDeviceList(): #先执行一遍ad...
true
4ede657aa3f43e86814cbc8321e36bf0a5b3cc6e
slava-kerner/pptracker
/src/utils/video.py
UTF-8
761
2.703125
3
[]
no_license
import ffmpy import youtube_dl def download_video(url, output): ydl_opts = { 'format': 'bestvideo', 'quiet': True, 'outtmpl': output } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) def crop(in_path, out_path, start_time, duration_time): """ Crops ...
true
4bfd47c94e55e5c62ff27340a3975a5e6ce36d7c
JisungKim94/file_overwrite_by_python
/mymodule.py
UTF-8
3,409
2.875
3
[]
no_license
# headerfile import linecache import os import shutil def movefile(origin_folder_path, new_folder_path): if not (os.path.isfile(origin_folder_path+'origin.c')): # origin 폴더에 origin.c가 없으면 print("Error : ther is no origin.c in", origin_folder_path) else: ...
true
387521bd94dc3ad3bc82f54899892e2fddb5698b
IldikoPilan/hitex-texteval
/dataset.py
UTF-8
13,203
2.828125
3
[]
no_license
import os import random import codecs import numpy as np import cPickle as pickle from auxiliaries.dset_proc_aux import * from sent_statistics import SentStatistics from sent_features import SentFeatures from auxiliaries.arff_aux import sk_to_arff, correct_arff from korp_classes import match, structs, kwic class Datas...
true
0ffef8afe123fd5acb709d1df0265a34d29f1969
Ivaylo-Atanasov93/The-Learning-Process
/Programming Basics/Simple_Operations-Exercise/Alchohol Market.py
UTF-8
1,108
2.5625
3
[]
no_license
# whiskey_price_perL = float(input()) # beer_liters = float(input()) # wine_liters = float(input()) # rakia_liters = float(input()) # whiskey_liters = float(input()) # # rakia_price_perL = whiskey_price_perL * 0.5 # wine_price_perL = rakia_price_perL * 0.6 # beer_price_perL = rakia_price_perL * 0.2 # # final_rakia_pric...
true
708f045356b08af9cd21d3751328d9ace43fec34
dseymo02/test_rep
/question3.py
UTF-8
556
4.125
4
[]
no_license
#question 3 def check(g,n): if g < n: return "Too low" elif g > n: return "Too high" else: return "Correct" def main(): # question 3 number = randint(0,99) guess = 0 finished = False count = 0 guess = int(input("Guess a number between 0 and 99: ")) while not finished: count += 1 if guess < numb...
true
927b8b4ebf53e81c2a962b255c0f620b1baaec61
Andromedanita/proclam
/proclam/simulators/simulator.py
UTF-8
907
3.40625
3
[]
no_license
""" A superclass for simulators """ import numpy as np class Simulator(object): def __init__(self, scheme=None, seed=0): """ An object that simulates true class assignments. Parameters ---------- scheme: string the name of the simulator seed: int, opti...
true
7eb08a2a818a48468eff56b3120ee09aaa700a89
intel-ctrlsys/actsys
/datastore/datastore/tests/test_datastore_builder.py
UTF-8
5,897
2.515625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # # Copyright (c) 2017 Intel Corp. # """ Tests for the FileStore class """ import unittest import os import tempfile from mock import patch from .. import DataStoreBuilder, DataStoreException, DataStore from ..filestore import FileStore from ..postgresstore import PostgresStore from .. multisto...
true
6f8da7b11ddc1063efba001fe6c0d9ac94525a97
anyakeller/StuyCS
/hwstuff/08hw.py
UTF-8
143
3.09375
3
[]
no_license
import math a = (3. + 4) / (7 - 2) b = ((5. ** 2) - (4./8))/( 16. - (8. * math.sqrt(9))) c = (5./6) / (7 + (9./ 5)) print a print b print c
true
2c42a13eca09e10407c3f37b71c004b740aa01ea
frenchd24/gt
/GTupdate2_countDiamSource.py
UTF-8
3,757
2.515625
3
[]
no_license
#!/usr/bin/env python ''' By David M. French (frenchd@astro.wisc.edu) $Id: GTupdate2_countDiamSource.py, v1.1 07/07/18 Count how many galaxy ratios, PAs and diameters came from each survey (09/26/17) v1.1: Update for thesis (07/07/18) ''' import sys import os import csv # import string import warnings import nump...
true
d7fc4f0214ccd14ed9a6c4ccd82c21400d471cf1
edenizk/python_ex
/for loop questions.py
UTF-8
1,348
4.3125
4
[]
no_license
def main(): #question 1 # You would like to count the number of fruits in your basket. # In order to do this, you have the following dictionary and list of # fruits. Use the dictionary and list to count the total number # of fruits, but you do not want to count the other items in your basket. ...
true
4fbf2776e3dc7d8d4f7237aa990d209160e28b4f
wwjjwwpt/KDtree
/test.py
UTF-8
5,671
3.078125
3
[]
no_license
from math import sqrt import numpy as np from random import randint import datetime ##生成kd树 def createTree(dataSet, layer=0): #Calculate the length of the data, which may be zero during the iteration length = len(dataSet) if(length == 0): return #Calculate the variance of each dimension, with ...
true
f17b6a9f344fa130945dccd2150ef8996d4c9aac
Randdalf/aoc20
/d06.py
UTF-8
480
2.65625
3
[]
no_license
#!/usr/bin/env python """Advent of Code 2020, Day 6""" from functools import reduce from aoc import solve def parse(data): return [[set(p) for p in g.split('\n')] for g in data.split('\n\n')] def anyone_answers(groups): return sum(len(reduce(lambda x, y: x | y, g)) for g in groups) def everyone_answers...
true
45d1691d4669fa41355eab18b98672b1147c5052
zheminzhou/QuarLab
/QuarHybrid.py
UTF-8
523
2.59375
3
[]
no_license
import sys, os, re if __name__ == '__main__' : q1 = {} for fname in sys.argv[1:] : with open(fname) as fin : for line in fin : if line.startswith('#') : continue part = line.strip().split('\t') if part[1] in q1 : q1[pa...
true
fb2a7e16ffba75a34799fc46ed6f8452b4e85621
anand57/lpthw
/ex13.py
UTF-8
213
2.609375
3
[]
no_license
from sys import argv script, first, second, third = argv print "The script is called: %s" % script print "The first arg is %s" % first print "The second arg is %s" % second print "The third arg is %s" % third
true
9f8f42bc2be1dc0d2767f7cc82410c354318b9c4
hariharaselvam/python
/day3_regex/reg1_search.py
UTF-8
146
2.953125
3
[ "Apache-2.0" ]
permissive
import re s="hello how 4470 and 4483 are done" pat=raw_input("Enter the pattern : ") if re.search(pat,s): print "Found" else: print "Not found"
true
2289b6ecfd554571acb750df600efbf7eca2acbf
zhaojhao/DRP
/DRP/ml_models/splitters/NoSplitter.py
UTF-8
672
2.859375
3
[]
no_license
"""Splitter visitor for the case when the data should not be separated.""" from AbstractSplitter import AbstractSplitter import random class Splitter(AbstractSplitter): """The splitter visitor.""" def __init__(self, namingStub): """Standard splitter initialisation.""" super(Splitter, self)._...
true
eff6a67deb0fdb8abbcbd8f33d6c4a949c07e2c1
AdamZhouSE/pythonHomework
/Code/CodeRecords/2730/60618/263636.py
UTF-8
219
3.0625
3
[]
no_license
t=int(input()) for i in range(t): num=int(input()) n=[int(n) for n in input().split()] sum=0 for j in range(0,num): sum+=n[j] if sum%3==0: print("1") else: print("0")
true
a820b055c933329cb0d6a49364708102f91f2d82
matthieupenchenat81/DreamPark
/Developpement/DreamPark/install.py
UTF-8
2,292
2.65625
3
[]
no_license
from random import * from Developpement.DreamPark.Model.Abonnement.Client import * from Developpement.DreamPark.Model.Parking.Place import Place def initTable(): # connect table conn = sqlite3.connect("test.db") curseur = conn.cursor() #voiture curseur.execute("DROP TABLE IF EXISTS Voiture") ...
true
5316d5638a4b31421afe3046d465b610129053bb
zuluman10/get_current_weather
/main.py
UTF-8
2,379
3.5
4
[]
no_license
""" Module name: main.py This module provides the run script for the Wunderground Weather API quiz question. Attributes: QUERY_TYPE: The type of query for the conditions engine. Note that conditions handles one query type right now, but can expand to handle oth...
true
95110646f416d58ad0d4fb00b6b68a3d63a944b7
running-on-sunshine/python-exercises
/List Exercises/even_numbers.py
UTF-8
1,245
4.75
5
[]
no_license
# ======================================================================= # # List Exercises # # ======================================================================= # # Begin here: # ======================================================================...
true
8333d775cf9868bad48f4e299bfd7e685e28d1b7
Vykstorm/pyvrepclient
/vrep.py
UTF-8
20,662
2.90625
3
[]
no_license
import vrep_binds as binds from vrep_errors import * from vrep_objects import * from re import fullmatch from functools import reduce import json def alive(unchecked_method): ''' Decorador auxiliar para los métodos de la clase Client. Sirve para añadir código de comprobación al inicio de estas funcio...
true
22cbc567c8bf2682c86061ab481ae424a24b320c
dingusagar/merJson
/jsonutils/merJson.py
UTF-8
3,426
3.015625
3
[]
no_license
import json import glob import os import logging logging.basicConfig(level=logging.INFO) class MerJson: current_dir = os.path.dirname(os.path.realpath(__file__)) output_file_seq_no = 0 extension_name = '.json' def read_json_to_dic(self, filename): with open(filename) as json_file: ...
true
bf3ab67540c91aa9d432890531d2a4d476c16e82
akshay-sridhar/demystifying
/demystifying/feature_extraction/random_feature_extractor.py
UTF-8
975
2.59375
3
[ "MIT" ]
permissive
from __future__ import absolute_import, division, print_function import logging import sys logging.basicConfig( stream=sys.stdout, format='%(asctime)s %(name)s-%(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') import numpy as np from .feature_extractor import FeatureExtractor logger = logging.get...
true
7053bf125f0b76835b2fb88705dbd64ae134b8a8
Bolsic/Flappy_Bird
/Flappy_Bird.py
UTF-8
6,423
2.78125
3
[]
no_license
import pygame import math import random pygame.init() win = pygame.display.set_mode((1000, 600)) pygame.display.set_caption("Flappy Bird") def collision_bird_stub (bird, stub): if bird.x + bird.r < stub.x: return False if bird.x - bird.r > stub.x + stub.width: return False i...
true
0d005763e9cbaade4a8d95bbe5d8853aa76692be
setu-parekh/DS-Algo-Coding-Challenges
/Linked_List/Educative/return_Nth_node_from_end.py
UTF-8
2,277
4.53125
5
[]
no_license
''' QUESTION - ---------- Write a program to return Nth node from end of the Linked List. Sample Input: 1 --> 2 --> 3 --> 4 --> 5, N = 4 Output: 2 APPROACH (Double Iteration) - ----------------------------- 1. Iterate to calculate length of the Linked List. 2. Find the node position from start using leng...
true
43faaf95e25cd49b820dd27a12624cde2f2af710
kenyalenae/CapstoneProject2
/menuOption1.py
UTF-8
2,186
3.921875
4
[]
no_license
# When user selects menu option 1 # Create a database and table import sqlite3 # create a database with a pre-defined table def create_database(): sqlite_file = 'test1_db.sqlite' # name of the sqlite database file # table_name = input('What would you like to name the table? ') # ask user what they would...
true
1f69973b25dfa34c32fb728fdde29e61a8059897
mari0d/PFM
/modules/from_url.py
UTF-8
165
2.515625
3
[]
no_license
#!/usr/bin/python # ### Info: URL decodes the input (including encoded spaces). import urllib def convert(data, args): return [urllib.unquote_plus(data)]
true
694985a09e9a12f2adc32acbb791e025462786e1
Alpha-Scorpii/Sherlock
/Python/Prime.py
UTF-8
562
3.578125
4
[]
no_license
import math import time # Method to find prime numbers # Optimized implementation # Don't worry still not faster than, same implementation of C lang. def prime(n): if(n == 1 and n == 2): return True if(n > 2 and n % 2 == 0): return False divisor = math.floor(math.sqrt(n)) for...
true
dc3ab1f15057433357e506a89a3e422539fa0161
to-lz1/bqunit
/tests/test_query_builder.py
UTF-8
1,163
2.6875
3
[ "MIT" ]
permissive
from bqunit.query_builder import QueryBuilder def test_extract_table_names(): query = """ select tbl1.col1 , tbl2.col2 , tbl1.col2 , tbl1.col3 from `prj_12345.data_set.table` tbl1 join ( select col1, 'test' as col2 from another_data_s...
true
7bf8984995d63b3cfd02ce7f9b5da34351297608
LockettPundt/Python-week-1
/magic_number.py
UTF-8
809
4.75
5
[]
no_license
#prompt user for number 1-10. #the function below checks to see if it matches a randomly generated number. user_number = int(input("Guess a number between 1 and 10. \n")) import random MY_NUMBER = random.randint(1, 10) count = 0 if (user_number > 10 or user_number < 1): user_number = int(input("Enter another numbe...
true
8ff48c28c38d93ed723c4573e7a07ec8405e4b93
ChironEvans/de321-Assignment2-2020
/js_parser/pickler.py
UTF-8
484
2.78125
3
[]
no_license
# Code by Chiron Evans from pickle import load, dump from os import path class Pickler: def __init__(self, pickle_name='last_pickle'): self.name = pickle_name self.filename = f'{self.name}.p' def preserve(self, an_object): with open(self.filename, 'wb') as f: dump(an_objec...
true
b605182270c2ddf30445d292d0869ad2d311b634
M0eB/py-practice
/python-the-hard-way/ex24.py
UTF-8
1,158
4.28125
4
[]
no_license
# ============================================================================= # By : Mohamed T. Ismail # Book : Learn Python The Hard Way # Author : Zed Shaw # Decription : Ex24 - More Practice # ============================================================================= print "Let's practi...
true
8532cf2452ca19f34c3dde4848be255af6f671b1
jydarack/aoc2020
/python/day06.py
UTF-8
897
3.140625
3
[]
no_license
from typing import List, Tuple from collections import Counter def get_inputs(fn: str = "toy") -> List[str]: with open(f"../inputs/day06/{fn}inputs.txt", "r") as f: inpt = f.read().split("\n\n") return inpt def check(ans: str) -> Tuple: ans = ans.replace("\n", "") return Counter(ans), len(se...
true
e2b65a78a23c0363a48bd9c0debf0ec1c00a6f48
bineeshpc/problemsolving
/datastructures/matrix/matrix.py
UTF-8
2,043
3.8125
4
[]
no_license
class IncompatibleMatrix(Exception): def __init__(self, a_columns, b_rows): self.a_columns = a_columns self.b_rows = b_rows def __str__(self): message = [] message.append('\nMatrices are incompatible.\n') message.append('columns of first matrix is not the same as rows o...
true
6f13a0c77f4a0aa9a7db2bd1ab22491cf4f2708f
oranguh/rhythmz
/stats.py
UTF-8
2,656
2.71875
3
[]
no_license
import os import json from datetime import timedelta from collections import defaultdict import librosa import pandas as pd from librosa.core import get_duration if __name__ == '__main__': path = "datasets/librivox" meta_path = "datasets/librivox_metadata" assigned_sample_rate = 8000 times = [] au...
true
d24663507e742aadd44888d3664c1ab527841c67
zgle-fork/OpenCV-Python-Tutorial
/ch22-直方图/hist-normalized-numpy.py
UTF-8
1,022
3.15625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- __author__ = 'play4fun' """ create time:15-10-24 下午5:26 直方图均衡化 想 一下如果一副图像中的大多是像素点的像素值 中在一个像素值范 围之内会怎样呢 例如 如果一幅图片整体很亮 所有的像素值应 会很 。但是一副 的图像的像素值分布应 很广泛。所以你应 把它的直方 图做一个横向拉伸 如下图 就是直方图均 化 做的事情。 常情况下 种操作会改善图像的对比度。 """ import cv2 import numpy as np from matplotlib import pyplot as plt #怎样使用 ...
true
38ad866bf5994a7842ac58cfb32c2d13da1e57aa
jonasht/cursoIntesivoDePython
/12-umaEspaconaveQueAtira-EmProgresso/12-umaEspaconaveQueAtira/03-318CriandoUmaclasseDeConfiguracoes/alien_invasion.py
UTF-8
742
3.265625
3
[]
no_license
import sys import pygame from settings import Settings def run_game(): pygame.init() ai_settings = Settings() screen = pygame.display.set_mode( (ai_settings.screen_width, ai_settings.screen_height) ) pygame.display.set_caption('alien invasion') # definir a cor bg do jogo -...
true
1a20962723fc96ab1e51c75a16a67e63e0931d9a
Aasthaengg/IBMdataset
/Python_codes/p03265/s282758313.py
UTF-8
445
3.109375
3
[]
no_license
x1,y1,x2,y2=map(int,input().split()) if x2 >= x1 and y2 >= y1: x3=x2-abs(y2-y1) x4=x1-abs(y2-y1) y3=y2+abs(x2-x1) y4=y1+abs(x2-x1) elif x2 < x1 and y2 >= y1: x3=x2-abs(y2-y1) x4=x1-abs(y2-y1) y3=y2-abs(x2-x1) y4=y1-abs(x2-x1) elif x2 < x1 and y1 >= y2: x3=x2+abs(y2-y1) x4=x1+abs(y2-y1) y3=y2-abs(x...
true
2182eea1f64b8332b048997d1769dc051be59697
whyjz/CARST
/extra/unused/combineColumns.py
UTF-8
1,503
3.0625
3
[ "MIT" ]
permissive
#!/usr/bin/python # combineColumns.py # Author: Andrew Kenneth Melkonian # All rights reserved def combineColumns(xyz1_path, xyz2_path, id_col_num_1, id_col_num_2): assert os.path.exists(xyz1_path), "\n***** ERROR: " + xyz1_path + " does not exist\n"; assert os.path.exists(xyz2_path), "\n***** ERROR: " + xyz2_pa...
true
181db543d0eaa2f7266ffaa904abe00b4adda14b
jrjhealey/AdventOfCode2018
/Day3/python/Day3Part1.py
UTF-8
1,426
3.078125
3
[]
no_license
import sys import numpy as np def initialise_matrix(num, coords, area): x, y = coords.rstrip(':').split(',') xlen, ylen = area.split('x') x, y, xlen, ylen = [int(i) for i in [x, y, xlen, ylen]] max_x = x + xlen max_y = y + ylen matrix = np.zeros((max_x, max_y)) matrix[x:max_x, y:max_y] = 1 ...
true
c87586ea49ccea62be8982c7c24aa43ff03a6d57
ctlab/true-dist-infer
/src/estimators/uniform_db_estimator.py
UTF-8
382
2.8125
3
[]
no_license
import math from src.estimators.abstract_db_estimator import AbstractDBEstimator class UniformDBEstimator(AbstractDBEstimator): def d_over_n(self, x): c_m = lambda m: lambda x: math.exp(- m * x) * (x ** (m - 1)) * (m ** (m - 2)) / math.factorial(m) return 1 - sum(c_m(m)(x) for m in range(1, 100))...
true
b04d42bf6727f2a827bcecd5db4b230c3c93956c
Aleksa-Jovanovic/IOADomaci
/Domaci/Domaci9/kod.py
UTF-8
3,177
2.828125
3
[]
no_license
import numpy as np import math import random as rand S=[2.424595205726587e-01, 1.737226395065819e-01, 1.315612759386036e-01, 1.022985539042393e-01, 7.905975891960761e-02, 5.717509542148174e-02, 3.155886625106896e-02, -6.242228581847679e-03, -6.565183775481365e-02, -8.482380513926287e-02, -1.828677714588237e-0...
true
0e50301ce5ace5e3e8cbc1df30936555e20d1745
Virendra-Das/PythonProjects
/prime_nos_while.py
UTF-8
345
3.921875
4
[]
no_license
def prime(n): num = 2 f = 0 while(num < n): if(n % num == 0): f=1 num+=1 break if(f==0): return True else: return False lim = int(input("Upto what numbers do you want to print the prime numbers? ")) i = 1 while(i < lim): if(prime(i)): ...
true
de6f21f0f6af498bbd82030b2bb11bdc9abbfaab
lsanopulos/Python-training-for-QA
/test/test_modify_group.py
UTF-8
1,445
2.734375
3
[]
no_license
from model.group import Group import random import pytest def test_modify_group_name(app, db): with pytest.allure.step('Checking, if group list is empty'): if len(db.get_group_list()) == 0: app.group.create(Group(name = "Created Group")) with pytest.allure.step('Given a group list'): ...
true
bfe5f80afb861721be5a1fcc3087ad4aebb8f922
walkerzh0/python
/PycharmProjects/oop/game.py
UTF-8
707
3.265625
3
[]
no_license
#!/usr/bin/python3 #coding=utf-8 def gethistoryScoreFromDb(): return 10000 class Game(object): history_top_score = gethistoryScoreFromDb() def __init__(self, player_name): self.player_name = player_name self.cur_score = 0 @staticmethod def show_help(): print("游戏帮助信息:游戏训...
true
5a5ae92ceddecf8538acd8b72bbdcfade04ceef2
dhruv-kun/WhatsApp-WebBot
/content.py
UTF-8
2,629
2.984375
3
[]
no_license
from datetime import datetime class Content(object): def __init__(self): self._sent = [] def set_type(self, data_type): try: assert data_type in ('text', 'media', 'document') except AssertionError: raise(TypeError( "must be text, media or docum...
true
82244a62ed10eb90a8e7c9a4c811a60c8fcb852b
ravijaya/june08
/psdict4.py
UTF-8
268
2.703125
3
[]
no_license
info = { 'host': 'ws1', 'domain': 'rootcap.in', 'desc': 'web server', 'app': 'apache httpd', 'version': 2.2 } print(info) print() value = info.pop('desc') del info['domain'] print(value) print(info) # del info # delete's the dict # print(info)
true
d710a503a7258039a3064363805d543d4dd9548d
uduse/bonobo
/bonobo/nodes/io/csv.py
UTF-8
2,444
2.734375
3
[ "Apache-2.0" ]
permissive
import csv from bonobo.config import Option from bonobo.config.processors import ContextProcessor from bonobo.constants import NOT_MODIFIED from bonobo.nodes.io.file import FileReader, FileWriter from bonobo.nodes.io.base import FileHandler, IOFormatEnabled from bonobo.util.objects import ValueHolder class CsvHandle...
true
49f9bff1f215b1e911f1fbbb4dcf45bfcb87f4ab
ZhengHui-Z/Pytorch-Retinaface-Mask-Detection
/scripts/generate_ground_truth.py
UTF-8
1,117
2.578125
3
[ "MIT" ]
permissive
import argparse import os parser = argparse.ArgumentParser() parser.add_argument("-s", "--source", type=str, help="source anotation") parser.add_argument( "-d", "--dest_folder", type=str, default="input/ground-truth", help="dest folder" ) args = parser.parse_args() class_map = {"0": "background", "1": "face", "2"...
true
6d3bab1db1452fa66bbb210bf1f0b83d4f561809
mahyarkargar/quant-econ
/quantecon/tests/test_ricatti.py
UTF-8
1,642
2.78125
3
[ "BSD-3-Clause" ]
permissive
""" Filename: test_tauchen.py Authors: Chase Coleman, John Stachurski Date: 07/22/2014 Tests for ricatti.py file """ import numpy as np from numpy.testing import assert_allclose from quantecon.matrix_eqn import solve_discrete_riccati def dare_test_golden_num_float(): val = solve_discrete_riccati(1.0, 1.0, 1.0, 1...
true
2f84460eba4d657d72fb7b9399af79f3d607d395
clesmes10/CatalinaLesmes_hw12
/CL_graph.py
UTF-8
247
2.828125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt #cargar datos datosad = np.genfromtxt("advection.txt") x = datosad[:,1] y = datosad[:,2] plt.plot(x,y, "c") plt.xlabel("x") plt.ylabel("y") plt.title("adveccion") plt.savefig("adveccion.png")
true
4edffbb02a034aeb79fc9a9bd729908811e9e893
KnightDark376/Opencv
/ColorChannels.py
UTF-8
433
2.578125
3
[]
no_license
import cv2 as cv import numpy as np img = cv.imread('picture/4.jpg') cv.imshow('anh4',img) blank = np.zeros(img.shape[:2], dtype='uint8') b,g,r = cv.split(img) blue = cv.merge([b, blank,blank]) green = cv.merge([blank, g,blank]) red = cv.merge([blank, blank,r]) mergered = cv.merge([b, g,r]) cv.ims...
true
58b79d3d668d43f3107ed5edbf09b8c6cb908b90
patalv/progcomp2018_2
/en_proceso/uva11292.py
UTF-8
1,178
2.671875
3
[]
no_license
#!/usr/bin/env python import sys lista=[] for line in sys.stdin: li=[] for var in line.split(): var=int(var) li.append(var) if len(li) == 1: li=int(li[0]) lista.append(li) aux=list(lista) casos=list([]) #print lista for i in lista: #print i,'narf' if (type(i) is list): if (i[0] == 0) and (i[1] == 0): b...
true
155ed2ad54126fc5ea54004e31ab4073310673ad
gonzojive/ros_hw1
/src/compassTest.py
UTF-8
9,793
2.703125
3
[]
no_license
#!/usr/bin/env python import roslib; roslib.load_manifest('hw1') import rospy import tf from math import * from line import * from lineviz import * from compass import * import time from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist from geometry_msgs.msg import Vector3 r2d = 180.0/3.14159 d2r =...
true
e2bf3a9f223136d61147a004ab69aef2db7f8b0e
shlpu/pytorch-3dunet
/datasets/hdf5.py
UTF-8
7,588
2.671875
3
[ "MIT" ]
permissive
import h5py import numpy as np from torch.utils.data import Dataset import augment.transforms as transforms class HDF5Dataset(Dataset): """ Implementation of torch.utils.data.Dataset backed by the H5(files), which iterates over the raw and label datasets patch by patch with a given stride. If one wou...
true
948238d52acf9b71672bc03858fdafd396173bb1
Eli-llc/beatfulData
/common/config.py
UTF-8
1,303
2.796875
3
[ "MIT" ]
permissive
import os import yaml from common.log import logger from common.error import ConfKeyNotFound class ParseYaml: """ 解析yaml配置文件 """ yaml_file = "../config/config.yaml" def __init__(self, conf=None): conf = conf or ParseYaml.yaml_file yaml_file_abspath = os.path.join(os.path.dirname(...
true
ecd33fc960b9cd504c95fd405560f8ec85304a55
STR-AI-Club/Lessons
/06 - Convolutional Neural Network/layer.py
UTF-8
429
2.9375
3
[]
no_license
import numpy as np class Activation: def __init__(self, activation, activationDeriv): self.activation = activation self.activationDeriv = activationDeriv self.input = None def forward(self, inputs): self.input = inputs return self.activation(self.input) def backwa...
true
6a030b50d990f6dfa940be46c45a0f74f719e39f
anousone-7898/dataStructure_python
/finding_Root_2_Leaf_Paths.py
UTF-8
3,879
3.671875
4
[]
no_license
import copy t = 0 class Node: def __init__(self, data=None): self.data = data self.right = None self.left = None def insert(self, data): if data == self.data: print("can not insert") # LEFT elif data < self.data: if self.left: ...
true
33a063207bcd7b2aa9b070265c0b8e2ed6c44bd5
yoshida-lab/XenonPy
/xenonpy/model/training/lr_scheduler.py
UTF-8
14,791
2.859375
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2021. TsumiNa. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. from torch.optim import lr_scheduler from xenonpy.model.training.base import BaseLRScheduler __all__ = ['LambdaLR', 'StepLR', 'MultiStepLR', 'ExponentialLR', 'Co...
true
8b5cf6843192125e9508bf8aede8df6a42822f54
chu83/DeepLearning
/01. perceptron/ex07.py
UTF-8
339
2.578125
3
[]
no_license
# 계단함수 import numpy as np import os import sys from matplotlib import pyplot as plt from pathlib import Path try: sys.path.append(os.path.join(Path(os.getcwd()), 'lib')) from common import step except ImportError: print('Library Module Can Not Fount') x = np.arange(-5.0, 5.0, 0.1) y=step(x) plt.plot(x, y)...
true
efe0fa81a09a25780581f631b8f0084d16f0baef
ykodama/data-structures-and-algorithms
/quick_sort.py
UTF-8
384
3.25
3
[]
no_license
# coding: utf-8 def quick_sort(buff, low, high): pivot = buff[(low + high)/2] i = low j = high while True: while pivot > buff[i]: i += 1 while pivot < buff[j]: j -= 1 if i >= j: break tmp = buff[i] buff[i] = buff[j] buff[j] = tmp i += 1 j -= 1 if low < i - 1: quick_sort(buff, low, i - 1)...
true
bec985f4f831f5fbdb6dce30597ed58a321e691c
Miguel-Frazao/GUI-countries-data
/country_data.py
UTF-8
2,513
3.28125
3
[]
no_license
import tkinter as tk, requests def c_data(c): c = c.strip() print() if c == '': return try: country = [i for i in countries if i['name'].lower() == c.lower() or i['code_iso2'].lower() == c.lower()][0] data = { 'd1': {'data': country['name'], 'entry': tk.Entry(root), ...
true
a8e579ba6202d8cea2d895a5e469a87951baef38
SatioO/DS-Algorithms
/Quick_Sort/main.py
UTF-8
1,489
3.765625
4
[]
no_license
numbers = [54, 26, 93, 17, 77, 31, 44, 55, 20] def partition(arr, first, last): # 1. setting up initial pivot value pivot_value = arr[first] # 2. setting up left and right mark leftmark = first + 1 rightmark = last # 3. setting up mark to check if partitioning is done or not done = False ...
true
9a199053d11d753491610160bfe87dc7fa35412e
youjin9209/2016_embeded_raspberry-pi
/pythonBasic/sum_3_or_7_multiple_til_100.py
UTF-8
153
3.765625
4
[]
no_license
total = 0 for item in range(1, 101): if (item % 3) == 0 or (item % 7) == 0: total = total + item print("multiple 3 or 7 summation 1 to 100", total)
true
7b932aeac84b0f90fbfc28debc6790a974690734
zrzka/blackmamba
/blackmamba/lib/rope/base/pyscopes.py
UTF-8
9,752
2.5625
3
[ "MIT" ]
permissive
import rope.base.builtins import rope.base.codeanalyze import rope.base.pynames from rope.base import ast, exceptions, utils class Scope(object): def __init__(self, pycore, pyobject, parent_scope): self.pycore = pycore self.pyobject = pyobject self.parent = parent_scope def get_names...
true
b8628cdcbeb35f972c9d8339c26d99ab6e990acd
PortugalNeto/Infnet
/TP3_Q3.py
UTF-8
707
3.78125
4
[]
no_license
vencedor = None notas = [] nomes = [] vencedor_nota = None posicoes = ['Primeiro', 'Segundo', 'Terceiro', 'Quarto', 'Quinto'] for i in range(0, 5): nome = input(f"Informe nome do {posicoes[i]} participante: ") nomes.append(nome) nota = float(input(f"Informe a nota do {posicoes[i]} participante: ")) wh...
true
e30a53e46980232134edd2640d7f9d36f10b33ef
NickBorgers/pybotvac
/sample/sample.py
UTF-8
673
2.578125
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import sys from pybotvac import Account, Vorwerk if sys.version_info[0] < 3: input = raw_input email = input('Enter email\n') password = input('Enter password\n') vendor = Vorwerk() account = Account(email, password, vendor) print("Robots:") for robot in account.robots: print(robot) print() prin...
true
355a11d62ab137f9acb991aa2fb2783aa76b9451
Reicher/AdventOfCode2019
/day1/main.py
UTF-8
540
4
4
[]
no_license
# Day 1 print 'Day 1' def simpleFuelCalc( mass ): fuel = mass / 3 fuel -= 2 return fuel def advFuelCalc( mass, total = 0 ): fuel = simpleFuelCalc( mass ) if fuel <= 0: return total else: total += fuel return advFuelCalc(fuel, total) sum = 0 with open('input.txt', ...
true
2d4f286aa84d0ada2c9a76dd9f392d82353e71c2
sysulic/GNTGDs
/code/src/parser.py
UTF-8
3,963
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """Parser.""" # Lexer import ply.lex as lex import re reserved = {'not': 'NAF'} tokens = [ 'CONSTANT', 'VARIABLE', 'STRING', 'PARAM_OPEN', 'PARAM_CLOSE', 'COMMA', 'SEMICOLON', 'CONS', 'DOT', 'NEG' ] + list(reserved.values()) def t_CONSTANT(t): # start with lowercase lett...
true
d9bdae53723efa42cbeeb6400d13e0062f12ff3c
carlosgregoriorodriguez/OpenCV
/2015-2016/vrg/test/otroCodigo/contrast.py
UTF-8
935
2.984375
3
[]
no_license
#include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/imgproc.hpp" #include <iostream> using namespace cv; using namespace std; /** * @function main */ int main( int, char** argv ) { Mat src, dst; const char* source_window = "Source image"; const char* equalized_wi...
true
3a909345bc3e5674cd7eaa6b8e47b5fa36caa863
Lewis-Lu/TravelSalesmanProblem
/src/TestBench/Generate_Data.py
UTF-8
1,664
3.234375
3
[]
no_license
import numpy as np # def Generate_Data_Directed(n): # '''Randomly generate directed data # ''' # res = [] # for i in range(n): # row = np.random.random_sample([n]) # row[i] = 0.0 # res.append(row) # return res # def Generate_Data_Undirected(n): # '''Randomly generate ...
true
b55cf65349abe96dfa12102af9907f0a93dafe54
nikita-chudnovskiy/ProjectPyton
/00 Базовый курс/012 Списки и Операции над ними/03 Задачи.py
UTF-8
831
3.484375
3
[]
no_license
# В списке найти 20 и заменить на 200 a = [1, 2, 20, 20] print(a.index(20)) # Ищет 1 вхождение print(a) a[2] = 200 print(a) # Убрать пробелы spisok1 = ["Привет", "", "sdsd", ""] spisok2 = list(filter(None, spisok1)) print(spisok2) # Возвести в квадрат a = [2, 4, 6, 8] s1 = [i * i for i in a] print(s1) # Убрать 20,9...
true
2b8ca392959920944fa2c2304ea244e09741302e
applepip/machine_learning
/dimensionality_reduction/dim_reduction.py
UTF-8
797
3.421875
3
[]
no_license
''' 主成分分析(PCA) ''' # 主成分分析(Principal Component Analysis)是目前为止最流行的降维算法。首先它找到接 # 近数据集分布的超平面,然后将所有的数据都投影到这个超平面上。 import numpy as np np.random.seed(4) m = 60 w1, w2 = 0.1, 0.3 noise = 0.1 angles = np.random.rand(m) * 3 * np.pi / 2 - 0.5 X = np.empty((m, 3)) X[:, 0] = np.cos(angles) + np.sin(angles)/2 + noise * np.rando...
true
a4d3a330761f006ab12865ae14daa5f5160feb3c
William-Abbot/Sudoku
/Sudoku/functions/generate.py
UTF-8
1,943
2.890625
3
[]
no_license
#!pyhton3 #generate.py #william Abbot import sys, os from . import isValid, printSudokuBoard as psb import random index_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,...
true
e387224bee443afb892a7bf951027135246c7bf1
JHM9191/TIL
/01_python/01_python_basic/example_01.py
UTF-8
999
3.890625
4
[]
no_license
import random # greeting = "안녕하세요." # print(greeting) # print(greeting) # print(greeting) # print(greeting) # print(greeting) # menus = ['순남시래기','양자강','타코벨'] # print(menus) # print(menus[1]) # phone_book = {'순남시래기':'000', '양자강':'111','타코벨':'222'} # print(phone_book) # print(phone_book['타코벨']) # for 반복문으로 여러번 인사할 ...
true
ea10aaa6578dadbed4e36fe3b57e6755ccf2304f
Yusufdexter/validating_with_regex
/validating_phone_no.py
UTF-8
1,484
3.375
3
[]
no_license
import re # SEARCH (validating phone numbers and any entry before or after and returning the first/0ne) def extract_phone(input): phone_regex = re.compile(r"\b\d{3} \d{4}-?\d{4}\b") match = phone_regex.search(input) if match: return match.group() return "Error" # FINDALL (validating phone...
true
f830e4aa209e4769d41ae935b069acf33e25a417
JulianLaiCL/LeetCode
/42.py
UTF-8
1,594
3.671875
4
[]
no_license
class Solution: def trap(self, height): '''Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. height: List[int] return: int ''' if len(height) < 3: ...
true
07e285b5bd51fcb2e04bbf51eb89cc48444df91f
bpsagar/pygraphdb-prototype
/src/pygraphdb/services/worker/type.py
UTF-8
1,122
3.109375
3
[]
no_license
__author__ = 'Sagar' import json class Type(): def __init__(self, type=None, parent_type=None, description=None): super(Type, self).__init__() self._type = type self._parent_type = parent_type self._description = description def get_type(self): return self._t...
true
b2a3a01331a47ec73e8f8a07ed68cb82a95b5ea6
micebitewood/PE
/96t.py
UTF-8
77
2.828125
3
[]
no_license
s = 0 with open('test', 'r') as f: for line in f: s += int(line) print(s)
true
9b65a2859389cbc9651185fa583b0d7972424c86
yuting-li/liewei-agi-code-part2
/28 编解码结构/test_20210420/cnn2seq.py
UTF-8
3,050
2.65625
3
[]
no_license
import torch from torch import nn import os import torch.utils.data as data from data import MyDataset import numpy as np img_path = "data" BATCH_SIZE = 64 EPOCH = 1000 save_path = "params/cnn2seq.pkl" #编码器 class Encoder(nn.Module): def __init__(self): super(Encoder, self).__init__() ...
true
101233d6c75fa1eb528b32b11640507508b67eb7
sbe918273/WOAS_React
/flask-api/db_utils/criteria.py
UTF-8
1,991
2.796875
3
[]
no_license
SCORING = { "Verbal aggression": [ "Patient shouts angrily, curses mildly, or makes personal insults", "Patient curses viciously, is severely insulting, has temper or outbursts", "Patient impulsively threatens violence toward others or self", "Patient threaten...
true
f0932b0acc891e5b053612f3e4854050409fd431
icebowl/python
/menu2.py
UTF-8
411
3.421875
3
[]
no_license
import tkinter as tk root = tk.Tk() #In order to hide main window root.withdraw() tk.Label(root, text="This is the main window").pack() aWindow = tk.Toplevel(root) def change_window(): #remove the other window entirely aWindow.destroy() #make root visible again root.iconify() root.deiconify() ...
true
f014c95bd9b7e1a4676d9fac920eab68d992a32e
pdw624/Smart_Cart
/Socket/Rasp_Android/server.py
UTF-8
1,439
2.671875
3
[]
no_license
import socket import time host = '192.168.0.139' # Symbolic name meaning all available interfaces port = 9999 # Arbitrary non-privileged port server_sock = socket.socket(socket.AF_INET) server_sock.bind((host, port)) server_sock.listen(1) print("waiting") client_sock, addr = server_sock.accept() #client_sock = ser...
true
7f6b197bc71b6299b19495ee01f03adbbefa9595
stak21/DailyCoding
/leetCodeChallenge/595_big_country_sql.py
UTF-8
396
2.9375
3
[]
no_license
# SQL statement to select rows where the countries poplation # is greater than 3m or area is > 3m km SELECT name, population, area FROM World WHERE population > 25000000 OR area > 30000000; # Using Union can be faster when searching multiple columns SELECT name, population, area FROM World WHERE population > 25000000 ...
true
ba713fc8255982467fdf9647f2746a8d5093ddf0
flaviofuria/sHAM
/megaDot/megaDot_pybind11.py
UTF-8
2,758
2.546875
3
[ "Apache-2.0" ]
permissive
import time import numpy as np from termcolor import colored import libexample as megaDot n = 100000 # Provato numero dispari per check sulla parte rimanente del vettore m = 100000 identmatrix = np.identity(n) constvect = np.ones(n) * 2 res_array_ref = np.zeros(n) res_array1 = np.zeros(n) res_array2 = np.zeros(n) res...
true
2b8585f3c63ee57c20cb5f361b72051e0239a7bc
Taoge123/OptimizedLeetcode
/LeetcodeNew/python2/LC_1044_2.py
UTF-8
2,361
3.59375
4
[]
no_license
""" https://leetcode-cn.com/problems/longest-duplicate-substring/solution/zui-chang-zhong-fu-zi-chuan-by-leetcode/ """ import bisect bisect.bisect class SolutionTLE: def longestDupSubstring(self, S): left, right = 0, len(S) res = '' while left < right: mid = (left + right) // 2 ...
true
b2b33dcf657e85b0baadab62c287d9c31f6065b6
newoni/BaekJoon
/python/2439.py
UTF-8
313
3.53125
4
[]
no_license
''' <21.01.23> made by KH problem number 2439 source: https://www.acmicpc.net/problem/2439 ''' line_num = int(input()) # 섞기수열 수 for i in range(line_num): for j in range(line_num-1,-1,-1): if(i>=j): print("*",end='') else: print(" ",end='') print()
true