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
6a18399fa8bf7c8beca2d886d5a53ff6430144dd
subhashreddykallam/Competitive-Programming
/timus/1607.py
UTF-8
293
3.921875
4
[]
no_license
petr, inc, driver, dec = map(int, input().split()) if (petr > driver): print(petr) exit() while True: if petr+inc <= driver: petr+=inc else: print(driver) exit() if driver-dec >= petr: driver-=dec else: print(petr) exit()
true
86ed3b41371dcd0a12be9b1cb486c9e97e01593b
josephcalver/CompleteDataStructuresAndAlgorithmsInPython
/LinkedLists/sum_linked_lists.py
UTF-8
880
3.75
4
[]
no_license
from LinkedLists.linked_list import LinkedList def sum_lists(list_a, list_b): n1 = list_a.head n2 = list_b.head carry = 0 result_list = LinkedList() while n1 or n2 or carry is not 0: result = carry carry = 0 if n1: result += n1.value n1 = n1.next ...
true
92b82d571a38a08904b592eb074d68937ae0e0ab
roiei/algo
/leet_code/1592. Rearrange Spaces Between Words.py
UTF-8
1,107
3.546875
4
[]
no_license
import time from util.util_list import * from util.util_tree import * import copy import collections class Solution: def reorderSpaces(self, text: str) -> str: n = len(text) i = 0 space = 0 while i < n: if not text[i].isalpha(): space += ...
true
326dd2052503444e49778052fb675eff35e7f8be
yokel72/bof
/functions.py
UTF-8
4,655
2.703125
3
[]
no_license
# Functions supporting a Windows x86 reverse shell stack buffer overflow # Saved Return Pointer overwrite exploit. # Parameters are saved in params.py for persistence. # Delete params.py and params.pyc to reset them; or simply edit params.py # # Written by y0k3L # Credit to Justin Steven and his 'dostackbufferoverflowg...
true
ab9737d3a7b4852b1beeb168440d774eac88baee
Jero-M/lbs_render
/filecheck.py
UTF-8
5,277
2.8125
3
[]
no_license
#!/usr/bin/python import os import pyseq import config class RenderFile(object): '''Create a render file object and gather all of its properties''' def __init__(self, file_path): '''Initialize the file object''' self.settings = config.Settings() self.render_file = file_path ...
true
5ba09736a1f28b98195193acd4760e8b7d68eb11
cgorbit/rem
/tests/test_07.py
UTF-8
488
2.59375
3
[]
no_license
import unittest from rem.storages import LocalTag, TagWrapper class T07(unittest.TestCase): """Checking internal REM structures""" def testTagWrapperSerialization(self): import cPickle tag = LocalTag("test", lambda *args: None) wrapOrig = TagWrapper(tag) wrapDesc = cPickle.du...
true
ada210a266210b0b70f8fa4848036281830280fe
Aasthaengg/IBMdataset
/Python_codes/p02788/s495945179.py
UTF-8
672
2.5625
3
[]
no_license
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,d,a = map(int, input().split()) xh = [None]*n # h = [None]*n for i in range(n): xh[i] = tuple(map(int, input().split())) xh.sort() r = 0 val = 0 from queue import deque ...
true
681049ca269488be2023c15e04b060fc9053f743
matthewgdv/subtypes
/subtypes/http.py
UTF-8
2,408
2.796875
3
[ "MIT" ]
permissive
from __future__ import annotations from typing import Any import json import simplejson from requests import Session from requests.models import Response as BaseResponse from requests.exceptions import HTTPError from urllib.parse import quote, quote_plus from .enum_ import Enum from .translator import TranslatableMe...
true
8d0e5a3563368ae117d42c4d52a2e26dee466f00
lwierzb1/mgr
/py/colorization_program/src/colorization_algorithm/colorization_using_optimization/image/colorization_optimized_solver.py
UTF-8
3,613
2.9375
3
[]
no_license
__author__ = "Łukasz Wierzbicki" __version__ = "1.0.0" __maintainer__ = "Łukasz Wierzbicki" __email__ = "01113202@pw.edu.pl" import time import numpy as np import scipy.sparse from colorization_program.src.colorization_algorithm.colorization_using_optimization.image.optimization_solver import OptimizationSolver from...
true
7227d7a5fd77c3d2353a63a6e5d92851eb2c24a0
rafaelperazzo/programacao-web
/moodledata/vpl_data/303/usersdata/300/69880/submittedfiles/testes.py
UTF-8
167
3.640625
4
[]
no_license
# -*- coding: utf-8 -*- #COMECE AQUI ABAIXO A = 5 B = 10 C = 3 print(type(A==A)) print(type(A>A)) print(type(B>A)) print(type((B%C)==1)) print(type((A%2)!=0))
true
bb9f47dae79bfb3dda93e569db583047f57fdf86
llgeek/leetcode
/2_AddTwoNumbers/solution.py
UTF-8
1,008
3.265625
3
[]
no_license
""" O(max(len(l1), len(l2))) time complexity """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rt...
true
4ce77b7dcb06f6956e3a98b31243c4fcee2e8936
Jordan-Voss/CA116-Programming1
/largest-number.py
UTF-8
261
3.234375
3
[]
no_license
n = input() i = 0 largest = -999999999999999999999 if largest < n: largest = n elif n < largest: largest = largest while i < 4: n = input() if largest < n: largest = n elif n < largest: largest = largest i += 1 print largest
true
2062c319c4971392e2dbfe155ddb3995b9095a71
traore18/python_academy
/animal.py
UTF-8
1,181
2.890625
3
[]
no_license
class vehicle(): engine_running = False number_wheels = 2 number_doors = 2 registration_plate = "" owner = "" def __init__(self, registration): self.registration_plate = registration self.owner = owner_name def __str__(self): return '%s' % (self.registration_plate) def start_engine(self): self.engine...
true
ecc51a48077f1a8d387927d2c8764b251bdb57b7
Yloubna/administration
/scolarite/etudiants/models.py
UTF-8
1,779
2.75
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. SPECIALITES = ( ("Systeme d'information", "Systeme d'information"), ) FILIERES = ( ("Informatique", "Informatique"), ) DOMAINES = ( ("MI", "MI"), ) PARCOURS = ( ('L1', 'L1'), ...
true
3fa89e50f85e5ff61d7e68ec42e73e6549d8cd09
usertxt/stellar-csv-creator
/stellar-csv-creator/utils/message_box.py
UTF-8
2,555
2.65625
3
[ "MIT" ]
permissive
import os import sys from PySide2 import QtWidgets, QtGui, QtCore class MessageBox: def __init__(self, theme): self.theme = theme if self.theme == "dark": self.icon_file = "gui/icons/stellar_dark.ico" else: self.icon_file = "gui/icons/stellar_default.ico" def...
true
37062f5939ff208a84d4062258631094f654dfe1
DanTeegan/Student_data_inheritance
/DevOps_student.py
UTF-8
346
2.96875
3
[]
no_license
# Here we are importing the class from the student_data file from student_data import Student_data # We are class Devops_student(Student_data): def __init__(self, first_name, last_name, adress): super.__init__(first_name, last_name, adress) daniel = Student_data("Daniel", "Teegan", "123 Fake street")...
true
fa69a05d365058559a826b31f36a6fdd7001ff10
alanlyyy/ira_contributions_project
/ira_Test.py
UTF-8
1,530
3.109375
3
[]
no_license
from ira_calculations_class import Portfolio_year import unittest """ Test Cases to test the Portfolio_year class functions Author: Alan Ly 11-02-18 """ class TestPortfolioClass(unittest.TestCase): #setUp is applied to all test cases in the TestPortfolioClass class def setUp(self): self.myPortfolio = Portfoli...
true
778e777153cc7b127d781b6a00f7d7924e81b0c0
ty-rosen/LL_GNC
/Teststand_CDH2/0MQ-helloworld/test_array.py
UTF-8
718
3.046875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Hello World client in Python # Connects REQ socket to tcp://localhost:5555 # Sends "Hello" to server, expects "World" back # #RASPBERRY PI import zmq import threading context = zmq.Context() # Socket to talk to server print("Connecting to 1...") socket1 = cont...
true
6ba0c3d6b91a941ce84491a9826d2852c3bd2688
awesome-archive/python-utils
/plot_images.py
UTF-8
891
2.890625
3
[ "MIT" ]
permissive
import numpy as np def map_range(x, in_min, in_max, out_min, out_max): return out_min + (out_max - out_min) * (x - in_min) / (in_max - in_min) def plot_images(images, xy, blend=np.maximum, canvas_shape=(512,512), fill=0): h,w = images.shape[1:3] if images.ndim == 4: canvas_shape = (canvas_shap...
true
fb190860f302e35619700254d1b38ebb63c945a7
c0deaddict/led-table
/server/server/utils.py
UTF-8
1,152
2.96875
3
[]
no_license
import asyncio from .log import logger async def run_shell(command): p = await asyncio.create_subprocess_shell(command) await p.wait() if p.returncode != 0: logger.info('run_shell failed: {}'.format(command)) async def wait_until_done(task): while not task.done(): await asyncio.slee...
true
d755119d373e81cc66b87b21abcb02f911a741d1
pathfinder1989/python_learning
/object_pro.py
UTF-8
746
3.65625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 _*_ class Student(object): pass #给实例绑定一个方法 stu = Student() stu.name = 'kang' print(stu.name) def set_age(self, age): self.age = age pass #给实例动态绑定一个方法 但是其他实例不会起作用 from types import MethodType stu.set_age = MethodType(set_age, stu) stu.set_age(23) print(stu.age) #如果要让...
true
77ef449c99174d6b0934870bd6690d2553c5d879
mcast2016/game_python
/game_development_tutorial_by_python/list0303_1.py
UTF-8
2,900
2.921875
3
[]
no_license
import tkinter #input key key = "" koff = False def key_down(e): global key,koff key = e.keysym koff = False def key_up(e): global koff koff = True DIR_UP = 0 DIR_DOWN = 1 DIR_LEFT =2 DIR_RIGHT = 3 pen_x = 90 pen_y = 90 map_data = [ [0,1,1,1,1,0,0,1,1,1,1,0], [0,2,3,3,2,1,1,2,3,...
true
b9d3676c34d7788560887862bf103dfd9efdba7b
owenGnet/edu
/HarvardExtension/CSCI_E-88/HW4_Flume_Kafka/src/p1_make_files.py
UTF-8
426
3.265625
3
[]
no_license
import os # Create 5 files with 10 lines of text each (anything goes) - named file1.txt, file2.txt,.... File5.txt output_folder = 'staging' for i in range(1,6): with open('staging/file{}.txt'.format(i), 'w') as f: for j in range(1,11): f.write('I am line {} in file {}\n'.format(j, i)) ...
true
704a6ceea63b1ad920d8d7561eb43a5a106b9dea
charlieLehman/yapwrap
/yapwrap/dataloaders/dataloader.py
UTF-8
2,299
2.8125
3
[]
no_license
import os class Dataloader(object): def __init__(self, root, size, batch_sizes, transforms): self.name = self.__class__.__name__ if root is not None: if not isinstance(root, str): raise TypeError('{} is not a valid type str'.format(type(root).__name__)) if ...
true
82e78524d3a7b55c01632331ececa060c371d623
vamsi-manyam/crosswordsolver
/python/func.py
UTF-8
1,500
2.96875
3
[]
no_license
import re def remove(list): pattern = '[^A-Z]' #pattern = '[1-9]' #a= re.sub('[^a-zA-Z0-9.?]',' ',a) list = [re.sub(pattern, '', i) for i in list] return list def strToGrid(str, k): temp = "" for i in range(len(str)): if i %k == 0: sub = str[i:i+k] ls...
true
6bc44b47d7ed76a70d81d16fb268333b412f9ced
nikosgalanis/bsc-thesis
/LDP/Distance_Sensitive_Encoding.py
UTF-8
3,452
3.09375
3
[ "Apache-2.0" ]
permissive
import numpy as np import random import math import numbers class Distance_Sensitive_Encoding_client(): def __init__(self, e, d): # initialization of the protocol's constants self.e = e self.d = d self.theta = math.floor((math.sqrt(4 * math.exp(self.e) + 1) - 1) / 2) self.a = (self.theta * (self.theta + 1)...
true
6cd24a860686ab7a037ba315a28608690ee13d06
hayeonk/codeforces
/Round #556 (Div. 2)/tiling_challenge.py
UTF-8
758
3.15625
3
[]
no_license
def setXY(y, x, delta): ok = True for i in range(5): ny = y + coverType[i][0] nx = x + coverType[i][1] if ny < 0 or ny >= n or nx < 0 or nx >= n: ok = False else: board[ny][nx] += delta if board[ny][nx] > 1: ok = False return ok def cover(): y, x = -1, -1 for i in range(n): for j in range...
true
e853e595086a29d5cf5097b96ce02118c5f66e94
Mariama2006/holbertonschool-higher_level_programming
/0x06-python-classes/1-square.py
UTF-8
167
2.5625
3
[]
no_license
#!/usr/bin/python3 "0-square.py define" class Square: """Class Samu """ def __init__(self, size): """Def """ self.__size = size
true
2c16c0d914c2529c503496ded080afba6cdb87b0
21-guns/algo
/practice/Python3/regular_expressions/regular_expressions.py
UTF-8
692
3.671875
4
[ "MIT" ]
permissive
import re # match whole string data1 = "aaab" data2 = "aaaba" pattern = r"\Aa+b\Z" match1 = re.match(pattern, data1) print(match1) match2 = re.match(pattern, data2) print(match2) # regular expression options data = "AaaA\n\raaaA" pattern = r"^(a+)$" match = re.match(pattern, data, re.I | re.M) print(match) print(m...
true
46dcc267e22aa9c00e4d368087027956979273bd
stephenhage/iubb
/iubb_data.py
UTF-8
885
2.6875
3
[]
no_license
import requests from bs4 import BeautifulSoup as bs espn_home = "https://www.espn.com" espn_base = "https://www.espn.com/mens-college-basketball/team/schedule/_/id/84" sched = requests.get(espn_base).text soup = bs(sched, "html.parser") with open("iusched.html", "w") as file: file.write(sched) opponentslist =...
true
66b5b1aac11822ca37a410357210678db22b13f8
racinmat/python-lessons
/snippets.py
UTF-8
5,594
3.25
3
[]
no_license
''' print("tohle se vypsalo") celeCislo = 5 print(celeCislo) print(type(celeCislo)) celeCislo = 5.5 print(celeCislo) print(type(celeCislo)) # promenna1 = "tohle je string" # tohle je jednoradkovy komentar \''' tohle je viceradkovy komentar \''' promenna1 = 'tohle je string' print(promenna1) print(type(promenna1)) prome...
true
eb00800075a1a671ff82e69f83b443352bd2bd23
rodrigoks/python
/desafios/mundo1/d024.py
UTF-8
190
3.75
4
[]
no_license
cidade = str(input('Informe o nome de uma cidade: ')).strip() if cidade.lower().find('santo') != -1: print('Esta cidade contem Santo.') else: print('Esta cidade nao contem Santo.')
true
fb46a985b4bc4ddd7a44f85300656b13c038ee1d
rayjustinhuang/BitesofPy
/operas.py
UTF-8
3,603
2.953125
3
[ "MIT" ]
permissive
from collections import namedtuple from datetime import datetime Composer = namedtuple('Composer', 'name born died') Opera = namedtuple('Opera', 'author play date') composers = { "beethoven": Composer("Ludwig van Beethoven", "17 December 1770", "26 March 1827"), "wagner": Composer("R...
true
8b060e25e9227325281d50b4bfbdddd900a5a5e8
umutalpdenktas/smilepy
/smile.py
UTF-8
594
3.734375
4
[]
no_license
import turtle pen = turtle.Turtle() def eye(col,rad): pen.down() pen.fillcolor(col) pen.begin_fill() pen.circle(rad) pen.end_fill() pen.up() pen.fillcolor('yellow') pen.begin_fill() pen.circle(100) pen.end_fill() pen.up() pen.goto(-40,120) eye('white', 15) pen.goto(-37, 125) eye('black', 5) ...
true
9b9123c8e0fdfaea6a4bb8dfa8d950ea93a42cb3
OneGov/onegov-cloud
/src/onegov/core/orm/cache.py
UTF-8
10,286
2.71875
3
[ "MIT" ]
permissive
""" Provides a simple and mostly transparent way of defining orm-cached properties on the application class. For example:: from onegov.core import Framework from onegov.core.orm import orm_cached class App(Framework): @orm_cached(policy='on-table-change:users') def users(self): ...
true
c3c673c6f6ff52e2bd2663337c076699c519c602
HG13301/Summary_exercise_python_ActiveCode
/Family.py
UTF-8
3,486
3.828125
4
[]
no_license
########## class Father(object): def __init__(self, father_name, father_age): self.father_name = str(father_name) self.father_age = father_age def set_father_name(self, name): self.father_name = name def set_father_age(self, age): self.father_age = age def ...
true
9b4fe682bf64bf174e7cbe2217e913f746a92b43
chrisfalter/DataScience
/Python/NumpyAnalytics/grade_utils.py
UTF-8
910
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jun 30 23:50:44 2017 @author: cfalter """ from decimal import Decimal def letterGrade(score): ''' given a numerical score, returns the corresponding letter grade Parameters: score - in string format Returns: letter grade in string forma...
true
fff00f65b7a22aa360adc56d9eebfdfa149b423f
lundbird/LeetCode
/excel_sheet_column_number.py
UTF-8
283
3.453125
3
[]
no_license
class Solution: def titleToNumber(self, s: str) -> int: alphabet_size = 26 mult = 1 total = 0 for char in s[::-1]: val = ord(char) - 64 total += val * mult mult *= alphabet_size return total
true
14869fe3c8d17220f2d323f81feb800560c5e74e
kjvmartinez/automation-for-lazy
/participants-to-certificate/load_names.py
UTF-8
599
2.828125
3
[]
no_license
from pptx import Presentation import csv def sendNamesToTemplate(): # open template file prs = Presentation("<relative path of your template>") title_slide_layout = prs.slide_layouts[0] with open("participants.csv") as file: reader = csv.reader(file) for row in reader: slid...
true
5a413016f1a57fb7272ac24ed9ebadff37e7cf42
nagireddy96666/Interview_-python
/Given_Number_Prime_Or_Not.py
UTF-8
320
3.59375
4
[]
no_license
a = input('Enter a number:: ') def prime(a): if a <= 1: print a, 'is a not prime' else : for i in range (2, a ): if a%i == 0: print a,' is not a prime number' break else: print "prime number" prime(a)
true
7c903c1620e4cb03279a4eda8a3199cede442469
LiaoBoWen/MyProject
/Leaning/NLP_project/基于word2vec_PCA_SVM的情感分析/svm_model.py
UTF-8
1,087
3
3
[]
no_license
from sklearn.svm import SVC import matplotlib.pyplot as plt from sklearn import metrics import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.decomposition import PCA from sklearn.model_selection import train_test_split def read_data(data_path='./Data.csv'): Data = pd.read_c...
true
3ff8da14a6efb0418140c595fda7a84c8a1f37c7
geokai/python_tuts_banas
/Tut_2/pythontut2_0.py
UTF-8
912
4.5625
5
[]
no_license
# for loops and cycling through lists for i in [2, 4, 6, 8, 10]: print('i =', i) print() for i in range(10): print("i =", i) print() for i in range(2, 10): print("i =", i) print() # floating point numbers your_float = input("Enter a float: ") your_float = float(your_float) print("Round to 2 decimals : ...
true
e38a163a9b82ebc4b10da43b2e4e02fc3999df67
AcubeK/LeDoMaiHanh-Fundamental-C4E23
/WebModule/WebModule3/homework10/extra/extra.py
UTF-8
1,032
3.328125
3
[]
no_license
import mlab from todo import ToDo mlab.connect() task = ["New to-do", "View ALL to-do", "Mark a to-do COMPLETE", "Delete a to-do", "Exit"] while True: for i, v in enumerate(task): print(i+1, v) x = int(input("Enter your command (number) : ")) - 1 t_list = ToDo.objects() if task[x] == task[0]: ...
true
4169dc4ef3da459000fcaefff9397d3fd2b02acd
JainManjari/ML_And_DataScience
/Data_Science_and_Machine_Learning/Deep_Learning/Assignments/House_Price_Prediction/file.py
UTF-8
2,223
2.734375
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt from keras import models from keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder df=pd.read_csv("Train_Data.csv") print(df) print(df.describe()) df.fillna(0,i...
true
bc4c08c88c092adb16f5cbef289b7f5abee93abe
GangaMegha/Machine-Learning
/EE15B025_PA1a/Code/q6/feature_selection.py
UTF-8
3,792
3.640625
4
[]
no_license
######################### Using reduced features #################################### import numpy as np from sklearn.linear_model import Ridge from sklearn.metrics import mean_squared_error from ridge_lamda import optimal_lamda # getting the optimum lamda from ridge_lamda.py print("\nRunning code for feature sele...
true
2166cbccb5b0b7742b4c6cbf42ab9435fb1bc88c
IITDU-BSSE06/ads-demystifying-the-logs-SakibRezoan
/assignment2/reducer.py
UTF-8
154
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/python import sys count = 0 for line in sys.stdin: if "/assets/js/the-associates.js" in line: count = count + 1 print(count)
true
c7fa1f52e70dc0e1db25a7a74877ccd9fe6b5aeb
jwr1969/sqlalchemy-challenge
/app_solution.py
UTF-8
5,578
2.90625
3
[]
no_license
################################################# # Python SQL toolkit and Object Relational Mapper ################################################# import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func, inspect import datetime a...
true
d89bd62b3aebe8493ed09927d5c0c443d1e44725
karenlmcneil/TunisianParser
/preprocessing/ar_ctype.py
UTF-8
1,657
2.84375
3
[]
no_license
import re from preprocessing.arabic_const import * HARAKAT_pat = re.compile(r'|'.join([FATHATAN,DAMMATAN,KASRATAN,FATHA,DAMMA,KASRA,SUKUN,SHADDA])) HAMZAT_pat =re.compile(r'|'.join([WAW_HAMZA,YEH_HAMZA])) ALEFAT_pat =re.compile(r'|'.join([ALEF_MADDA,ALEF_HAMZA_ABOVE,ALEF_HAMZA_BELOW,HAMZA_ABOVE,HAMZA_BELOW])) LAMALEF...
true
4124ba438e61881184450eff87f149d757e60683
ithou/ML-Review
/3 SVM/SVMDemo.py
UTF-8
1,141
3.421875
3
[]
no_license
import numpy as np import pylab as pl from sklearn import svm # 1.准备数据集 np.random.seed(42) class_A_X = np.random.randn(5, 2) - [2, 2] class_B_X = np.random.randn(5, 2) + [2, 2] # r c # 2.提取特征变量 X = np.r_[class_A_X, class_B_X] # 将每一行矩阵拼接成一块 Y = [0] * 5 + [1] * 5 # label 贴标签 print("Y: \n", Y) # 3.结合算法 clf = svm.SVC(k...
true
42189d44df4bedda4aa9fd28ec1a2b8f5dd5d4fd
Arjuna1513/Python_Practice_Programs
/AllAboutDictionaries/DictionaryMethods.py
UTF-8
944
4.09375
4
[]
no_license
dict1 = {1:2, 3:4, 'a':'b', 5:{1:2}} # print(dict1) # # print(len(dict1)) # prints length of dict1 # # print(dict1.items()) # Returns a list of items with both key and value pairs and since the list is # # returned we are able to iterate over it # # print(dict1.values()) # returns only list of values # # print(dict1.ke...
true
66b8e2726892380cd85d11eef02e9295a2cd4894
ledpear/algorithm
/BAEKJOON/10000~/10974_모든 순열_python/CodingTest.py
UTF-8
290
3.078125
3
[]
no_license
import string import sys from itertools import permutations sys.setrecursionlimit(10**9) input = sys.stdin.readline size = int(input().rstrip()) numArr = [i for i in range(1, size + 1)] for arr in permutations(numArr, size): for num in arr: print(num, end=' ') print("")
true
b3dbc0bc523d568f0d43c81e48478002f143a26b
jiaruncao/Readers
/Lucence/indexize.py
UTF-8
1,715
2.515625
3
[]
no_license
''' @ author: jiarun Cao Example of Indexing with PyLucene 3.0 ''' import os, sys, glob import lucene #from org.apache.lucene.store import SimpleFSDirectory from lucene import SimpleFSDirectory, System, File, Document, Field, StandardAnalyzer, IndexWriter, Version # index all the file with pylucene def luceneInd...
true
70d777b2716514608326917e3480ac413b500968
jindongyang94/migration_scripts_rds-s3
/production_scripts/daily_migration.py
UTF-8
10,758
2.65625
3
[]
no_license
import subprocess import os import re import csv import contextlib from datetime import datetime import boto3 import psycopg2 from helper import RDSHelper, S3Helper, PGHelper, DATALAKE_NAME """ The idea of this script is to find the respective database instances using Boto3, and then find the respective databases i...
true
600a7fb045682c6cb8cf6d974e354ac0ea2d817f
jiamen/TensorflowStudy
/chapter2/linear_regression.py
UTF-8
385
2.9375
3
[]
no_license
import tensorflow as tf import numpy as np data = [] # 保存样本集的列表 for i in range(100): # 循环采样100个点 x = np.random.uniform(-10., 10.) # 随机采样输入x eps = np.random.normal(0., 0.1) # 采样高斯噪声 y = 1.477 * x + 0.089 + eps # 得到模型的输出 data.append([x, y]) data = np.array(data) # 得到
true
8a6b6df4918c40adc1d6aba468ed1f03496e2794
chenying-wang/usc-ee-coursework-public
/ee450/lab4/lab4.py
UTF-8
2,600
2.8125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/python3 import sys START_FLAG = 'SF' END_FLAG = 'EF' def main(fname): with open(fname) as f: lines = f.readlines() lines = [line.strip() for line in lines] # 0 Read input file sources_name = [] sources_packets = [] sources_priority = [] for line in lines: if no...
true
da1d2a934a898d087e00125dce43dd4584c532bb
PhantomSpike/Python_edX
/Week 3/Lectures/test5.py
UTF-8
889
3.578125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 19 09:15:32 2019 @author: aleksandar """ def how_many(aDict): ''' aDict: A dictionary, where all the values are lists. returns: int, how many values are in the dictionary. ''' # Your Code Here count = 0 for w in aDict: ...
true
e819fd816ff3a28f51baab7f0e7e1bd99dc37905
passionbytes/sparkcode
/code/q11/TotalBabies.py
UTF-8
825
2.828125
3
[]
no_license
import sys import csv from pyspark.sql import SparkSession from pyspark import SparkContext if __name__ == "__main__": sparkSession = SparkSession \ .builder \ .master("local[*]") \ .appName("Total Count of Babies") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() sc = spark...
true
7ad180b1c226ad410cd1fc13f39fdef6d1e89888
GZ-Alinx/Six_Star
/day8-集合和函数/lx_04函数返回值.py
UTF-8
243
3.421875
3
[]
no_license
# 函数返回值 是函数处理完后返回给调用者的数据 def sum_sum(num1, num2): d = num1 * num2 return num1 + num2, d # return 表示函数结束执行 下面的代码不会再执行 ret = sum_sum(10,20) print(ret)
true
2d35fa959b8711e079c508ff55f1be89b5a33d1f
ritusingla/Realtime-Face-Recognition-using-KNN
/project1 realtime face recognition using knn/face_detection.py
UTF-8
1,582
3.359375
3
[]
no_license
# Read video stream from webcam (frame by frame) import cv2 #step1 - #to capture a device from which youw want to read the video stream. #ByDefault the id of our webcam is 0 # if we have multiple webcams then we can trey with mutiple ids cap=cv2.VideoCapture(0) #object of haarcascades classifier which works...
true
2205a9f8fbcd149dd7808a6cc675b10171914c1f
daofeng123/ClassCodes
/d16_plot_linalg/p06_conv.py
UTF-8
189
2.75
3
[]
no_license
import numpy as np x = [1, 2, 3, 4, 5, 6] # 原始数据 y = [6, 5, 4, 3, 2, 1] # 核 # r[0] = x0y0 # r[1] = x0y1 + x1y0 # r[1] = x0y2 + x1y1 + x2y0 print(np.convolve(x, y, mode=''))
true
e0cd235f9a040bd73269a8c880395d7f99ba60c5
sharvilkadam/hiddenMarkovModel
/hmmlearn.py
UTF-8
3,975
2.640625
3
[]
no_license
import sys import codecs import math def readText( file1 ): fo = codecs.open(file1, "r",encoding='utf8') text=fo.read()#.decode('utf8') fo.close() return text def learnLine( tx , d ): t1=tx.split(" ") count=0 while count<(len(t1)): #tagarray = t1[count].split("/") #tag = tagarray[len(t...
true
b00bd22498cc3fdb3ac3941adef61b7d0783fde2
chujihan/0418
/prob/prob103.py
UTF-8
85
2.6875
3
[]
no_license
#아래 코드의 출력 결과를 예상하라 #print(3 < 5) #True print(3 < 5)
true
95b242d89ddcfea6386735da4ebfc64a23363c5b
estebanech/TallerPatrones
/Cliente.py
UTF-8
1,329
2.78125
3
[]
no_license
from datetime import date class Cliente: def __init__ (self, nombre, apellidos, genero, FN, EC, id = 0): self.__id = id self.__nombre = nombre self.__apellidos = apellidos self.__genero = genero self.__FNacimiento = FN self.__ECivil = EC def __str__(self): ...
true
8a4b31f20cea4ef6578e781b27bb07bc2d79c007
Zongziyu/CUHK-Business-project
/loan/data_pre.py
UTF-8
3,193
2.78125
3
[]
no_license
import pandas as pd need_col = ['loan_amnt','int_rate','installment','emp_length','annual_inc','dti','delinq_2yrs','mths_since_last_delinq','open_acc','revol_bal','own_house','mortgage_house','total_pymnt_'] addr_map = {'WA':'West','OR':'West','ID':'West','MT':'West','WY':'West','CA':'West','NV':'West','UT':'West','C...
true
54adc9912a7e4c2d00ce3960f9a3d8fb6ef16b32
fresnik/battlesnake-sad-snake
/src/server.py
UTF-8
1,587
2.671875
3
[ "MIT" ]
permissive
import os import cherrypy import json from snakes.claustrophobicsnake import ClaustrophobicSnake from gamestate import GameState """ This is a simple Battlesnake server written in Python. For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md """ class Battlesnake(object): @...
true
585c4f278a5cd8b8f4ae4c7326e985b1b5365118
asilva009/Curso-Python
/Seção 13/EX_01_secao13.py
UTF-8
307
3.921875
4
[]
no_license
with open("arquivo.txt", "w") as arquivo: while True: caracter = input("Entre com um caracter: ") if caracter != "O": arquivo.write(caracter) arquivo.write("\n") else: break with open("arquivo.txt", "r") as arquivo: print(arquivo.read())
true
455efd6027e6b53a46c3c16d818ba5463e2bbf11
Exdenta/HackerRank
/yandex/utils.py
UTF-8
194
3.078125
3
[]
no_license
# read reader = open('input.txt', 'r') a, b = [int(n) for n in reader.readline().split(" ")] reader.close() # write writer = open('output.txt', 'w') writer.write("%d" % (a+b)) writer.close()
true
159e2662cde76ebbfdcc94b29d05f9a398302ecf
Joycepy/informational_retrival
/work4/scrapyData.py
UTF-8
7,576
3.046875
3
[]
no_license
import json import re from time import sleep # 用来解析 HTML 文本,可以获取爬到的 HTML 文本中的各个项的属性 from bs4 import BeautifulSoup # 可以模拟浏览器获取异步数据或者执行点击操作 from selenium import webdriver # 模拟火狐浏览器执行点击操作 browser = webdriver.Firefox() def wf(path, obj): file = open(path, 'w', encoding='utf-8') file.write(json.dumps(obj, sort_k...
true
168bb42e39b83ed11430df4475403a749b0be097
mariogen/curso_python
/dia_2/pi_test.py
UTF-8
1,766
2.53125
3
[ "MIT" ]
permissive
#https://techsupport.osisoft.com/Documentation/PI-SDK/Introducing_the_PI_SDK/PISDK_object_model.htm #Não esquecer de cadastrar no PIProcessBook File/Connections/Servidor/Adicionar servidor {"Nó da rede": S2750AS10, "usuário": pidemo, "senha": pidemo} from win32com.client.dynamic import Dispatch from datetime imp...
true
03b440e886808b705cdac49b2bb586c03fedee6f
weak-head/leetcode
/tests/test_p0417_pacific_atlantic_water_flow.py
UTF-8
640
2.6875
3
[]
no_license
# flake8: noqa: F403, F405 import pytest from leetcode.p0417_pacific_atlantic_water_flow import * solutions = [ pacificAtlantic, ] test_cases = [ ( [ [1, 2, 2, 3, 5], [3, 2, 3, 4, 4], [2, 4, 5, 3, 1], [6, 7, 1, 4, 5], [5, 1, 1, 2, 4], ...
true
faa566b6f519b1d5336cdeaa3989490a95e268b4
shubhamishere/JustSomeRandomPythonShit
/loopsPractice.py
UTF-8
239
4.21875
4
[]
no_license
#Use Python 3 spam = 3 #Spam variable is initially set to 0 while spam < 5: #if spam variable is less than 5 print("Hello, World!") #print hello world spam += 1 #And increment spam by 1
true
4d604cb935775a6bef9eb52a19055e9d4f9db7ea
ViniciusArdonyx/shisen_sho
/treatPieces.py
UTF-8
5,721
3
3
[]
no_license
''' Trata as informacoes necessarias das pecas quando ainda brutas, ou seja, antes de estarem completamente ajustadas para a exibicao na tela do jogo. ''' import os import sys import math import random from PIL import Image from tkinter import messagebox from screenBack import screenBack from configFile import configF...
true
709473ecd1512ff54803fbc0b40621cf27e78be9
troyane/xkcdComicsBot
/latest_comics_checker.py
UTF-8
1,745
2.828125
3
[ "MIT" ]
permissive
import logging import asyncio from time import sleep from threading import Thread import comics as Comics LatestComicsNumber = 1981 needToCheckLastComics = True UNDEFINED = -1 # Setup logger logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLog...
true
386ce8afd6cc9d71bd6f17d61e4a361b5f36ccaa
martin-sicho/zprac_chem_strukt
/ukol_03/Python/3DSouradnice/molecule/Atom.py
UTF-8
698
3.34375
3
[]
no_license
import Node class Atom(Node.Node): _x = int() _y = int() _z = int() def __init__(self, x, y, z, name=""): Node.Node.__init__(self, name=name) self._x = x self._y = y self._z = z def __repr__(self): return "Atom[order:{0},name:{1}]".format(self.getNodeCount...
true
4bda454b0e17006652358f1396a8c9fa8bc6d660
Gurdit559/myOpenCV
/ExploreOpenCV/trackbar.py
UTF-8
1,100
2.71875
3
[]
no_license
import cv2 import numpy as np #img=np.zeros((400,400,3),np.uint8) #cv2.imshow("image",img) cv2.namedWindow("image") def position(x): print(x) S="color/grey" cv2.createTrackbar(S,"image",0,1,position) # acts like a switch cv2.createTrackbar("cp","image",0,255,position) #cv2.createTrackbar("G","image",0,...
true
4fce58006a541fb3bee7c27e022a7b39516e09fc
Laboratorio-imagenes-CICATAQro/Taller-DL-2018
/Proyecto-Final/t_rex/utils.py
UTF-8
1,818
3.046875
3
[]
no_license
import os import pygame as pg def load_image(name,sizex=-1,sizey=-1,colorkey=None): fullname = os.path.join('sprites', name) image = pg.image.load(fullname) image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0, 0)) image.se...
true
c25cde4737ab82d98694fcc5dbbe80b50462fc8d
MichaelMauderer/prysm
/prysm/pupil.py
UTF-8
13,464
3.0625
3
[ "MIT" ]
permissive
''' A base pupil interface for different aberration models. ''' from copy import deepcopy from numpy import ( empty, zeros, linspace, meshgrid, isfinite, ) from matplotlib import pyplot as plt from prysm.conf import config from prysm.util import share_fig_ax, rms from prysm.coordinates import cart_to_pol...
true
4e8fd73f3957ffe2ed34ca110bebf0e1b62d7330
EduardoPacheco12/Calculadora-Binaria
/DivisaoBinario.py
UTF-8
2,425
3.671875
4
[]
no_license
import os import Menu #DIVISÃO DE BINÁRIOS def divisão(): while(True): print('Pra voltar ao MENU INTERATIVO, digite "voltar"\n') divisao_um = input('Primeiro número binário: ') if divisao_um.lower() == 'voltar': os.system('cls') print ('...
true
43945cee8052da401401664e274ef438e4a946ee
rstom19/Data-Science-Portfolio
/Notebooks, Projects, Tutorials/Admissions_Dataset_ML_Techniques.py
UTF-8
6,940
3.625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 16 21:09:29 2019 @author: ryantomiyama """ ############ Machine Learning Techniques on Admissions Dataset############ ### The goal is to use ML techniques to predict the chance of applicants getting admitted to graduate school. import pandas as p...
true
4c0c4c94b7ff8a1067a346b060a9c102ac29ef64
earharpm/2014_Base
/pickup.py
UTF-8
1,699
2.59375
3
[]
no_license
import common __all__ = ['Pickup'] class Pickup(common.ComponentBase): def __init__(self, config): self.motor = config.pickup_motor self.solenoid = config.solenoid self.forward = config.forward self.reverse = config.reverse self.pickup_switch = config.picku...
true
d834c0264feb3af177bba7a167a947edb1f96c7a
dmarc0001/spx42Control
/tools/makeBuildTemplate.py
UTF-8
3,423
2.5625
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- from argparse import ArgumentParser import datetime import os.path """ BUILD-Nummer hochzählen, Builddatum erzeugen """ __author__ = 'Dirk Marciniak' __copyright__ = 'Copyright 2019' __license__ = 'GPL' __version__ = '0.2' BUILDCONFIGNAME = "src/config/CurrBu...
true
3a3593b8e05ecd07b81fa7da00f91778a1d8d240
frankfanslc/DMARCate
/visualizations/heatMap-out.py
UTF-8
4,313
2.796875
3
[]
no_license
################################################# # Author: Yadvir Singh # # Date: 17-07-2016 # # Description: # # # # Script that generates a heat map of # # outgoing reports by name. Each tile # # contains the domain, # # the total nu...
true
33b4fd54a2c2714bb7257b265345159bcaaaaa3d
cmhcbb/attackbox
/attack/Bandit.py
UTF-8
4,385
2.578125
3
[ "MIT" ]
permissive
import time import numpy as np import random import torch import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import torch.nn as nn from torch.nn.modules import Upsample def norm(t): assert len(t.shape) == 4 norm_vec = torch.sqrt(t.pow(2).sum(dim=[1,2,3])).view(-1, 1...
true
aa5d455114ace77775447f8bc36e86f269833d6a
shammy8/Motion-and-Smile-Detector
/plotting.py
UTF-8
1,208
3.359375
3
[]
no_license
"""Display when motion is detected onto a quad (bar) graph, through the capture.py script""" from capture import times_df #execute capture.py and get the times_df from it from bokeh.plotting import figure, show, output_file from bokeh.models import HoverTool, ColumnDataSource #format the date and tim...
true
cbab7d99d6cf51d945cce2aa2d7340ed50067b6b
csherwood-usgs/IPython_notebook_examples
/exif2track.py
UTF-8
10,441
2.765625
3
[]
no_license
# coding: utf-8 # In[ ]: # exif2track - script to plot photo locations and tabulate image info # This is an ipython script that can be run in a Jupyter notebook # after loading with the magic command %load exif2track.py """ Unless otherwise noted, the software and content on this site is in the public domain becaus...
true
780b503fa211c377e542b2e48977b5f1b3ccd11a
byuan45/LitmusCovid
/gui/graphs/misc/ctp_stream.py
UTF-8
573
2.703125
3
[]
no_license
import requests import json #response = requests.get("https://api.covidtracking.com/v1/states/daily.json") response = requests.request("GET", "https://api.covidtracking.com/v1/US/daily.json") with open('CTPNational.txt', 'wb') as f: f.write(response.content) """ data = str(response.content) data = json.loads(dat...
true
6ba895d497c9fdace83463059b10ed932ddbc0bd
kefirski/CDVAE
/utils/batchloader.py
UTF-8
7,550
2.765625
3
[]
no_license
import os import re import numpy as np import torch as t import collections from torch.autograd import Variable from six.moves import cPickle class BatchLoader: def __init__(self, data_path='./data/', force_preprocessing=False): """ :param data_path: string prefix to path of data folder :p...
true
447ffb0331b3f00b9435e2cad9194d99fe895276
rdumaguin/CodingDojoCompilation
/Python-Oct-2017/PythonFundamentals/Checkerboard.py
UTF-8
673
4.3125
4
[]
no_license
def checkerboard(): x = 8 for i in range (0,x): if i % 2 == 0: print "* * * * " else: print " * * * *" checkerboard() # Write a program that prints a 'checkerboard' pattern to the console. # # Your program should require no input and produce console output that looks lik...
true
91020ecd6c1aa66bf201cb6943b63ad35c74211a
vrakitine/eco-programming
/p_01_030/fsm_p_01_030_000.py
UTF-8
2,763
3.59375
4
[]
no_license
''' Case 00 ''' # You can use python emulator online # https://www.onlinegdb.com/online_python_interpreter # for the code below. Just simple copy and paste code to the emulator. # Enjoy! import json # init block real_number = str("-56.78") integer_part = str("") decimal_part = str("") current_state = str("s_00") pre...
true
df37408bb1189b4ce0c746936262cd8df0fbe33c
nodd2000/loto
/loto_classes/tests/test_barrel.py
UTF-8
641
3.21875
3
[]
no_license
""" Тест создания экземпляра класса Barrel """ import random from pytest import fixture from loto_classes import config, Barrel TEST_NUMBER = random.randint(1, config.BARRELS_IN_SACK) @fixture(scope="module") def barrel(): """Фикстура с экземляром класса Barrel""" return Barrel(TEST_NUMBER) def test_repr...
true
78aec2f6c1a3c46e3318a033aa71909455a28430
swathiraon/filter
/filter.py
UTF-8
3,291
2.96875
3
[]
no_license
# from tkinter import * # root = Tk() # canvas = Canvas(root, width = 300, height = 300) # canvas.pack() # img = PhotoImage(file="A8R.gif") # canvas.create_image(150,150, image=img) # mainloop() #to display the image.in the canvas. # from tkinter import * # root = Tk() # frame ...
true
03c88886a4cc6ec0380a13ad72a53cf3bca09f4b
TildenWinston/HackUMBC2019
/financeWizard.py
UTF-8
985
3.15625
3
[]
no_license
from pymongo import MongoClient if __name__ == "__main__": #prompt for budget budget = float(input("what is your budget? ")) #connect to database print("[~] Connecting to DB") client=MongoClient("172.17.0.2",27017) #After spinning up the docker container,$ db=client['stox_database'] #gimme a...
true
7d4ec1b0de4c748ab5ecf3e145d89ea5ac5b3338
Heartyhp/lpthw
/function/ex_19.py
UTF-8
1,071
4.28125
4
[]
no_license
from sys import argv def cheese_and_crackers(cheese_count, box_of_crackers): print(f"you have {cheese_count} cheese!") print(f"you have {box_of_crackers} boxes of crackers!") print("Man thats enough for a party") print("\n Get an Blnket") print("We can just give the function numbers directly:") cheese...
true
4130bf85304bf9cd0632f640005f36a5ba00b4be
sdevkota007/HackerRank
/lonely_number.py
UTF-8
394
3.171875
3
[]
no_license
#!/usr/bin/py def lonelyinteger(a): j=1 while len(a)>2: if a[0]==a[j]: a.pop(j) a.pop(0) j=1 else: j=j+1 if j==len(a): break return a[0] if __name__ == '__main__': a = input() ...
true
271d2e5a40e49a6445d90e4095da6565019429b1
backman-git/leetcode
/sol89.py
UTF-8
190
2.765625
3
[]
no_license
class Solution(object): def grayCode(self, n): res=[] nRange= 1<<n for i in range(nRange): res.append((i>>1)^i) return res sol = Solution() print sol.genGrayCode(4)
true
4d94a1d35ee57dfd5f97b2e5020c5ebea3e5f3e9
ssmithie/classification_project
/cleaning.py
UTF-8
2,357
3.171875
3
[]
no_license
#!/usr/bin/env python3 import pandas as pd # strip the odd punctuation from the column names, and change spaces for underscores df.columns = df.columns.str.strip('\n') df.columns = df.columns.str.replace(" ", "_") df.columns = df.columns.str.replace("-", "_") # get rid of any oddly low prices (10,000/25,000 rows) index...
true
3f504f4d82ca1dd3e732f7a9601f6b14a7aaeaff
kjyggg-sketch/DAlmaden
/legacy/alm3_Analyzer_2key_combined.py
UTF-8
2,674
2.671875
3
[]
no_license
from threading import Thread from crawlLibNaverBlog_12 import * from textAnalyzer import * from renderWordCloud import * from setCalculus import * import matplotlib.pyplot as plt ######################################################################################################################## ...
true
9a31731be87792300513282134cbab4561ea96c6
Dasol159/procesing
/nebo/nebo.pyde
UTF-8
251
2.984375
3
[]
no_license
def setup(): fullScreen() background(0) frameRate(5) def draw(): stroke(random(200,250)) strokeWeight(random(10000,100000)) stroke(random(0,255),random(0,255),random(0,255)) point(random(0,width),random(0,height))
true
794ad1d8faf016b57a9ab5d4e45a5505a0bbab80
ceciliechrstnsn/projects-2021-luna-hjerteknuser
/inauguralproject/inauguralproject.py
UTF-8
8,880
3.71875
4
[ "MIT" ]
permissive
############################### multidimensional solver ####################################### from scipy import optimize import numpy as np def u_func(x, mp): ''' Calculates utility for a chosen (consumption, housing) bundle Args: x (array) : Array of length 2, first element is housing and...
true
793c4808e6ee31dfc613e3ec5c58432039236f52
SenseKnowledge/pytorch-NER
/package/metrics.py
UTF-8
1,615
2.75
3
[]
no_license
# -*- coding: utf-8 -*- from package.utils import decode_bio_tags from collections import Counter class Score: """ Score BIO-style NER """ def __init__(self): super(Score, self).__init__() self.origins = [] self.founds = [] self.rights = [] def compute(self): ...
true