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
838423f7fd97d501886734e1200416abe6810cb1
ModoUnreal/Top_Down
/Top down attempt V2.py
UTF-8
1,027
3.140625
3
[]
no_license
# Plans for a Top Down Shooter # Make a character from a bird's eye view # Add sidescrolling to the thing import pygame import time from player import * from enemy import * from backround import * from constant import * from spritesheet_functions import SpriteSheet import sys # Initialises pygame and creates a windo...
true
fcaa9cf5dfd9562b5f747b6387e88bb3ac7624c6
kikilin-tn/DictCntCal
/ChaCnt.py
UTF-8
262
3.625
4
[]
no_license
""" 可計算出字串中,每個字出現的次數 """ message = 'It was a good day, and the company tourney will be held in weekend.' count = {} for character in message: count.setdefault(character,0) count[character] = count[character]+1 print(count)
true
86a1d4558345a15572cb2eacc760991993d140c2
simsax/Neural-Networks
/toy_nn/matrix.py
UTF-8
2,977
3.65625
4
[]
no_license
import numpy as np import math def frand(x): return x*2-1 class Matrix: def __init__(self,rows,cols): self.rows = rows self.cols = cols self.data = np.zeros([rows,cols]) #the matrix def randomize(self): self.data = np.random.rand(self.rows,self.cols) ...
true
55acfac1fe2e09eed2e636a97facfebaf747410e
victoriarwang/Blackjack-Project
/deck.py
UTF-8
259
3.203125
3
[]
no_license
import random from card import Card class Deck: def __init__(self): self.cards = [Card(v) for v in range(1, 14) for j in range(4)] random.shuffle(self.cards) def deal(self): top_deck = self.cards.pop() return top_deck
true
4ed7cf75a8e45af02a009ab21adda9e91a874269
kennyjoseph/covid_localnews_public
/code_for_stm/preprocess_text_for_topicmodel.py
UTF-8
2,340
2.953125
3
[]
no_license
'''' Given a csv file formated for the STM, preprocess the text. This is a strict preprocessing method to ensure we are left with the most meaningful words in each document '''' from nltk.corpus import stopwords import gensim stop_words = stopwords.words('english') extended = ['from', 'subject', 're', 'edu', 'use', ...
true
0ddcbf3eb72e66368ce123075af25c3b1d786388
kkhitsko/file-checker
/FileChecker.py
UTF-8
901
3.3125
3
[]
no_license
__author__ = "Khitsko Konstantin <khitsko.konstantin@gmail.com>" __date__ = "14.03.2021" from os import listdir from os.path import isfile, join """ Класс для работы с содержимом директоририи и получения и фильтрации списка файлов """ class FileChecker: files = [] directory = None def __init__(self, ar...
true
28f119b8ecd95b977fcbc14e0111036dbe8f25c4
3uxeca/Bitcamp-AI-study
/keras/keras_test.py
UTF-8
2,208
3.046875
3
[]
no_license
import os import pandas as pd import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM, Flatten from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt import math from sklearn.metrics import mean_squared_error look_back = 1 def create_...
true
f7ac0757819eb248931417df802419f6681d4cc8
basinadeepakraj/Paper-III
/linkedlistv2.py
UTF-8
2,254
3.0625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Oct 2 11:18:46 2019 @author: basina """ class Node: def __init__(self, identity, key, choiceindx): self.next = None self.identity = identity self.key = key self.choiceindx = choiceindx class ApplianceSSLL: def ...
true
f39779352f312f2e54811307f3d3f60a79e8df9e
snehalshirgure/PerceptronClassifier-HotelReviews--NLP
/Solution/perceplearn3.py
UTF-8
5,546
2.578125
3
[]
no_license
import re import operator import json f = open("train-labeled.txt", "r", encoding="utf8") d_all={} stopwords = ["a", "i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you", "your", "yours", "yourself", "he", "him", "his", "himself", "she", "her", "hers", "herself", "it", "its", "itself", "they", ...
true
3bef945be734a7b54c75743f8a92291a70d52393
Purva-10/Script
/purva.py
UTF-8
199
2.765625
3
[]
no_license
read -p "enter three numbers:" N1 N2 N3 echo "$N1 $N2 $N3" if [[ $N1 -gt $N2 && $N1 -gt $N3 ] && [ $N2 -gt $N3 ]] then echo "$N1 is Greater" elif echo "wrong input" fi ===========================
true
5430287366269162ac4d89d99f6028f7043efa75
jpallavi23/Smart-Interviews
/06_SI_Basic-Hackerrank/06_Reverse String.py
UTF-8
249
3.84375
4
[]
no_license
''' Given a string, reverse the given string. Input Format Input contains a String - S. Constraints 1 <= len(s) <= 100 Output Format Print the reversed string. Sample Input 0 fdsrd Sample Output 0 drsdf ''' string = input() print(string[::-1])
true
b71b8c3677f868e9a37b08ebc7c5cd96437f0625
hzm2016/gym-kuka-mujoco
/gym_kuka_mujoco/utils/quaternion.py
UTF-8
1,901
2.53125
3
[ "MIT" ]
permissive
import numpy as np import mujoco_py identity_quat = np.array([1., 0., 0., 0.]) def mat2Quat(mat): ''' Convenience function for mju_mat2Quat. ''' res = np.zeros(4) mujoco_py.functions.mju_mat2Quat(res, mat.flatten()) return res def quat2Mat(quat): ''' Convenience function for mju_quat2...
true
d9590048285c4206fd250d0945cfc81dbbde5c98
Rohanvasista/Coding-activities
/Day-9/program 1.py
UTF-8
514
3.84375
4
[]
no_license
problem statement : python program to get digit root of number where we give a random number and until it become complete single digit it goes on calculate solution : num = input() def droot(num): if len(num) == 1: return num else: sum = 0 for i in num: ...
true
09108ebcdff70eb8fcb72194eefb12b1efba9ffa
lnkuiper/information-retrieval
/src/count_freqs.py
UTF-8
518
2.546875
3
[]
no_license
# Makes one pass over our index to count total term occurrences for QL models import _pickle as pickle with open("../data/INVERTED_INDEX_NOSTOP.pkl", "rb") as file: inverted_index = pickle.load(file) TERM_FREQ = {} total_tokens = 0 for key in inverted_index: posting = inverted_index[key] term_freq = 0 ...
true
29755f288044ca488c9aaef2840a69ef7ca7b654
collabkare/fhir-river
/tests/river/unit/transformer/test_reference_binder.py
UTF-8
2,451
2.6875
3
[ "Apache-2.0" ]
permissive
from uuid import UUID import pytest from river.transformer.errors import IncompleteIdentifierError from river.transformer.reference_binder import ReferenceBinder def test_identifier_to_reference(identifier): binder = ReferenceBinder() resource_type = "Patient" reference = binder.identifier_to_reference...
true
782daca7549fa9935f90f76f818e2e984d18c6b0
Wraient/Python-Progarams
/087.more.list.methods.py
UTF-8
228
3.578125
4
[]
no_license
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Sunday", "Thursday", "Friday", "Saturday"] print(days.count("Sunday")) print(sorted(days)) print(days) print(days.sort()) print(days) days_copy = days.copy() print(days_copy)
true
f04513fc85e617a26cf831fa66b6823aa9185932
takecian/ProgrammingStudyLog
/Libs/bit_all_search.py
UTF-8
300
3.265625
3
[]
no_license
# Bit 全探索 def bit_all_search(l): pattern = 1 << len(l) # 1 をリストの長さだけ左にシフトする for i in range(pattern): scope = [] for j in range(len(l)): if (i >> j) & 1: scope.append(l[j]) # do something pass
true
e1041d873abade3f05b6aaa466ae8d1d08de98fa
josezindia/Syllus
/app/editProgram.py
UTF-8
1,806
2.515625
3
[ "MIT" ]
permissive
from allImports import * from app.logic.getAuthUser import AuthorizedUser from app.logic.redirectBack import redirect_url @app.route("/editProgram", methods=["POST"]) def editProgram(): authorizedUser = AuthorizedUser() if authorizedUser.isAdmin: # we need the page for loggin purposes page ...
true
d4dfd9358be93db2e67d87b42898865a648ff05a
Consofine/pandemic
/tests/component_test.py
UTF-8
23,103
2.921875
3
[]
no_license
import sys sys.path.append('..') import unittest import functools from board import * from custom_exceptions import GameEndedError from constants import * class TestMap(): def __init__(self): self.cities = Board.init_cities(STARTING_CITY) def get_city(self, city_name: str) -> City: return sel...
true
a4e829c378207222badc14e80a5cd55ca5626b7a
satyaajeet/Project_Euler
/Project_Euler_48_Self_Powers.py
UTF-8
295
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 28 22:15:32 2019 @author: satya """ s=0 for i in range(1,11): num=i**i s=num+s for i in range(11,1000): num=str(i**i) rem=num[(len(num)-10):len(num)] s=int(rem)+s s=str(s) print(s[(len(s)-10):len(s)])
true
b28992a7a690206dabb6584b3790d6c647b7d5af
Michaelplata/calculator_test
/week_01/day_3/functions_lab_1/solution/src/python_functions_practice.py
UTF-8
1,326
3.921875
4
[]
no_license
def return_10(): return 10 def add(num_1, num_2): return num_1 + num_2 def subtract(num_1, num_2): return num_1 - num_2 def multiply(num_1, num_2): return num_1 * num_2 def divide(num_1, num_2): return num_1 // num_2 def length_of_string(string): return len(string) def join_string(string_1...
true
d52e22926ac09afe5d71e2b4c972bdce69c98590
yumoqing/srudp
/test/demo2.py
UTF-8
281
2.625
3
[ "MIT" ]
permissive
from srudp import SecureReliableSocket from time import time import sys sock = SecureReliableSocket() sock.connect((sys.argv[1], int(sys.argv[2]))) while not sock.is_closed: data = sock.recv(1024) if not data: break print(time(), data) print("closed", sock)
true
72d654942b01446b1b0049e0c6d47951e0c9c7cb
aallaire/python_forex_types
/forex_types/price.py
UTF-8
2,839
3.546875
4
[]
no_license
"""Price class.""" from decimal import Decimal from statistics import mean class BasePrice: """Common parent of Price and NinjaPrice""" # Prices outside these limits are considered errors. MIN = Decimal("0.1") # minimum for standard quote currencies MAX = Decimal("10.0") # maximum for standard quo...
true
758c2985dcdc5a35bca9c8b5573f8292d516cacf
kevinthwu/vis-a2
/stability.py
UTF-8
10,639
2.984375
3
[]
no_license
# COMP8503 Assignment 2 # Authors: Wu Tien Hsuan, Wu Zhiyong # TCSVT 2017 Clustervision Visual Supervision of Unsupervised Clustering # Stability Score import sys import pandas as pd from scipy import linalg from sklearn.cluster import KMeans from rtree import index import numpy as np import time import matplotlib.pyp...
true
1870c0e5502e0da8e1b185693c75328c068b269f
mang0kitty/crypto-pals
/fixedXOR/fixedXOR.py
UTF-8
572
3.078125
3
[]
no_license
import string from binascii import unhexlify, b2a_base64 def hex_to_byteArray(hexString): return unhexlify(hexString) def xor(buffer1: bytes, buffer2: bytes) -> bytes: return bytes([(b1 ^ b2) for b1, b2 in zip(buffer1, buffer2)]) def byte_to_string(byte_list: bytes) -> str: return "".join(filter(lambd...
true
2b0f6175f68946a88db5059e9096d930da104409
eroicaleo/LearningPython
/interview/leet/43_Multiply_Strings.py
UTF-8
1,151
3.0625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ if num1 == '0' or num2 == '0': return '0' l1, l2 = [list(map(int, n)) for n in (num1, num2)] len1, len2 = le...
true
6c9953c8416c946a8354e47934971ff13cbd3f6c
Think-Differently/140PA1
/ECE 140A.py
UTF-8
2,727
3.421875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[48]: list_1=[1,2,3,4,5,6,7,8,9] # In[49]: list_2=[11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0] # In[50]: list_1[0]="one"; list_1[1]="two"; list_1[2]="three"; print(list_1) # In[51]: list_2[0]="eleven"; list_2[1]="twelve"; list_2[2]="thirteen"; print(list_2...
true
bef62e74c0569efc54b42bdea7632ea800771935
kjemist/dndice
/dnd_dice.py
UTF-8
2,640
3.921875
4
[]
no_license
#!/usr/bin/env python3 """ script for simulating dice rolls in Dungeons and Dragons Fifth Edition inputs number of dice, number of sides and dice modifier outputs the total sum of the dice roller, including the modifier on top designed to work with Python3 by Illimar Rekand illimar.rekand@gmail.com March 2019 """ ...
true
07d0e4b21e4101d75a39bab042d70716dfe448c2
nicoguaro/ellipse_packing
/examples/poly_split-average.py
UTF-8
933
3
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Nov 09 11:53:18 2015 @author: nicoguaro_2 """ from __future__ import absolute_import, division, print_function import sys import numpy as np from matplotlib.patches import Polygon import matplotlib.pyplot as plt sys.path.append("./..") from ellipse_packing.ellipse_packing imp...
true
ea0ffc8f84c24ed762800806c2e9781cb957c906
ailabteam/CodesignalPython
/maxSumSegments.py
UTF-8
478
3.125
3
[]
no_license
def maxSumSegments(inputArray): res = [0 for i in range(len(inputArray))] for i in range(1, len(inputArray) + 1): sum = 0 mxSum = 0 idx = -1 for j in range(len(inputArray)): sum += inputArray[j] if j >= i: sum -= inputArray[j-i] ...
true
4e4ec22ee65ee0183655e674a58f1dbc58c31070
snowflake8864/myML
/playground/sigmoid_dist.py
UTF-8
197
2.984375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) bins = np.arange(-10, 10, 0.1) plt.plot(bins, sigmoid(bins), linewidth=2, color="r") plt.show()
true
e9c49af715b4ba17933ad597d7905ab41e8d7096
CollegeBoreal/INF1042-202-20H-02
/C.Comprehensions/.scripts~/b300115065.spec.py
UTF-8
316
2.859375
3
[]
no_license
import sys; sys.path.append('.') # Rajouter le repertoire courant from b300115065 import rightTriangle test = rightTriangle(11) == [(8, 6, 10)] if test: print('--------------------') print(':tada: :tada: :tada:') else: print('--------------------') print(':no_entry: :no_entry: :interrobang:')
true
9bba991b9176d7266d6af4efe3794b3a4e3d558b
kedpak/holbertonschool-higher_level_programming
/0x06-python-test_driven_development/5-text_indentation.py
UTF-8
1,492
3.625
4
[]
no_license
#!/usr/bin/python3 ''' text indentation module ''' def text_indentation(text): ''' test ''' if type(text) != str: raise TypeError("text must be a string") iter = 0 while iter < len(text): snap = True if text[iter] == ' ' and iter == 0: while text[iter] is ...
true
b2c86724b7c2f4f9e4d3327d6515937ea282cdd2
samgiles/lrucache
/lrucache_interview/lrucache_interview.py
UTF-8
1,835
3.65625
4
[ "ISC" ]
permissive
# -*- coding: utf-8 -*- from .doubly_linked_list import DoublyLinkedList class LRUCache(object): """ This Least Recently Used Cache is an in memory key value cache with a fixed capacity. When the number of items in the cache reaches the capacity, the item that was used least recently of all cach...
true
55d356f2c141010561e090c126225d9aba0ad5c5
MacroFinanceHub/PyELike
/elike.py
UTF-8
8,125
3.078125
3
[]
no_license
# Code to implement empircal likelihood estimation import numpy as np import scipy.optimize as opt from numpy import * from math import * # Numerical Jacobian using Richardson extrapolation # Jay Kahn - University of Rochester, November 19, 2012 # f - function to take derivative over # x - point (vector) at whic...
true
ece0872f6fb250e1b008726da504c1c078c60c22
CryptoCoinsWorks/stockgyaan
/StockGyaan/social/data_news_.py
UTF-8
5,108
2.515625
3
[]
no_license
from bs4 import BeautifulSoup as bs import requests, feedparser class DataStreamNews: # err: # telegram rss-bridge feed_telegram_base = "https://rss-bridge.bb8.fun/?action=display&bridge=Telegram&username={username}&format=Atom" feed_telegram_keys = ["content", 0, "value"] # nitter rss : twitter...
true
eb123046df14a168b875d6920146a253c771c956
mariloca/cs50x_2020
/pset6/cash/cash.py
UTF-8
539
3.734375
4
[]
no_license
from cs50 import get_float def main(): arr = [25, 10, 5, 1] # prepare change in the loop change = round(get_change() * 100) coins = 0 # loop thru the list for i in range(len(arr)): # quotient of change // arr[i] is numbers of coins coins = coins + change // arr[i] # pre...
true
1801a496c7388ac619c0aa0d7f73cd7ff7d04dd4
fergusonsa/imap_email_to_sqlite
/utils/common_utils.py
UTF-8
2,504
2.671875
3
[]
no_license
import datetime import logging import os import os.path class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def setup_logger_to_console_file(log_file_path, log_level...
true
ffea299dff80d5bf46cdebd0521106abebacbeec
Alsasolo/MentorMix_pytorch
/models/MentorNet.py
UTF-8
3,311
2.578125
3
[]
no_license
import torch import torch.nn as nn class MentorNet_arch(nn.Module): def __init__(self,MentorNet_type,label_embedding_size=2, epoch_embedding_size=5, num_label_embedding=2, num_fc_nodes=20): super(MentorNet_arch,self).__init__() self.MentorNet_type = MentorNet_type self.feat_dim = label_embe...
true
698c3c7d6b435e1212569a5cf189c94194ca84b9
AlleLustWillEwigkeit/twotowers
/mapgen.py
UTF-8
5,430
2.515625
3
[]
no_license
# -*- coding:utf8 -*- import Tkinter #HA LE AKAROD CSERÉLNI A PÁLYA MÉRETÉT, KÉRLEK ITT TEDD! MAGASSAG = 25 # sorok száma SZELESSEG = 25 # oszlopok száma #CONSTANTS EPITESI,UT,KEZDET,VEG = 0,1,2,3 # Guba Said So. DEBUGBULLSHIT = ["építési","út","kezdet","vég"] COLORZ = ["green", "brown", "red", "blue"] #Csak valami ...
true
279f5330ec632d3f8f4ce1dd637026406c954d46
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1/HanSolo/a_counting_sheep.py
UTF-8
789
3.34375
3
[]
no_license
def solve_case(n): if n == 0: return 'INSOMNIA' digits = [False for x in range(10)] remaining = 10 sheep_no = 0 while remaining > 0: sheep_no += 1 new_n = sheep_no * n str_n = str(new_n) for c in str_n: d = int(c) ...
true
849f477870b1c6567b5a58c2ac337af1c530033c
florentdelgrange/memoire
/util/unfolding.py
UTF-8
4,260
2.953125
3
[]
no_license
"""Prism mdp unfodling This script allows to unfold a mdp from a prism file (for a reward bounded reachability problem). Usage: unfolding.py PRISM_FILE (-t <reward> <T> <threshold>)... [-o OUTPUT_FILE_NAME] unfolding.py (-h | --help) Options: -h --help ...
true
ab04bac9802da903cbdbff46c542c31e8ba429f9
danielosen/code
/INF5860_Oblig1/code/classifiers/softmax.py
UTF-8
7,079
3.375
3
[]
no_license
import numpy as np from random import shuffle ### Some comments about this task. There are multiple definitions of the softmax loss function, ### and they usually all differ in what constants you multiply them with... ### I have chosen, and this is from discussion in lectures..., ### the exact formulas available...
true
1bc2c7651bab6409b42b7a88d9dca2a556127382
matthewh806/sound_scripts
/midi_monitor.py
UTF-8
1,880
2.875
3
[]
no_license
import pygame, pygame.midi midi_map = { 144: "note_on", 145: "note_on", 128: "note_off", 129: "note_off", 177: "CC" } def print_device_info(): c = pygame.midi.get_count() print "{} midi devices found".format(c) for i in range(c): (interf, name, input, output, opened) = pygame....
true
1c5d695d21548a3ea35646d2dd9212a4a4c03529
wubowen416/co-speech-gesture-generation-using-CGAN
/data_processing/prosodic_feature.py
UTF-8
3,331
3.0625
3
[]
no_license
from pydub import AudioSegment import parselmouth as pm import numpy as np def average(arr, n): """ Replace every "n" values by their average Args: arr: input array n: number of elements to average on Returns: resulting array """ end = n * int(len(arr)/n) return np.me...
true
0b46c2347107b4d2410a1b6e0c1d47c7cce29ebf
therealmikkelw/automate-the-boring-stuff
/examples/editPDF_PyPDF2_example.py
UTF-8
993
3.4375
3
[]
no_license
import PyPDF2 # Using xxx for page level editing of PDF files # Note that PyPDF2 module cannot write text to a pdf # Using pythons built-in open() method to read binary pdf files pdf1File = open('meetingminutes1.pdf', 'rb') pdf2File = open('meetingminutes2.pdf', 'rb') # Parse binary to reader object using...
true
53c8ec9f0811fa695848fd86d6f3b47a6d9761ec
SantaR17/kolganov
/branches/test.py
UTF-8
145
2.859375
3
[]
no_license
class MyFeatures(): def __init__(self): print("Class constructor is here") def feature(self): print("New nice feature")
true
2a4d96740eec279a477d4c40ec663d227e3ddc74
adamkrieger/boto3_docker
/src/common/filesys.py
UTF-8
584
3.53125
4
[]
no_license
"""File System Interaction""" import os def __full_rel_pair__(root, this_file_root, this_filename): full_path = os.path.join(this_file_root, this_filename) root_with_trailing = os.path.join(root, '') relative_path = full_path[len(root_with_trailing):] return full_path, relative_path def get_files_recu...
true
7537e704c5bc3aae87320f4ddf5f2fa83a30622d
LarisaFonareva/Dictionaries
/2.18_Genealogy_levels_counting.py
UTF-8
1,168
3.125
3
[]
no_license
# def level(name): # if name not in d: # return 0 # если имени нет в детях - вернуть 0 # return 1 + level(d[name]) # иначе: вернуть 1+функция от родителя имени # d = {} # S=set() # for i in range(int(input()) - 1): # s = input().split() # d[s[0]] = s[1] # ребенок - родитель # ...
true
a4d093d73d66836ab7f2339db73e211a3945848f
SNeugber/OpenVault
/Plotting/dataPlot.py
UTF-8
1,424
2.703125
3
[ "Apache-2.0" ]
permissive
import csv import glob import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as tkr import pandas as pd def getDataInFolder(dir): outData=dict() outData2=[] for fileName in glob.glob(dir+'/*.csv'): numruns=int(fileName[fileName.find('_')+1:fileName.find('epochs')]) data=list(csv.reader(ope...
true
d0497b4bf42bd09b6178eb4b7e0a731c4133a1f7
sebanazarian/itedes
/modulo1/segmento3/apunte2IfElse/ejercicio2.py
UTF-8
275
4.03125
4
[]
no_license
usuario = input("Ingrese su nombre de usuario: ") contrasena = input("Ingrese su contrasena: ") if (usuario=="Juan" and contrasena=="1234") or (usuario=="Pedro" and contrasena=="5678") : print("Bienvenido "+ usuario) else: print("Usuario y/o contrasena incorrecto")
true
3bf3fb01e7b5ae20052491bd64f30d83155dcaa3
AnnKuz1993/Python
/lesson_08/example_02.py
UTF-8
1,110
4.09375
4
[]
no_license
""" Создайте собственный класс-исключение, обрабатывающий ситуацию деления на нуль. Проверьте его работу на данных, вводимых пользователем. При вводе пользователем нуля в качестве делителя программа должна корректно обработать эту ситуацию и не завершиться с ошибкой. """ class MyZeroDivisionError(Exception): zero_e...
true
3916603c1161d5f73655afaacefc4d38346b075d
yeeeeees/eventio-backend
/app/utils.py
UTF-8
701
2.578125
3
[ "Apache-2.0" ]
permissive
import os import secrets from flask import current_app from PIL import Image def save_picture(pic, pic_type): random_hex = secrets.token_hex(8) _, f_ext = os.path.splitext(pic.filename) picture_fname = random_hex + f_ext if pic_type == "profile": picture_path = os.path.join(current_app.root_pa...
true
a13e1b4409e1c22d21cf92bd61c0959488eb7798
Vineelkumar/sython_OOPS
/divide.py
UTF-8
2,966
3.171875
3
[]
no_license
import math class Fraction(object): def __init__(self,numerator = 0,denominator = 0): if numerator < 0 and denominator < 0: self._numerator = abs(int(numerator)) self._denominator = abs(int(denominator)) elif denominator < 0: self._numerator = -(int(numerator)...
true
e9ba30588a988e284d0cb5ce17bf28810c9e4d06
Aasthaengg/IBMdataset
/Python_codes/p03352/s980381255.py
UTF-8
173
2.921875
3
[]
no_license
X = int(input()) if X == 1: print(1) exit() ans = 0 for b in range(2, int(X**0.5)+2): temp = b while temp <= X: ans = max(ans, temp) temp *= b print(ans)
true
d0980dcb0bb5b541ca733bf6bdb005e61bc23159
heyitsanthony/klee-mc
/scripts/klee-gcc
UTF-8
1,374
2.5625
3
[ "NCSA" ]
permissive
#!/usr/bin/env python import os, sys, os.path def isLinkCommand(): # Look for '-Wl,' as a signal that we are calling the linker. What a hack. for arg in sys.argv: if arg.startswith('-Wl,') or arg == '-link': return True def main(): if not isLinkCommand(): cArgs = [] cA...
true
81f4cfb460beab9db6f579d192dee6de60a0b0ac
urmilshah1/CSES-Problem-Set
/Introductory Problems/Increasing Array.py
UTF-8
227
3.109375
3
[]
no_license
n = int(input()) lst = [] count = 0 lst = list(map(int,input().split())) #print(lst) for i in range(1, n): if lst[i] < lst[i-1]: count = count + (lst[i-1] - lst[i]) lst[i] = lst[i-1] print(count)
true
a3f16ac2081bdcac73fa3239824246f40772349d
Duni0810/python_code
/dict.py
UTF-8
1,714
4.3125
4
[]
no_license
#coding= utf-8 #字典的使用 ##字典的作用是能够直接定位到数据,不用list那样索引下标 info = {'name':'young','id':'100054','sex':'m','add':'china'} print info['name'] print info['add'] #在我们不确定字典中是否存在某个键而又想获取其值时,可以使用get方法,还可以设置默认值: age = info.get('age') print age # 不存在所以为none age = info.get('age', 23) #若info中不存在‘age'这个键,则返回默认18...
true
838d315dc6e62c28b36994aa24f37394e89ad736
SebastianZug/test_contributor_feedback
/.github/workflows/extractGitHubData.py
UTF-8
3,513
2.828125
3
[]
no_license
from github2pandas.utility import Utility from github2pandas.version import Version from pathlib import Path import os from tabulate import tabulate import pandas as pd import matplotlib.pyplot as plt github_token = os.environ['TOKEN'] git_repo_name = os.environ['CI_REPOSITORY_NAME'] git_repo_owner = os.environ['CI_RE...
true
d2b4bec81452838dbaac16abc662b9cb178944ee
foilmirror/AoC_2019
/2019/1/day1.py
UTF-8
585
3.125
3
[]
no_license
a = 0 b = [] with open("mass.txt", "r") as x: for mass in x: current = int(mass)//3 - 2 b.append(current) current = current//3 - 2 while (current > 0): b.append(current) current = current//3 - 2 print(sum(b)) """ INPUT_FILE = 'mass.txt' def main(): ...
true
2fcb4ca8a9f17ea7459bd6aa933ccbe2c555d52a
james-ward/cassandra
/cassandra/main.py
UTF-8
446
2.578125
3
[ "MIT" ]
permissive
"""Cassandra a prediction system for FRC games based on trueskill. """ from data_store import DataStore class Cassandra: def __init__(self, key, years): """Initialise Cassandra Args: key: String of TBA key. years: List of the years in which to cache results. """ ...
true
2957d8ae091055288ab94eb94461c25c58ca81c2
bici-sancta/nlp
/homework_03/get_stems.py
UTF-8
1,175
3.078125
3
[]
no_license
from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize def remove_stopwords(phrase) : stop_words = set(stopwords.words('english')) word_tokens = word_tokenize(phrase...
true
86143ef9c401c23039605688a6749506ff4b4910
AdamZhouSE/pythonHomework
/Code/CodeRecords/2624/58586/241907.py
UTF-8
672
3.734375
4
[]
no_license
string=input().replace("\\","") def partition(string): res=[] if "+" not in string and "-" not in string and "*" not in string: res.append(int(string)) return res for i in range(len(string)): if string[i]=="+" or string[i]=="-" or string[i]=="*": for left in partition(str...
true
45c7595652e0f2357c3181c0144fa04888eefb1c
sakajiri1942/PY
/文字列操作.py
UTF-8
644
3.5625
4
[]
no_license
aaa = 'おはよう' bbb = 'ございます' ccc = aaa + bbb print(ccc) aaa = 'おはよう' bbb = 100 ccc = aaa + str(bbb) print(ccc) aaa = 200 bbb = 100 ccc = aaa + bbb print(ccc) aaa = 200 bbb = 100 ccc = str(aaa) + str(bbb) print(ccc) aaa = 200 bbb = 100 ccc = str(aaa) + str(bbb) print(ccc) ddd = int(ccc) - 200 print(ddd) ########...
true
c1d130d34db3fe02711dda43609b6140ef7607b4
DnLKnR/Catalyst
/Lib/Enemy/enemy.py
UTF-8
1,147
3.546875
4
[]
no_license
import random, pygame class Enemy: def __init__(self,coordinates): self.coordinates = coordinates self.color = [255,50,50] self.rate = 1 self.size = 7 self.window_size = [600,600] def set_rate(self, rate): self.rate = rate def get_rate(self): return self.rate def set_size(self, size): self...
true
f241c00f5c84870beefb290bc4dd3a292899bc95
AdamHillingerSzekely/PythonExamples
/look.py
UTF-8
206
3.34375
3
[]
no_license
n=0 msg = input("Enter message ") look = input("What are you looking for ") i=0 while i <len(msg): if msg[i] == look[0]: if msg[i: i+len(look)] == look: n=n+1 i=i+1 print("found", n, look)
true
7722034c3a50c038d082ea9226c4478e97bdcd33
drewherron/class_sheep
/Code/Drew/python/lab20-credit_card_validation.py
UTF-8
1,206
3.921875
4
[]
no_license
while True: # ask user for number cc_input = input("Please enter your credit card number:\n") # convert user number to list of strings cc_number = [] for num in cc_input: try: cc_number.append(int(num)) except ValueError: continue if len(cc_number) == 16: ...
true
66bd8fd65de6037a2c0068c1d4fff59af9ca18dd
TyongKim/ERD2
/Deterministic_Code_ver2/Code_Main_run.py
UTF-8
7,020
2.640625
3
[]
no_license
""" After performing 'Code_Main_script.py', this script predict a structural responses (maximum transient displacement) using the DNN model developed by Kim et al. (2019). Developed by Taeyong Kim from the Seoul National Universtiy chs5566@snu.ac.kr June 15, 2020 Reference Kim, T., O.-S. Kwon*, and J. Song (2019). R...
true
97fa724a39935d8907ec0f11aa41e38f00b1b631
onlymezhong/Surrogate-Model
/surrogate/mutation/mutShuffleIndexes.py
UTF-8
1,012
3.390625
3
[ "MIT" ]
permissive
"""Shuffle the attributes of the input individual and return the mutant. The *individual* is expected to be a :term:`sequence`. The *prob* argument is the probability of each attribute to be moved. Usually this mutation is applied on vector of indices. :param individual: Individual to be mutated. :param prob: Independ...
true
4ee18f4587dcf0da37030da30c14522534d66927
rlopezlu/leetcode
/algorithms/selfDividing.py
UTF-8
504
3.125
3
[]
no_license
class Solution: def selfDividingNumbers(self, left, right): """ :type left: int :type right: int :rtype: List[int] """ nList = [] for number in range(left, right + 1): flag = True for digit in map(int, str(number)): if...
true
3f5454c34d3470a441d46ae702b64f8c33bd25c4
zzdely/daguan-extraction
/pre_process.py
UTF-8
823
2.78125
3
[]
no_license
# -*- coding: UTF-8 -*- '''================================================= @Project -> File :daguanjinsai -> pre_process @IDE :PyCharm @Author :Zhang zhe @Date :2019/7/3 15:51 ==================================================''' import collections def longest(): longest=0 with open("./datagrand/train...
true
21b17ebe40932d945e8f3e9e62b919e8ff7c8ddd
erpost/google-cloud-platform
/tbd/bucket-read_object.py
UTF-8
231
2.640625
3
[]
no_license
# Python 2.7 # Prints contents of object to the console from google.cloud import storage client = storage.Client() bucket = client.get_bucket('ep-test-bucket') blob = bucket.get_blob('test.txt') print(blob.download_as_string())
true
7ac28763604af1592bae7b0f6406aa3ed216620f
arnaudsjs/YCSB-1
/front_end/plot/ConsistencyResultData.py
UTF-8
1,225
3
3
[ "Apache-2.0" ]
permissive
class ConsistencyResultData: def __init__(self): self.possibleOperations = ['INSERT', 'UPDATE', 'DELETE'] self.operationDict = {}; for operation in self.possibleOperations: self.operationDict[operation] = []; def add(self, operation, time, delay): if not ope...
true
d5bb6cd6e73a3cdf525b02fe3a030a81d17f7eca
kwangseok90/PYTHON_PolytechKorea
/PYTHON/Python_CLASS/12-11.py
UTF-8
557
3.65625
4
[]
no_license
import threading import time class RacingCar: carName = "" def __init__(self, name): self.carName = name def runCar(self): for _ in range(0,100): carStr = self.carName + '~~달립니다.\n' print(carStr, end='') time.sleep(0.1) car1 = RacingCar("@자동차1") car2 = R...
true
22c65728cec7f5871fc25f3f814f9d9def075843
TheScendant/RedditWallpapers
/getBestOfPastDay2.py
UTF-8
2,503
3.078125
3
[]
no_license
#!/usr/bin/python """ @Author Hayden M Nier Opens the top posts from r/wallpaper and r/wallpapers and saves all of the images. No gaurantees if you use this script yada yada yada """ import sys import urllib import urlparse import requests from bs4 import BeautifulSoup import itertools import code from gradeImages imp...
true
ce348e6c5c7ce13b3a4f6ffe6edb55d0e5bcb5a1
cshung/MiscLab
/GreatestCommonDivisor/problem_1_5_15.py
UTF-8
301
2.828125
3
[ "MIT" ]
permissive
from polynomial_module import * def problem_1_5_15(): print "Problem 15" f = polynomial.from_string("x^11 - x^10 + 2x^8 - 4x^7 + 3x^5 - 3x^4 + x^3 + 3x^2 - x - 1") fd = f.derivative() g = polynomial.polynomial_gcd(f, fd) (q, r) = polynomial.polynomial_divide(f, g) print q
true
bb715ea25c863d090cd8a8948f81de76bfcfe9ac
daniel-reich/ubiquitous-fiesta
/qKAcMAkWXvXKAxXut_13.py
UTF-8
243
2.734375
3
[]
no_license
import re ​ ​ def calc_bundled_temp(n, temp): initial_temp = float(re.search('\d+', temp).group()) for num in range(1, n+1): initial_temp = (initial_temp * 0.1) + initial_temp return str(round(initial_temp,1)) + "*C"
true
1487e36b923798200fd89c915501507e54eb31d0
sturnerin/Katerina
/anagramma.py
UTF-8
541
3.40625
3
[]
no_license
import random def anno(word): a = random.sample(word, len(word)) newword = ''.join(a) return newword with open('text.txt', encoding = 'utf-8') as f: text = f.read() text = text[1:] text = text.replace(',', '') text = text.replace('.', '') words = text.split() print(words) with o...
true
f28e20cec5c5351487a81c52b48fa4a739070005
BorjaSuarezMoron/trabajo
/venv/regulares1.py
UTF-8
171
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- import re txt="borja@hotmail.com" if re.search("^[A-Z|a-z]+[@]+[A-Z|a-z]+[.]+[com|es]", txt): print "Correo válido" else: print"Correo no válido"
true
58c54190ffd14bd8bb0cdf725ca53f7309333410
huioo/stdlib_
/8.Data Types/code/collections_userdict_.py
UTF-8
1,914
3.609375
4
[]
no_license
from collections import UserDict # 直接使用 print(UserDict({'a': 1})) # {'a': 1} print(UserDict({'a': 1}, ab=1)) # {'a': 1, 'ab': 1} print(UserDict(ab=1)) # {'ab': 1} print(UserDict(ab=1, dict={'a': 1, 'b': 2})) # {'a': 1, 'b': 2, 'ab': 1} print(UserDict({'a': 1}, ab=1, dict={'a': 2,...
true
efe0c40a8d5ea462e64da0d16144d4dbfd0b9a85
mattrea6/PythonCoursework1
/Question2/Simulation.py
UTF-8
4,251
3.703125
4
[]
no_license
import random import math import csv def nextTime(mean): return -mean * math.log(1 - random.random()) def theoreticalMeanQueueLength(alpha, beta): """ >>> theoreticalMeanQueueLength(10, 2) 0.25 >>> theoreticalMeanQueueLength(5, 1) 0.25 >>> theoreticalMeanQueueLength(4, 2) 1.0 >>>...
true
cfd4c47b36fa2482bef8aa93367a8cbc2899ab2b
Wumpf/adventofcode2016
/day21/script.py
UTF-8
3,630
3.46875
3
[]
no_license
#!/usr/bin/python3 # invalid variable name # pylint: disable=C0103 # Missing function docstring # pylint: disable=C0111 # Line too long # pylint: disable=C0301 # Example # data = """swap position 4 with position 0 # swap letter d with letter b # reverse positions 0 through 4 # rotate left 1 step # move position 1 to ...
true
12eaa911e22992f57b91d25af28d41bf5e292d7a
Abanobbb/Dog-breed-classifier
/dog_breed_app.py
UTF-8
32,440
3.65625
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Convolutional Neural Networks # # ## Project: Write an Algorithm for a Dog Identification App # # --- # # # --- # ### Why We're Here # # In this notebook, you will make the first steps towards developing an algorithm that could be used as part of a mobile or web app. A...
true
2019a961e115fd8588f2902c16cc08f7a60b0aa2
longben2017/learningPython
/python3/str2float.py
UTF-8
492
3.65625
4
[]
no_license
#!/usr/bin/env python3 #coding:utf-8 ''' Make the string type to float type. Mainly practicing map() and reduce() usage. ''' from functools import reduce def str2float(s): def func(x,y): return x*10+y def cd(a): return {'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'0':0,'.':'d'}[a] ...
true
444da8c464b97d109b2d3de4772a81ee7a2cc7c3
shivengup1851/pythonstocks
/getstockpricedata.py
UTF-8
774
2.53125
3
[]
no_license
import datetime as dt import matplotlib.pyplot as plt from matplotlib import style import matplotlib.dates as mdates import pandas as pd import pandas_datareader.data as web style.use('ggplot') # start = dt.datetime(2000, 1, 1) # end = dt.datetime(2020, 7, 20) # dataframe = web.DataReader('AAPL', 'yahoo', start, end...
true
2a351098ad3c1a9c1c31141505a825226d9efefa
cnolimit/python-tic-tac
/tic_tac.py
UTF-8
4,286
3.390625
3
[]
no_license
import re in_game_board = {'0': '', '1': '', '2': '', '3': '', '4': '', '5': '', '6': '', '7': '', '8': '', '9': ''} help_game_board = {'0': '0', '1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9'} win_paths = {'789', '456', '123', '963', '852',...
true
42e6e56432804f2f043c0ac4bd77befe97434885
gentimouton/olympus
/src/game_scene.py
UTF-8
2,714
2.796875
3
[ "MIT" ]
permissive
""" The game scene has a HUD with gauges and a series of encounters. Player makes decisions during encounters, affecting game state. If game state is lost, call game over scene. Can also pause game and go to main menu, passing an option to resume game. """ import random from constants import CMD_NEWG, CMD_R...
true
7729135800d9ddc6f8866100e2ca293920d9ef3f
MrHamdulay/csc3-capstone
/examples/data/Assignment_9/bdgmul001/question3.py
UTF-8
4,123
3.515625
4
[]
no_license
''' sudoku validity Mulisa Baugela 15 May 2014''' #input rows covert to list row1=list(input()) row2=list(input()) row3=list(input()) row4=list(input()) row5=list(input()) row6=list(input()) row7=list(input()) row8=list(input()) row9=list(input()) grid=[row1,row2,row3,row4,row5,row6,row7,row8,row9] def ...
true
28e5169fc6e98eee3ef48cfa5e5d4ad5f9dd9f83
AkankshaKaple/Machine_Learning_Algorithms
/Probability/Probability_21.py
UTF-8
856
3.4375
3
[]
no_license
# 21. HIV The New York State Health Department reports a 10% rate of the HIV virus # for the “at-risk” population. Under certain conditions, a preliminary screening test # for the HIV virus is correct 95% of the time. (Subjects are not told that they are # HIV infected until additional tests verify the results.) If som...
true
90a57171b93ab5f0dcba2cf4dcd779800f4d6241
GoncharovArtyom/DocumentFlowEfficiency
/Clustering/Clustering.py
UTF-8
1,735
2.65625
3
[]
no_license
from sklearn.decomposition import TruncatedSVD from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer from sklearn.cluster import KMeans from scipy import io from time import time import os import matplotlib.pyplot as plt # Settings FROM_N_CLUSTERS = 3 TO_N_CLUSTERS = 100 N_COMPONENTS...
true
280b954355c071986a0c8571dddeee98a1b7f9da
yuhonghai123/Flok_muitimodal_operators
/Batch_AudioCut.py
UTF-8
1,752
2.53125
3
[ "MIT" ]
permissive
# 重采样 import pandas as pd from FlokAlgorithmLocal import FlokDataFrame, FlokAlgorithmLocal import json import sys, os import librosa class Batch_AudioCut(FlokAlgorithmLocal): def run(self, inputDataSets, params): audio_dict=inputDataSets.get(0) start = float(params["start"]) end ...
true
5bbc24777a0d2e57ee60ad66a66bc59217276e16
manishkumar212111/HPDF
/setcookie.py
UTF-8
840
2.609375
3
[]
no_license
from flask import Flask, request, make_response, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('cookie.html') @app.route('/setcookie', methods=['POST', 'GET']) def setcookie(): if request.method == 'POST': name = request.form['name'] ...
true
13d54c416246713c0befc57cea6550f6e734cbc5
clubrobot/team-2018
/raspberrypi/Vision/cam2OpenCV.py
UTF-8
1,183
2.546875
3
[]
no_license
from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import time import cv2 import numpy as np import sys res = (1088,720) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.avi',fourcc, 20.0, res) class camth(Thread): def __init__(se...
true
1b7eb79457ba18cd1ac0ee92efbc9b75482015b0
SunnyEver0/rw_excel_python
/updateProduce.py
UTF-8
508
2.890625
3
[]
no_license
# Correts cost in produceSale spreadsheet import openpyxl PRICE_UPDATE = { 'Garlic': 3.17, 'Celery': 1.19, 'Lemon': 1.07 } wb = openpyxl.load_workbook('produceSales.xlsx') ws = wb['Sheet'] # loop through the rows and update the prices, skip the first row for rowNum in range(2, ws.max_row + 1): produ...
true
977e9d6f068328d424930cdb9c8ede07a458e970
akashbulbule/smart-data
/collCount.py
UTF-8
1,116
2.671875
3
[]
no_license
import nltk from nltk.collocations import * from nltk.tokenize import RegexpTokenizer from bs4 import BeautifulSoup def colCount(inputfileName): tokens = [] stopwords = nltk.corpus.stopwords.words('english') path = "C:\Users\Akash\Desktop\ f = open(path+inputfileName) raw = f.read() raw = raw.replace(",", "")...
true
76ae3caca6c6f23631a2baa35051524ae83c5cf9
jenniferjadon/Jenni
/p146.py
UTF-8
121
3
3
[]
no_license
b,d=map(int,input().split()) f=1 g=1 while b>0: f=f*b b=b-1 while d>0: g=g*d d=d-1 n=f//g print(n)
true
dced438d4b0ebe6a2198e9055ff21d1eb0469f78
DominikZabron/inventory
/db.py
UTF-8
742
3
3
[]
no_license
import sqlite3 def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d def init_db(): conn = sqlite3.connect(':memory:') conn.row_factory = dict_factory cur = conn.cursor() cur.execute(""" CREATE TABLE IF NOT EXIS...
true
3486a25a55fd0be765e9154564775b89a66d2789
Suhaiz/first
/regular_expression/regular_exp.py
UTF-8
4,909
3.0625
3
[]
no_license
###regular expressions are used to find matches import re count=0 matcher=re.finditer('ab','abaababa') for match in matcher: print("match available at",match.start()) print("group=",match.group()) count+=1 print("count=",count) # import re # count=0 # x='[abc]' # matcher=re.finditer(x,'a7ba@k9z') # for m...
true
d57c869f9d73bbc36abfacf2688beb1368f4330e
asgiraldoc/Computational_genomics
/week1/random_seq_sample.py
UTF-8
945
2.984375
3
[]
no_license
import random import sys import io def fasta(): sys.argv = ["","fasta_example.fasta"] filename = sys.argv[1] with open(filename, "r") as f: for line in f: read_fasta = line return read_fasta def get_random_str(read_fasta, substr_len): for line in read_fasta: str...
true
91d6bbcbd0fbf686eaa86a0401c77e829e6c398b
ssumitk14/python-OOPs
/Inheritance.py
UTF-8
429
4.34375
4
[]
no_license
class Dog: def __init__(self,name,age): self.name = name self.age = age def speak(self): print("Bark") def justPrint(self): print("Printing from Parent Class") class Cat(Dog): def __init__(self,name,age,color): super().__init__(name,age) self.color = co...
true