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
097c1844118e44db0ae8e55ff0d9f1354e148d23
leeowen/sketch-based-modeling
/Blending_Project/scripts/cross_section_extract_cmd.py
UTF-8
12,746
2.9375
3
[]
no_license
# cross_section_extract_cmd.py # # DESCRIPTION: # # Produces the MEL "crossSectionExtract" command. # # To use the command, select the joint and mesh that you want data for and # then type the command, being sure to use the -mu/-myUParameter flag to specify # the location on the Joint where a ray will cast out ...
true
756705097557bc6db6cdcce8cb16fd635201ff84
pradyyadav/KnowDigit
/dl/digit_detection.py
UTF-8
618
2.515625
3
[]
no_license
import numpy as np import cv2 import tensorflow as tf from pathlib import Path BASE_DIR = Path(__file__).resolve().parent def digit_detection(image_path): pred = tf.keras.models.load_model(str(BASE_DIR)+'/final_model') image = cv2.imread(image_path,0) image = cv2.resize(image,(28,28)) image = np.array...
true
c19deafccc1a88da2b0f3fd5f38ccc7173e277e8
PtspluS/Jeu_Python
/src/Game_Object/Personnages/Personnage.py
UTF-8
2,164
2.71875
3
[]
no_license
import pygame from src import Global from pygame.locals import * class Personnage: max_hp = 100 max_speed = 1 def __init__(self, img, nom, desc, inventory, vie=100, PO=5000, posX=0, posY=0, lvl=1,PA=6,PA_max=6): self.img = img self.name = nom self.desc = desc self.hp = v...
true
11763628d5b4bc6bf6791512686120726636ba5b
aayanaziz/Portfolio
/LTS_SL.py
UTF-8
573
2.65625
3
[]
no_license
#Just some contants that can be changed later #Point mass sim, # All units are SI m = 320 mu = 1.6 cl = None cd = 0.267 ar = 1.3 g = 9.81 r = 0.226 rho = 1.23 s = 1 u = 0 T = 0 t = 0 S = 0 # straight line loop while S<80 : Fxt = mu*m*g #print(Fxt) Fxd = 0.5*rho*ar*(u**2)*cd #print(Fxd) acc = ...
true
7ec822625c92375e8d896e391d9e29f135d560bf
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/1016.py
UTF-8
622
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- f = open("A-small-attempt0.in") T = int(f.readline()) for t in range(T): a = int(f.readline()) for i in range(1, 5): s = f.readline() if i == a: firstset = set(map(int, s.split(" "))) b = int(f.readline()) for i in range(1, 5): s = f.readline...
true
a2c2f865de610a7823f29751e3b7f48ccfcbb8a3
minginggg/ai_project
/json_ex.py
UTF-8
1,399
2.984375
3
[]
no_license
import json import getpass def read_json(): with open('students.json','r',encoding='utf-8') as json_file: json_data = json.load(json_file) return json_data def write_json(json_data): with open('students.json','w',encoding='utf-8') as jsonfile: json.dump(json_data, jsonfile, ensure_ascii...
true
7841e074d309bfc382cfaa6a1dc25213cd88a2e7
Pandinosaurus/actuariat_python
/src/actuariat_python/data/geocoding.py
UTF-8
7,301
2.796875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ @file @brief Various function to download data about **French** elections. """ import os import warnings import pandas import numpy def geocode(df, col_city="city", col_place="place", col_zip="zip", col_address="address", col_latitude="latitude", col_longitude="longitude", col_...
true
f14c1bee0bb9c1c69d61af07718bb2ded1efcc53
activehuahua/python
/pythonProject/requestsDemo/request-ep4.py
UTF-8
1,360
2.890625
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' @Author : zhaojianghua @File : request-ep4.py @Time : 2018/12/12 18:09 @desc : ''' import requests, re,string import urllib.request header = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.10...
true
f49674efc4e1d1c77ce394f34f961b6220b31506
mcc-sw-eng-course/python-programs-Sr-samuel
/L3/test_filecmp_cmp.py
UTF-8
5,385
3.484375
3
[]
no_license
""" Matricula: AA00354798 Nombre: Samuel Solorzano Ramirez Maestro: Dr. Gerardo Padilla Materia: Analysis, Design, and Construction of Software Systems L3 - 19 Given the filecmp.cmp function Define a set of test cases that exercisethe function (Remember RightBICEP) """ import unittest from filecmp import ...
true
8d8bc0661cfd647b38384b1e59896d10b39dd9cb
igormorgado/seismic
/oldsrc/veryold/wave1d.py
UTF-8
930
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Apr 16 13:37:33 2016 @author: morga """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as anim import cython from scipy import signal dx=0.01 dt=0.05 tmin=0.0 tmax=2.0 xmin=-5.0 xmax=5.0 c=1.0 rsq=(c*dt/dx)**2 nx=int(...
true
edc981d63c534662ca23aae453121aa51bfda7c3
alehpineda/flask_bootcamp
/04-Flask-forms/00-Flask-forms-basics.py
UTF-8
874
2.875
3
[ "MIT" ]
permissive
from flask import Flask, render_template # Imports for the forms from flask_wtf import FlaskForm from wtforms import StringField, SubmitField app = Flask(__name__) # config secret key app.config['SECRET_KEY'] = 'my_super_secret_key' # declare form class class InfoForm(FlaskForm): breed = StringField('What Breed...
true
263fb2cc12df01bd7fde4affbe3d0a6f6e9c0835
gitswovi/gits-coding
/python/pitop/myOLEDclock.py
UTF-8
1,229
3.25
3
[]
no_license
#!/bin/python3 # From https://pi-top-pi-top-python-sdk.readthedocs-hosted.com/en/latest/api_miniscreen/oled.html #import libraries from pitop.miniscreen import OLED from datetime import datetime # Displaying a clock on the OLED: oled = OLED() oled.set_max_fps(1) canvas = oled.canvas clock_face_box = canvas.get_bou...
true
55270a92ee144008d5bac3c8de3430220561a1d8
akshaynaik797/mail_processing_date_range
/temp.py
UTF-8
371
2.828125
3
[]
no_license
import signal from time import sleep timeout = 1 class TimeOutException(Exception): pass def alarm_handler(signum, frame): print("ALARM signal received") raise TimeOutException() while 1: try: signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(timeout) sleep(10) ...
true
b2f264c3553c0684d8ed89f38945b9b8ddb78918
Aasthaengg/IBMdataset
/Python_codes/p02837/s635805049.py
UTF-8
875
2.796875
3
[]
no_license
n = int(input()) a_list = [] person_list = [] syogen_list = [] ans = 0 for i in range(0, n): w = [] v = [] a = int(input()) for j in range(0, a): x,y = map(int,input().split()) w.append(x) v.append(y) person_list.append(w) syogen_list.append(v) #print(person_list) #prin...
true
eae856e6912ccd9b87dd3e960308e51c1ea00563
AlekhyaRanabothu/TextClassification
/clustering.py
UTF-8
2,357
3.03125
3
[]
no_license
from sklearn.cluster import KMeans, AgglomerativeClustering from sklearn import metrics from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 from sklearn.datasets import load_svmlight_file import warnings import matplotlib.pyplot as plt warnings.filterwarnings('ignore') #...
true
d3c4ab2bd9c10e302cfa79d7d33b7c5668b83b48
Balaji-Govindaraj/Artificial-Intelligence
/logistic_regression.py
UTF-8
917
2.9375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt x=np.matrix('1 1;1 2;1 9;1 4;1 7;1 6;1 11;1 8;1 19;1 10;1 21;1 12;1 13;1 14;1 5;1 16') y=np.matrix('0;1;0;1;0;1;0;1;0;1;0;1;0;1;0;1') test_x=np.matrix('12;3') theta=np.matrix('0.01;0.01') learning_rate=0.001 iterations=100 m=len(x) for i in range(iterations): t=theta[...
true
337be33dcbe77d08b0548513ad869a22132aef45
L200183103/Praktikum-Algopro
/Activity 3.py
UTF-8
2,484
3.5
4
[]
no_license
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> Name = 'Luckyta Afia Susanto' >>> NIM = 'L200183103' >>> X = '1' + NIM[7:] >>> a = int(X) >>> b = len(Name) >>> type (a) <class 'int'> >>> ##because ...
true
330b9e1b71b316b190b2fe793622d575dbb02d81
Waldemar-Makalafen/Lecture_1
/Dl Academy/Лекция_первое_занятие/5занятие/easy/PN3.py
UTF-8
225
3.234375
3
[]
no_license
lst = [] a = int(input()) b = int(input()) c = int(input()) d = int(input()) lst.append(a) lst.append(b) lst.append(c) lst.append(d) lst1 = [x for x in lst if x >= 0 and x%4 and not x%3] print(lst1)
true
42b23535471303561ad1474ff63996dbefe755f2
lszyman/PressNotePropagation
/wordcount.py
UTF-8
2,151
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- #!/usr/bin/env python import os import re import sys import codecs from nltk import download from nltk.corpus import stopwords from nltk.stem.snowball import SnowballStemmer class WordCount: def __init__(self, language): self.stopwords = self.load_stopwords(language) self.parse_regexp = r...
true
bb7b6d80d856fe8aeb4ecda652a81f4907b38f39
drsnallapati/AWP_Project_Lightward
/game_over.py
UTF-8
4,418
2.953125
3
[]
no_license
import pygame from pygame.locals import KEYDOWN, K_RETURN, MOUSEBUTTONUP import level_one import level_two import level_three class GameOver: def __init__(self, screen, text="You found your way! Thanks for playing!", replay=1, retry=False): self.screen = screen self.screen_width = screen.get_width(...
true
2f943442ef27db9b50e7a5fb566376d7344144bd
mucheniski/curso-em-video-python
/Mundo1/003TratandoDadosEFazendoContas/009Tabuada.py
UTF-8
153
4.03125
4
[]
no_license
numero = int(input('Informe o número: ')) cont = 1 while cont <= 10: print('{} x {} = {}'.format(numero, cont, (numero * cont))) cont += 1
true
eb110d43223ea71e4eb991e85db7663274f40f62
nryant/tensorflow_mnist_examples
/mnist_lib/datasets/datasets.py
UTF-8
3,655
3.21875
3
[ "Apache-2.0" ]
permissive
"""Classes and functions for generating minibatches of examples for training. """ import numpy as np; __all__ = ['Dataset']; _METHODS = set(['sequential', 'random_slices', ]); class Dataset(object): """Iterator over minibatches of examples. Parameters ---------- feat...
true
e47cd0f87242409879e537e490edf6cdad51a08d
ALEJANDRAPONCE2116/FUNDPROG_EVA1
/EVA1_9_AREAS/EVA1_9_AREAS-Python/src/eva1_9_areas.py
WINDOWS-1250
519
3.4375
3
[]
no_license
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. __author__ = "Isela Alejandra Ponce de Leon Carrasco 18550720" print("vamos a calcular el area de un trapecio") print("Ingrese la base mayor") ...
true
24eddb1d298942d33163b8b20b2893d478788775
karshil2309/special-repo
/ECE_2020/Compression.py
UTF-8
4,070
2.765625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import wave import sys import math import contextlib from pylab import* from scipy.io import wavfile import pyaudio import wave,sys import numpy as numpy import matplotlib.pyplot as plt fname = r'C:\Users\91910\Desktop\ECE\r.wav' outname = 'filtered.wav' cutOffFreq...
true
f0115311e2a15cf46967a6ea607badd0490d4ea8
liquidise/ProjectEuler
/Problem81.py
UTF-8
636
3.171875
3
[]
no_license
file = open( 'assets/matrix.txt' ) matrix = [] for line in file: numbers = line.split(',') numbers = [ int( i ) for i in numbers ] matrix.append( numbers ) max_index = len( matrix ) - 1 row = max_index column = max_index while row >= 0: while column >= 0: if row < max_index and column < max_index: matrix[ r...
true
d0f21c589a7c903f0e2e3af4052af950ff0d7183
ignagonz99/project-FitEat
/app.py
UTF-8
13,491
2.53125
3
[]
no_license
import tkinter as tk import tkinter.ttk as ttk import operations height = ['50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86',...
true
ce813e44f5c58d065042b5fd38f744b525bee01a
LegenDAirie/python-noc
/lib/vector.py
UTF-8
4,017
4
4
[]
no_license
from random import randint, random import math class Vector(object): """ a basic vector class used for creating 2D vectors""" def __init__(self, x, y): self.x = x self.y = y # str(a) def __str__(self): return "[" + str(self.x) + ", " + str(self.y) + "]" # repr(a) or print(...
true
990a4f11a0a3f4363d2398e14c8d049a4e0f7cda
Student-A/Quantum-Team-14
/buttons.py
UTF-8
8,135
2.8125
3
[]
no_license
import pygame from pygame.locals import * import math def collide_w_mouse(x, y, recto): rect =pygame.Rect(recto) if (x > rect.left) and (x < rect.right) and (y > rect.top) and (y < rect.bottom): return True else: return False def draw_button(window, bdy, buttontype, color,...
true
f817a2805fac35c099e72be95c9f9efa3b42ef36
hemal507/CS-Algorithms
/test_reverseSentense.py
UTF-8
413
2.90625
3
[]
no_license
import reverseSentence def test_case1(): assert reverseSentence.reverseSentence("Man bites dog") == "dog bites Man" def test_case2(): assert reverseSentence.reverseSentence("IHateSpaces") == "IHateSpaces" def test_case3(): assert reverseSentence.reverseSentence("a b c") == "c b a" def test_case4(): ...
true
b6b2062c5c942ae0a49a1399c974f35f649c0c7e
Sohan2133/Python-practice
/lecture2/grade.py
UTF-8
349
3.0625
3
[]
no_license
mark=int(input("give a positive number:")) if mark > 100 or mark < 0: print("Wrong input") elif mark>=80: print("it is A+") elif mark>=70: print("it is A") elif mark>=60: print("it is A-") elif mark>=50: print("it is B") elif mark >= 40: print("it is C") elif mark >= 33: print("it is D") el...
true
a845e434c02cadb585b3f3b5ae690700a29b0c09
TanayGahlot/Wanderlust
/geocodePlaces.py
UTF-8
1,169
2.90625
3
[]
no_license
#oggpnosn #hkhr #extracting geolocation from urllib import urlencode from urllib2 import urlopen import json import sys key = "AIzaSyBk21CHntg-QcGbm4l4wq5L0hhV5AKNbGA" def getGeocode(searchTerm, key): searchTerm = searchTerm.lower().replace("nr", "").replace("at", "") url = "https://maps.googleapi...
true
16e3552591e3d5508adc70e9f409f02e395054ce
lukasz-marek/za2017
/lab1/graham_scan.py
UTF-8
3,266
3.59375
4
[]
no_license
import math import lab1.parser as parser EPSILON = 0 def find_new_origin(coordinate_tuples_list): # origin - min x, min y (bottom left) return min(coordinate_tuples_list) def create_cartesian_to_polar_converter(origin_tuple): origin_x, origin_y = origin_tuple def convert(coordinate_tuple): ...
true
01b0252e86c39d9cfe44a3376e1d30f497ec07be
agryan/datetools
/datetools/tests/test_gaps.py
UTF-8
1,175
3.28125
3
[ "MIT" ]
permissive
# pylint: disable=C0111 # pylint: disable=C0103 import unittest import datetools class TestGaps(unittest.TestCase): def test_gaps_given_single_missing_date_returns_list_containing_date(self): dates = ["20140101", "20140103"] result = datetools.gaps(dates) expect = ["20140102"] self...
true
d337036370a8e61601cc1607f4be9f10148a7395
Divisekara/Python-Codes-First-sem
/Project Euler Problems/pe21.py
UTF-8
217
3.046875
3
[]
no_license
def d(n): sum_=0 for i in range(1,n): if n%i==0: sum_+=i return sum_ sum_2=0 n=1 while n<10000: if d(d(n))==n and d(n)!=n: sum_2=sum_2+n n+=1 print sum_2 #40284
true
4f614c26ee273188b5cfd9cf27359a6996f1a64d
jocompto/PythonDev-
/Assignment7.1/Assignment101.py
UTF-8
1,202
3.53125
4
[]
no_license
# Using Python 3.x # Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line: # From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 # You will parse the From line using split() and print out the second word in the line (...
true
8166dc3409463b10cc18f4a665f3f7ef33c50431
Dushmanta/Python
/SearchText.py
UTF-8
308
3.109375
3
[]
no_license
#Find the specific word in a paragraph fh = open('/Users/dushmantakumar/Qbot/q_bot/cont_matching/base_files/file1.txt','r') word = input ("Enter the word to search:") s = " " count = 1 while(s): s = fh.readline() L = s.split() if word in L: print("Line number",count,":",s) count+=1
true
a579776fc5d9579b4f04314807863fede06da753
aarontaylor/FizzBuzz
/FizzBuzzFunc.py
UTF-8
155
3.328125
3
[]
no_license
__author__ = 'taylorak' for i in range(1, 101): words = [word for n, word in ((3, 'Fizz'), (5, 'Buzz')) if not i % n] print(''.join(words) or i)
true
62f15e6753e8babbe932833757cdacf780582fce
Gabiiii/study_python
/02-2. 문자열 자료형/02-2-10.py
UTF-8
50
2.546875
3
[]
no_license
ch='a:b:c:d' ch=ch.split(':') print('#'.join(ch))
true
b8c722e542fdca5858df8d54057b9575fe370519
Anwar91-TechKnow/PythonPractice-Set1
/Stings and Class.py
UTF-8
365
3.5625
4
[]
no_license
#strings '''Multi Line Comment ''' #here i have cover below functions including join import time a='ANWAR AZAM SHAIKH' print("The string which used:" ,a) print('a[2]= ',a[2]) print('a[2:6]= ',a[2:6]) print('a[:2] = ',a[:2]) print('a[2]+Annu = ',a[2]+'Annu') #below is the class b='Anwar' c=23 d=509.3 print(type(a)) pri...
true
d5b77915b65a54b9e4dc205c75bf6a52402f886e
a87150/learnpy
/collections_learn.py
UTF-8
622
3.21875
3
[]
no_license
from collections import defaultdict, namedtuple websites = [ ('Sohu', 'http://www.google.com/', '张朝阳'), ('Sina', 'http://www.sina.com.cn/', '王志东'), ('163', 'http://www.163.com/', '丁磊') ] WebSite = namedtuple('Website', ['name', 'url', 'founder']) for website in websites: website = WebSite._make(website...
true
d83b0157e72012d140a459188ec3ab3fbac766ab
zuko56/Projetos_Python
/condiçoes aninhadas.py
UTF-8
350
3.578125
4
[]
no_license
nome = str(input('Digite seu nome: ')).strip().lower() if nome == 'guanabara': print('Curso em video') elif nome == 'joão' or nome == 'maria' or nome == 'josé': print('Seu nome é popular no brasil') elif nome in 'ana' or 'cláudia' or 'silva': print('Nomes femininos populares') else: print('Fon') print('...
true
b64fa43b9158857d75f70a847ade86756a9dbbbb
solartune/async_demo
/application/decorators.py
UTF-8
436
2.5625
3
[]
no_license
from aiohttp.web import json_response class login_required: """ Trying to find user in the request if he trying to access to an end-point. If user didn't found returns 401 code. """ def __init__(self, func): self.func = func def __call__(self, request): if not request.user: ...
true
b6bd62127214d6ffa043f98f547b0c2635344041
robkeim/random
/AdventOfCode/2020/day05.py
UTF-8
1,275
3.53125
4
[]
no_license
def part1(): print(max(parse_boarding_passes())) def part2(): boarding_passes = sorted(parse_boarding_passes()) prev = boarding_passes[0] for i in range(1, len(boarding_passes)): if boarding_passes[i] != prev + 1: print(prev + 1) return prev = boarding_passes...
true
01fbc4d3b34a3b998cb432a12e39e7aec42a21d3
ah16336/PythonPractice
/ChristmasPractice/ChristmasPractice/ChristmasPractice.py
UTF-8
6,326
3.234375
3
[]
no_license
import seaborn as sns from matplotlib import pyplot as plt import numpy as np import pandas as pd from sklearn.model_selection import train_test_split def rate_score(classy, x_test, y_test): score = classy.score(x_test, y_test) score = round(score, 3) print("Score:", score) if score > 0.9: prin...
true
5ce850534e905b19277b901b684a1e95ddb9808d
taoing/python_code
/2.4 thread/06_process异步.py
UTF-8
828
2.890625
3
[]
no_license
from multiprocessing import Pool import os import time def test(): print('subprocess %s is running, parrent process is %s' % (os.getpid(), os.getppid())) time.sleep(1) print('subprocess ended and return something.') return 'my pid %s' % os.getpid() # 回调函数,其参数为函数test运行后的返回值 # test函数所在子进程执行完之后,父进程立即开始执行...
true
e427536b2869a587eca867c75b224b5afedb9bde
gouwschristo/templar
/templar
UTF-8
1,052
3.078125
3
[]
no_license
#!/usr/bin/python from jinja2 import Template import sys import json def main(): try: template_file = open(sys.argv[1]) template_data = template_file.read() template_file.close() except: print("Unable to read template file.") sys.exit(1) data = {} input = "" if len(sys.argv) < 3: # Check if there's d...
true
76146bd6e0875e8285944ffbd742d8c7638b8d59
liamcoau/challenge
/lib/tasks.py
UTF-8
10,841
2.890625
3
[ "Apache-2.0" ]
permissive
#This file is only to be run by celery from __future__ import absolute_import import datetime import json from lib.celery import app as celery from pymongo import MongoClient #Access the database for the files client = MongoClient() db = client["files"] entries = db["entries"] SUPPORTED_FORMATS = ".txt or .j...
true
3a3b73e5d385ac42d86d5de1bfc3bd178ef69b32
curtischong/middle_out_backend
/server.py
UTF-8
763
2.671875
3
[]
no_license
from flask import Flask, request, jsonify from PIL import Image import numpy app = Flask(__name__) @app.route('/upload', methods=['POST']) def upload(): framecount = int(request.form['framecount']) frames = [None] * framecount for i in range(framecount): img = Image.open(request.files[str(i)]).con...
true
b71b47ddba57e249d155a42ab2ec49331490a3ab
HumanCellAtlas/logs
/apps/es_idx_manager/test/test_app.py
UTF-8
3,722
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import os import unittest import yaml from app import ESException, ESCleanup import datetime class TestApp(unittest.TestCase): test_prefix_ele = '.'.join( [e for e in [os.environ.get('TRAVIS_BUILD_ID'), os.environ.get('TRAVIS_EVENT_TYPE')] if e] ) index_prefix = f"test{('.' ...
true
3255058d08c87a84b86fa4f57bb07ba673fa62c2
a1864754/python
/大二一些代码/复利.py
UTF-8
229
3.21875
3
[]
no_license
import copy sum1 = 1000 day = 1 while day <= 365: if day % 30 == 0: sum1 += 500 sum = sum1 * (1 + 2.78 / 100) day += 1 print("结果为: ", sum1) print("") one = [1, 2, 3] two = copy.deepcopy(one) print(two)
true
cc50ef320d6a133a42cb0b68122659e3181898c0
Seraphina11/Predicting-stock-prices-technocolabs
/resamplingOfS1_2.py
UTF-8
1,022
3.09375
3
[]
no_license
#Amazone stock price prediction import inline as inline import matplotlib import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib.dates as mdates # reading CSV file s1=pd.read_csv(".\HistoricalData_AMZN.csv") # seting date as a index s1_2=pd.read_csv(".\...
true
2777266a3a07b659a9e271891c490f0f09f0b70d
acid9reen/Artezio
/Lesson_6/task1.py
UTF-8
609
4.375
4
[]
no_license
'''Even iterator''' class EvenIterator: '''Even iterator''' index = -1 def __init__(self, list_): self.list_ = [list_[x] for x in range(0, len(list_), 2)] def __iter__(self): return self def __next__(self): self.index += 1 if self.index < len(self.list_): ...
true
d0cac00fb689cf78c8f83baf36839b81cd885eb1
mx1001/animation_nodes
/algorithms/perlin_noise.py
UTF-8
1,058
2.90625
3
[]
no_license
from . random import getUniformRandom # setup a cache for faster results smoothNoiseCacheSize = 50000 smoothNoiseCache = [] for i in range(smoothNoiseCacheSize): smoothNoiseCache.append(getUniformRandom(i, -1, 1)/2.0 + getUniformRandom(i-1, -1, 1)/4.0 + getUniformRandom(i+1, -1, 1)/4.0) # http://freespace.virgin....
true
dccbd96b8c9add9a2d696dba12430d663eb5d117
diptiw/pandas
/pandas/tests/frame/indexing/test_sparse.py
UTF-8
582
2.859375
3
[ "BSD-3-Clause" ]
permissive
import pandas as pd import pandas._testing as tm from pandas.arrays import SparseArray class TestSparseDataFrameIndexing: def test_getitem_sparse_column(self): # https://github.com/pandas-dev/pandas/issues/23559 data = SparseArray([0, 1]) df = pd.DataFrame({"A": data}) expected = p...
true
b238a4136192a71bf8977fb4b6924fee26356e25
David-Lor/pysgapi
/pysgapi/finders.py
UTF-8
5,212
2.859375
3
[ "Apache-2.0" ]
permissive
"""FINDERS Functions to find giveaways and parse them """ # # Native # # import random from argparse import Namespace from time import sleep # # Package # # from .assets import Giveaway from .helpers import steam_url_to_id, string_numbers_only, calculate_probability def _parse_giveaways(kwargs): """Parse a HTML...
true
f3f554f52bd5851c7e902c7a1a370842f51f0594
JoseAstrain/Healthy-Ship
/licenses_reader/prueba2.py
UTF-8
1,750
2.734375
3
[]
no_license
import numpy as np import cv2 from matplotlib import pyplot as plt import math import pytesseract def adjust_gamma(image, gamma=1.0): invGamma = 1.0 / gamma table = np.array([((i / 255.0) ** invGamma) * 255 for i in np.arange(0, 256)]).astype("uint8") return cv2.LUT(image, table) def recognize_text(imag): i...
true
9d6848de8ef9d7b022f14a0482eb1d4c68b254ef
recursecenter/coding-bee
/problems/medium.py
UTF-8
2,497
3.859375
4
[ "MIT" ]
permissive
# original problems def med_is_hex(s): """Takes a string and returns whether all characters of the string are contained within [0123456789abcdef] - assume lowercase abcdef.""" return set(s) <= set('1234567890abcedf') def med_is_decimal(s): """Takes a string and returns whether all characters of the string...
true
5170de0aacd1f1e53cd8480c0dccb63428836b80
xmy1208945213/MQTmine
/temp.py
UTF-8
12,007
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- # 读取txt文本, 数据预处理 # import random # # [Error] 141 行 # # 矩阵最后一列 # for item in matrix.keys(): # matrix[item][-1] = sum(matrix[item][0:-1]) # if matrix[item][-1] >= minSup: # freqItem.append(item) # # # # [Error]144 line # if matrix[item][-1] >= minSup and item not ...
true
c62557ff2febf2eaad9437c15aeaa60d41f443f6
Mowareking/Space-Raiders
/player.py
UTF-8
11,714
2.671875
3
[]
no_license
from data.core_funcs import * from data.mine import * from data.bullet import * from data.laser import * from data.crate import * import pygame import math class Player(pygame.sprite.Sprite): def __init__(self, win, img, bullet_img, bullet_icon, pos, angle, color, controls, player): super(Playe...
true
7cce95b0ef5b745a123fd1dc4a7729536f61a7a3
Fumiya-K/ros_myo
/research/new/subscribers.py
UTF-8
1,641
2.5625
3
[ "MIT" ]
permissive
#! /usr/bin/env python # -*- coding: utf-8 -*- import rospy from ros_myo.msg import EmgArray from std_msgs.msg import Float32 import serial class EmgSubscribers(): def __init__(self): self.subscriber = rospy.Subscriber('/myo_raw/myo_emg', EmgArray, self.callback) self.message = EmgArray sel...
true
9cc7ca2c9d4356d55f6ae907b905a440f4b4afbb
cha63506/ProxyMonitor
/cgi-bin/acceso.py
UTF-8
1,077
2.609375
3
[]
no_license
#!/usr/bin/env python3 import cgi, cgitb cgitb.enable() import lib.mi_html as mi_html import lib.core as core mi_html.insertar_content_type() usuario_auth = b'YWRtaW4=' password_auth = b'YWRtaW4x' def validar_usuario_y_contrasenia(correcto = False): # Obtener campos del formulario campos = cgi.FieldStorage...
true
e72ac88266f03c7a1ecfb85eeda17536b93d3305
abeaumont/competitive-programming
/atcoder/abc088/b.py
UTF-8
256
2.859375
3
[ "WTFPL", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python2 # https://abc088.contest.atcoder.jp/tasks/abc088_b n = input() a = map(int, raw_input().split()) a.sort(reverse=True) s1 = 0 s2 = 0 for i, k in enumerate(a): if i % 2 == 0: s1 += k else: s2 += k print s1 - s2
true
182198df97c965779b2fda7ec19094aa1900fcd5
ngcaonghi/neuron_similarity
/src/louvain.py
UTF-8
9,222
3.59375
4
[]
no_license
import numpy as np from collections import defaultdict from itertools import combinations from copy import deepcopy class Vertex(object): ''' Class for a weighted vertex in a community graph. Attributes: parent: Vertex this Vertex's parent, i.e. representative of the community this Vertex ...
true
3027dc38985a6c408850b255d463b74e4651029f
hellion86/pythontutor-lessons
/4. Цикл for/Факториал.py
UTF-8
438
3.484375
3
[]
no_license
''' Условие Факториалом числа n называется произведение 1 × 2 × ... × n. Обозначение: n!. По данному натуральному n вычислите значение n!. Пользоваться математической библиотекой math в этой задаче запрещено. ''' n = int(input()) s = 1 for i in range(2,n+1): s = s * i print(s)
true
e8503a78a28b1e5356c0a7d252161e9d3d97dcb8
ikekontomah/TriviaNight
/backend/datagen.py
UTF-8
1,329
2.90625
3
[]
no_license
from unidecode import unidecode import json import os myData = {} data_file = open("Questions") lines = data_file.readlines() for i, line in enumerate(lines): try: if("(" in line and ")" in line and "+" in line): countryCode = line[line.index("+")+1:line.index(")")] myData[countryCode] = {} for topic in ...
true
61e9d40f1516c96914047242e7b3c2ab785484b9
B1sounours/leon
/skills/productivity/todo_list/src/lib/db.py
UTF-8
2,311
2.78125
3
[ "MIT" ]
permissive
from time import time import utils # Skill database db = utils.db()['db'] # Todo lists table db_lists = db.table('todo_lists') # Todos table db_todos = db.table('todo_todos') # Query Query = utils.db()['query']() # Time stamp timestamp = int(time()) def create_list(list_name): """Create list in DB""" db_lists....
true
c9e3039f85ffd70998feab0cd28d2dc067823dd0
mbindadavid/Python
/PracticeProject2.py
UTF-8
301
3.359375
3
[]
no_license
def comma_and(list_value): if len(list_value) == 0: return "" elif len(list_value) == 1: return str(list_value[0]) else: return ', '.join(map(str, list_value[:-1])) + ' and ' + str(list_value[-1]) list1 = ['python','php','sql','js','C'] print(comma_and(list1))
true
5c0e51806bdb44d645d72fffe3f1f3f86e5e4d90
monk-blade/web_fetcher_python
/gktoday.py
UTF-8
1,274
2.765625
3
[]
no_license
from urllib import urlopen from BeautifulSoup import BeautifulSoup import re import urllib2 # Copy all of the content from the provided web page webpage = urlopen('http://www.gktoday.in/gk/general-knowledge-quizzes/').read() # Grab everything that lies between the title tags using a REGEX #patFinderTitle = re.co...
true
f508ed6f0a9aeb8eb9001d266f5e1ce5511735f3
Dmi3y888/Project-Sky
/Tasks/Task1/Homework1/PersonSql.py
UTF-8
5,291
3.15625
3
[]
no_license
import sqlite3 from datetime import datetime conn = sqlite3.connect("db1.sqlite") cursor = conn.cursor() class Person: def __init__(self, full_name, birth_date): self.full_name = full_name self.birth_date = birth_date self.id = None def __repr__(self): return 'Full name of p...
true
4256f9d3fa084ad73a1445b34be6530d71de5a1f
CSA-DJH/CompSci1DJH
/namecheck.py
UTF-8
496
3.59375
4
[]
no_license
#daniel Herbowy #checking names import os os.system("clear") infile=open("/storage/sdcard0/Download/namelength.txt", "r") afile=infile.readlines() for i in range(6): #for loop that runs 6 times x=afile[i].split() #splits the list num1=(int(len(x[0]))) #gets the length of the name num2=(int(afile[i+6])) ...
true
43085ef0742156b834f81c72c163efb15878f7db
masnursalim/belajar-python
/09_booleans/fungsi_bool.py
UTF-8
204
3.03125
3
[]
no_license
print(bool("Python")) print(bool(30)) print(bool(["Apel", "Jeruk", "Mangga"])) print() print(bool(False)) print(bool(None)) print(bool(0)) print(bool("")) print(bool(())) print(bool([])) print(bool({}))
true
b7e5dde0343f9a69960b179760d4eee2d4986ab5
bjpatterson/graceful-spiders
/Scripts/GracefulSpiderEnumerator.py
UTF-8
3,945
3.328125
3
[ "MIT" ]
permissive
""" Generates all possible graceful spiders in a sane order """ import GraphUtils.Graph as Graph import time OUTPATH = 'results/spider_enum_order_{0:0>3}.txt' def is_unique_graceful_spider(graph): """ Given a graceful graph, detect whether it's a spider. (Some special logic detects and rejects certain ty...
true
ffab0422238b6690aa0f997aa3edde618cca89f3
mgoel283/pod3_repo
/samson_adeymi/tip_calculator.py
UTF-8
2,282
4
4
[]
no_license
''' my tip calculator will ask the patrons to enter the cost of their meal, the number of people splitting the bill, and how much they are willing or able to tip percentage wise. the calculator will then give the user the total of the bill (tip included) and the sum each person is required to pay. ''' '''veriables that...
true
5763af6ce4735689e561ca1e485ac1ec8c86c398
gadamslr/U1C3b-Read-a-file-Python
/transcript2.py
UTF-8
469
3.3125
3
[]
no_license
transcript1 = open("transcript1.txt", "r") transcript2 = open("transcript2.txt", "r") readtrns1 = [] readtrns2 = [] for line in transcript1: readtrns1.append(line.strip()) for line in transcript2: readtrns2.append(line.strip()) transcript1.close() transcript2.close() lengthtrans01 = len(read...
true
700f0e183e650f210cb425003173b45faf41b138
iamkucuk/further_investigation_of_football_data_analysis
/data/match_goal_statistics.py
UTF-8
7,047
3.3125
3
[]
no_license
## Importing required libraries import sqlite3 import pandas as pd import seaborn as sns import itertools from time import time import warnings warnings.simplefilter("ignore") ## Loading all functions def get_match_label(match): ''' Derives a label for a given match. ''' #Define variables home_goals ...
true
e529480f5d5edcd07197b63b41586a48b5ef7a1c
iamhatesz/torchstruct
/test/test_utils.py
UTF-8
1,264
3.015625
3
[ "MIT" ]
permissive
import torch from torchstruct import keys, rdefaultdict, tensor_values def test_rdefaultdict_should_create_new_dictionaries_on_demand(): d = rdefaultdict() d['a']['b']['c']['d'] = 5 assert d['a']['b']['c']['d'] == 5 def test_keys_should_return_keys_of_nested_dicts(): d = { 'a':...
true
0844451ef058d02893a30961e18adcd74c138227
crisnita/University
/Programming Fundamentals/Lab 10/utils/tests.py
UTF-8
3,529
2.8125
3
[]
no_license
""" @author: Nita Andrei-Cristian @email: cristiannita99@yahoo.com @date: 11/20/2018 00:38 """ from unittest import TestCase from domain.entities import * from domain.validators import * from repository.FileRepositoryPerson import FileRepositoryPerson from repository.FileRepositoryEvent import FileRepos...
true
920b804c6176f093a2ab5740d7d7425b0f957ab1
youngf-GitHub/springboot-order-managment
/init-mysql-orderdb.py
UTF-8
3,590
2.78125
3
[]
no_license
#!/usr/bin/python import pymysql import warnings warnings.filterwarnings('ignore') def create_initial_records(cursor): """ Create initial demo records """ sql = """INSERT INTO category (NAME) SELECT %s FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM category WHERE NAME=%s)""" val = [ ...
true
4e78c2a78f8d29c3ae639b221972e8190496de82
spd94/Marvellous_Infosystem_Assignment_2
/Assingment2_7.py
UTF-8
211
3.859375
4
[]
no_license
def print_pattern(n): i=0 print("Output :") while(i<n): j=0 k=1 while(j<n): print(k,end=" ") k+=1 j+=1 print("") i+=1 print("Input :",end=" ") x=int(input()) print_pattern(x)
true
fb2ff45dfc7ce15ec35e85a9487ef2165cfb151a
nlo-edu-pl/2020-nlo-inf
/2021-02-25-matura-2020-cz1/zadanie2.py
UTF-8
119
3.359375
3
[]
no_license
def sym(a, b): if a != 0: sym(a-1, b+1) print(a*b, end=" ") sym(a-1, b+1) sym(3,1) print()
true
5b764b11ec6d2fd32bcd7a7697a65fc7c0646b19
jason-lean/CS-2620-Assignment-4
/proxy.py
UTF-8
2,580
3.1875
3
[]
no_license
# Networking & Security for Informatics - Assignment 4 # Programmer: Jason Lin # Import socket library from socket import * import time ''' Helping Functions ''' def HTTP_GET(host, port): # Declare socket clientSocket = socket(AF_INET, SOCK_STREAM) clientSocket.settimeout(1.0) # Connect ...
true
f01836c2477198d673e0a4a117e8f0af1f5c557b
bdwilliamson/spvim_supplementary
/code/sims/get_influence_functions.py
UTF-8
1,308
2.5625
3
[ "MIT" ]
permissive
# influence functions for shapley values def shapley_influence_function(Z, z_counts, W, v, psi, G, c_n, ics, measure): """ Compute influence function for the given predictiveness measure @param Z the subsets of the power set with estimates @param W the matrix of weights @param v the estimated pred...
true
318361033b4b5b9472f1067572140fd24b133046
graceolivia/book-wizard
/tests.py
UTF-8
2,344
2.921875
3
[]
no_license
import unittest import unittest.mock as mock from io import StringIO import sys from wizard import * # this printout-checking test produced with help from the good people at: # https://stackoverflow.com/questions/33767627/python-write-unittest-for-console-print def printout_tester_one_arg(function, arg): captur...
true
3ce358df4496e731410af92741a1fa145d0c76e5
blueberry686868/crawler_code
/get_data/get_tencent_data.py
UTF-8
3,767
2.859375
3
[ "MIT" ]
permissive
import requests import json import time # 获取腾讯疫情数据 def get_tencent_data(): """ :return: 返回历史数据和当日详细数据 """ url = 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5' headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.414...
true
d35e5a5ef44e8494bca41e2e2ba418acb761089b
raghavsaboo/algorithms
/sorting/selection-sort/selection_sort.py
UTF-8
372
3.609375
4
[]
no_license
def selection_sort(arr): for i in range(0, len(arr)): min_index = i for j in range(i + 1, len(arr)): if arr[j] < arr[min_index]: min_index = j if min_index != i: arr[min_index], arr[i] = arr[i], arr[min_index] if __name__ == "__main__": arr = [10,...
true
4f9e13f65baffa1639b9f684e643f8e6b6e763ee
coloriya/pypalettes
/complementary.py
UTF-8
1,425
3.046875
3
[]
no_license
import json import math from pypalettes.color import PyColor palette_types = [ None, None, "complementary", "triadic", "tetradic", "pentagonal", "hexagonal" ] s_pairs = [ [70, 30], [80, 40], [90, 50], [85, 55], [95, 65] ] l_pairs = [ [60, 40, 20], [50, 30, 10] ] index = 1 def get_ngon_palettes(n): gl...
true
c27a1195132d1848c4b4719d0f0e0f0107f3106c
deepakoshy/US-States-Guess-Game
/us-states-game-start/main.py
UTF-8
1,079
3.5
4
[]
no_license
import turtle import pandas screen = turtle.Screen() screen.title("U.S States Game") image = "blank_states_img.gif" screen.addshape(image) turtle.shape(image) states = pandas.read_csv("50_states.csv") states_list = states.state.to_list() correct_ans = [] while len(correct_ans) < 50: answer_state = screen.textinp...
true
40b3aeff59b5764e8398f8254c9b8294582aaea9
parker-allen/scripture-of-the-day
/updater.py
UTF-8
4,264
2.84375
3
[]
no_license
import urllib.request from bs4 import BeautifulSoup import pandas as pd import numpy as np import gspread from oauth2client.service_account import ServiceAccountCredentials import time def get_scriptures(url, user_agent, len_old_urls): arr1 = np.array([]) arr2 = np.array([]) arr4 = np.array([]) reques...
true
7afc99fa42182a00e190868137ce195d9057a238
sangjianshun/Master-School
/python_high_level/chapter09/iterable.py
UTF-8
446
3.53125
4
[]
no_license
# 什么是迭代协议 # 迭代器是访问集合内元素的一种方式,一般用来遍历数据 # 迭代器和以下标的访问方式不一样,迭代器是不能返回的,提供了一种惰性方式数据的方式 # 实现魔法函数 __iter__变成可迭代对象 # 再实现魔法函数 __next__变成迭代器 from collections.abc import Iterable,Iterator a = [] print(isinstance(a, Iterable)) print(isinstance(a,Iterator)) # False
true
96cc913154757fff9d80db12db995e55fb3e50f1
sahitya-pavurala/dplay
/python/problems99/p1.py
UTF-8
369
3.984375
4
[]
no_license
# find last but one element in a list import sys def find_last_but_one_element(lst): if len(lst) <= 1: print("Invalid input, Cannot find last but one element") sys.exit(1) if len(lst) == 2: return lst[0] return find_last_but_one_element(lst[1:]) if __name__ == "__main__": p...
true
dfb1d8690da596da4b029cdeb1e5c0e29b10aeaf
cocuh/macronizer
/macronizer/pipeline/remapper.py
UTF-8
3,530
2.53125
3
[]
no_license
import dataclasses import logging from typing import Dict, Generic, Optional, Set, Tuple, Type, TypeVar, Union from macronizer.consts.input_event_codes import BaseKeyEventCode, EventType, KeyEventCode, KeyEventValue from macronizer.device.structures import InputEvent, TimeVal from macronizer.pipeline.pipeline import B...
true
798d659fab57457fd914be809ff275dec7a47fa5
david-belbeze/python-csv-to-json
/__main__.py
UTF-8
6,807
3.34375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: UTF_8 -*- import argparse import csv import json import os import re import sys class TypeDescriptor: """ Abstract type descriptor used to parse data """ def parse(self, value): """ Parse the value into the right type as the type descriptor ...
true
98e25e01e173ad26695e82614388f21456e14616
MaiconRenildo/Python
/Python 2.7/Códigos/Listas/Lista3/q6.py
UTF-8
214
3.5625
4
[ "MIT" ]
permissive
i=1 total=0 while i<=5: produto=float(input('Preco do produto: ')) quantidade=input('Informe a quantidade: ') total+=(produto*quantidade) i+=1 print 'O total gasto pela empresa foi: ',total,'Reais'
true
6396c448850a7743f5e8dbaf30fa6362dd12f3ec
chirumist/Python-Practice
/python-files/health-management.py
UTF-8
1,634
3.375
3
[ "MIT" ]
permissive
import datetime def getDate(): return datetime.datetime.now() try: users = {"0": "Harry", "1": "Rohan", "2": "Hammad", "3": "Chirag"} lock = int(input("What you want lock or retrive by press 0 for retrive or 1 for lock. \n")) tasks = {"0": 'diet', "1": 'excercies'} print("Select num...
true
39baa942bce8d15f91a7d1e5b1c10559b23efb3c
cooover/Projekt1
/Menu.py
UTF-8
3,024
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- import pymysql class Menu: def __init__(self): self.conn = pymysql.connect("localhost", "root", "kurs", "wytwornia_plytowa") self.c = self.conn.cursor() print("Polączenie ustanowione") self.nav="" while(self.nav!="Q"): self.nav = input("...
true
2a6d64c4ee721a479b3c988a51f881b58051e40c
DeniSusanto/ai_skincare_advisor
/skin_tone_detection/skin_tone_detection.py
UTF-8
3,301
3
3
[]
no_license
import cv2 import numpy as np import matplotlib.pyplot as plt import imutils # ---- START FUNCTIONS ----# # display an image plus label and wait for key press to continue def display_image(image, name): window_name = name cv2.namedWindow(window_name) cv2.imshow(window_name, image) cv2.waitKey() cv2...
true
2f3a2e059ae1bed989fa2681d5c45217cc1b29f3
nk900600/Python
/week_1/Functional/Array2D/Array2DBL.py
UTF-8
1,496
4.0625
4
[]
no_license
# ---------------------------------- prg----------------------------------------------- # Array2D.py # date : 26/08/2019 # write into the file in form of 2D array array_2D = [] def method2D(row, col): # we take a empty list name array_2D initially this is empty # array_2D = [] # for loop for create n nu...
true
69f8540f295ab00279b538c3af4364e0cac7d7d8
c-yan/atcoder
/arc/arc054/arc054a.py
UTF-8
206
2.578125
3
[ "MIT" ]
permissive
L, X, Y, S, D = map(int, input().split()) d = D - S if d < 0: d += L result = d / (X + Y) if Y - X > 0: d = S - D if d < 0: d += L result = min(result, d / (Y - X)) print(result)
true
637da26b20f875e8275d92ba97b9e766a3f92ba6
ajabri/rlpyt
/selfish/model.py
UTF-8
3,348
2.703125
3
[ "MIT" ]
permissive
''' TODO 0. Central agent baseline 1. Implement shared relational encoder function (basically graph net / self-attention) 1.a. Baseline: shared MLP action decoder function 1.b. Skill Pool: action decoders indexed by key (basically a non-parametric mixture of experts) Try different gating strategies ...
true
77746fdc2eaf799840b093758266ad447ab32825
luizdefranca/Curso-Python-IgnoranciaZero
/Aulas Python/Exercícios Extras/Python Brasil/3 - Estrutura de Repetição/Ex 27.py
UTF-8
632
4.28125
4
[]
no_license
""" 27. Faça um programa que calcule o número médio de alunos por turma. Para isto, peça a quantidade de turmas e a quantidade de alunos para cada turma. As turmas não podem ter mais de 40 alunos. """ turmas = int(input("Digite o número de turmas: ")) total = 0 for i in range(turmas): alunos = int(input("Digite o...
true