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
d7778e43396206687c6cddba785c077c6d5c4a40
adityamhatre/Flappy-Bird
/NEAT/InnovationNumberGenerator.py
UTF-8
487
3.359375
3
[ "MIT" ]
permissive
class InnovationNumberGenerator: def __init__(self, start=0): """ Constructor for the innovation number generator that is global for each genome :param start: Start the innovation number from this integer """ self.innovation_number = start def next_int(self): """...
true
30b85c98099ffddc783c44948bcf62cd08af41ae
khush-01/Python-codes
/HackerRank/30 Days of Code/Day 1.py
UTF-8
151
3.15625
3
[]
no_license
i = 4 d = 4.0 s = 'HackerRank ' i2 = int(input()) d2 = float(input()) s2 = input() print(i + i2) print("{:.1f}".format(d + d2)) print(s + s2)
true
a1f831a5edbf10b42efad3f879d5163e3b64180d
scottkirkwood/clipboard-modifier
/clipboardmodifier/plugins/text2unicode.py
ISO-8859-13
1,834
2.59375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- encoding: latin1 -*- # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
true
8f50f76693d2de1e33c953ec273b1c5a99d67d84
Argude01/UI_Python-Tkinter
/Hugo1.py
UTF-8
906
3.015625
3
[]
no_license
from tkinter import * from tkinter import ttk window = Tk() f_app = Frame(window, width=400, height=800, bg="red") f_app.pack() # Widgets dentro del contender APP f_navbar = Frame(f_app, width=400, height=100, bg="yellow") f_navbar.grid(row=0, column=0) f_title = Frame(f_app, width=400, height=100, bg="yellow") f_tit...
true
20baac07f2638f2dee25a6e74924a175645074c3
gfobiyatechnical/2k19-With-Python-
/2nd Sem.-python pdf/string_concatination.py
UTF-8
312
3.921875
4
[]
no_license
''' author: Rakesh yadav aim: Given a string name, e.g. "Bob", return a greeting of the form "Hello Bob!". helloName("Bob") → "Hello Bob!" helloName("Alice") → "Hello Alice!" helloName("X") → "Hello X!" ''' name = input("Enter any name: ") prefix = "hello " print(prefix + name)
true
23f999aa964edf7dafdfd364579394cad714e10c
wwq2032/NaviBayes
/NaviBayes.py
UTF-8
1,549
2.828125
3
[]
no_license
import numpy as np def getMeansAndVar(inX): meansMat = np.zeros((3, 4), dtype=float) stdMat = np.zeros((3, 4), dtype=float) t = inX[0:35, ] meansMat[0] = np.mean(t, axis=0) stdMat[0] = np.std(t, axis=0) t = inX[35:70, ] meansMat[1] = np.mean(t, axis=0) stdMat[1] = np.std(t, axis=0) ...
true
17c7c0e4dc01a4ec860ea4efdc785cbafbad6354
madanneelapu/python3
/file_handling/show_employees.py
UTF-8
199
3.28125
3
[]
no_license
import pickle # loading data from a .dat file using De-serialization f = open("employees.dat", "rb") employees = pickle.load(f) for dept, emps in employees.items(): print(dept, ",".join(emps))
true
d02e33dbca05c0d79179a153b45de315e08d1823
indebetouw/lmc-alma-analysis
/dendroplot/plotting/pltprops.py
UTF-8
40,191
2.8125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import numpy as np from numpy.random import randint from scipy import stats, odr import os from os.path import join import re import matplotlib.pyplot as plt from matplotlib.patches import Polygon from astropy import units as u from astropy import constants as const from astropy.table import Tabl...
true
8e7f65db90770f5cf421e80a2a236e58615fdde2
ataias/Online-Judge-Submissions
/uri/1134.py
UTF-8
546
3.59375
4
[]
no_license
#!/usr/bin/env python3 def main(): A = 0 G = 0 D = 0 answer = 0 while answer != 4: answer = int(input()) if answer == 4: break if answer == 1: A += 1 continue if answer == 2: G += 1 continue if answ...
true
d1d5be867da6b92bdb805412b321e0ae54e9f180
zdelrosario/aa222
/project2/example2.py
UTF-8
489
3.203125
3
[]
no_license
### Example problem #2 from numpy import sqrt, linspace def f(x): return 4.0*x[0]**2 - x[0] - x[1] - 2.5 def g(x): return (-x[1]**2+1.5*x[0]+1.0, \ x[1]**2+2.0*x[0]**2-2.0*x[0]-4.25) x_star = (0.164439, 2.12716) f_star = -4.68344 constraints = (lambda x: sqrt(1.5*x**2-2.0*x+1.0), ...
true
5f11f99f314fe0a914fb516c5fd4838f68530c5b
CesaireTchoudjuen/programming
/week08-Plotting Data/Lab8.2.py
UTF-8
461
4
4
[]
no_license
# Program that makes a list , called salaries, that has 10 random numbers (20000 - 80000) # Each time the program is called the same random number should be pulled by the program # Author: Cesaire Tchoudjuen import numpy as np import random np.random.seed(88) # Random.seed to have the same value pulled everytime the ...
true
e55d2638e37390512b495a3fc70d68b7453c44a4
EliaDassio/Sistemi_e_Reti
/Python/es_function_dictionair/es.py
UTF-8
446
3.921875
4
[]
no_license
def somma(a, b): return a+b def moltiplicazione(a, b): return a*b dizionario_funzioni = {0:somma, 1:moltiplicazione} def main(): val_utente = int(input("0 per somma, 1 per moltiplicazione: ")) a = int(input("primo numero: ")) b = int(input("secondo numero: ")) try: x = dizionario_funz...
true
3234b8b369f7da45e2b92c9d84702a5e2f94f360
opnumten/frustrated-random-walk
/src/compare_hitting_time_deepwalk.py
UTF-8
6,799
2.96875
3
[ "Apache-2.0" ]
permissive
import os def normalize_similarity(deepwalk_similarity): pairs = sorted(deepwalk_similarity.iteritems(), key = lambda (k, v): v, reverse = True) result = dict() max_similarity = pairs[0][1] min_similarity = pairs[-1][1] for i in range(len(pairs)): k, v = pairs[i] if i == 0: ...
true
4725f09aec942da0f75665ba2e85f38b3291673d
enhuiz/hmr
/hmr/networks/munit/__init__.py
UTF-8
12,931
2.53125
3
[]
no_license
""" Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ from torch import nn from torch.autograd import Variable import torch import torch.nn.functional as F import os from .utils import weights_init...
true
c6eb828006bc336e35b19fb708275ea3516e12b1
elmeriki/PythonAppsEx
/samples/forloops.py
UTF-8
151
3.109375
3
[]
no_license
#for Names in "Meriki Solomon": # print(Names) prices = [90,80,30] total = 0 for price in prices: total = total + price print(total)
true
b36751a449f408f85014f5001c445becdb94224c
p4lewandowski/PersonIdentification
/Praktyki2018-Kod_aplikacji/SystemRozpoznawaniaTwarzy/Application/FaceRecognition_cnn_stream.py
UTF-8
3,242
3.046875
3
[]
no_license
import sys from PyQt5 import QtGui from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, \ QTextEdit, QDesktopWidget from keras import callbacks from PyQt5.QtCore import QObject, pyqtSignal, QCoreApplication, Qt class OutputStream(callbacks.Callback): """ Stworzony niestandardowy ob...
true
12a22b3b9a4eb9e8ebeb929ec82583f0431744fe
Pasewark/Practice-problems
/ElementsofProgramming/chap5/5-5.py
UTF-8
292
2.765625
3
[]
no_license
def powerSet(s): num=0 while num<2**len(s): bnum=bin(num)[-1:1:-1] output=[] for i in range(len(bnum)): if bnum[i]=='1': output.append(s[i]) if len(output)==0: print '{emptyset}' else: print ",".join(map(str,output)) num+=1
true
74fe3d3ef76ac2819345b24449c238f57f931378
ToyokoLabs/moonrock
/moonrock/sites/localhost/pages/HomePage.py
UTF-8
3,808
2.5625
3
[ "BSD-2-Clause" ]
permissive
import time from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from .BasePage import BasePage from helper import Colors from UImap import home_page_map from .SubscribePag...
true
c452114d366eae1cefcd1ea4086df56ee27c5ac2
smonsalve/ST0240-20162
/2.Ejercicios/entrada1.py
UTF-8
192
3.90625
4
[]
no_license
cantidad = int(input("imprima la cantidad de datos a ingresar:")) datos = [] for i in range(0,cantidad): val = input(("ingrese valor #{}: ").format(i)) datos.append(int(val)) print datos
true
737255745b5b45ebf7e4b0afb99db1185ec45b9b
MaddenJohn/archivedProjects
/Python/Tensorflow/cs342/hw10/starter/starter_gf.py
UTF-8
6,009
2.796875
3
[]
no_license
""" This assignment requires pytux, make sure to download a binary or compile it from source. Then link (or copy) the pytux and data directory here ln -s /path/to/supertux/pytux pytux ln -s /path/to/supertux/data data It is also recommended that you launch the training script from an actual lab machine, not through s...
true
8aaf8e168c03f9f47c4edc8b431955df20adf7bc
duochen/Python-Beginner
/Lecture04/Exercises/filter.py
UTF-8
147
3.703125
4
[]
no_license
def is_even(num): return num % 2 == 0 nums = [1, 1, 2, 3, 5, 8, 13, 21, 34] a = [num for num in nums if is_even(num)] print(a) # => [2, 8, 34]
true
e31d6d8ddd56faed12cecd4be33b7ef146742629
pewosas/DuongHieu-C4T6
/turtle_practice1.py
UTF-8
205
3.046875
3
[]
no_license
from turtle import * shape("turtle") colormode(255) color(49, 0, 200) for i in range (50): penup() stamp() forward(20) stamp() forward(20) left(50) forward(20) mainloop()
true
303ace8a2331766fbb690815abe690bb88ad493e
iBranch-DataScience/scraping_scheduler
/ibranch/scraping_scheduler/util/Debug.py
UTF-8
395
3.109375
3
[ "CC-BY-4.0" ]
permissive
import threading from singleton_decorator import singleton @singleton class Counter: def __init__(self): self._mutex = threading.Lock() self._cnt = 0 def count(self): try: self._mutex.acquire(blocking=True) self._cnt = self._cnt + 1 value = self._c...
true
dd3510447c7e983f0dfc3c5b12a125e17c266da1
Igor-ua/python-shared
/py_compile_helper/py_compile_helper.py
UTF-8
2,916
2.890625
3
[]
no_license
#!/usr/bin/python3.7 import argparse import py_compile import os import subprocess import shutil args = None def resolve_args(): parser = argparse.ArgumentParser(description='A helper for recursive compilation of python modules') parser.add_argument('input', help="input folder that must be compiled") pa...
true
d58fce626e90215b405d788490cc630a7f277a8b
alsignoriello/geometry
/2D/pointinpoly2d.py
UTF-8
2,001
3.546875
4
[]
no_license
#!/usr/bin/python import sys import numpy as np from numpy import sqrt,arccos,pi def get_angle(p1,p2,p3): radian = 0 p12 = sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2) p13 = sqrt((p1[0]-p3[0])**2 + (p1[1]-p3[1])**2) p23 = sqrt((p2[0]-p3[0])**2 + (p2[1]-p3[1])**2) if p12 != 0 and p13 != 0: try: radian = arccos...
true
10f9f8aec4e7202203162e72b836a7b07027f291
Singhal861/Python_Learning_stage_codes
/5.3exeCache.py
UTF-8
354
2.90625
3
[]
no_license
import time from functools import lru_cache num = int(input()) @lru_cache(maxsize= num) def exe(n): print("funtion on sleep") print("Function start") time.sleep(n) return n if __name__== "__main__": # print("funtion on sleep") exe(6) # print("funtion on sleep") print("complete") ...
true
3c506283435a3df383dd7b6cd5a5e365cd9ce501
jakvah/tenmen-tracker
/match_extraction/Team.py
UTF-8
2,611
3.859375
4
[]
no_license
#!/usr/bin/python3 "Team class" """ from Player import Player """ class Team: def __init__(self,p1=None,p2=None,p3=None,p4=None,p5=None,size=5,score=0): self.iterator_value = 1 self.size = size self.player_1 = p1 self.player_2 = p2 self.player_3 = p3 self.player_4 ...
true
edebfc42398defd6a6b78e3368b0ca975cb51fe7
leviafan14/ftp_upload
/python_without_insert.py
UTF-8
3,163
3.125
3
[]
no_license
import pymysql from pymysql.cursors import DictCursor def read_to_database(user_name: list, split_char: str) -> str: # Создаем подключение и проверяем удалось ли подключиться try: # Т.к. сервер локальный, то учетные данные передается напрямую в connection connection = pymysql.connect( ...
true
d888516aa2d89d062ba9347dc4d02ae16016294a
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/regex/Practice/8.py
UTF-8
523
3.359375
3
[]
no_license
""" 8. Match the set of all valid Web site addresses (URLs) (start with a loose regex, and then try to tighten it as much as you can, yet maintain correct functionality).Try to break what we did in class and improve it. """ import re urls = '''www.yahoo.com http://testsite.com https://www.google.com www.bob....
true
09a72363c452e9f6290b6b669289762e423ef5c4
mtoqeerpk/eqsig
/eqsig/displacements.py
UTF-8
1,151
3.40625
3
[ "MIT" ]
permissive
import numpy as np import scipy.integrate def velocity_and_displacement_from_acceleration(acceleration, dt, trap=True): """ Computes the velocity and acceleration of an acceleration time series, using numerical integration. Parameters ---------- acceleration: array_like acceleration time ...
true
1e27c45bb5b29efcd689d119e5b225ea00c09c47
IAmFiveHigh/learnPython
/模糊搜索文件/index.py
UTF-8
127
2.734375
3
[]
no_license
import os files = os.listdir("./") for f in files: if "fish" in f and f.endswith(".png"): print("find it! " + f)
true
816d1faba037fee69d3d832070324e53f09238b3
rohan2734/CRUD__react-flask-mongdb
/simple_proFreelancers/backend/resources/errors.py
UTF-8
870
2.640625
3
[]
no_license
class InternalServerError(Exception): pass class UserAlreadyExist(Exception): pass class UnAuthorized(Exception): pass class UserDoesntExist(Exception): pass class FieldsEmpty(Exception): pass class PasswordIsShort(Exception): pass errors={ "InternalServerError": { "message": "Some...
true
10f5958a01f61a9248b3e3a8e1cf2bdb21f5864a
johanere/CP4
/Code/MPI_Count_MC_configs/plotconfigs.py
UTF-8
1,812
2.546875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import string as str outdata="dataMC" T=1 #open for reading f= open(outdata) if f.mode == 'r': lines = f.readlines() n=len(lines) #placeholders mcs=np.zeros(n) E=np.zeros(n) C=np.zeros(n) Mtot=np.zeros(n) X=np.zeros(n) M=np.zeros(n) configs=np.zeros(n) #extract...
true
8c0c00127a042ca235ce6c23ab6a85dc1a70f7a3
zhiwenwei/python
/day9/进程Queue相互通信.py
UTF-8
253
2.625
3
[]
no_license
#-*- coding:utf-8 -*- #Author:ZhiWenwei from multiprocessing import Process,Queue def f(q): q.put([10000,None,'hello!!!!']) if __name__ == '__main__': q = Queue() p = Process(target=f,args=(q,)) p.start() print(q.get()) p.join()
true
839271ed1a248e37a0c6e05262a5f5a1cada8ec8
all1m-algorithm-study/2021-1-Algorithm-Study
/week1/Group10/1182_장서빈.py
UTF-8
292
2.578125
3
[]
no_license
n, s = map(int, input().split()) list = list(map(int, input().split())) count = 0 i = 1 while i<2**n: switch = bin(i) sum = 0 for j in range(-1*(len(switch)-2),0): if switch[j] == '1': sum += list[j] if sum == s: count += 1 i += 1 print(count)
true
fba23ad2d9291ee21c61a09426f97274f50b5707
inaheaven/Finance_Tool
/Finance_Data_Scraper/kospi200_scraper5.py
UTF-8
2,727
2.953125
3
[]
no_license
import urllib import time from urllib.request import urlopen from bs4 import BeautifulSoup stockCode = 'KPI200' # 065450 빅텍 dayPriceUrl = 'http://finance.naver.com/item/sise_day.nhn?code=' + stockCode dayPriceHtml = urlopen(dayPriceUrl) dayPriceSource = BeautifulSoup(dayPriceHtml.read(), "html.parser") dayPricePage...
true
f307426d19f6b44d40ed9b7cf6263241d31c66e1
rajanvyas/ds-practice
/array/move_zeros.py
UTF-8
1,880
4.03125
4
[]
no_license
# -*- coding: utf-8 -*- # Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. # # Example: # # Input: [0,1,0,3,12] # Output: [1,3,12,0,0] # Note: # # You must do this in-place without making a copy of the array. # Minimize the total numbe...
true
9c0008e459396251c48d58852dea2b352f1b25bb
iamanobject/Lv-568.2.PythonCore
/CodeWars/KKolesnychenko/Kata_Multiples_3_or_5.py
UTF-8
198
3.125
3
[]
no_license
def solution(number): arr=[] if number<0: return 0 else: for i in range(number): if i%3==0 or i%5==0: arr.append(i) return sum(arr)
true
8f86cfb2446b74dd098e902ca1d5895921119349
mskstg/2018-1-Project1
/news_parser.py
UTF-8
916
3.234375
3
[]
no_license
from bs4 import BeautifulSoup from urllib.request import urlopen import nltk # 1-1. print title, author, date, video title, article content using BeautifulSoup # TODO - fill in your team's url url = '' data = urlopen(url).read() doc = BeautifulSoup(data, 'html.parser') # TODO - print title title = '' print("Title: ...
true
2db7298018c3f13ccab19fdf1ea6ed4fc4d962df
raccoongang/OLGA
/web/olga/analytics/utils.py
UTF-8
2,884
2.546875
3
[ "Apache-2.0", "AGPL-3.0-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" Helpers for the analytics part of OLGA application. """ from http import HTTPStatus as http import logging import requests from django.http import HttpResponse from olga.analytics.forms import ( EdxInstallationParanoidLevelForm, EdxInstallationEnthusiastLevelForm, InstallationStatisticsParanoidLevel...
true
15b0632347951bf2f973b6aa3f7987409ab66be1
gistable/gistable
/dockerized-gists/63dd174247e3188500c08f8466e9cbc2/snippet.py
UTF-8
1,044
3.09375
3
[ "MIT" ]
permissive
""" how to count as fast as possible (numbers from Python 3.5.2 on a Macbook Pro) YMMV, but these results are pretty stable for me, say +/- 0.1s on repeated runs """ from collections import Counter, defaultdict import random random_numbers = [random.randrange(10000) for _ in range(10000000)] # 2.28 s def use_dict():...
true
b364dbb062d6932cfa97463c2bc872482a2e6713
DineshDDi/datascience-with-python
/practice_slr.py
UTF-8
1,057
3.078125
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.impute import SimpleImputer from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression data = pd.read_csv("SLR_practice_height_weight.csv") # print(data.isnull().sum()) x = data.iloc[:,0:1]...
true
1f4dee7fb1d13482d701cb03ce0026b97654924f
wangwf/Codes
/py-leetcode/majorityElement.py
UTF-8
392
3
3
[]
no_license
def majorityElement(num): dict={} for i in num: dict[i]= dict.get(i,0) +1 for i, v in dict.iteritems(): if v>len(num)/2: return i def majorityElement(num): res= [num[0],1] # for x in num[1:]: if x== res[0]: res[1] +=1 else: if res[1]>0: re...
true
6fc0b0bd99ef8134a612fd3eee09d673c8e8613b
seniorteck/100DaysofPythonProject
/Workbench_Algorithm/workbench7.py
UTF-8
91
3.359375
3
[]
no_license
subtotal = int(input('what is the subtotal amout? ')) total = subtotal * 0.15 print(total)
true
dd893376cfa99d0dea518dba639fee703539df71
The-direction/chatroom
/audioin.py
UTF-8
1,222
3.046875
3
[]
no_license
"""PyAudio example: Record a few seconds of audio and save to a WAVE file.""" import pyaudio import wave #设置参数 CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 8000 RECORD_SECONDS = 60 WAVE_OUTPUT_FILENAME = "output.wav" #保存的文件名 p = pyaudio.PyAudio() #调用pyaudio #设置录制参数 stream = p.open(format=FORMAT, ...
true
29d41195a16da74d652ff4da34dea343bc78d37a
safelyafnan/Muhammad-Safely-Afnan_I0320070_M-Wildan-Rusydani_Tugas6
/I0320070_Soal 2_Tugas 6.py
UTF-8
278
3.96875
4
[]
no_license
nilai = [] banyak_nilai = int(input('Berapa banyak nilai yang ingin dihitung: ')) for i in range(banyak_nilai): nilainya = int(input('masukkan nilai ke-{} : '.format(i+1))) nilai.append(nilainya) print('hasil rata-rata adalah : {} '.format(sum(nilai)/banyak_nilai))
true
bb31552b86da9da4bc2b9e9426eda1568f58fbb2
GiuseppeRistaino/DatabaseDD2.2
/Entities/Spell.py
UTF-8
836
2.796875
3
[]
no_license
ATTRIBUTE_SPELL = ["Nome", "Scuola", "Livello", "Classe", "Raggio di azione", "Resistenza agli incantesimi", "Tiro salvezza", "Tempo di lancio", "Descrizione", "Durata", "Bersaglio", "Componenti"] class Spell(): def __init__(self, nome, scuola, livello, classe, raggio_di_azione, res_inc, t...
true
55f3adbad9caef1aadff3cd8c195c4a902854876
ezgigungor/DASM
/scripts/rename_images.py
UTF-8
528
2.65625
3
[]
no_license
import os # Rename each image in the passed foleder to its id starting from zero for directory_name in os.listdir("/home/malek/ml/project/unlabeled_data/data/unnamed_images"): count = 0 for image in os.listdir("/home/malek/ml/project/unlabeled_data/data/unnamed_images/{0}".format(directory_name)): ...
true
2679e91fd133d0a1887efae2d5a3d620d5842f19
LouisU/practice
/nc/2.py
UTF-8
909
4.15625
4
[]
no_license
# -*- coding: utf-8 -*- # author = "Louis" # 题目描述 # 写出一个程序,接受一个由字母、数字和空格组成的字符串,和一个字母,然后输出输入字符串中该字母的出现次数。不区分大小写,字符串长度小于500。 # # 输入描述: # 第一行输入一个由字母和数字以及空格组成的字符串,第二行输入一个字母。 # # 输出描述: # 输出输入字符串中含有该字符的个数。 # # 示例1 # 输入 # ABCabc # A # 输出 # 2 if __name__ == '__main__': # str_line = "nhrwlbcc8m7c5hih9mhalw98k0322wf2jjm47k...
true
9bf0d34e861f87ba9e1edda622598bfabc552e9b
seanlopez/python-new-test
/HankerRank/RE/re_compile_rank.py
UTF-8
126
2.9375
3
[]
no_license
import re s = "yuantianqi" pattern = re.compile(".") for i in range(len(s)): print(pattern.match(s,i).group())
true
36edd52d32d3d0eb2a0f1396359982a73b50c049
Kawser-nerd/CLCDSA
/Source Codes/CodeJamData/16/32/12.py
UTF-8
807
2.9375
3
[]
no_license
def binary(n): if n == 0: return "" return ("1" + binary(n/2) if n%2 == 1 else "0" + binary(n/2)) T = int(raw_input()) for test_case in range(T): [B, M] = [int(x) for x in raw_input().split()] maxval = 2**(B-2) if M > maxval: answer = "IMPOSSIBLE" elif M == maxval: answer = "POSSIBLE\n" ...
true
f565722c9e8018791dbc91e2a3131276e758b345
firnice/pytest
/TestBase/TestList.py
UTF-8
101
2.8125
3
[]
no_license
__author__ = 'firnice' list = ['t1','t2','t3'] print (list) print(len(list)) print(list[-3])
true
554e001977844cb24e9b1653d9b2227dbd63deac
catomania/Random-late-night-time-wasters
/ctci/Chapter-2/question_1.py
UTF-8
2,595
4.40625
4
[]
no_license
# how to create a linkedlist # write code to remove duplicates from an unsorted linked list # reference: http://alextrle.blogspot.com/2011/05/write-linked-list-in-python.html # linked list code: # node class: every node has a value and pointer to the next node # when first instantiated, it has a value but is not point...
true
30ca61a5cd747a03325b3453b3d6788934f94787
lbu0413/python-study
/SWEA-PYTHON-BASIC-2/ㅁㄴㅇㄹ.py
UTF-8
262
3.828125
4
[]
no_license
# # 1 - 100, 2진수로 바꾸고, 0이 하나만 포함된 숫자 # output = [i for i in range(1, 101) if "{:b}".format(i).count("0") == 1] # print(sum(output)) a = {"city": "atl", "name": "wook", "age": 28} print(a.keys()) print(a.values()) print(a.items())
true
796a0099a7b5a0a91d7a46b6374ab86420dd3e1d
brendrach/handoff_package
/Harm3D_IGM_WhiskyMHD_Complete_Handoff_Package/Harm3D_IGM_WHISKY_Handoff.py
UTF-8
18,104
2.671875
3
[]
no_license
""" This is the main handoff From the command-line, run via: python Interp_Sph_ReadIn.py interp_sph_grids.dat [number of gridfunctions (58 or so)] [outfile] Currently the last parameter "outfile" is required but not actually used. The handoff was developed by Brendan Drachler and Zach Etienne for use in the BNS TCAN ...
true
fad2077c76c89cc6b76001fad0ad58708c695169
juliafealves/advanced-algorithms-basic
/contest-02/p5.py
UTF-8
480
3.328125
3
[]
no_license
# coding: utf-8 from collections import Counter def gcd(a, b): if b == 0: return a return gcd(b, a % b) while True: n = int(raw_input()) if n == 0: break a = map(int, raw_input().split()) b = map(int, raw_input().split()) pairs = Counter() for i in a: for j in b: ...
true
034d5167d456d0763240ad94e645be565ba47b85
Ellison997/Python
/oopAdvanced.py
UTF-8
3,135
4.34375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 数据封装、继承、多态只是面向对象程序设计中最基础的3个阶段, # 在python 中,面向对象还有很多高级特性,允许我们写出更强大的功能 print('------------多重继承,定制类,元类----------------') from types import MethodType class Student(object): pass s=Student() s.name="张三" # 动态给实例绑定一个方法 print(s.name) # 给实例绑定一个方法 def set_age(self,age...
true
a6cd3c53fbd5db1dfb0e689a2147c43866062e42
SpIIIII/Agent.Discord.Bot
/python_test/bot_modules/trello/draw_dashbord.py
UTF-8
5,337
2.9375
3
[]
no_license
import matplotlib.dates as mdates import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import numpy as np import json import os from get_trelo_score import get_trello_data from mpl_toolkits.mplot3d import Axes3D static=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),'...
true
ec16fcd92a2f98a27db744884471a0878d3173e3
imolina218/TimBuchalka
/ControlFlow/notin.py
UTF-8
228
2.921875
3
[]
no_license
activity = input("What would you like to do today? ") if "cinema" not in activity.casefold(): print("But I want to go to the cinema") else: print("Okay lets go") # https://docs.python.org/3/library/stdtypes.html
true
3be084f46f592fc04234d79dbb341a12024da6b9
Yernat02/pk1
/Untitled4.py
UTF-8
236
3.484375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: qty0ranges=input(0) price0range=input() qty0ranges=int(qty0ranges) price0range=float(price0range) sum0ranges=qty0ranges*price0range print("Заплатите", sum0ranges, "руб")
true
619ed70b1c9c3e800bea52c5192a881d200188da
dorisjlee/rabi_flop_fitter
/rabiflop_modified_test.py
UTF-8
7,620
2.671875
3
[]
no_license
''' Testing modification to guess_f_rabi and Container class for a Rabi flop fit ''' import lmfit as lmfit from datafit import DataFit import numpy as np import timeevolution as te from labrad import units as U from get_data import * # Need to change working directory for get_data files on non-local machine # import...
true
178220fc80e07f470f2422e3bc15fa548f1f8c01
chrahunt/quicken
/.azure-pipelines/scripts/python.py
UTF-8
588
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Helper to make venv python invocation independent of OS/shell. Usage: python.py <args> Refers to AGENT_OS and VENV. """ import os import sys from pathlib import Path def get_python_path(venv: Path): python_paths = { 'Linux': Path('bin') / 'python', 'Windows_NT': Pa...
true
bb263abd0f10aba9c34b83c2a467106327bcca2e
achedges/python-libraries
/tests/TestCrypto.py
UTF-8
468
2.984375
3
[]
no_license
import unittest from localutils import crypto class Test(unittest.TestCase): def testGCD(self): self.assertEqual(crypto.gcd(12, 64), 4) self.assertEqual(crypto.gcd(270, 192), 6) self.assertEqual(crypto.gcd(3, 3), 3) self.assertEqual(crypto.gcd(1, 17), 1) self.assertEqual(crypto.gcd(10, 100), 10) ...
true
43dc68128607c54580b412f1b9194dfce38ad9fa
Sol-cito/LGCNS_PS_Study
/4. LIS(최장증가부분수열)/병사.py
UTF-8
234
2.796875
3
[]
no_license
n=int(input()) arr=list(map(int,input().split()))[::-1] max_len=[] for i in range(n): max_len.append(1) for j in range(i): if arr[j]<arr[i]: max_len[i]=max(max_len[j]+1,max_len[i]) print(n-max(max_len))
true
a78ef5465585ffec433fb390bfc50b62b6c4f57b
puppol/cs325
/hw4/kmergesort.py
UTF-8
413
3.25
3
[]
no_license
import heapq def merge(arrays): heap = [] for array in arrays: heap.extend(array) heapq.heapify(heap) return [heapq.heappop(heap) for _ in range(len(heap))] def kmergesort(array, k): if len(array) <= 1: return array return merge([kmergesort(array[i*len(array)//k : (i+1...
true
8cde3011f6f943ede1960a3f0161c9ddbbfee2df
chikinn/skat
/bot_utils.py
UTF-8
1,582
3.359375
3
[]
no_license
"""Library of generic functions to make writing AI players easier. Feel free to add to this file. If a function is so specific that only one bot will use it, however, then it doesn't belong here.""" from skat_classes import * ### BIDDING def bid_incrementally(r, maxBid): """Slowly bid up to the desired max."""...
true
c431fc7320e0b35ceb105ffb8c536774602b3361
huzaifabaloch/Python_Crash_Book_Exercises
/Chap_8 - Functions/8_1_message.py
UTF-8
103
2.828125
3
[]
no_license
def display_message(): print("I am learning about functions in python.".title()) display_message()
true
09a81a5bfa54ec070df3031afb657caf6b208628
Jesus121299/Ejercicios_Optimzacion
/ejercicios/ejercicio10.py
UTF-8
298
3.21875
3
[]
no_license
#Optimización de formula del area de un cuadrado por método de mirrilla lado = 4 area = lado * lado print(area) ''' lado1=4; lado2=4; a = lado1 * 2; b = lado2 * 2; print(a + b); en este se usa el metodo de optimizacion de mirilla por que elimina instrucciones que sólo alargan el codigo '''
true
0b1e7c6f0f075b743faef8b65fe2fd9e3d25e867
jamesrstevick/preliminary_stages
/block_enter.py
UTF-8
13,904
2.796875
3
[]
no_license
import datetime import os import csv from tkinter import * from tkinter import messagebox from os.path import expanduser class EnterBlock: def __init__(self, master, dashboard): ### CUSTOMIZE PROGRAM ### # Property Names self.buildings = ['1716 Rose','1722 Walnut','1446 MLK','88 S Ocea...
true
72deeea278f34234d76a0f1825c76518eed70d85
gaoshangs/toolbox
/python3/basic/args/args2.py
UTF-8
199
2.953125
3
[]
no_license
# -*- coding:utf-8 -*- def a1(x1, x2=2, x3=3): print(x1, x2, x3) def a2(x1, **args): print(x1, args['x2'], args['x3']) a1('xx1', x3='is x3', x2='is x2') a1('xx1', x3='is x3', x2='is x2')
true
9a6f6bd258461cc4055a0f1860a9f9a272ba67b2
padamcs36/Introduction_to_Python_By_Daniel
/Chapter 4 Selections/GuessLotteryNumber.py
UTF-8
673
4
4
[]
no_license
import random lottery = random.randint(0, 99) guess = eval(input("Enter your lottery (pick two number): ")) lotteryDigit1 = lottery // 10 lotteryDigit2 = lottery % 10 guessNum1 = guess // 10 guessNum2 = guess % 10 print("Lotter number are : ",lottery) if guess == lottery: print("Exact Match! You wo...
true
a3ee54360f2c3719c14d4b7a55e5f7f3b91659f4
Parizval/CodeChefCodes
/Python/FLOW Series/FLOW011.py
UTF-8
217
3.359375
3
[]
no_license
# cook your dish here for a in range(int(input())): total = 0 sal = int(input()) if sal >= 1500: total = 1.98*sal + 500 print(total) else: total = 2* sal print(total)
true
b79152a11948dd3bca3d8d948f21efbd1b0792bb
ispielma/DMDWavemeter
/DMDWavemeter/pylon_test.py
UTF-8
2,141
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 23 17:16:43 2020 @author: ispielma """ from pypylon import pylon, genicam def RecurseNodeTree(camera, visibility_string, writeable_only=True): """ Recurse the Node tree and return a list of redreadable nodes writeable_only further ...
true
cc7d3107a894cf1188380f7f58289d8eee59a2fd
alneberg/msc_thesis.scripts
/fake_coverage.py
UTF-8
863
2.921875
3
[]
no_license
#!/usr/bin/env python DESC="""Reads sequences and outputs table with zeros for each id. """ import fileinput import sys import os from Bio import SeqIO from logbook import Logger from argparse import ArgumentParser import pandas as p def main(args): """For each sequence in sequence_file, output zero to one colum...
true
62ccce9ea6c5ee84cbfd8ae0d19fafa6165a33b7
donghL-dev/Info-Retrieval
/lecture-data/PythonBasics/006_file.py
UTF-8
211
2.65625
3
[]
no_license
iF=open('i.txt') for line in iF: print(line) # end for iF=open('i.txt') oF=open('o.txt','w') for line in iF: L=line.rstrip().split() for t in L: print(t) oF.write(t+'\n') # end for # end for oF.close()
true
31c55009aaca20e240002f31026393dc18a5907b
himanshu-iitrin-yadav/Begginers-s-Hypothesis
/model.py
UTF-8
636
2.796875
3
[]
no_license
inport pandas as pd filename = input() #reading through file dataF = pd.read_csv(filename , sep=','); # creating dataframe which contains unique values in dataF['queries'] queries = dataF['query'].unique() #now encoding each query dataF['tag'] = 0 def newdata(dataF , queries): listq = queries.tolist() for...
true
d33a24d84cc22cc6f9938df15c837a8cf2ae0ce4
cwalstra/cs344
/lab06/lab06_3.py
UTF-8
1,297
3.234375
3
[]
no_license
''' This file examines the properties of the Boston Housing Price dataset supplied by Keras Written by: Chris Walstra, based on code supplied by Keith Vander Linden ''' import numpy as np from keras.datasets import boston_housing def print_structures(): print( f'training images \ \n\tcount: ...
true
415cfbce9aa1b7052b907b519fe95bffefb1ac0d
attilaolah/math
/shorts/drafts/circle.py
UTF-8
4,607
3.375
3
[ "Apache-2.0" ]
permissive
import manim as m class MetricLoopFunction(m.Scene): """Metric loop function scene.""" # pylint: disable=too-few-public-methods,invalid-name def construct(self): """Construct the scene.""" # In this video, I'll try to describe a function that takes a specific # kind of *loop* as i...
true
e63e386043a49a9ae1c69fe7118afeb1ef8d9cbe
titosilva/collatz-generator-flask
/src/collatz/collatz_map.py
UTF-8
1,181
3.625
4
[]
no_license
from typing import List, Tuple def collatz_iterate(number: int): return int(number/2 if number % 2 == 0 else 3*number + 1) class CollatzMap: __map_values: List[int] = [] __map_values_pointer: List[int] = [] # Store the indexes of the elements pointed def __recursive_add(self, value: int) -> int: ...
true
2d33f724c9a8b7c0cd58b7404fd04ce41dc7b4bc
ReaganLeon00/The-Tech-Academy-Python-Coding-Projects
/python_projects/PG 121/PG 121.py
UTF-8
2,021
2.796875
3
[]
no_license
from tkinter import * from tkinter import filedialog import tkinter as tk class MainWindow(Frame): def __init__(self, master, *args, **kwargs): Frame.__init__(self, master, *args, **kwargs) self.master = master self.master.minsize(600,150) self.master.maxsize(700,300) ...
true
7eacb0ea5024ffea110042603ed537501ddd5ecd
entangled90/computazionale_m
/potts/data/fit_log.py
UTF-8
1,371
2.71875
3
[]
no_license
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import math import sys def fit_fun(x,*p): return p[0]*np.power(np.absolute(np.log((-1)*(x+(-p[1]))/p[1])),p[2]) filename = sys.argv[1] np.seterr(all='warn') lungh=20 BetaC = 0.435 BetaMin = 0.3 temp = np.loa...
true
81994fae445308b771bb78ca10d250aba81aa20d
AjaykumarGP/MyDataStructures_SolvedProblems
/Data structure/Array/Move all negative numbers to beginning and positive to end with constant extra space.py
UTF-8
619
4.21875
4
[]
no_license
#Move all negative numbers to beginning and positive to end with constant extra space def rearrange(array): start = 0 end = len(array)-1 while(start<end): if(array[start] < 0 and array[end] < 0): start += 1 elif array[start] > 0 and array[end] >0: end -= 1 ...
true
5bc130c3a1c1ae16bb5a3387c3763b0ec6454ca6
aniket147/Audio-Based-Landuage-Identification
/model_train.py
UTF-8
7,463
2.546875
3
[]
no_license
import pandas as pd from collections import Counter import sys from keras import utils import librosa import multiprocessing import numpy as np from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from keras.callbacks import EarlyStopping, TensorBoard from keras.layers.c...
true
91ce5192c6994af5f0c005d7ca6007dfa0a7e59a
MeerimI/LeetCode
/DefangingIPAddress.py
UTF-8
313
2.734375
3
[]
no_license
""" Runtime: 20 ms, faster than 42.64% of Python online submissions for Defanging an IP Address. Memory Usage: 13.5 MB, less than 34.51% of Python online submissions for Defanging an IP Address. """ class Solution(object): def defangIPaddr(self, address): return address.replace(".", "[.]")
true
9604d275209e8b319035d801cc8bbf39e9f377cb
Gaspela/holbertonschool-machine_learning
/supervised_learning/0x13-qa_bot/4-qa.py
UTF-8
692
3.125
3
[]
no_license
#!/usr/bin/env python3 """ Multi-reference Question Answering """ question_answer = __import__('0-qa').question_answer semantic_search = __import__('3-semantic_search').semantic_search def qa_bot(corpus_path): """ Bot Question """ in_qa = '' while (in_qa is not None): in_qa = input("Q: ")...
true
72832538ca2d388f6dc6c421cd65f64099e5f687
lukechoe/stock-analysis
/stocks.py
UTF-8
997
3.0625
3
[]
no_license
import requests import json from io import StringIO data_type = 'TIME_SERIES_DAILY' symbol = 'MSFT' apiKey = 'R47YKWQC9N8YJS1P' interval = '1min' outputsize = 'compact' outputsizefull = 'full' """ data = requests.get('https://www.alphavantage.co/query?function={}&symbol={}&interval={}&apikey={}&outputsize={}'.format(d...
true
6d0eab590aac6f54f6db7eff48b6fdfb840266ca
not4win/MLfinance
/finance.py
UTF-8
2,010
3.328125
3
[]
no_license
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from keras.models import Sequential from keras.layers import LSTM,Dense from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt data = pd.read_csv('all_stocks_5yr.csv') print(data.head()) ...
true
92ecb5ca7b951d03aaf7408fd977c4b14b9339cd
Sileven/Interview-code
/8.26腾讯深圳-2拓展.py
UTF-8
969
4.1875
4
[]
no_license
""" 输入一个有序数组,删除数组所有相同元素,返回去重后的数组 如: 输入 [1, 2, 2, 3] 输出 [1, 2, 3] 要求:不能使用python自带的和数组操作相关的函数 """ # 方案1,直接赋值 import sys nums=[int(m) for m in sys.stdin.readline().split()] if len(nums)<2: print(nums) exit(0) start=1 end=1 while(end<len(nums)): if nums[end]!=nums[start-1]: nums[star...
true
c59ca80b5aed8198c8289910121ef1ae84514f2c
TimSC/py-modern-opengl
/common2d.py
UTF-8
3,624
2.765625
3
[ "MIT" ]
permissive
#! /usr/bin/env python # -*- coding: utf-8 -*- #Based on http://cyrille.rossant.net/shaders-opengl/ from __future__ import print_function import numpy as np import OpenGL.GL as gl import OpenGL.arrays.vbo as glvbo # Vertex shader VS = """ #version 330 // Attribute variable that contains coordinates of the vertices. l...
true
497b98a51f978fdf3b7861104705db1bf5a02e08
jcpozoc/erix
/concatenate.py
UTF-8
118
3
3
[]
no_license
print("Hello World!") str1="Cisco" str2="Networking" str3="Academy" space=" " print(str1,space,str2,space,str3)
true
2688d16b3fb5b81248c1a370b23280d6437b41be
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4134/codes/1836_1275.py
UTF-8
174
2.796875
3
[]
no_license
from numpy import* from numpy.linalg import* a = array(eval(input("horario: "))) b = shape(a)[0] tot = zeros(b,dtype=int) for i in range(b): tot[i]=sum(a[i,:]) print(tot)
true
7e442b80cfeac51634a9e349184dab2ee3954e31
argriffing/xgcode
/RejectionSampling.py
UTF-8
3,211
3.5625
4
[]
no_license
import unittest import random class RejectionSampler: def __init__(self, propose, accept): """ @param propose: a callable that draws from the proposal distribution @param accept: a callable that decides if a proposal is accepted """ self.propose = propose self.acc...
true
b01772ebdea8c59ee205d4513c46a3fba46a073a
svvay/CodeWars
/work_directory/String_incrementer.py
UTF-8
1,340
3.859375
4
[]
no_license
# Your job is to write a function which increments a string, to create a new string. # # If the string already ends with a number, the number should be incremented by 1. # If the string does not end with a number. the number 1 should be appended to the new string. # # Attention: If the number has leading zeros ...
true
f826e31b62cdb8c78f9424caa262cc80ed7d37cf
gaojun1020/homeTools
/math/mathPuzzle.py
UTF-8
1,755
2.859375
3
[]
no_license
# -*- coding: UTF-8 -*- from playsound import playsound from prettyTime import pretty_time_delta from printUtil import printMe from termcolor import colored from mathLib import Question, Test import random import os import sys import time import winsound ############################### os. system('CLS') numQ = i...
true
cb73da2e313ae6670c2fded5874b2df4fb050932
jhu-asco/optimal_control_framework
/controllers/acc_unicycle_controller.py
UTF-8
1,980
2.8125
3
[]
no_license
from optimal_control_framework.controllers import AbstractController import numpy as np import sys class AccUnicycleController(AbstractController): # Goal (p, pdot, pddot) _xd = np.array([0, 0, 0, 0, 0, 0]) # kp, kd _gains = np.array([1,1]) _tol = 1e-4 def __init__(self, dynamics): super...
true
f2b47977868294213295e3455547d2789ec63c6c
piyushkumar102/Problem-Solving
/Arrays/next_palindromes.py
UTF-8
585
3.421875
3
[]
no_license
n = input() number = int(n) if (number >= 1 and number <= 9999): x = number x = str(x) y = x[::-1] if (x == x[::-1]): print(x) if (number < 1000): print("110\n220\n330\n440\n550\n660\n770\n880\n990") for i in range(number + 1, 10000): x = int(i) x = s...
true
858e28075f17aab57ba4838a8f4834160a44b1c5
PsiQ/gdsfactory
/pp/components/coupler2.py
UTF-8
972
2.5625
3
[ "MIT" ]
permissive
import pp from pp.component_from_yaml import component_from_yaml from pp.component import Component from pp.name import autoname @autoname def coupler( wg_width: float = 0.5, gap: float = 0.236, length: float = 10.007 ) -> Component: pp.drc.assert_on_1nm_grid(length) pp.drc.assert_on_2nm_grid(gap) n...
true
88cc8d9c7b388cdc2bca242484861b4055598677
cordeirolibel/RPI
/T06/exercicio_cifar10_keras.py
UTF-8
4,235
2.625
3
[]
no_license
from keras.callbacks import LearningRateScheduler from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import MaxPooling2D from keras.layers import Input, Dropout, Flatten, Dense from keras.layers.convolutional import Convolution2D from keras import backend as K...
true
992486d02d55b2510b32ebd59f2a11f9ec202ca7
dluciv/python-intro-course
/docs/examples/02.5.typing/typeguard_bug.py
UTF-8
464
3.125
3
[]
no_license
#!/usr/bin/env python3 from typeguard import typechecked import typing @typechecked def handle_strings_or_ints_py_3_10(values: list[str | int]) -> str: return "OK: " + " + ".join(map(str, values)) @typechecked def handle_strings_or_ints_py_3_9(values: list[typing.Union[str | int]]) -> str: return "OK: " + " ...
true
d33f3bd99b36a9ef6df269ebd99081ff815aacb8
arianrasyidd/Hello_Python
/Explore_Module_1/self_practice_13.py
UTF-8
1,451
2.734375
3
[]
no_license
# data = open('data_penjualan_motor_honda_2014_2018.csv', 'r') # print(data.readable()) # files = data.readlines() # pre_header = (files[0].split(',')) # pre_header[-1] = pre_header[-1][ :-1] # print(pre_header) # header = pre_header.index(::) # print(header) # print(header[1]) # for title in files[0]: # dict(row)...
true