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
bc4dc26b1df7b95b966a33306ef2bec786d81b0e
diegom626/dmm_pyapps
/py-scripts/week9/ex2_oop.py
UTF-8
1,310
3.1875
3
[]
no_license
#!/usr/bin/env python import re def find_uptime_field(a_pattern, uptime_str): ''' If there is a match return the match group(1) Else return 0 ''' a_check = re.search(a_pattern, uptime_str) if a_check: return int(a_check.group(1)) else: return 0 class Uptime(object): ...
true
23b78d8aabaf3fa6d57af9a2ac517eb07adb7d62
myriad-opensource/samwell
/samwell/sam/clipping.py
UTF-8
17,635
3.21875
3
[ "MIT", "Python-2.0" ]
permissive
""" Utility Functions for Soft-Clipping records in SAM/BAM Files ------------------------------------------------------------ This module contains utility functions for soft-clipping reads. There are four variants that support clipping the beginnings and ends of reads, and specifying the amount to be clipped in terms...
true
cfc60f313e53e0f24e20ce99b9f5f28213357006
futrica/python_4_zombies
/exercicios/exercicio04_joaomarcelo_05.py
UTF-8
930
3.515625
4
[]
no_license
import string texto = """The Python Software Foundation and the global Python community welcome and encourage participation by everyone. Our community is based on mutual respect, tolerance, and encouragement, and we are working to help each other live up to these principles. We want our community to be more diver...
true
a08ffcfafee5427d88ec62dfeb430cc9020deecf
ccie11292/pyneta
/lab4-7.py
UTF-8
530
2.8125
3
[]
no_license
import textfsm from pprint import pprint text_file = "lab4-2_show_int_status.txt" template_file = "lab4-2_show_int_status.tpl" with open(text_file) as f: show_int_status = f.read() with open(template_file) as template: fsm = textfsm.TextFSM(template) result = fsm.ParseText(show_int_status) print(fsm.h...
true
9a5b6d10face7b5ce2efeffa40458d1bbe8b5177
marcjoos-phd/pymisc
/factory/factory.py
UTF-8
3,678
3.4375
3
[]
no_license
#!/usr/bin/env python #=============================================================================== #> \file factory.py ## \brief ## \b Class factory in Python ## \author ## Marc Joos <marc.joos@gmail.com> ## \copyright ## Copyrights 2019, Marc Joos ## This file is distributed under the CeCILL-A & GNU/GPL licenses, ...
true
7503115192ece3c30aa9a47d15e54b639a8776f5
jonathabsilva/ProgISD20202
/Jonatha/Aula 03/Atividade Contextualizada/Questao 02/AtividadeContextualizada.py
UTF-8
15,958
3.140625
3
[]
no_license
from os import system system('clear') resolucao = 128 tipoCelula = 'eucarionte' reagente = 'Tipo 1' interruptorArgonio = False startSystem = False larguraLasers = 7 # 7~10nm digitalOffSet = 0 digitalGain = 0 speedAquisicao = 20 salvarFile = '/Documents' print('Esse programa tem como objetivo receber dados para autom...
true
7772c5f1d44c6e083e2bfdc9a6ae453999f48baf
hunterachieng/python_class
/car.py
UTF-8
403
3.40625
3
[]
no_license
class Car: model = "Toyota" def __init__(self,color,mileage,material): self.color = color self.mileage = mileage self.material = material def new_car(self): return f"I just bought a new {self.model} that has a mileage of {self.mileage} liters/km" def car_material(self): ...
true
5561bc09e7df3dae5e18739c994421c20623cad0
AndreGuerra123/exercises
/exercises/solution.py
UTF-8
7,521
2.890625
3
[]
no_license
import csv, json, tempfile, statistics HEADER = ['experiment_name', 'sample_id','fauxness','category_guess'] CATEGORY = ['real','fake','ambiguous'] FORMATS = ['csv','json','dict'] class FauxDialect(csv.Dialect): # This could be further improved to improve the robustness of Faux files. delimiter = ',' # Required ...
true
d90b8ab73008dfe44f8fdc90b8a2dbee13898d51
hevi9/etc-python
/gtk3/learngtk/recentchooserwidget.py
UTF-8
695
2.703125
3
[]
no_license
#!/usr/bin/env python from gi.repository import Gtk def retrieve_info(button): selection = recentchooser.get_current_item() print("Display name: %s" % selection.get_display_name()) print("File URI: %s" % selection.get_uri()) print("Last application: %s" % selection.last_application()) window = Gtk.Wi...
true
31e2ec66d5f5731d59acd4f2acb0aadc8cd9cb5d
ShubhrikaSehgal/IR_Project
/src-folder/PreProcessData/Processing.py
UTF-8
857
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Nov 16 02:51:32 2020 @author: shubhrika """ #File locations import Classes.Path as Path #Tokenizer from nltk.tokenize import RegexpTokenizer #Stemmer from nltk.stem import SnowballStemmer class Processing: def __init__(self): self.tokenizer = RegexpTokenizer(r'\...
true
35c5f97a82af535f1a0c6a0159fd122fd8cfdade
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/1064.py
UTF-8
448
3.109375
3
[]
no_license
f=open("txt","r") cases=int(f.readline()) i=0 while(1): clock=0 arr1= f.readline().split() C=float(arr1[0]) F=float(arr1[1]) X=float(arr1[2]) incr=2 cks=0 while(1): if(float(X)/incr>((float(C)/incr)+(float(X)/(incr+F)))): clock+=(C/incr) incr+=F else: break final_t...
true
8786b080112a3f7d00056cb4966b987d02122402
eleven1234567/public_git
/api_test_3/public/do_mysql.py
UTF-8
1,361
2.8125
3
[]
no_license
#操作mysql # pymysql 安装: pip install pymysql # mysql 安装:pip install mysql-connector -python import pymysql # from mysql import connector from public import read_path from public.read_conf import ReadConf class DoMysql: #操作数据库的类,专门进行数据库的读取 def do_mysql(self,query,flag=1): ''' :param query: sql查...
true
9cbee056c588b335f7db1cc4ca5e013278b809dc
Laucr/LeetCode_s2
/easy/evaluate_reverse_polish_notation.py
UTF-8
700
3.796875
4
[]
no_license
def evalRPN(tokens): """ :type tokens: List[str] :rtype: int """ stack = [] def calc(op2, op1, operator): if operator == '+': return op1 + op2 if operator == '-': return op1 - op2 if operator == '*': return op1 * op2 if operato...
true
675c91defe39b4ad556524255fb3fc56f9809622
chandan-n-bhat/python-oop
/excercises/3-abstraction-and-encapsulation.py
UTF-8
1,367
4.125
4
[]
no_license
class Car_Rental: def __init__(self): # Why car_type is instance attribute? Cause rent may vary for different Car Rental company. Here Hardcoded for simplicity self.car_type = {"Hatchback":30,"Sedan":50,"SUV":100} def calculate_fare(self,car,days): if car not in self....
true
1f7d547227cac1defb8a63022d4bab4704219e79
Brow71189/extensions
/DoubleGaussianFilter_AM/DoubleGaussianFilter.py
UTF-8
20,731
2.5625
3
[]
no_license
""" Double Gaussian Filter. Implemented as an operation that can be applied to data items. This code is experimental, meaning that it works with the current version but will probably not work "as-is" with future versions of the software. """ # standard libraries import gettext import mat...
true
225a172170dc1d25cc8bde36c52bac980fae1144
AK-1121/code_extraction
/python/python_14179.py
UTF-8
160
2.84375
3
[]
no_license
# Why does Popen.communicate() return b'hi\n' instead of 'hi'? print(subprocess.Popen("echo -n hi", \ shell=True, stdout=subprocess.PIPE).communicate()[0])
true
4efdf220cdd9783281ef9071431ac38b349fb5e3
BaptisteDeslaurier/Generateur-PL
/monPackage/temps.py
ISO-8859-1
1,102
3.609375
4
[]
no_license
''' Created on 12 nov. 2014 @author: Baptiste 'MagiKarpe' Deslaurier, Clment 'cLESE' Sebillet ''' import logging def VerifTps(temps): ''' Vrifie le temps de la playlist que a saisi l'utilisateur l'appel de l'application @param temps : le temps de la playlist que a saisi l'utilisateur l'appel de l'appli...
true
32e79a3f41e5fafe2636190d053b715884d9bfa2
Aasthaengg/IBMdataset
/Python_codes/p02952/s393705023.py
UTF-8
191
3.1875
3
[]
no_license
a=int(input()) if a<10: print(a) if 10<=a<100: print(9) if 100<=a<1000: print(9+a-99) if 1000<=a<10000: print(909) if 10000<=a<100000: print(909+a-9999) if a==100000: print(90909)
true
bd544027cb51b0418233dea4ef0bab721122119e
japablaza/python
/2020/pws/ppfl.py
UTF-8
664
3.640625
4
[]
no_license
#!/usr/bin/env python3 ''' for-loop''' for a in range(10): print(a) texto = 'Vamos a la playa, oh oh oh!!' for txt in texto: if txt == ' ': print('!!') continue print(txt) for w in range(1, 10, 3): print(w) n = 'loro' for e in range(4): for e in n: print(e) print('Nex...
true
503c87b127429a85c5067ecda264013490a3d4ef
david8z/alg-practicas
/utils/test_all.py
UTF-8
681
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- import re import os from multiprocessing import Process from multiprocessing import Pool import sys sys.path.append('../') def execute( tarea, distance): os.system( "python3 ../%s/leer_resultados.py %s -nv" % (tarea, distance)) if __name__ == "__main__": """ Encargado de ha...
true
330c7726b90ef069dba7ad3d85341027755a0e18
HJ23/Algorithms-for-interview-
/RadixSort/sort.py
UTF-8
697
3.265625
3
[]
no_license
from count import counting_sort def radix(arr=[12,34,657,12,0,1,2,444]): maxi=len(str(max(arr,key=lambda x:len(str(x))))) for x in range(maxi): tmp=[] keys={0:[]} for element in arr: if(len(str(element))-1<x): keys[0].append(element) tmp.append(0) elif(...
true
ba45bd2eb52b7370044193165e96889d47b36a21
ozkansen/go_python_struct
/MixedStruct.py
UTF-8
888
2.703125
3
[]
no_license
from ctypes import c_int, CDLL, Structure, c_void_p, c_double, c_long, POINTER import numpy as np from numpy.ctypeslib import ndpointer GO = CDLL("MixedStruct.so") # Create an object to capture the struct class MixedStruct(Structure): _fields_ = [("length", c_int), ("data", c_long)] # Define the arg and return ...
true
08dd413e4eab54402abb04e890ab9fe99dcb18b3
ctensmeyer/formCluster
/preprocessing/image/median_driver.py
UTF-8
397
2.71875
3
[]
no_license
import Image import imageutils import sys def main(input_image, output_image): print input_image im = Image.open(input_image) im = imageutils.median_filter(im, 15, 3) im.save(output_image) print 'done' if __name__ == "__main__": if len(sys.argv) < 3: print "[input_image output_image]" exit() input_image...
true
23c94bb9bfb959331ece07328458f3ef41021bb2
kolusask/emmaa
/emmaa/tests/test_gene_list_prior.py
UTF-8
463
2.515625
3
[ "BSD-2-Clause" ]
permissive
from emmaa.priors import SearchTerm from emmaa.priors.gene_list_prior import GeneListPrior def test_get_search_terms(): gp = GeneListPrior(['BRAF'], 'braf', 'BRAF model') assert gp.name == 'braf' assert gp.human_readable_name == 'BRAF model' st = gp.make_search_terms() assert st assert all([is...
true
9aec621c772fb220b31432e7d8b7af9250d311cc
lordtang/spider
/get_ip.py
UTF-8
1,164
3.125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 11 23:25:50 2019 @author: T """ import requests import re import csv import random def get_ip(): url = "https://www.xicidaili.com" headers = { "Accept-Encoding":"gzip", "User-Agent":"Mozilla5.0/" } proxies = {"http":"121.233.206.44:99...
true
e1048d3958bfff5153b37e1abb1a8696d98abd81
ajayyadavay/STEADY_INFILTRATION_MODEL
/Steady_Infiltration_Model.py
UTF-8
3,191
2.90625
3
[]
no_license
from numpy import * import matplotlib.pyplot as plotting global characteristics global number_of_data, answer f = open("INPUT.txt", "r") print("\t\tSTEADY INFILTRATION MODEL (SIM) \n") for line in f: characteristics = line.split(',') number_of_data = len(characteristics) print("Total number of data = ", ...
true
575cd06d9571253845dc158d7263c93c6b6fba68
mtwlg/exploitsearch
/exploitsearch.py
UTF-8
5,436
2.640625
3
[ "Apache-2.0" ]
permissive
import re import ast import time import urllib import requests import argparse import webbrowser import bs4 as bs from rich.table import Table from bs4 import BeautifulSoup from urllib.parse import quote from urllib.parse import unquote from rich.console import Console text_list = [] url = 'https://www.pwnwiki.org/i...
true
eb83a8ed7bd6b55b9b3a8738ad73166ea2fc8333
underbais/CSHL_python2017
/python6_problemset/1.py
UTF-8
294
3.25
3
[]
no_license
#!/usr/bin/env python3 import re with open("Python_06_nobody.txt", "r") as nobody: for line_num,line in enumerate(nobody): line = line.rstrip() for match in re.finditer(r"Nobody", line): print("Number of matching line:",line_num+1,match,'Start:',match.start(), 'End',match.end())
true
ef633f74a9b32efa45d6b86d84e99353f8cd2e9f
benrobinson88/CitiBike-Usage-Analysis
/citibikeTest.py
UTF-8
821
2.65625
3
[]
no_license
#Packages import pandas as pd import urllib2 import simplejson as json from collections import defaultdict import subprocess from datetime import datetime #Point to the data url = 'https://gbfs.citibikenyc.com/gbfs/en/station_status.json' page = urllib2.urlopen(url) content = page.read() result = json....
true
6ebe066f288e1f12b91f7b13cc53c2fcbe4232e2
rabernat/parcels
/parcels/kernels/diffusion.py
UTF-8
1,824
2.84375
3
[ "MIT" ]
permissive
"""Collection of pre-built diffusion kernels""" from parcels import rng as random import math __all__ = ['BrownianMotion2D', 'SpatiallyVaryingBrownianMotion2D'] def BrownianMotion2D(particle, fieldset, time, dt): """Kernel for simple Brownian particle diffusion in zonal and meridional direction. Assumes tha...
true
c29aba69970bab1702a8b421c1304f600df2a2e3
yogeshmj/mne-torch
/common.py
UTF-8
5,717
2.84375
3
[]
no_license
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Jean-Rémi KING <jeanremi.king@gmail.com> # # License: BSD Style. import copy import numpy as np from tqdm import tqdm import torch import torch.nn.functional as F from torch.utils.data import Dataset from torch.utils.data.dataset import ConcatDa...
true
edd07a37da565e8be529920584a1c2ea87b4806e
chorna-popka/wortkarte
/google_t.py
UTF-8
817
2.75
3
[]
no_license
import six import os from google.cloud import translate_v2 as translate basedir = os.path.abspath(os.path.dirname(__file__)) json_file = os.path.join(basedir, 'static/files/Word-cards-c28ca42966b3.json') def translate_text(target, text): """Translates text into the target language. Target must be an ISO 639...
true
d0c66b2da346c5b7baafa55b740215b3521a8171
LaurenceGA/programmingProjects
/python/UoA/215/AS2/CrackManyTimePad.py
UTF-8
2,518
2.515625
3
[]
no_license
#!/usr/bin/env python from sys import stdout __author__ = 'Laurence Armstrong' authorship_string = "{} created on {} by {} ({})\n{}\n".format( "CrackManyTimePad.py", "7/03/16", __author__, 15062061, "-----" * 15) \ if __name__ == '__main__' else "" stdout.write(authorship_string) encrypted_text = """\ 140...
true
f7738fb2fbfcb990e77dc3078e0418f8e5a547c8
Jonnty/vbf
/vbf.py
UTF-8
1,351
3.015625
3
[]
no_license
#! /usr/bin/python # vbf.py - a tape-based visual brainfuck interpreter import sys, time from tape import Tape, Tapes, TapeError f = open(sys.argv[1]) program = [c for c in f.read() if c in "<>,.-+[]"] f.close() prog_tape = Tape(program, right_infinite=False) data_tape = Tape([0], 3) tapes = Tapes((prog_tape, data...
true
668c2b4462ee2ac293e3d9c85278ede3f5180437
ChrisMattSam/sql_meets_python
/db_connection_test.py
UTF-8
988
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jul 3 09:17:19 2020 @author: Christopher Sampah The goal is to open and close a connection to the database to test whether the machine is connected to the lia VPN. """ from time import time t1 = time() from misc_fxns import set_local_variables import update_dependency_track...
true
fdd7dcce48860fd5a809609903e4097296e116ab
KrystianKierklo/-Data-visualization---exercise-codes
/LAB_03/Code_3/main.py
UTF-8
2,903
3.765625
4
[]
no_license
#zamiast uzupełniać elementy w pętli lista = [] for element in zakres: if warunek_na_elemencie: lista.append("coś sie dzieje z" element) lista2 = ["coś się dzieje z" element for element in zakres if warunek_na_element] lista_a = [] for x in range(10): lista_a.append(x**2) print(lista_a) a = [x**2 ...
true
8f6290b7343d76182b0c621147b369c359be32db
poojithayadavalli/codekata
/nthelement.py
UTF-8
94
3.03125
3
[]
no_license
n=input().split() k=int(n[1]) for i in range(k-1,len(n[0])-k+2,k-1): print(n[0][i],end=" ")
true
73202000e6e93f7ff98a8a5c4114ea68070ef3b3
shtsai/CS6513
/assignment2/task7.py
UTF-8
990
3.0625
3
[]
no_license
import sys from pyspark import SparkContext from csv import reader def createMapping(x): # mapping: (violation code, (weekendCount, weekCount)) date = x[1] day = date.split("-")[2] if day in ["05", "06", "12", "13", "19", "20", "26", "27"]: return (x[2], (1, 0)) else: return (x[2], ...
true
e45645c326c0e765b0682da559c3b362f8339694
zsl1105/work
/myjob/python_test.py
UTF-8
441
3
3
[]
no_license
""" python 典型例题,经典集锦!!!! """ """ 1,写一个单例模式:单例模式是一种常见的软件设计模式,该模式主要目的确保该类中只有一个实例存在 """ # 装饰器方法实现 def singleton(cls): _instance = {} def _singleton(*args, **kwargs): if cls not in _instance: _instance[cls] = cls(*args, **kwargs) return _instance[cls] return _singleton
true
6b3fb584583756537609dcff63820a0f0e81f1bb
melaniesifen/Elements-of-Software-Design
/sorting/cycle sort.py
UTF-8
767
3.484375
3
[]
no_license
def cycleSort(a): writes = 0 for i in range(len(a) - 1): item = a[i] pos = i num_changes = 0 for j in range(i + 1, len(a)): if a[j] < item: pos += 1 if pos == i: continue while item == a[pos]: pos += 1 ...
true
f5c8d3568dc714f4464c38f3b758b2d95833f336
Aasthaengg/IBMdataset
/Python_codes/p02784/s817123235.py
UTF-8
151
2.515625
3
[]
no_license
H, N = list(map(lambda x: int(x), input().split(" "))) A = list(map(lambda y: int(y), input().split(" "))) print("Yes") if H <= sum(A) else print("No")
true
f7e5319e610c21d54182123624040992bf1be51d
CodevEnsenada/actividades
/alumnos/Alexis Fabela/Ejercicio03/Actividad-3/Actividad-3.py
UTF-8
322
4.25
4
[]
no_license
print("Actividad 3") print("Saber si el numero es par o impar"'\n') print("Por favor ingresa tu numero"'\n') Value1 = int( input("Ingresa tu numero" '\n')) %2 # usar modulo, si resulta cero es par y si resulta uno es non if (Value1 == 0): print("El numero es par") elif (Value1 == 1): print("El numero es impar"...
true
2224c1efd1266de06e60043a012cb8e0dfa89946
sebastianrmirz/clippy
/clippy.py
UTF-8
1,248
3.953125
4
[]
no_license
# clippy finds all words that can be formed without rearranging the alphabet import sys def find_words(dictionary): alphabet = 'abcdefghijklmnopqrstuvwxyz' words = [] for i in range(len(alphabet)): for candidate in words_around(i, alphabet): if candidate in dictionary: ...
true
f96d9679300b46d86d75483e840470785cc82a1d
andrew-curthoys/wheres-my-store
/src/db_functions.py
UTF-8
2,853
3.1875
3
[ "MIT" ]
permissive
import psycopg2 from psycopg2 import extras from config import config def pg_select(query_string : str) -> tuple: """ Parameters ---------- query_string : str The SELECT query to run on the database Returns ------- query_response : tuple A tuple of tuples with each inner t...
true
f1ce11dc49972984ac8b81064891adba5f6ac6e3
Kryostatic94/Contact-List
/init.py
UTF-8
3,415
3.46875
3
[]
no_license
import persona import rubrica import errori import csv def menu(): print("1) Aggiungi un contatto.") print("2) Modifica un contatto.") print("3) Rimuovi un contatto.") print("4) Cerca un contatto.") print("5) Stampa elenco contatti.") print("6) Esci.") print("Benvenuto nella tua...
true
8391129e4ae5b6136e69a701a42b071a945d26b6
ptracton/experimental
/python3/RaspberryPi/main.py
UTF-8
4,448
2.734375
3
[]
no_license
#! /usr/bin/env python3 """ File: main.py Author: Phil Tracton This is a test program to demonstrate a bottle web server running in conjunction with threads for both SMS and Twitter """ # # Imports go here # import os import socket import threading import time import queue import bottle import mako import mako.templa...
true
7dff584331e9bb632146feabfc4d8f5a51a256f9
ljj7975/composable-model-exp
/utils/util.py
UTF-8
3,251
2.71875
3
[]
no_license
import errno import hashlib import os from tqdm import tqdm from utils import color_print as cp def is_audio_file(file_name): return file_name.split('.')[-1] == "wav" def get_instance(module, name, config, *args): return getattr(module, config[name]['type'])(*args, **config[name]['args']) def makedir_exist_o...
true
40fa985eddeaf5e0979dc5494008d0ef778c9e47
danielzhang1998/xiaojiayu_lesson_coding
/python/lessons_coding/lesson69_tk_v1.py
UTF-8
556
3.265625
3
[]
no_license
from tkinter import * master = Tk() theLB = Listbox(master, selectmode = MULTIPLE) # 多选 theLB.pack(padx = 10, pady = 10) animals = ['pig','tiger','elephant','dog','cat','snake','cow','lion','bird','dragon', 'ant', 'etc.'] for each in range(len(animals)): theLB.insert(each, animals[each]) #theLB.delete(0, END) ...
true
02ce14ff4b5d2cf8f77337a51703a83b3dafaece
raydive/sandbox
/fizzbuzz.py
UTF-8
388
3.625
4
[]
no_license
#!/usr/bin/env python # encoding: utf-8 import sys def FizzBuzz(number=100): for x, x3, x5 in ((i , i%3, i%5) for i in range(1, number)): if x3 == 0 and x5 == 0: print('FizzBuzz') elif x3 == 0: print('Fizz') elif x5 == 0: print('Buzz') else: print(x) if __name__ == '__main__': number = 100 if...
true
9223b0bd1bb504ad176f6e001d28112462a7a861
lynchlynch/health_care
/example_2.py
UTF-8
592
3
3
[]
no_license
# 逻辑回归实现之前的乳腺癌数据集分类预测 from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression cancer = datasets.load_breast_cancer() cancer_X = cancer.data print(cancer_X.shape) cancer_y = cancer.target print(cancer_y.shape) X_train, X_test, y_train, y_test...
true
b5b0f6b4b3e6467a76b648e8cc5d164686bdc479
kili-technology/active-learning
/experiments/siim-isic-melanoma-classification/data_processing.py
UTF-8
2,850
2.65625
3
[ "Apache-2.0" ]
permissive
import os import pandas as pd import albumentations from sklearn import model_selection from wtfml.data_loaders.image.classification import ClassificationDataset from al.helpers.constants import DATA_ROOT from al.dataset.active_dataset import ActiveDataset DATA_PATH = os.getenv('TO_DATA_PATH') def get_train_val_da...
true
cbb303e132110200d9c90eadb53157b566e8634f
UdaikaranSingh/zillow_analysis
/ZillowUnivariate/univ_stats.py
UTF-8
4,047
2.78125
3
[]
no_license
#!/usr/bin/env python import pandas as pd import sys import os class SingleTableReader(object): def __init__(self, db, table, basepath='./'): self.db = db self.table = table self.layout = os.path.join(basepath, 'Layout.xlsx') self.basepath = basepath self._get_schema(...
true
b9131f448c27e69c94ef8c2510e916ca40015ebe
Bytamine/ff-olymp
/06 while/5.py
UTF-8
121
3.484375
3
[]
no_license
#!/usr/bin/env python3 x = float(input()) y = float(input()) day = 1 while x < y: x *= 1.1 day += 1 print(day)
true
7b70e3a0df0032626f3a92d1f87ba618d4103bb4
jacky567/logic-circuit
/circuit.py
UTF-8
7,778
3.046875
3
[]
no_license
import kivy from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.lang.builder import Builder from kivy.properties import NumericProperty, StringProperty, ReferenceListProperty from kivy.graphics import Rectangle, Color import boolean Builder.load_file('gates.kv') ...
true
7052af00361a176e0316427a14aeb01df0c195ac
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_63/22.py
UTF-8
328
2.984375
3
[]
no_license
#!/bin/python import sys import math inf = sys.stdin T = int(inf.readline()) for t in range(T): L, P, C = map(int, inf.readline().split()) choices = [] while L < P: L *= C choices.append(L) y = math.ceil(math.log(len(choices), 2)) print 'Case #%d: %d' % (t...
true
efaef103ce7688f4f841f2a39b893f2813b5e7f5
hobson/ggpy
/ggpy/cruft/autocode/StandaloneDeORer.py
UTF-8
2,356
2.65625
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ generated source for module StandaloneDeORer """ # package: org.ggp.base.util.gdl.transforms.standalone import java.io.BufferedWriter import java.io.File import java.io.FileWriter import java.io.IOException import java.util.List import org.ggp.base.util.files.FileUtils import org.ggp.bas...
true
d79dc13d0a194f779355e7db9df32765328698bb
suhang319/exercise
/第5天/多重继承.py
UTF-8
647
3.40625
3
[]
no_license
#_*_ coding:utf-8 _*_ #@Time :2020-12-2016:46 #@Author :lemon_suhang #@Email :1147967632@qq.com #@File :多重继承.py #@Software:PyCharm class Master(): def __init__(self): self.kongfu='[五香煎饼果子]' def make_cake(self): print(f"运用{self.kong}制作") class School(): def __init__(self): ...
true
114b328a7e26371e64d6ee9b88477e2e751ed74f
menghaoshen/python
/15.正则表达式/09.字母的特殊含义.py
UTF-8
746
3.9375
4
[]
no_license
# 字母表示它本身,很多字母前面加\会有特殊含义 # \n 表示换行 # \t 表示制表符 # \s 空白字符 # \S 非空白字符 import re # \d 表示数字,等价于[0-9],默认匹配一个数字,需要加个+ 匹配多个数字 print(re.search(r'x\d+p','x234p')) # ^ 除了表示指定的内容以外,在[]里面可以表示取反 # \D 表示非数字,等价于[^0-9] print(re.search(r'\D+','hell0')) print(re.search(r'[^0-9]+','hell0')) # \w 表示数字,字母以及_ 等价于[0-9a-zA-Z],一次或多次,非标点符号,中...
true
e182a6b34234f5bd8f1aa3113bb061f9c09821db
exgs/hongikuniv_chemical-engineering
/화공전산(2-2)/chapter7.상미분 방정식/연습문제/p7.11.py
UTF-8
854
2.921875
3
[]
no_license
from math import cos, sin, sqrt from scipy.integrate import solve_ivp import numpy as np def f(t, z, tau, k): [CA1, CB1, CA2, CB2] = z k0 = (CA0 - CA1)/tau - k*CA1 k1 = -CB1/tau + k*CA1 k2 = (CA1-CA2)/tau - k*CA2 k3 = (CB1-CB2)/tau + k*CA2 return k0,k1,k2,k3 tau = 5 k = 0.25 h = 1 t0, te = 0, 40 CA0 = 20 c1 = [...
true
95b630a9a40c5d66848542cf7ab42a038db38b80
weezybusy/Cracking-the-Coding-Interview
/Problems/1/rotate_matrix/test_rotate_matrix.py
UTF-8
2,784
3.375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import unittest from rotate_matrix import rotate_matrix, rotate_matrix_in_place class TestRotateMatrix(unittest.TestCase): def test_rotate_matrix(self): # Positive tests. original_matrix = [ [1, 2, 3, 4], [5, 6, 7, 8], [9,...
true
29f0d2f86360803083cb6bcf3c8c5e62b6b75e02
hduyuanfu/SHUQI_SHIYAN
/GUI/base_easy.py
UTF-8
2,493
2.78125
3
[]
no_license
from tkinter import * '''我试试同步功能''' master = Tk() master.geometry('700x600') #lable标签组件 l_show = Label(master, text='三酷猫:') #photo = PhotoImage(file = 'C:\Users\袁富\Pictures\Saved Pictures\vscode背景图.jpg') #l_show1 = Label(master, image = photo) l_show.pack(side='left') #l_show1.pack(side = 'left') #entry单行文本组件 e_show = ...
true
57487bd456691623780eba0e2cf10437c85740e3
yutake27/Atcoder
/abc/abc181/e.py
UTF-8
915
2.953125
3
[]
no_license
import bisect n, m = map(int, input().split()) h_list = sorted(list(map(int, input().split()))) w_list = sorted(list(map(int, input().split()))) diff_list = [0] * n diffl_sum_list = [0] * (n // 2 + 1) diffr_sum_list = [0] * (n // 2 + 1) for i in range(1, n): diff_list[i] = h_list[i] - h_list[i - 1] if i % 2:...
true
f9f8fd06687c220a4aa9cfebd536ffb4318a7989
duggalr2/linkedin_recommend
/link_rec/link_new/linkedin_file.py
UTF-8
6,296
2.734375
3
[]
no_license
from linkedinRecommender import duplicate from linkedin_parser import Linkedin import pickle, random from timeit import default_timer as timer from file_handler import FileProcessor ############################################################## # Handling all file stuff for LinkedIn Script ########################...
true
2e3082b8940002aa4b8245fbc235970b55c0e829
niujie/DeepLearning_TensorFlow
/Chap4/chap4-1.py
UTF-8
639
3.75
4
[]
no_license
# TensorFlow basics import tensorflow as tf # 4.1.1 Data type a = 1.2 aa = tf.constant(1.2) # scalar print(type(a), type(aa), tf.is_tensor(aa)) x = tf.constant([1, 2., 3.3]) print(x) print(x.numpy()) a = tf.constant([1.2]) print(a, a.shape) a = tf.constant([1, 2, 3.]) print(a, a.shape) a = tf.constant([[1, 2], [3...
true
eac844f3b5649cf4984bc7876138ab4d7e92fa3f
mayhewsw/projects
/pending/RummikubSolver/rummikub.py
UTF-8
5,181
3.671875
4
[]
no_license
# This is a Rummikub solver # Stephen Mayhew # December 2012 import random # This will need a set of tiles (I don't know what the numbers are). # 104 tiles, 2 joker tiles # 1 through 13 # Four colors: black, yellow, blue, red. # there is a "table" which contains all # the "runs" (stored as lists of tiles) # as well ...
true
72abef37bd4ca570ce8bf8b583ef1a51a2a732c6
nroldanf/infiniteremixer
/infiniteremixer/remix/beat.py
UTF-8
1,324
3.3125
3
[ "MIT" ]
permissive
import os from dataclasses import dataclass @dataclass class Beat: """This class represents the beat of a track.""" file_path: str track: str number: int @classmethod def from_file_path(cls, file_path): track = Beat._get_track_from_file_path(file_path) beat_number = Beat._get...
true
490cdabb202a28e32a507a9c5e1494e1adca9129
andy2332/Python_Study
/a_Python基础_预习/02_列表/names.py
UTF-8
237
3.46875
3
[]
no_license
# 作者:蔡不菜 # 时间:2020/10/14 21:35 # 定义一个存储名字的列表names names = ['张三', '李四', '王五', '赵六'] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print("你好" + names[0] + '!')
true
a8246469067cbcdfa14ef756ea7405fb4ef18f29
deepdatanalytics/ASSIGNMENTS
/01_Assigments/Assig(Front-Back).py
UTF-8
413
3.84375
4
[]
no_license
# word = input("write a word : ") # def front_back(word): # word2 = list(word) # uzunluk = len(word2) # i = word2[0] # word2[0] = word2[uzunluk-1] # word2[uzunluk-1] = i # cikti = "".join(word2) # return cikti # print(front_back(word)) def missing_char(word, n): word2 = list(word) ...
true
847b645241c3074ce9af4c9eb7cbcccd58a071e5
CloudsWeight/video2password
/video2password.py
UTF-8
3,297
3.1875
3
[ "Unlicense" ]
permissive
''' Video 2 Password Desscription: Program takes a video, converts it to .mp3. Then translates the speech in the .mp3 to a text list, currently. More plans in the future. This is a working version that will need an [ apikey = ] and a [ url = ] to access resources. Acceptable Video Formats: ...
true
eec4a5fdbf090a7fbe83a50532ef8a402499b88f
RazZziel/PantalanApp
/UDOO/net.py
UTF-8
924
2.515625
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 import BaseHTTPServer class WebHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): sensors = self.sensors.read() #sensors = [1000, 1000, 1000] self.send_response(200) self.send_header("Content-type", "application/json") se...
true
e7ad78ffdf77aec6ce59506e877599b722e76935
HoverHell/lw-survey-analysis
/blogs_and_media_html.py
UTF-8
6,082
3
3
[]
no_license
import json import statistics import numpy as np import libsurveyanalysis import argparse parser = argparse.ArgumentParser() parser.add_argument("clusters", help="The json file containing the cluster information.") parser.add_argument("structure", help="The file containing the ...
true
62bbeea9f9dfc5ce95239837d2cbdd327d3107cd
seokWonYoon/ezenTensor_1
/numpy/matplot3.py
UTF-8
387
2.921875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt mu, sigma = 0.5, 0.1 # mu 평균 / sigma 표준편차 s = np.random.normal(mu, sigma, 1000) count, bins, ignored = plt.hist(s, 20, normed=True) plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) * np.exp(- (bins - mu) ** 2 / (2...
true
b6e8fa1fd312de79b35b61dba4c084ca4e37ae2e
caizixian/sicp
/6B Sieve of Eratosthenes.py
UTF-8
222
3.5
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 def sieve(generator): a = next(generator) yield a yield from sieve(filter(lambda x: (x%a) != 0,generator)) def primes(n): return sieve(iter(range(2, n))) print(list(primes(1000)))
true
fe487d4fdfcadeddc0c94ae951352aa6422a9b45
kobot30/begginer_mnist_pytorch
/mnist_data_sample/2d_mnist.py
UTF-8
2,245
2.6875
3
[]
no_license
import cv2 from torch.utils.data import DataLoader from torchvision.datasets import MNIST, EMNIST, FashionMNIST, KMNIST, QMNIST from torchvision import transforms transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(mean=(0.5,), std=(0.5,)) ]) # MNIST dataset_train = MNIST('data/', tra...
true
b58960f7ad3ad5f5339e8ceb7d20d05a2904574d
lisa906673062/webauto-1
/taobao.py
UTF-8
2,068
2.6875
3
[]
no_license
from selenium import webdriver import time driver = webdriver.Chrome() url = "http://www.taobao.com" #进入淘宝,搜索鞋 driver.get(url=url) time.sleep(2) driver.find_element_by_xpath("//*[@id='q']").send_keys("鞋") driver.find_element_by_xpath("//*[@id='q']").submit() #回车 #time.sleep(2) #绝对路径 #driver.find_element_by_xpat...
true
55c7c558d050853aa105ff8c0da8696d74c834a0
teoria/Marketing-Calculadora
/calculadoras/cost_hiring.py
UTF-8
1,047
3
3
[]
no_license
import streamlit as st import numpy as np def cost_hiring_page(): st.header('Calculadora de custo por contratação') cc_ad = st.number_input('Custo com Propaganda', value=0, key='cc_ad') cc_er = st.number_input('Custos de indicação do funcionário', value=0, key='cc_er') cc_af = st.number_input('Custo co...
true
470b34d15e8859b9aafb77eb0515dd96e52637de
erlingpaulsen/bigdata
/plot_vars.py
UTF-8
16,800
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Nov 19 12:21:49 2016 @author: ERLING """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d import proj3d def plotAll(df, mru=0): if mru==1: for col in df.columns: ...
true
dfd506f992ed907555e7297cf3bddd35c9864771
shramikgawde/pythonExercise
/13.py
UTF-8
52
2.6875
3
[]
no_license
my_range=range(1,21) print(list(map(str,my_range)))
true
9fd11eea452873b395b493a1ba4e4bbb3c9a9bd2
bameeman/areRPI_SimCV
/testinput/testinput.py
UTF-8
190
2.609375
3
[]
no_license
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(23,GPIO.OUT) GPIO.setup(24,GPIO.IN) while 1: a = GPIO.input(24) if (a == 0): GPIO.output(23,1) else: GPIO.output(23,0)
true
f5861375f5647f06fa0c9255b62aa9a36142c81f
Nikxs2603/python-practice
/rotatingfhexamples.py
UTF-8
869
2.984375
3
[]
no_license
import logging from logging.handlers import RotatingFileHandler logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) #roll over 1kb, and keep backup log app.log1, app.log2 etc handler = RotatingFileHandler('app.log', maxBytes=1000, backupCount=2) logger.addHandler(handler) for _ in range(10): ...
true
372b2cffdd036611f169bb332dc21d3162b3831a
zhaoxinlu/SemAnalysis
/data_process/data_processing.py
UTF-8
8,139
2.625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ 数据处理相关操作 """ import os import pandas as pd import jieba import re import numpy as np import pickle from collections import Counter import itertools from torch.utils import data from sklearn.model_selection import train_test_split #DATA_PATH = os.path.join(os.path.dirname(...
true
a2d6ef4c51eb001aba8181a971e516f2546df026
ewhuang/parecat_bcb16
/his/get_time_series_statistics.py
UTF-8
12,733
3.359375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- ### Author: Edward Huang from discontinued_herbs import * import math ### This script provides functions for retrieving basic statistics on the time ### series data. Writes out disease complications, side effects, treatments, and ### good symptoms. # Input is list...
true
83e6614e13219e367a1bc6f7c65f92a2d8e690a2
royopa/grau_project_Repo
/grau_datas/grau_datas.py
UTF-8
11,423
2.90625
3
[]
no_license
import datetime from datetime import datetime, date, timedelta from dateutil.relativedelta import relativedelta import pandas as pd import calendar from dateutil import parser ''' Criar funcao para fechar o programa caso seja fds ou feriado. ''' feriados_ambima = '/usr/lib/python2.7/dist-packages/grau_project/grau_da...
true
430c739f14a3d87e11784a59cb8a0ad21ab0c6aa
Krishnaarunangsu/XpressoDataVersioning
/xpresso/ai/core/data/structured_dataset.py
UTF-8
6,477
2.953125
3
[]
no_license
""" Class design for Dataset""" import pickle import pandas as pd from xpresso.ai.core.data.dataset import AbstractDataset from xpresso.ai.core.data.dataset_explorer import Explorer from xpresso.ai.core.data.dataset_type import DatasetType #from xpresso.ai.core.logging.xpr_log import XprLogger import csvdiff __all__...
true
5d72e543e35e4d63f130bc998ccc27636e381e8e
Andreyglass1989/Swift_Avia_Group
/advanced/NLTK/nltk_first_steps.py
UTF-8
476
3.390625
3
[]
no_license
import nltk from nltk.book import * text1.concordance("monstrous") from nltk import word_tokenize text_hello="Привет мир. Я люблю программирование, и не только. Замечательный мир, он яркий и красивый." ''' >>> type(text_hello) <type 'str'> ''' text_hello=text_hello.decode('utf8') tokens = word_tokenize(tex...
true
94b9239c7f7461b47c820d22a4ccb669cfb17193
k7krishnar/edabit
/flip_boolean.py
UTF-8
394
3.3125
3
[]
no_license
def reverse(arg): if isinstance(arg, bool): if arg == True: print ( "False" ) return False else: print("True") return True print("boolean expected") return "boolean expected" reverse(False) reverse(0) reverse({}) # best solution def reverse(...
true
0049b0110e236b0b55168d39451b03da877dc060
KendallWeihe/Artificial-Intelligence
/prog2/collect_data/rename_files.py
UTF-8
841
2.765625
3
[]
no_license
import pdb import os import subprocess path = os.getcwd() filenames = os.listdir("mixed_puzzles/") for i in range(len(filenames)): filenames[i] = "mixed_puzzles/" + filenames[i] # print filenames # try: i = 1 for filename in filenames: new_filename = filename # pdb.set_trace() try: file_nu...
true
a4af8019b0a68ee410e449b43a9c4d1ef40745e1
cnjocelyn/Copy-From-Mac
/W16/SI601/Week2/Examples/regex_tutorial.py
UTF-8
1,064
3.421875
3
[]
no_license
########################################## #### Regular Expression Tutorial ######### ########################################## import re # Open the file (make sure its in the same directory as this file) f = open('mbox-short.txt') print f.read() # Loop through each line of the file and count the lines count...
true
95417fc97967a35008f12fbff72e99dd9cf6158f
alexfjclements/fractal_scripts
/fractal/basics
UTF-8
854
3.953125
4
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python '''The fractal code started as part of a tutorial on Python. This script gives a few basic Python examples before jumping into interesting fractals.''' # The first line above declares this file as an executable python script import sys # Import a module so that stuff like sys.argv works from ge...
true
380d15e3bfd023593fa32103174d9bead6263bd7
giselleramlal/Smart-Glasses
/finalThresholdMethod.py
UTF-8
6,637
3.0625
3
[]
no_license
## Press ESC button to get next image import cv2 import cv2 as cv import numpy as np frame = cv2.imread('test_folder/image6.jpeg') # frame = cv2.imread('extra/c2.png') ## keeping a copy of original print(frame.shape) original_frame = frame.copy() original_frame2 = frame.copy() ## Show the original image winName = ...
true
28f797b1c6efa4d08401d089b43df70258f31ebc
AnastasiyaFeofanova/StepicPythonSeleniumAutomation
/test_mark_parametrizeTask2.py
UTF-8
1,808
2.65625
3
[]
no_license
import pytest from selenium import webdriver import time import math from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC final='' @pytest.fixture(scope="session") def browser(): print("\nstart browser f...
true
ebc76767658b636255aa3dc5ab64b8c6034a00bb
deepakpatell/python-programs
/New folder/explore.py
UTF-8
154
3.171875
3
[]
no_license
a=[1,2,3,3] def fun(a): for i in range(0,len(a)-1): if a[i]==3 and a[i+1]==3: return True else : return False
true
e3ee5be362ee9549225b3543278119bbc97b787f
hestad/advent-of-code
/2018/day23/day23.py
UTF-8
922
3.3125
3
[]
no_license
from dataclasses import dataclass from typing import List @dataclass class Bot: x: int y: int z: int range: int def read_input() -> List[Bot]: result = [] with open('day23.txt') as f: for line in f: s = line.split('>, r=') left = s[0].strip("pos=<") ...
true
229ec8e25a7c687f69d09434c2c30e97bef51eac
TianyaoHua/LeetCodeSolutions
/License Key Formatting.py
UTF-8
412
2.703125
3
[]
no_license
class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ S = S.replace('-','') i = len(S)-K answer = '' while i > 0: answer = S[i:i+K]+'-'+answer i -= K answer =...
true
3f6960b604e9ae92b882adccbd18eb14e39080f1
ethen8181/programming
/data_pipeline/celery/tasks.py
UTF-8
392
2.53125
3
[]
no_license
from pandas_datareader import DataReader from celeryapp import app @app.task def get_stock_info(stock, start, end, source = 'yahoo'): stock_col = 'Stock' df = DataReader(stock, source, start, end) df[stock_col] = stock agg = df.groupby(stock_col).agg(['min', 'max', 'mean', 'median']) agg.columns =...
true
5ab3933c87b2fb5eefe7b5bc6efe88f54ae813a3
weber81/DailyProgrammerSolutions
/bridges.py
UTF-8
11,894
3.296875
3
[]
no_license
import re class Island(): def __init__(self, location, value): self.location = location self.value = value self.west = self.east = self.south = self.north = None self.connections = [self.west, self.north, self.east, self.south] self.bridges = [] self.eastB = [] ...
true
70f5e335b0f95fa5c4cf72d4e7b8529f9b9cae03
tnankie/project-sturm_drang
/archive/LSTM_classes_functions.py
UTF-8
12,001
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Nov 7 12:03:48 2020 @author: work_cbdvl """ import torch import numpy as np class fc_net(torch.nn.Module): def __init__(self, n_features, seq_length =1, hidden = 30, layers = 2, fc_layer = 60): super(fc_net, self).__init__() self.n_features = n_features ...
true
4ff3e3e8db6c9a2044a9c37ae576042c17ba4fcd
dpla-attic/akara
/lib/__init__.py
UTF-8
6,165
2.703125
3
[ "Apache-2.0" ]
permissive
# -*- coding: iso-8859-1 -*- # # akara # © 2008-2010 by Uche Ogbuji and Zepheira LLC # """ akara - top-level module for an Akara installation Copyright 2009-2010 Uche Ogbuji and Zepheira LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the Licens...
true
925ecaac81370385babf866d700155888bf1a068
Xiangruili-seed/eRNA
/human/cell/split.py
UTF-8
881
2.671875
3
[ "Apache-2.0" ]
permissive
import pysam import sys ### Input varibles to set # file to split on unsplit_file = sys.argv[1] # where to place output files out_dir = sys.argv[2] # variable to hold barcode index CB_hold = sys.argv[3] itr = 0 # read in upsplit file and loop reads by line samfile = pysam.AlignmentFile( unsplit_file, "rb") for read in ...
true
0ac75b1f5a515b5ea9cb185333840126398e5c63
juansemarquez/teacher-planner
/teacher_planner/planner/models.py
UTF-8
8,431
2.671875
3
[]
no_license
from django.db import models from django.conf import settings # from django.contrib.auth import get_user_model from django.contrib.auth.models import User import datetime class Teacher(User): class Meta: proxy = True def get_lessons_by_taglist(self, tag_list): ''' Receives a list of keyphrases,...
true