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
80d3d8ecd00b55fc65e5e68632b30eeb17d95c57
tmu-nlp/100knock2017
/kurosawa/chapter06/knock57.py
UTF-8
739
2.8125
3
[]
no_license
import xml.etree.ElementTree as ET import pydot from knock53 import xml_parse if __name__ == '__main__': root = xml_parse('nlp.txt.xml') s = int(input('何行目の係り受けを出力しますか >>')) for sen in list(root.getiterator('sentence')): if sen.get('id') == str(s): edges = [] dep = sen.find(...
true
ee1e743d8faf229eeca1a9a43cccfd7542936200
Dambldore/TCPscaner
/TCPscaner.py
UTF-8
725
2.921875
3
[]
no_license
import socket from contextlib import closing import threading ips = [] with open("config.txt") as f: ips = list(f.readline().split(",")) for i in range(len(ips)): ips[i] = ips[i].replace("\n", "") ips[i] = ips[i].replace(" ", "") def check_port(ip, port): s = socket.socket(...
true
93f71ffd2804202e1758859c37c48c5181be8bce
neptunium/hello-world
/week5.py
UTF-8
463
3.171875
3
[]
no_license
import statistics as st with open('inputdata.txt') as f1: data=f1.read().splitlines() numdata=[] for i in data: numdata.append(float(i)) mo=round(st.mean(numdata),3) std=round(st.stdev(numdata),3) with open('outputdata.txt','w',encoding='utf8') as f2: line='Μέσος όρος = '+str(mo)+'\n'+'Τυπική...
true
795acd01def27483d0d977ceceb4eb016257150a
manon2012/e
/JustCodeIt/P15/composition.py
UTF-8
1,553
3.703125
4
[]
no_license
聚合(aggregation):指的是整体与部分的关系。通常在定义一个整体类后,再去分析这个整体类的组成结构。从而找出一些组成类,该整体类和组成类之间就形成了聚合关系。需求描述中“包含”、“组成”、“分为…部分”等词常意味着聚合关系。 组合(composition):也表示类之间整体和部分的关系,但是组合关系中部分和整体具有统一的生存期。一旦整体对象不存在,部分对象也将不存在。部分对象与整体对象之间具有共生死的关系。 请看下面的代码。类组合,Computer实例对象不存在了,内部组合的Cpu实例也不存在。聚合Computer实例对象不存在了,从初始化方法传入的Cpu实例不属Computer实例对象存在不存在的影响。 #! /...
true
3b3649201b05f21a2534f9ffa4dfce34e8a6203e
Cloudxtreme/HAProxy-manager-1
/manage_lb.py
UTF-8
6,123
2.546875
3
[]
no_license
""" LB manager This Script require HAProxy """ from prettytable import PrettyTable import os servers = { "s1": { 'address': '127.0.0.1:8001', }, "s2": { 'address': '127.0.0.1:8002', }, } BASE_CONF = 'base_haproxy.conf' BASE_SH = 'base_reload.sh' REAL_CONF = 'haproxy.cfg' REAL...
true
79e9604c8ccfccccf951f9379f9337ce2b7ab817
SafonovMikhail/python_000577
/001133SelfeduPy/Selfedu001133PyBeginCh03p02TASK05_20200521.py
UTF-8
255
3.140625
3
[ "Apache-2.0" ]
permissive
''' Разделите введенное с клавиатуры предложение на слова (слова разделяются пробелом) ''' str1 = 'миру мир, мир, труд, май' str2 = str1.replace(" ", ",") print(str2)
true
c7660fa2404d49fb96132964873a440d8d9f9e9d
DimaRozhko/PostgreSQL
/lab2/lab2-mvc/processing/entity/type/ItemType.py
UTF-8
2,235
2.859375
3
[]
no_license
from processing.basic import ExceptionsMVC as mvc_exc from processing.basic.ItemBasic import ItemBasic from entity.Type import Type class ItemType(ItemBasic): def __init__(self): super(ItemType, self).__init__() def create_item(self, type_id, spoil_quick, type_name): results = [] for...
true
a7b27d5fe0608f4989eb2898bd775b2a679df53b
danvk/webdiff
/webdiff/argparser.py
UTF-8
3,310
2.828125
3
[ "Apache-2.0" ]
permissive
"""Parse command line arguments to webdiff.""" import argparse import os import re from webdiff import dirdiff from webdiff import githubdiff from webdiff import github_fetcher from webdiff.localfilediff import LocalFileDiff class UsageError(Exception): pass USAGE = '''Usage: webdiff <left_dir> <right_dir> ...
true
610bf32664a8d9a4ffa5b1bed691e5e328374dea
MinbiaoHan/malmo
/code/Project 1/BFS.py
UTF-8
1,063
3.28125
3
[ "MIT" ]
permissive
# Created by Minbiao Han and Roman Sharykin # AI fall 2018 def search(maze, start, end): queue = [start] visited = set() while len(queue) != 0: if queue[0] == start: path = [queue.pop(0)] # Required due to a quirk with tuples in Python else: path = queue.pop(0) ...
true
edb7433a181343c7e03c23f3e0d41bc88a995773
yuzeqi/chat_robot
/scripts/import_data.py
UTF-8
1,626
2.640625
3
[]
no_license
import os import sqlite3 CURRENT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) DATA_DIRECTORY = os.path.abspath(os.path.join(CURRENT_DIRECTORY, "../data")) DEST_FILE = os.path.join(DATA_DIRECTORY, "./rules") conn = sqlite3.connect(os.path.join(DATA_DIRECTORY, "rule.db")) def create_database(): conn.exe...
true
3e39d4c6b6220e4f88c3434dd49c112d449c31ea
likes2addfunctions/CodeSamples
/PatternRec/gf data capture/capture over time pc.py
UTF-8
1,355
2.703125
3
[]
no_license
### Portfolio Note # This is a tool to run the google finance data capture tool every # minute during market hours. import os import datetime import time import holidays us_holidays = holidays.UnitedStates() def marketopenhelp(date,daynum,hour,minute): if date in us_holidays: print "markets closed."...
true
ca0923cd57b96c587d55c67e4ccdd20cb4ffba37
Jimmy-Xu/face-recognition-python-code
/opencv_face_recognition/1_from_image.py
UTF-8
743
3.171875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import face_recognition import cv2 # 读取图片 img = cv2.imread("./img/emotion/emotion.jpg") # 转换 BGR(opencv使用) 为 RGB(face_recognition使用) rgb_img = img[:, :, ::-1] # 识别图片中的脸部(可能存在多个脸) face_locations = face_recognition.face_locations(rgb_img) # 遍历人脸位置信息 for top, right, bottom, l...
true
18808f7c7f1704d9fa3bafc440d732a8fc6b5450
nmarriotti/SSCBS
/modules/algorithms.py
UTF-8
564
4.375
4
[]
no_license
def BinarySearch(array, x, start, end): ''' Locates a value stored in an ordered list ''' if start > end: return False # Find middle element middle = int(start + ((end - start) /2)) # Check if middle element contains x if array[middle] == x: return True # Slice l...
true
6d53fe9540b2d9925eb998dd8957526a3950f584
alkuzman/iDealHubAnalysis
/app/model/problem.py
UTF-8
323
2.671875
3
[]
no_license
from app.model.document_file import Document class Problem(Document): def __init__(self, title: str, text: str): Document.__init__(self, title, text) @classmethod def from_dict(cls, **d): obj = cls(**d) return obj def __init(self, **kwargs): self.__dict__.update(kwarg...
true
5f55e7b53f61f7c817a0d8520f2e6e686943f485
vladopp/Programming101
/week2/3/cashdesk.py
UTF-8
1,472
3.546875
4
[]
no_license
class Bill: def __init__(self, amount): self.amount = amount def __int__(self): return int(self.amount) def __str__(self): return "A %s$ bill" % self.amount def __repr__(self): return str(self) def __eq__(self, other): return self.amount == other.amount ...
true
b80910e9379a7ba2a766f79b3615d9855ecb5fb1
feddieminas/Programmr
/Python/Number_or_not.py
UTF-8
333
3.640625
4
[]
no_license
# # http://www.programmr.com/zone/python # # Number_or_not.py # ProgrammrPy # import sys if (sys.version_info[0]>=3): raw_input=input num=raw_input("Enter a number:") numchk=str(num) if all(c in '+-.0123456789' for c in numchk): print("You entered the number " + str(float(num))) else: print("That was no...
true
10c30ee78d367a56a63bcedbf3e7de0e0a36e52c
shankar7791/MI-10-DevOps
/Personel/Elankavi/python/practice/march25/inheritance_prog5.py
UTF-8
185
3.59375
4
[]
no_license
class num(): def add(self,a,b): return("Addition",a+b) class num2(num): def sub(self,a,b): return("subtraction",a-b) d=num2() print(d.add(6,7)) print(d.sub(6,7))
true
e01607bc96141e8f08e2a08cc98e57ef658c5282
wumpus/visigoth
/scripts/extract-things-from-visigoth-xml.py
UTF-8
6,175
2.609375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 from sys import argv files = argv[1:] import xml.etree.ElementTree as ET import os import re import gzip import csv import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from visigoth.findthings import findthings # XXX what did I screw up here? def process_one_file(file)...
true
f4eb93b379377927b84611928c379abc4517a38e
merlin24u/Debruitage_Parole
/main.py
UTF-8
3,277
2.609375
3
[]
no_license
from scipy.io.wavfile import read from scipy.io.wavfile import write import math import matplotlib.pyplot as plt import numpy as np import numpy.fft as FFT def main(arg): rate, data = read(arg) affiche(rate, data) def affiche(rate, data): print("frequence d'echantillonnage : {0} Hz\n".format(rate)) pr...
true
af02538eebf2877411b5deb67593f02f75c3d129
xiangyum/ml_publicpolicy
/labs/svm.py
UTF-8
5,540
2.984375
3
[]
no_license
# parameters to optimize for from sklearn.svm import SVC from sklearn.metrics import roc_auc_score from sklearn.model_selection import KFold def custom_predictions(clf, threshold = 0.7, x_test = X_test): # threshold = the probability threshold for something to be a 0. # generate array with predicted probabil...
true
53ed3e5aee890b12ccb417babed72ee7398d4b18
HassanSherwani/Learning_projects_Python
/get the best-selling products/topsell.py
UTF-8
889
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Apr 11 13:21:19 2019 Returning top 3 top selling products @author: Hassan """ from heapq import nlargest class Product: def __init__ (self, name, sales): self.name= name self.sales= sales def getname(self): return self.name ...
true
f3c8d72a5fd8d4c43d389d1f3ef30e1de5f33ba2
sangzzz/crypto-programs
/solovay_strassen.py
UTF-8
979
3.59375
4
[]
no_license
import sys import random from gcd import gcd from jacobi_symbol import jacobi def solovay_strassen(n, security=10): candidates = [] for i in range(security): a = random.randint(2, n-2) candidates.append(a) gcd_a_n = gcd(n, a) if gcd_a_n > 1: return False lege...
true
4caffeb0da8f6d3c86d3ee53dca79dcbd18e477a
sam735/CodeYard
/top_down_subset.py
UTF-8
580
3.21875
3
[]
no_license
def init_t(n, m): t = [[False for j in range(0, m+1)] for i in range(0, n+1)] for i in range(0, n+1): t[i][0] = True return t def sub_set(arr, sum, n, t): for i in range(1, n+1): for j in range(1, sum+1): if arr[i-1] <= j: t[i][j] = t[i-1][j-arr...
true
439aa28496d1cf623c2cdc2885145b9988af8024
shaorui0/automate_the_boring_stuff_with_python
/Regex_project/StripRegexVersion.py
UTF-8
554
3.5625
4
[]
no_license
#! python3 # StripRegexVersion.py - Regex Version of strip() import re def strip_regex(souceString, pattern = ''): # TODO: pattern是否存在 # TODO: pattern不在,找到并删去头尾whitespace # TODO: pattern在,删去souceString中的pattern matches = '' if pattern is '': matches += (re.search(r'\s*(.*?)\s*$', souceStri...
true
6d1a4e31306678ab30a10c43b7026b556a4ea1c9
nickysavage/Powerballbetty
/lottery2.py
UTF-8
2,195
2.984375
3
[]
no_license
import random from tkinter import * def Lotto_No(): x = random.randint(1,69); q = random.randint(1,69); w = random.randint(1,69); e = random.randint(1,69); r = random.randint(1,69); t = random.randint(1,35); num1.set(x) num2.set(q) num3.set(w) ...
true
5b4f750ee51822bbf634579a9e5fb51eb6aef8d0
giri-2452/Python-excersises
/venv/Calculator.py
UTF-8
711
4.59375
5
[]
no_license
def add(): a = int(input("Enter a number. ")) b = int(input("Enter another number. ")) print("The sum of two numbers are :", a+b) def substraction(): a = float(input("Enter a number. ")) b = float(input("Enter another number. ")) print(a - b) def multiplication(): a = float(input("Enter ...
true
7fa97fb76991663e0b638e3ce870f524568d2a8f
angelusualle/algorithms
/cracking_the_coding_interview_qs/8.11/make_change_test.py
UTF-8
225
2.640625
3
[ "Apache-2.0" ]
permissive
import unittest from make_change import make_change class Test_Case_Make_Change(unittest.TestCase): def test_make_change(self): self.assertEqual(make_change(10), 4) self.assertEqual(make_change(100), 242)
true
0a7565065a012cef974b9101a771b3a125a9d114
martynovappolina/queueing
/Queueing/bin/queueing/claim.py
UTF-8
1,086
2.890625
3
[]
no_license
class Claim: def __init__(self, receiving_time, priority, service_time): self.receiving_time = receiving_time self.priority = priority self.service_time = service_time self.processing_start_time = -1 def __lt__(self, other): return self.priority < other.priority or \ ...
true
d84b760f3eae9cb4e33593b2737f97f6d404f722
ZEROFAIL/goblin-legacy
/goblin/tests/properties_tests/properties_tests/circle_tests.py
UTF-8
4,081
2.71875
3
[ "Apache-2.0" ]
permissive
from __future__ import unicode_literals import unittest from tornado.testing import gen_test import geojson from goblin.tests import BaseGoblinTestCase from goblin._compat import PY2 from .base_tests import GraphPropertyBaseClassTestCase, create_key from goblin.properties.properties import Circle, GraphProperty from...
true
df83a8c88868ba92f2f689026cf8d2a4cc783e7b
MehradShahmiri/Python-class
/Ex10_3_1_mehrad Shahmiri.py
UTF-8
275
3.234375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 10, 100) f = (np.exp((-x)/10))*np.sin(np.pi*x) g = x*np.exp(-x/3) plt.figure() plt.plot(x, f,label='f') plt.plot(x, g,label='g') plt.xlabel('X') plt.ylabel('Y') plt.legend() plt.show()
true
c7dd4f1c9b2775838fca4d2777dbe9b4bf299b2e
kevin0932/MscTheisPythonUtils
/OpenCV3_TestingVideos.py
UTF-8
630
2.609375
3
[]
no_license
############################################################## ###### Just for testing of OpenCV with Python interface ###### ### Python 3.5 + OpenCV 3.3 in Anaconda (tensorflow_demon) ### ############################################################## import cv2 cap=cv2.VideoCapture("SampleVideo_360x240_30mb.mp4") prin...
true
8a03f20362096f46ce302f9c2b952043f9562ecd
PraveenAdepu/kaggle_competitions
/Avito/8000.Prav_regression_framework_models_Avito.py
UTF-8
12,826
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Mar 25 22:15:27 2017 @author: SriPrav """ import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from sklearn.preprocessing import LabelEncoder from sklearn.metrics import r2_score from sklearn.random_projection import Gauss...
true
399ccf299973625a3564703132acec764eb186ae
daniel10012/training
/03_more_datatypes/2_lists/03_09_flatten.py
UTF-8
301
4.09375
4
[]
no_license
''' Write a script that "flattens" a list. For example: starting_list = [[1, 2, 3, 4], [5, 6], [7, 8, 9]] flattened_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] ''' starting_list = [[1, 2, 3, 4], [5, 6], [7, 8, 9]] f_list = [] for el in starting_list: for i in el: f_list.append(i) print(f_list)
true
f45effa9c86ddf20c9a84e3ef0542a745403cf20
YoungcsGitHub/PythonHouse
/pyqt5/chapter3/drawing/DrawPoints.py
UTF-8
1,241
3.40625
3
[]
no_license
# -*- coding: utf-8 -*-# #------------------------------------------------------------------------------- # Name: DrawPoints # Description: # Author: Dell # Date: 2019/10/6 #------------------------------------------------------------------------------- ''' 用像素点绘制正弦曲线 -2pi 2pi drawPoint(x...
true
df74e41adc9a92bb99862101fb739d5359eb8593
dillonkooncey/Projects
/Python Tutorial/Return Statement.py
UTF-8
244
3.328125
3
[]
no_license
#return information from a function def cube(number): #Without return nothing will be displayed in the pritn statement below. return number * number * number print(cube(3)) #Can also be used in this way. result = cube(4) print(result)
true
08d28be1419920b3f11d08e55fba035a08473579
techjunaid/python-django
/textutils/textutils/views.py
UTF-8
1,509
2.75
3
[]
no_license
# I have created this file -junaid from django.http import HttpResponse from django.shortcuts import render def index(request): return render(request,'index.html') def about(request): return HttpResponse("This is about section") def analyze(request): djtext = request.POST.get('text','default') re...
true
e6366b4764cb545fb250d131d0ad59752b70085e
chiragbairagra/Task-1
/area_of_circle.py
UTF-8
131
3.921875
4
[]
no_license
pi=3.14 r=float(input("Input the radius of the circle:")) area=pi*r*r print("The area of the circle with radius 1.1 is:",area)
true
a62ea87eefe6368fb59c36edd64e57bd1107b7fb
Helton-Rubens/Python-3
/exercicios/exercicio086.py
UTF-8
333
3.9375
4
[ "MIT" ]
permissive
#matriz em python matriz = [[], [], []] for c in range(0, 3): for cont in range(0, 3): matriz[c].append(int(input(f'Digite um valor para a posição [{c+1}/{cont+1}]: '))) print('=-'*30) for i in range(0, 3): print('|', end='') for cont in range(0, 3): print(f"{matriz[i][cont]:^5}", end='|') ...
true
1880c233142fab3384b71009354ce112a64cff1e
duncangrubbs/algorithms
/Python/sorting.py
UTF-8
871
3.828125
4
[]
no_license
array = [1, 66, 45, 3, 2, 45, 23, 12, 68, 44, 3, 6, 9, 11, 15, 23, 56, 98, 65, 0] # BUBBLE SORT def bubble_sort(arr): for i in range(len(array)): for k in range(len(array) - 1): if (arr[k] > arr[k+1]): tmp = arr[k] arr[k] = arr[k+1] arr[k+1] = tmp...
true
c8c12af5029fe5c04b11f217e4c4fcc00fa2c933
Oziel-Silva/Processamento_de_Imagens
/Python/trabalho_02/src/interp_vizinho_proximo.py
UTF-8
2,492
2.875
3
[]
no_license
# -*- coding: utf-8 -*- ################################################################################## ## Company: ## Engineer: Oziel da Silva ## ## Create Date: 02-09-2017 10:40 AM ## Module Name:Interpolação de imagem ## Description: interpolação de imagens usando o método de vizinhos mais próximos ## Addit...
true
284ff4c611d88aee93cd0969de6a74804885d570
arthurPignet/privacy-preserving-titanic-challenge
/src/models/unencrypted_LR.py
UTF-8
10,208
3.1875
3
[ "MIT" ]
permissive
import logging import time import numpy as np class LogisticRegression: """ Model of logistic regression, performed on unencrypted data. It aim to be a reference model, to compare with encrypted models """ def __init__(self, init_weight, init_bias, ...
true
6211ecdf13a749cf6b11f21479c1b2ebface6213
marcmaligmat/my_scraper
/worldscheap/crawlers/crawlers/spiders/ggdeals.py
UTF-8
1,757
2.5625
3
[]
no_license
import scrapy from crawlers.items import GameItem class GameSpider(scrapy.Spider): name = 'ggdeals' #https://api.rawg.io/api/games/dragon-ball-z-kakarot/screenshots?key=b0dcfe4aac2f46209bf08e9cb1721387 start_urls = ['https://gg.deals/game/industries-of-titan/',] # def start_requests(self): # # ...
true
6f140508fffef7d122a5056b07bca737b7b47460
FabienDragne/python_udemy
/main.py
UTF-8
1,791
4.5
4
[]
no_license
################################################# # Fonctions ################################################# # Afficher le résultat nom et âge def display_the_result(name, age): print("Your name is " + name + " and you are " + str(age) + " years old.") print("Soon you will be " + str(age + ...
true
5071d280b37c2af786115687865b286d6609297b
n3z0xx/tp_labs1-3
/28.py
UTF-8
653
3.90625
4
[]
no_license
# 28. Создать 20 элементный список рандомных целых (-10, +10). Если в # нем есть два соседних элемента одного знака, выведите эту пару. Если # соседних элементов одного знака нет - не выводите ничего. Если таких # пар соседей несколько - выведите первую пару import random egg = random.sample(range(-10,11), 20) #print(e...
true
3960f8aa1d388a850cc84338da2016c4bf5f4c2a
zl8115/HotWheels
/pixyRacer/OriProvidedCode/Week 6 code/obstacleAvoidance_student.py
UTF-8
7,792
2.578125
3
[]
no_license
### ALBiR 2018-19 Spring ### Made by: HTL, LH, DK ### Last updated: 02/19 by DK import pixyRacer import pixy import time import math from helper import PID_controller, blocksAreNew, copyBlockArray class obstacleAvoidance(object): def __init__(self, racerBot): self.bot = racerBot self.constantServoPosition = 0 ...
true
a762a8cd02abd8e7a364fec612cc5ec0f103e410
czacarias905/Lab6
/random.randrange.py
UTF-8
176
3.578125
4
[]
no_license
#Cecilia Zacarias #2/20/2020 #random.randrange #Problem 1 printing 10 random integers between 25 and 35 import random for x in range(10): print(random.randrange(25,35))
true
6da1ff9fe5b4e1d0693566781e9edb2cf6041c8a
awilli32/jsmini
/01-Class-Activities/10-Advanced-Data-Storage-and-Retrieval/2/Activities/02-Stu_Hello_Web/Solved/app.py
UTF-8
560
3.0625
3
[]
no_license
# 1. Import Flask from flask import Flask #%% # 2. Create an app yasir = Flask(__name__) #%% # 3. Define static routes @yasir.route("/") def index(): return "Hello, world!" #%% @yasir.route("/about") def about(): name = "Dartanion" location = "Chicago, IL" return f"My name is {name}, and I li...
true
c1bf4a1d504e41983623ddaf00828fe93754fba8
elizabeth247/elizabeth247.github.io
/dataprocessing.py
UTF-8
3,147
3.46875
3
[]
no_license
import csv import json import tkFileDialog #make list of 26 city names citieslist = [] with open("26citiesWithLatitudeLongitude.csv") as csvfile: reader = csv.DictReader(csvfile) for row in reader: citieslist.append(row["\xef\xbb\xbfCity"]) #weird encoding thing added this crap to the beginning of City #save js...
true
890f5188d94524546a68af824deb41cfe4c7ad88
spearfish/python-crash-course
/example/09.4.2_store_classes/my_electric_car.py
UTF-8
246
2.578125
3
[]
no_license
#!/usr/bin/env python3 from car import ElectricCar tesla = ElectricCar('tesla', 'model s', 2020) print(tesla.get_descriptive_name()) tesla.odometer_reading = 23 tesla.read_odometer() tesla.battery.describe_battery() tesla.battery.get_range()
true
1afe772f6808a533f08a86a5d0c73fb2570ba6ef
reginald1787/LeetCode
/Python/ValidNumber.py
UTF-8
1,662
3.328125
3
[]
no_license
class Solution: # @param s, a string # @return a boolean def isNumber(self, s): INVALID = 0 SPACE = 1 SIGN = 2 DIGIT = 3 DOT = 4 EXPONENT = 5 NUM_INPUTS = 6 transitionTable = [ [-1, 0, 3, 1, 2, -1], ...
true
6caca1c27525ef2bae4d7865fe28af62019a169e
floydchenchen/leetcode
/199-binary-tree-right-side-view.py
UTF-8
1,989
3.890625
4
[]
no_license
# 199. Binary Tree Right Side View # Given a binary tree, imagine yourself standing on the right side of it, # return the values of the nodes you can see ordered from top to bottom. # # Example: # # Input: [1,2,3,null,5,null,4] # Output: [1, 3, 4] # Explanation: # # 1 <--- # / \ # 2 3 <---...
true
64232b4b653ed2c345f4c0a4e3710356403e132a
longvd336/advanced-algo
/contest1/khoangcachnhohonk.py
UTF-8
460
3.265625
3
[]
no_license
def countPairs(a, n, k): a.sort() res = 0 for i in range(n): j = i+1 while (j < n and a[j] - a[i] < k): res += 1 j += 1 return res # Driver code a = [1, 10, 4, 2] k = 3 n = len(a) print(countPairs(a, n, k), end = "") if __name__ == '__main__': test =...
true
cbb7e82c6848a8bb758dbda748252917c894d0de
viviancheng2001/15112TPCMU
/hypnosisAnesthesia.py
UTF-8
3,452
2.828125
3
[]
no_license
############################################################################### # CITATION: Created using outline of providedStarterFile leapMotionDemo.py # which includes: # LeapMotion built-in variables/gesture-detection functions from leap # motion library # 112 Tkinter Framework, from the CMU 15-112 course # Uses...
true
e984a5000b161dfad6037113f0ace7e1571d1262
mjadiletta/learnToCodePython
/lessons/17_fileIO.py
UTF-8
9,554
4.6875
5
[]
no_license
""" Practice Group 17: File Input and Output Created: 3/21/2020 Reading and writing to files in python is crucial for creating programs that require external data, output lots of data, etc. There are a number of ways to read and write files in python. We will talk about two. The most common way is to use python's open...
true
788ec8d684fd1ca20069205347fad6ab3dde4baa
congvm-cs/pymlkits
/pymlkits/statistic.py
UTF-8
367
3.484375
3
[]
no_license
# statistic.py import numpy as np def stat(arr, name=''): '''Print statistic of given array Parameters ---------- arr : list list of number for statistic ''' arr = np.array(arr) print((name, arr.shape, 'min:', np.min(arr), 'max:', np.max(arr), 'std:', np.std(arr), 'mea...
true
6b235b1ee34164624fa34fa234b0fdacd2e4a75a
emanuele/euclidean_embeddings
/test/test_embeddings.py
UTF-8
2,547
2.90625
3
[ "MIT" ]
permissive
"""Simple tests for Euclidean embeddings. """ import numpy as np from euclidean_embeddings.lipschitz import compute_lipschitz from euclidean_embeddings.dissimilarity import compute_dissimilarity from euclidean_embeddings.fastmap import compute_fastmap from euclidean_embeddings.lmds import compute_lmds from scipy.spati...
true
68781e0c461c7a760b5bae507dda1d1ac7b087cd
Hoeyboey/Guild-Wars-2-Discord-Bot
/get_request_functions.py
UTF-8
1,983
2.640625
3
[]
no_license
import urllib.request import json def collect_daily_quests(): current_dailies_httpreqestobj = urllib.request.urlopen("https://api.guildwars2.com/v2/achievements/daily") current_dailies = json.loads(current_dailies_httpreqestobj.read().decode('utf-8')) return current_dailies def format_current_dailies_to_your_level...
true
7c9e38fe0368e17711e81e154157c115e2aff70c
FAIR4HEP/hbb_interaction_network
/src/data/h5data.py
UTF-8
11,109
2.90625
3
[ "MIT" ]
permissive
# Data class and associated helper methods import itertools import os import time from threading import Thread import h5py import numpy as np class FilePreloader(Thread): """Class implementing a thread. Attributes: file_names (list): list of data files to use for training batch_size (int): size...
true
af2d138719e5690850f2740685a620e5022f674c
ufgm000/python_apps
/sc_chap_3-1.py
UTF-8
252
3.59375
4
[]
no_license
import pandas as pd # CSVファイルを読み込む df = pd.read_csv("test.csv") print(df) # 表データの情報を表示 print("データ件数 =",len(df)) print("項目名 =",df.columns.values) print("インデックス=",df.index.values)
true
d4bca02ca68bed3a087905e7ad3acb78f997415e
ytyaru/Python.OTP.tools.201704200841
/database/src/Main.py
UTF-8
388
2.609375
3
[ "BSD-3-Clause", "CC0-1.0", "MIT", "Unlicense", "Apache-2.0" ]
permissive
#!python3 #encoding:utf-8 # configで指定したディレクトリにDBがない場合、作成する import configparser import os.path import Create config = configparser.ConfigParser() config.read('./config.ini') print(config['Path']['DB']) print(os.path.abspath(config['Path']['DB'])) creator = Create.InitializeMasterDbCreator(os.path.abspath(config['Path']...
true
06f7f9fc84bf2ba32c93e1eb4597ef88286d3b3d
Aasthaengg/IBMdataset
/Python_codes/p02897/s258895235.py
UTF-8
90
3.171875
3
[]
no_license
N=int(input()) ans=0 i=1 while i<=N: if i%2!=0: ans+=1 i+=1 print(ans/N)
true
6ff977dfc344603576e55bc769f8ef3811482cc2
iNani27/Women_code_festival_2018
/plusOUmoins-inani.py
UTF-8
604
3.84375
4
[]
no_license
import os #importe module système d'exploitation import random as rd #importe module pour que l’ordinateur tire aléatoirement un nombre entier. nombre = rd.randint(0, 10) print("Jeu du + OU - ? Devine le nombre auquel je pense, entre 1 et 10") reponse = 0 while reponse != nombre : print("Tape un nombre e...
true
ae30fedc64612beaea5454715359515c02708ab6
palli/ncpa
/client/check_ncpa.py
UTF-8
6,851
2.578125
3
[]
no_license
#!/usr/bin/env python """ SYNOPSIS """ import sys import optparse try: import json except: import simplejson as json try: import urllib.request, urllib.parse, urllib.error except ImportError: import urllib import shlex import re __VERSION__ = 0.2 def pretty(d, indent=0, indenter=' '*4): info...
true
7adee45c872d08c07b125c50b84d7827dc7dd667
hiys/PYTHON
/pythonScripts/PyScripts/PyScripts6/select5.py
UTF-8
457
2.609375
3
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
from myorm import Salary, session from sqlalchemy import and_, or_ # select * from salary where award>4500 and basic>10000; for row in session.query(Salary).\ filter(and_(Salary.award>4500, Salary.basic>10000)): print(row.emp_id, row.basic, row.award) # select * from salary where basic>10000 or award>4500...
true
60b60ca721c3dc20ed2ef97daa4b78096c30a96c
amaradevi/PythonSDETHireVue
/Question_4.py
UTF-8
2,715
3.515625
4
[]
no_license
class Employee(): """This is employee clas""" def __init__(self,firstname,lastname,pay_rate,yearly_vacation): """This is constructor method of employee""" self.firstname=firstname self.lastname=lastname self.pay_rate=pay_rate ...
true
2b04900d1a5da6b3feab8db89c4301fbbefdf1cb
CEA-jiangming/DecGMCA
/pyDecGMCA/mathTools.py
UTF-8
13,444
2.65625
3
[]
no_license
''' Created on Nov 4, 2015 @author: mjiang ''' import numpy as np import scipy.fftpack as scifft import numpy.linalg as LA def fftshift2d1d(cubefft): (nz,nx,ny) = np.shape(cubefft) cubefftSh = np.zeros((nz,nx,ny)) + np.zeros((nz,nx,ny)) * 1j # Convert to complex array for fm in np.arange(nz): ...
true
b834df85136ac0917469906812a3d4d04e8cb20e
MarianDanaila/Competitive-Programming
/Leetcode Contests/Weekly Contest 225/Find Kth Largest XOR Coordinate Value.py
UTF-8
627
3.015625
3
[]
no_license
class Solution: def kthLargestValue(self, matrix, k: int) -> int: large = [matrix[0][0]] n = len(matrix) m = len(matrix[0]) for i in range(1, n): matrix[i][0] ^= matrix[i - 1][0] large.append(matrix[i][0]) for j in range(1, m): matrix[0][j...
true
a52d00c5b36dd9771248d83d65f11e19c59d3d37
gando999/idlewild
/tests/mutations/fixtures.py
UTF-8
1,941
3.109375
3
[ "MIT" ]
permissive
from collections import namedtuple Human = namedtuple('Human', 'id name friends appearsIn homePlanet') # EPISODE # 0 -> Star Wars # 1 -> Empire Strikes Back # 2 -> Return of the Jedi luke = Human( id='1000', name='Luke Skywalker', friends=['1002', '1003', '2000', '2001'], appearsIn=[0, 1, 2], ho...
true
e1f815a08bf325e375546ad96bd1615fff666ce4
husainshaikh895/Word_Counter
/wordcount/views.py
UTF-8
684
2.625
3
[]
no_license
from django.http import HttpResponse from django.shortcuts import render import operator def homepage(request): return render(request, 'home.html') def count(request): full_text = request.GET['fulltext'] wordlist = full_text.split() length = len(wordlist) word_dict = {} for word in wordlist: if(word in word_d...
true
b1e456a86b35f806b580362089684c8d00820323
StavC/DeepLearningProjects
/DogsVsCats Image Classification/Dogs_vs_Cats.py
UTF-8
5,790
2.859375
3
[]
no_license
import os import matplotlib.pyplot as plt import tensorflow as tf import numpy as np def main(): _URL = 'https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip' zip_dir = tf.keras.utils.get_file('cats_and_dogs_filterted.zip', origin=_URL, extract=True) # my location is C:\Users\Stav\.keras...
true
445aca6312a58e26941bdfd83fe9987942d74833
linchenhan123/QIQIguaiguai
/number_contour.py
UTF-8
1,314
2.59375
3
[]
no_license
import cv2 import numpy as np img = cv2.imread('/home/lin/001.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret ,thresh = cv2.threshold(gray,170,255,1) kernel = cv2.getStructuringElement(cv2.MORPH_RECT,(20,20)) dilated = cv2.dilate(thresh,kernel) cv2.imshow('dilated',dilated) image, contours , hierarchy = cv2.fi...
true
eec493021d30b6f0df83fabb07ae6715cb7c03cb
lovroselic/Coursera
/Data Strucures/week2_priority_queues_and_disjoint_sets/2_job_queue/job_queue.py
UTF-8
3,928
3.078125
3
[ "MIT" ]
permissive
# python3 #https://docs.python.org/3.0/library/heapq.html #https://stackoverflow.com/questions/47564075/most-efficient-1-loop-way-to-use-priority-queue-in-parallel-jobs-task #https://codereview.stackexchange.com/questions/208772/parallel-processing-simulation from collections import namedtuple class Worker: def ...
true
513ac7dfb57866792d7c62fa6ddddce1b4c6fef7
prashant0493/playground
/fibonacci.py
UTF-8
399
3.953125
4
[]
no_license
'''Fibonacci series program in recursive way... www.python-course.eu/python3_recursive_functions.php''' def fibonacci(num): if num==0: return 0 elif num==1: return 1 else: return fibonacci(num-1)+fibonacci(num-2) #definition ends here.............................. num=int(...
true
02f9f59f5715bcc240d2b013686a64e929e0718f
Oscar-Hogben/Alarm
/Speak.py
UTF-8
326
2.625
3
[]
no_license
import requests,json,random,playsound,os,time from gtts import gTTS class Speak: def Speak(audio_string): tts = gTTS(text=audio_string, lang='en') audio_file = 'audio-' + "speach" + ('.mp3') tts.save(audio_file) playsound.playsound(audio_file) print(f"Playing: {audio_string}") os.remove(audio...
true
7cc1963b09509c16c56d3bcea89f8cbedd974e05
Jinzi-Wu/Computational-Physics
/classical_scattering/roots/newton_raphson.py
UTF-8
858
3.84375
4
[]
no_license
from math import nan def newton_raphson_step(f, x0, df): return x0 - f(x0) / df(x0) def newton_raphson(f, x0, df, tol): """ Using the Newton--Raphson method, find a zero of the function f to accuracy tol with starting point x0. If there is a stationary point between x0 and the zero, the alg...
true
a6effd18149d5115e17394172cda8f4946860819
bmmtstb/adventofcode
/2020/Day15.py
UTF-8
2,697
3.4375
3
[]
no_license
import unittest from typing import Dict, List, Tuple, Set def get_nth_spoken(start: List[int], n: int) -> int: """play the elves game until char n""" start.reverse() state = start while len(state) < n: # does not exist yet if state.count(state[0]) == 1: state.insert(0, 0) ...
true
2587a9f69d790033371cded8e51682a024ba6748
bluesky139/MjolnirTornado
/base/utils/json_utils.py
UTF-8
1,939
2.5625
3
[]
no_license
import json import datetime import time from collections import deque from base import * # deprecated class JsonDecoder(json.JSONDecoder): def __init__(self, *args, **kwargs): return super(JsonDecoder, self).__init__(object_hook=self.dict_to_object, *args, **kwargs) def dict_to_object(self, obj): if '__intenum_...
true
826f325b40799d0917c3b69b7bbf3a71673ef596
mjavaly/mlb-batted-balls
/mlb_gd.py
UTF-8
5,921
2.640625
3
[]
no_license
import mlbgame import time import json # may remove this in favor of csv import csv from datetime import datetime, timedelta from collections import defaultdict from lxml import etree import os import sys try: from urllib.request import urlopen from urllib.error import HTTPError except ImportError: from urllib2 imp...
true
92dd9fc9ea541072cff68a13bdd8fdf00b403a9b
KohsukeKubota/Atcoder-practice
/eating_symbols_easy.py
UTF-8
106
3.34375
3
[]
no_license
S = input() res = 0 for s in S: if s == '+': res += 1 else: res -= 1 print(res)
true
b4f7760a828acda668dec4f0ee9df5d1b9a476ed
AK-1121/code_extraction
/python/python_21645.py
UTF-8
121
2.703125
3
[]
no_license
# How to get particular tag from an xml document in python for i in tree.findall('.//country'): print ET.tostring(i)
true
ce61dc1dc5a5a73efb5e46889df348c67b8ad43b
guilhermejcmarinho/Praticas_Python_Elson
/01-Estrutura_Sequencial/12-Calcula_Peso.py
UTF-8
101
3.734375
4
[]
no_license
altura = float(input('Digite a sua altura: ')) print('Seu peso ideal é:', round(72.7*altura-58, 2))
true
b0c698ac2336399b08fd69db5ab9332dc61c7237
yaelshteyer/shehacksgame
/game_classes.py
UTF-8
3,838
3.109375
3
[]
no_license
import pygame #sounds buzz = pygame.mixer.Sound('sound_buzz.wav') ding = pygame.mixer.Sound('sound_ding.wav') # bins blue_bin_pic=pygame.image.load("bin1.png") blue_bin_pic=pygame.transform.scale(blue_bin_pic,(90,130)) green_bin_pic=pygame.image.load("bin2.png") green_bin_pic=pygame.transform.scale(green_bin_pic,(90,...
true
e9ec596e6f38494bbf3479ef603c3a76dc37353c
hkotkanen/hel-coffeebtn-srv
/coffee.py
UTF-8
1,610
2.625
3
[]
no_license
from flask import Flask, request, redirect, jsonify, g, render_template import arrow app = Flask(__name__) db_file = 'coffees.db' @app.route('/api/coffees', methods=['GET', 'POST']) def coffees(): ct = arrow.now('Europe/Helsinki') if request.method == 'GET': return jsonify({'latest': stamper.get_lates...
true
5c3a7378cea70d5c1f880ce12e9e3c4ff174953c
jvladimir/desafio_b2w
/b2ww.py
UTF-8
688
3.453125
3
[]
no_license
import requests print('STAR WAR API') print('As opções são: films(filmes), people(personagens), planets(planetas), species(especies), starchip(naves), vehicles(veiculos)') numero = input('Digite o numero ') if len(numero) != 1: print('esquisa dinvalida') exit() request = requests.get('https://s...
true
c25052053b4624a55b12677ff8bdd2d367d3b98f
felipem4rtins/CES-22
/Aula3/Ex15.12.4.py
UTF-8
684
4.28125
4
[]
no_license
# Felipe Martins Gomes # Comp 20 # Exercício 15.12.4 # Programa compilado com PyCharm 2018.1.2 class Point: """ Point class represents and manipulates x,y coords. """ def __init__(self, x=0, y=0): """ Create a new point at the origin """ self.x = x self.y = y def slope_from_origi...
true
e65edb8772b8cee98bfdf763fc386f33d6c0c122
machadodev/Recursion
/Algoritmos/Fatorial/fatorial.py
UTF-8
268
4.5
4
[]
no_license
# Função Recursiva def fatorial(n): # Caso base if n <= 1: return 1 # Passo em direção ao fim do problema return n * fatorial(n - 1) n = int(input("Deseja calcular o fatorial de qual numero? : ")) fat = fatorial(n) print("Fatorial de", n, ":", fat)
true
8078e08b54c526d3c1b992eb0bee1969d95d1af5
vincentiussgk/seleksi-labpro-backend
/app.py
UTF-8
8,304
2.5625
3
[]
no_license
from flask import Flask, jsonify, request from models.models import Dorayaki, Store, StoreItem, session, dorayaki, store, store_items from flask_cors import CORS app = Flask(__name__) CORS(app) @app.route('/') def your_root_route(): return "hello" # Dorayaki Methods def getDorayaki(): allDorayaki = session...
true
b6f122625a96cd8bfd68785db0cf1bbd69c8a404
QuitayenKA16/COMP3500---IoT
/project/detect-emotion-from-image.py
UTF-8
1,052
2.734375
3
[]
no_license
import os, sys import requests, json # Variable required to access Azure Face API subscription_key = '11291157eba34c9c847b603363bc8def' face_api_url = 'https://comp3500-azure-face-api.cognitiveservices.azure.com/face/v1.0/detect' if __name__ == '__main__': # Require console input: path of image to analyze if...
true
6a0b49baa672410b4b804db441383f612490728c
vipingujjar1/python-edsystango
/homework/29 July 2019/marksheet.py
UTF-8
711
3.640625
4
[]
no_license
# marksheet programm maths=int(input("Enter marks obtain in maths :")) physics=int(input("Enter marks obtain in physics :")) chemistry=int(input("Enter marks obtain in chemistry :")) communication=int(input("Enter marks obtain in communication :")) computer=int(input("Enter marks obtain in computer :")) total=maths+p...
true
cbd94d0012347cec88be118727665b32fdcdda14
aidanhb/face_maker
/name_metrics.py
UTF-8
2,385
3.703125
4
[]
no_license
"""A bunch of random ways to get numbers 0 - 1 from strings.""" CONSONANTS = "bcdfghjklmnpqrstvwxz" VOWELS = "aeiouy" def bounciness(name): name = name.lower() b = 0 previous_is_vowel = name[0] in VOWELS for c in name[1:]: cur_is_vowel = c in VOWELS if previous_is_vowel != cur_is_vowe...
true
04f645452ebd0bb78f6135954ec98f0234747d6b
xerew/PythonPrograms
/erg6.py
UTF-8
569
3.28125
3
[]
no_license
import numpy as np c = int(input("Enter the columns of the matrix: ")) #eisagwgi stilwn apo ton xristi r = (input("Enter the rows of the matrix: ")) #eisagwgi seirwn apo ton xristi bombs = int(input("Enter the number of the bombs: ")) #eisagwgi arithmo vomvwn apo ton xristi bomb_value = -1 #orizoume to value po...
true
19e52037ef7aa87418c7c9db18fbe62d7cd22251
Golchef/EMCSimulator
/main.py
UTF-8
9,321
2.515625
3
[]
no_license
""" @ Author: Pky @ Time: 2020/2/2 @ Software: PyCharm """ import json from RedTeam.RedTeam import RedTeam from BlueTeam.BlueTeam import BlueTeam from EMCSimulator import EMCSimulator from AlgorithmsLib.PolicyGradient import PolicyGradient from AlgorithmsLib.DQN import DQN from AlgorithmsLib.PPO import PPO import torc...
true
c66723015fa378a6899596eeaa08b2f9cf88b17b
c0fec0de/anytree
/anytree/util/__init__.py
UTF-8
2,108
3.703125
4
[ "Apache-2.0" ]
permissive
"""Utilities.""" def commonancestors(*nodes): """ Determine common ancestors of `nodes`. >>> from anytree import Node >>> udo = Node("Udo") >>> marc = Node("Marc", parent=udo) >>> lian = Node("Lian", parent=marc) >>> dan = Node("Dan", parent=udo) >>> jet = Node("Jet", parent=dan) ...
true
6625d46d77f6b836732caf6149af72f701c26beb
neila8926/curso
/operadores-logicos.py
UTF-8
347
3.578125
4
[]
no_license
a=int(input("Proporciona un Valor: 10")) valorMinimo=0 valorMaximo=5 dentroRango=(a>=valorMinimo and a<=valorMaximo) if dentroRango: print("Dentro del Rango") else: print("Fuera del Rango") vacaciones=True descanso=True if not(vacaciones or descanso): print("Puedes ir al parque") else: print("T...
true
f6d20cb543eca15fd0a4a422bd45a754cd6dac8b
Leoleocheng/MEETJINN
/meetjinnDJ-2.0/zahuo/用户水印.py
UTF-8
373
2.671875
3
[]
no_license
import PIL from PIL import ImageFont,Image,ImageDraw #设置字体,如果没有,也可以不设置 font = ImageFont.truetype(r"../static/font/123.ttf",25) imageFile = r"../s1.jpeg" im1=Image.open(imageFile) draw = ImageDraw.Draw(im1) a=im1.size print (a) draw.text((a[0]-120,a[1]-40),"@ceshi1",(255,255,255),font=font) draw = ImageDraw.Draw(im1) i...
true
08bbe06bcab2392ff8b29ddacc07a4ebb9a50376
tpike3/Kibera
/Population/dbfRead.py
UTF-8
20,547
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Feb 12 10:47:01 2018 @author: ymamo """ #Read in dependencies import pandas as pd import numpy as np import random ######################################### # # HELPER FUNCTIONS # # MAIN FUNCTION LINE 317 # #####################...
true
ab2cf56e540bd1e7d974c73f3be6372e8a4c8156
MikelShifrin/Python1
/Students/Aheesh/Extra2.py
UTF-8
282
3
3
[ "MIT" ]
permissive
day=int(input("Please enter a date:\n")) month=int(input("Please enter a month:\n")) year= int(input("Please enter a year:\n")) magic1 = day * month magic2 = year % 100 if magic2 == magic1 : print("This is a magic date") else: print("This is not a magic date") *to Revise
true
58b26d049d52b932917912c24c363589c8d29d53
sunshinelu/PythonDiary
/dataclean/FilterDemo2.py
UTF-8
940
2.609375
3
[]
no_license
#-*- coding: UTF-8 -*- import pandas as pd import pymysql import numpy as np from sqlalchemy import create_engine ## 加上字符集参数,防止中文乱码 dbconn = pymysql.connect( host="localhost", # 127.0.0.1 database="cnki", user="root", password="root", port=3306, charset='utf8' ) table = "rc_jbxx_20190301" ...
true
e65e3b19912d86840f09644c3ef47e7577798447
Suffoquer-fang/tianshou
/tianshou/core/policy/base.py
UTF-8
2,468
3.078125
3
[ "MIT" ]
permissive
from __future__ import absolute_import from __future__ import division __all__ = [] class PolicyBase(object): """ Base class for policy. Mandatory methods for a policy class are: - :func:`act`. It's used interacting with the environment during training, \ so exploration noise should be added in this...
true
3a24ba48bc931ed9b1df3c9fbc1dea360078b94e
renatasarmet/ori-T1
/main.py
UTF-8
3,155
3.765625
4
[]
no_license
# Organização e Recuperação da Informação - Turma A. # TRABALHO 1 - Implementação de arquivo sem ordenação. # Isadora Eliziário Gallerani - 726542 # Renata Sarmet Smiderle Mendes - 726586 # importando metodos que serao utilizados from metodos_basicos import criaArquivo from metodos_basicos import insere from m...
true