blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
d595336419640de4e9ac6769a6ed628863383840
Python
green-fox-academy/DonBattery
/week-04/day-4/TODO_App/vlister.py
UTF-8
2,278
3.484375
3
[]
no_license
# Virtual list class for todo-er # later can be altered to control different virtual list class Virtual_List_Controller(): def __init__(self, raw_text, separator, character_blacklist): # right now it is dessigned to get a string and separate it to lines # excluding the blacklisted characters ...
true
a1c933eb4d02eabcd085f951b99c18d077761c83
Python
chris-wucy/products
/products.py
UTF-8
1,909
4.09375
4
[]
no_license
# refactor 重構,用function import os # 載入作業系統,才有權限查看 # 讀取檔案 # 資料是長-> ramen,250 def read_file(filename): products = [] with open(filename, 'r', encoding = 'utf-8') as f: for line in f: if '商品,價格' in line: continue # 用continue跳過寫入'商品,價格',繼續下一個迴圈 name, price = line.strip().split(',') # strip把換行符號 \n, 拿掉spli...
true
49cbe909d2709472159fa7709cb1335055bdd81a
Python
johnatasr/Python-Tricks
/itertools_combinations_perm_product.py
UTF-8
342
3.53125
4
[]
no_license
from itertools import ( combinations, permutations, product ) pessoas = ['Joao', 'Pedro', 'Marcos', 'Paulo'] # Sem repeticao for grupo in combinations(pessoas, 2): print(grupo) # COm repeticao de ordem for grupo in permutations(pessoas, 2): print(grupo) #geram grupos for grupo in product(pessoas...
true
8f3b29de95712069d18db7d833c54db886c02b94
Python
jake17007/CountingCarsCNN
/parseXml.py
UTF-8
620
2.796875
3
[]
no_license
import xml.etree.ElementTree as et def numCarsInFile(file): root = et.parse(file).getroot() numCars = 0 for space in root.getchildren(): if 'occupied' in space.attrib and space.attrib['occupied'] != '0': numCars += 1 return numCars def numSpacesInFile(file): root = et.parse...
true
94fbb25d8663e126c545b91b4f3d55272afa638a
Python
nlarralde13/pub
/mysocket.py
UTF-8
1,419
2.640625
3
[]
no_license
import socket import sys import collections from utils import GetException from log import Log HOST = '' # Symbolic name meaning all available interfaces PORT = 8888 # Arbitrary non-privileged port class UDPSocket(): def __init__(self, port=PORT): try: self.dq = collections.deque(maxlen=10...
true
8bff306f4fe359ec7386b51c7f02f9448a84bcb3
Python
arnabs542/DS-AlgoPrac
/strings/intToEng.py
UTF-8
1,439
3.703125
4
[]
no_license
"""To convert integer to english""" def numberToWords(num): """ :type num: int :rtype: str """ if num == 0: return "Zero" def helper(a): ans = [] if a//100: ans = ans+[dict_[a//100]]+["Hundred"] a = a%100 # print(ans) if a <= 20 a...
true
7479e3a51188f720eab1ea299372db743df5332e
Python
JAYARAKKINI/code_kata_guvi_python
/Basics/max_min.py
UTF-8
192
3.4375
3
[]
no_license
#Find the smallest number and largest number and print both the indices N=input() n=int(N) n1=[int(x) for x in input().split()][:n] a=min(n1) b=max(n1) print((n1.index(a))+1,(n1.index(b))+1)
true
0761f648ef73c2b79d476e310c4436330ec30d90
Python
noath/toloka-kit
/src/client/project/view_spec.py
UTF-8
6,249
2.65625
3
[ "Apache-2.0" ]
permissive
__all__ = [ 'ViewSpec', 'ClassicViewSpec', 'TemplateBuilderViewSpec' ] import json from copy import deepcopy from enum import Enum, unique from typing import List from .template_builder import TemplateBuilder from ..primitives.base import attribute, BaseTolokaObject from ..util import traverse_dicts_recu...
true
c54360dcae9d65624524fcc3b58930f24dc8b785
Python
beforeuwait/code_daqsoft
/大众点评/version_3.0/parse_model.py
UTF-8
1,505
2.9375
3
[]
no_license
# coding=utf8 """ 作为大众点评的解析模块,承担 列表,详情,评论的解析 关于data字段,数据存json格式 """ import json from lxml import etree class DianpingList(): """作为点评网商铺列表的解析器 获取商铺的id,名称 同时与预处理里中的地域信息匹配生成列表 """ def parse_list(self, result): # 处理selector,报错就停止 try: selector = etree.HTML(result.get('ht...
true
f724bf26ead7697b3a925d97ceea05e07bf6f7d3
Python
sbetzin/neural-style-azure
/docker/frame-interpolation/src/losses/vgg19_loss.py
UTF-8
13,539
2.859375
3
[ "Apache-2.0" ]
permissive
# Copyright 2022 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
true
7a3a7a0820acef063cc0319c5a71f92db1afe501
Python
OWEN-JUN/Study_DL
/TF/test0822_jyj_model.py
UTF-8
1,532
2.625
3
[]
no_license
import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler test = pd.read_csv("./data/test0822.csv") test_columns = test.columns.drop("date") print(test_columns) print(test) max = test.max() ##max = 9 min = test.min() ##min = 0 print(max,min) test["kp_sum"] =test[test_columns].sum(axis...
true
b41c5688e137ff1ed369fe725f9b1f70c8abf696
Python
Legendarytruth/Polygon-Area-Calculator
/shape_calculator.py
UTF-8
1,162
3.53125
4
[]
no_license
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self,num): self.width = num def set_height(self,num): self.height = num def get_area(self): return self.width*self.height def get_perimeter(self): return 2 * self.width +...
true
a9eb611ad466a43e2e049d29e2daf23e8456da4c
Python
iamstevedavis/foto
/foto_getter.py
UTF-8
3,139
2.515625
3
[]
no_license
import imaplib import email import traceback import os import errno from pathlib import Path from foto_reconcile import reconcile # Third Party Imports # import configparser config = configparser.ConfigParser(interpolation=None) config.sections() config.read(['.env', 'config']) EMAIL_CONFIG = config['EMAIL'] IMAGE_DI...
true
b313d0561840a1e4aaefd9ecf1723cb55d92a6ad
Python
curiousTauseef/Algorithms_and_solutions
/LeetCode/9_palindrome-number.py
UTF-8
1,527
4.5625
5
[]
no_license
""" Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Examp...
true
deb8abad8ef4e53c51b6825a528e2986dcabc5c9
Python
SouthernYoda/People_API
/auth.py
UTF-8
1,740
2.59375
3
[]
no_license
from connexion.decorators.security import validate_scope from connexion.exceptions import OAuthScopeProblem import six from jose import JWTError, jwt from datetime import datetime, timedelta JWT_ISSUER = 'com.people.connexion' JWT_SECRET = 'change_this' JWT_LIFETIME_SECONDS = 600 JWT_ALGORITHM = 'HS256' def decode_...
true
475728002ca7e8f6431487f6abde40daaa2d7a5f
Python
Python3pkg/cf-view
/old/plotConfigWidgets.py
UTF-8
14,801
2.59375
3
[ "MIT" ]
permissive
import pygtk import gtk import guiWidgets as gw class plotChoices(gw.guiFrame): ''' Provides a small set of cf-plot aware plot choices ''' def __init__(self,callback,xsize=None,ysize=None): ''' Constructor places buttons etc in frame, users interact, and then press one of the two key buttons: s...
true
aeaa22fe73fc5d8a6fc2ac85a1ac5d505d0fa41a
Python
nite/covid-19
/wrangle.py
UTF-8
3,097
2.875
3
[ "MIT" ]
permissive
import numpy as np import pycountry_convert as pc def get_continent(country): try: country_code = pc.country_name_to_country_alpha2(country, cn_name_format='default') return pc.country_alpha2_to_continent_code(country_code) except (KeyError, TypeError): return country def fix_country...
true
7dc2b35159e004ec77169518810400a64c0ed1a8
Python
chirag-kapadia/Python
/functionUpdate.py
UTF-8
80
2.828125
3
[]
no_license
def update(x): print(x) x = 10 print(x) a = 30 update(a) print(a)
true
99cb0e3ab1efe61ffa0791abbc7f3696cf9f8372
Python
NKcell/leetcode
/203. Remove Linked List Elements/203.py
UTF-8
940
4.125
4
[]
no_license
""" 203. Remove Linked List Elements Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val = 6 Output: 1->2->3->4->5 """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self....
true
1783c74fbd0e972d1a0ea5554ac7af35cf40503a
Python
d223302/jiant
/analysis/plot.py
UTF-8
1,293
2.90625
3
[ "MIT", "Apache-2.0" ]
permissive
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np import sys BLUE = [[0, 1, 1], [0, 0.4, 0.4], [0, 0, 0.8], [0.6, 0.2, 1]] GREEN = [[0.7, 1, 0.4], [0.3, 0.6, 0], [0.6, 0.6, 0], [0, 0.4, 0]] RED = [[1, 0.4, 0.7], [1, 0, 0], [1, 0.5, 0], [1, 1, 0]] if __name__ == '__main__': pos = np.load('po...
true
5e61c339e54eda1b92f0431b456a7baf71527c64
Python
jaishankarg24/Django-Rest-Framework
/DjangoRestFrameworkProjects/withRest/project2/demo.py
UTF-8
2,615
3.140625
3
[]
no_license
import requests import json import sys BASE_URL = 'http://127.0.0.1:8000/' END_POINT = 'restapi/' def create_data(): eno = input('Enter the employee number :\t') ename = input('Enter the employee name :\t') esalary = input('Enter the employee salary :\t') eaddress = input('Enter the employee address :\t') emp_...
true
78a2ae832833f6501d68f804179849ad257ab471
Python
ry-nl/SearchAlgVisual
/algorithms/bfs.py
UTF-8
2,029
2.96875
3
[]
no_license
from helpers.searchgui import * from queue import Queue def link_nodes(): for row in range(50): for col in range(75): if col > 0: node = graph[row][col - 1] if node.nodeType != 'obstruct': graph[row][col].neighbors.append(node) if ...
true
f03f9324b25f7063a6cc8c0930edced9f5d89cab
Python
jjmojojjmojo/awsdns
/prototypes/basic_dns.py
UTF-8
6,850
2.78125
3
[]
no_license
""" Basic DNS server Source: http://notmysock.org/blog/hacks/a-twisted-dns-story.html """ from twisted.internet.protocol import Factory, Protocol from twisted.internet import reactor from twisted.names import client, server, dns from twisted.python import log, failure import ConfigParser import boto.ec2 from twist...
true
e7af76b89d6213f0a9de9b757f56b404cb72fc9a
Python
AdityaGudimella/numbasub
/src/numbasub/tests/test_nonumba.py
UTF-8
1,042
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import pytest import numbasub.nonumba as nb # can call the same decorator as any "numba" function # decorated function should do the same as undecorated function @pytest.mark.parametrize("decorator", [nb.autojit, nb.generated_jit, nb.guvectorize, nb.jit, nb.jitclass, ...
true
8f4417a3c84d8def6e37919b2d290c4be7ffbeaa
Python
roiti46/Contest
/atcoder/abc/abc022/b.py
UTF-8
205
2.921875
3
[]
no_license
from collections import defaultdict N = int(raw_input()) hist = defaultdict(int) for loop in xrange(N): a = int(raw_input()) hist[a] += 1 ans = 0 for v in hist.values(): ans += v - 1 print ans
true
fc4ab7492add179894fa424e2f83e81fae8c717f
Python
KevinJHaas/markov-music
/src/generator.py
UTF-8
1,880
3.34375
3
[]
no_license
#!/usr/bin/env python3 # This class handles the generation of a new song given a markov chain # containing the note transitions and their frequencies. import argparse import mido from markov_chain import MarkovChain from midi_parser import MidiParser class Generator: def __init__(self, markov_chain): sel...
true
a1b668a775161bf30c081c1385fcc2c7f0fe61b7
Python
pp2pppp2/Ps
/9월/0918/화물도크/화물도크.py
UTF-8
457
2.6875
3
[]
no_license
import sys sys.stdin = open("input.txt") T = int(input()) for tc in range(1, T+1): N = int(input()) se = [[0, 30, 0] for _ in range(26)] for i in range(N): da = list(map(int, input().split())) if se[da[0]][1] > da[1]: se[da[0]] = da + [1] ret, tmp = 0, 30 for i in range(...
true
27953f4e4cbbea91e657843c4fd00de5469d281f
Python
altmanxy/GUI_TEST
/gui_test/common/set_report.py
UTF-8
5,376
2.5625
3
[]
no_license
import os import time from thrid_session.gui_test.common.connect_DB import DBtools class Setreport: def __init__(self): self.db=DBtools() def write_report(self,version,planid,testtype,caseid,casetitle,result,error,screenshot): testtime=time.strftime('%Y-%m-%d_%H:%M:%S',time.localtime(time.tim...
true
d62ba0e8c5d0562180e4185ea3934226464e3561
Python
tommyhooper/legacy_python_utils
/bin/.rv_builder.py
UTF-8
6,087
2.625
3
[]
no_license
#!/usr/bin/python #import threading import os #import commands #import Queue #import time import sys #import datetime #import glob import re re_seq = re.compile('^(|.*[^0-9])([0-9]+)([^0-9]*)$') from optparse import OptionParser p = OptionParser() #p.add_option("-a",dest='audiofile', type='string',help="audio file") ...
true
222d15771bf3eea6b8d4ab1aa79dbbb15ef01615
Python
rcjosue/CoE-16x
/CoE 163 - Computer Architechtures and Algorithms/matrix_multiplication_loops.py
UTF-8
1,741
3.125
3
[]
no_license
from time import time import random random.seed(0) n = 500 def init_rand(mat,n): for x in range(n): new = [] for y in range(n): new.append(random.random()) mat.append(new) def init_matrix(mat,n,value): for x in range(n): new = [] for y in range(n): new.append(value) mat.appe...
true
bc8be75d3578c251d46f435e96df0df526b202a1
Python
raj13aug/Python-learning
/example-programs/Looping_over_items.py
UTF-8
458
3.828125
4
[]
no_license
chars = ['A', 'B', 'c'] fruit = ('Apple', 'banana', 'cherry') dict = {'name': 'Nataraj', 'ref': 'python', 'sys': 'win'} # items method --> to display key and value. for key, value in dict.items(): print( key, '=', value) # enumerate to display index number for item in enumerate(chars): print(item) # zip me...
true
7f95d3289e10d03ff1c0d4a63d791e0419a9fa16
Python
gadeuneo/Python
/Python Programs Into to CS/Tutorial Python/isOdd.py
UTF-8
81
3.546875
4
[]
no_license
def isOdd(n): if n % 2 != 0: return True else: return False print(isOdd(4))
true
0bfe11805639102d590036da0462340d2fa2b970
Python
Wdeil/LP_Python3
/BlastingUsingDB.py
UTF-8
3,294
3.015625
3
[]
no_license
#! /usr/bin/env python3 # -*- coding:utf-8 -*- ''' This program is for blasting 59.77.226.32 using the method of ergodic. You can also user your own dictionary by adding the abspath of the dictionary. You should tell program which user you want to blast by adding the abspath of the SQL.txt for example: user: 01150110...
true
b6d5945903b872c09c8bffc50beab5e3da3e029a
Python
ajaykumar96/SapientPython
/TicTacToefinalv1.py
UTF-8
3,120
3.5625
4
[]
no_license
import pickle import sys class TicTacToe: def __init__(self,choices=[],playerOneTurn=True,winner=False,boardDim=3,game="newGame"): if game == "newGame" : self.choices = choices self.playerOneTurn = playerOneTurn self.winner = winner self.boardDim = boardDim self.initialiseParameters(self.boardDim)...
true
f0885a3c6538680e687e8fc3a418badfbc7a3493
Python
Devansh-Agarwal/CS6510-Applied-Machine-Learning
/Assignment 2/randomForestsklearn6a.py
UTF-8
1,220
2.625
3
[]
no_license
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score import csv import numpy as np import random with open("spam.data") as f: # next(f, None) data = [tuple(line) for line in csv.reader(f, delimiter=" ",quoting=csv.QUOTE_NONNUMERIC)] # with open("wine-d...
true
02445d306c4df17d73468a012f7318c595265c73
Python
julienr/gridclock
/build_grid.py
UTF-8
2,798
3.953125
4
[]
no_license
""" This is a simple algorithm that will figure out all the words needed to print all the hours/minutes. It will then create a crossword-like grid with all those words The goal is to build a clock similar to http://thepagefoundry.com/TPFprojects/clock/ """ from humantime.human_time import human_time from datetime impor...
true
170e83ba57023c4c6a6fe2a18c321149323afd9e
Python
reidac/AOC2020
/day4a.py
UTF-8
857
3.171875
3
[]
no_license
import re # A dictioanry is "valid" if it contains all the indicated keys. def valid(dct): kset = ['byr','iyr','eyr','hgt','hcl','ecl','pid'] # 'cid' optional. for k in kset: if k not in dct.keys(): return False return True if __name__=="__main__": f = open("day4.txt","r") ...
true
075ca1f17f467a0226745ea74d8ca04daceb5ec8
Python
emdodds/DictLearner
/tests/topo_test.py
UTF-8
1,134
2.734375
3
[ "MIT" ]
permissive
import numpy as np import tf_toposparse class topo_test(): def setup(self): pass def default_test(self): """Check that the default topology is correct. (Actually just check one row)""" topo = tf_toposparse.topology(shape=(25,25), sigma=np.sqrt(2)) g = topo.get_matr...
true
9529b9180b70f7f6cf53222213cccbb72fa515fe
Python
Aidaralievh/Aidaralievh
/2_Semester/Homework/3_homework_PasswordManager.py
UTF-8
666
3.578125
4
[]
no_license
class PasswordManager: def __init__(self): self.old_passwords = ['asdfasd', '1232134123', 'asdfg'] self.password = input('type new password: ') self.password2 = input('Enter the new password again: ') def set_password(self): self.old_passwords.append(self.password) def get...
true
f10e58e7563ae9769502d9fa458acef1506e315f
Python
jhonnyFR/cdd_embraer_titanic
/titanic_hello_word.py
ISO-8859-1
1,247
2.609375
3
[]
no_license
# LINK GITHUB PROJETO # https://github.com/ikeda27/cdd_embraer_titanic #site referncia: https://medium.com/@suzana.svm/data-science-udacity-titanic-e5b04a8e415f # APENAS USE ISSO CASO FOR NO PC EM VEZ DO SITE ONLINE !!! #pip install numpy #pip install pandas #pip install matplotlib import numpy as np imp...
true
970a7e277f80efb4b40daacd0b63f2a6f2372fd9
Python
chanduy2009/Rocket-Project
/html_table.py
UTF-8
1,635
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 19:05:42 2018 @author: User """ from bs4 import BeautifulSoup import pandas as pd import numpy as np import lxml import html5lib import csv import pickle path = 'E:/Data Science/BI/Rocket Project/0000001750/0000001750__2006-09-01.htm' path1='E:/Data...
true
ee4a0a65d75be5b6ed0a7c5e9aa71f28f5267bc1
Python
ddbourgin/mturk_utils
/psiturk_batcher.py
UTF-8
5,581
2.609375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys import time import logging from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, RawDescriptionHelpFormatter import pexpect DESCRIPTION = """ Emulate TurkPrime's HyperBatch feature to avoid accruing an extra 20% MTurk fee for h...
true
1b64e735aa7ad32d6696ef1e4a968d1a5c68ceec
Python
hazemessamm/Competitive-Programming
/ProjectEuler/Even-Fibonacci.py
UTF-8
1,047
4.125
4
[]
no_license
#to store each value with it's corresponding result for later purposes. fib_recorder = dict() #Initial fib values fib_recorder[1] = 1 fib_recorder[2] = 1 #Dynamic Programming is used here to memoize the N values for optimizing the function. #Some function calls will be free which means it will have O(1) because it...
true
767a2a96b6059d5e126ae3beedb2a8a4c7f34be0
Python
ZadenMaestas/ZoomAutoJoiner
/main.py
UTF-8
2,031
2.953125
3
[]
no_license
from time import sleep from colorama import Fore, Back, Style from datetime import datetime from pyautogui import alert import webbrowser title = open('logo.txt', 'r') art = title.read() print(Fore.GREEN + art) title.close() true = True while True: rn = datetime.now().strftime('%H:%M') print("Checking time"), ...
true
9711068e46bc04e38e4d218523296d012003f012
Python
juno7803/Algorithm-ANALYSIS-School-
/과제5/2016104154+이준호+과제5.py
UTF-8
3,678
3.921875
4
[]
no_license
# 2016104154 이준호 # 1번 2번 두문제 다 최솟값을 구하기 위해 비교하기 위한 값을 1000이라고 가정하여 풀었습니다(small = 1000 이라고 초기화 하여 비교함) import math import pdb # utility.py code - printMatrix def printMatrix(d): m = len(d) n=len(d[0]) for i in range(0,m): for j in range(0,n): print("%4d" % d[i][j],end=" ") p...
true
0cc7b060398b452c5f12a05b3beb8dad6edec013
Python
sashaobucina/interview_prep
/python/medium/find_duplicates_in_array.py
UTF-8
2,108
4.03125
4
[]
no_license
from typing import List def find_duplicates_naive(nums: List[int]) -> List[int]: """ # 442: Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without extra space and ...
true
0f8736206c0f1af30120a37f6046381a995d720e
Python
leandro86/ProjectEuler
/problems/p4.py
UTF-8
543
3.703125
4
[ "Unlicense" ]
permissive
import time def isPalindrome(n): number = str(n) return number == number[::-1] def solve(): upperLimit = 999 lowerLimit = 100 maxPalindrome = 0 for i in range(upperLimit, lowerLimit, -1): j = i while j >= lowerLimit and i * j > maxPalindrome: n = i * j ...
true
9f6db64cae5c40789f3b3197b40b653a303b1c9f
Python
rawOrlando/WorldCivilizationBuilder
/worldcivilizationbuilder/db/technology.py
UTF-8
3,753
2.71875
3
[]
no_license
from tinydb import Query from db.base import Base_DB_Model from db.helper import Dict2Class, get_db class Technology(Base_DB_Model): """ Fields: id uuid name str tec_type str description str prerequisite...
true
1b204b67f95c2e81dacbe1219508b780854a4e54
Python
stuart727/edx
/edx600x/L10_Classes/ebook_Python3_OOP/class_variables.py
UTF-8
2,204
3.859375
4
[]
no_license
# p. 64 class Contact(object): all_contacts = [] # class variable, shared by all instances of this class; #there is only one Contact.all_contacts list, and if we call #self.all_contacts on any one object, it will refer to that single list def __init__(self, name, email): self.name = name ...
true
00d7f295cb1d0c3d20efd6539b513226468343cb
Python
artbohr/codewars-algorithms-in-python
/7-kyu/beef-taco.py
UTF-8
983
3.84375
4
[]
no_license
def tacofy(word): t_dict = {'a': 'beef','e':'beef','i':'beef','o':'beef','u':'beef', 't':'tomato', 'l':'lettuce','c':'cheese', 'g':'guacamole', 's':'salsa'} return ['shell']+[t_dict.get(x) for x in word.lower() if t_dict.get(x)]+['shell'] ''' If you like Taco Bell, you will be familiar with their signatur...
true
e024a6718656517e883746c368d83d67af8c6424
Python
Aasthaengg/IBMdataset
/Python_codes/p02546/s120423928.py
UTF-8
68
3.234375
3
[]
no_license
S = input() if S.endswith("s"): print(S + "es") else: print(S + "s")
true
c84906208e8254e7295542cfaceda298eea33aec
Python
FahadHabib1998/Caesar-Cipher-Encryption
/caesarCipher.py
UTF-8
1,585
3.734375
4
[]
no_license
#Forming a dictionary where each alphabet/digit coressponds to the alphabet/digit according to ROT-13 and ROT-5 def form(): dic={} dic[" "]= " " for i in range(ord("A"),ord("Z")+1): newi = i shift = newi+13 if shift > ord('Z'): shift=shift-26 dic[chr(i)] = c...
true
90d43461e030606b0c1504adb667c8a0d5f72d13
Python
namand010/Project4091998
/Learning_code/linked.py
UTF-8
469
3.5
4
[]
no_license
class Node: def __init__(self, value): self.value = value self.next = None class Linkedlist: def __init__(self): self.head = Node() def append(self, value): if self.head is None: self.head = Node(value) return self.head else: tem...
true
3d4610bf49353a0c53af0615b4f4341bd2129ba8
Python
Natacha7/Python
/Cadena/cadena_len.py
UTF-8
51
2.703125
3
[]
no_license
cadena = "Programar en Python" print(len(cadena))
true
5eec9be9f3a463a9e0d90411b1e2268f1332636b
Python
luzeduardo/book-hands-on-scikitlearn
/housing.py
UTF-8
772
3.046875
3
[]
no_license
import pandas as pd import os import matplotlib.pyplot as plt import numpy as np def load_housing_data(housing_path): csv_path = os.path.join(housing_path, 'housing.csv') return pd.read_csv(csv_path) def split_train_test(data, test_ratio): shuffled_indices = np.random.permutation(len(data)) test_set_size = in...
true
f15f43266d3156465bf70cc724d497de3b3d70ac
Python
reshma-jahir/GUVI
/set98.py
UTF-8
148
3.046875
3
[]
no_license
gef11,sef11=map(int,input().split()) maxima=max(gef11,sef11) while(1): if(maxima%gef11==0 and maxima%sef11==0): print(maxima) break maxima+=1
true
b47927e107bfd6699c99a5ac99dbd0662d5bc26d
Python
aeverson/handy_scripts
/reddit_ticket_generator.py
UTF-8
1,346
2.5625
3
[]
no_license
import json import requests # # Set the request parameters subreddit = "finishing" url = 'https://z3nzdsupport.zendesk.com/api/v2/tickets.json' user = '' pwd = '' headers = {'content-type': 'application/json'} # Get Reddit post # Need to figure out how to get many posts and get a new one each time content = requests....
true
98af056238ae6d1304e8819edef0c04ded3ccbdd
Python
getkeops/keops
/pykeops/pykeops/test/test_float16.py
UTF-8
1,290
2.515625
3
[ "MIT" ]
permissive
# Test for Clamp operation using LazyTensors import pytest import torch from pykeops.torch import LazyTensor dtype = torch.float16 M, N, D = 5, 5, 1 torch.backends.cuda.matmul.allow_tf32 = False device_id = "cuda" if torch.cuda.is_available() else "cpu" torch.manual_seed(0) x = torch.randn(M, 1, D, dtype=dtype, req...
true
688a5fbab6922aa2fc49e629adb98e5c3d97a0e8
Python
banginji/algorithms_sot
/datastructures/stack.py
UTF-8
615
3.953125
4
[]
no_license
class Stack: def __init__(self): self.stack_data = [] def push(self, data): self.stack_data = [data] + self.stack_data def pop(self): popped_data = self.stack_data[0] self.stack_data = self.stack_data[1:] return popped_data def peek(self): return self.s...
true
34c739eb924fa127bf0bd069f1b990009185003c
Python
Pythephant/ProgrammingPython
/Gui/Tour/entry2-modal.py
UTF-8
377
2.625
3
[]
no_license
from tkinter import * from entry2 import fields, makeForm, fetch def show(entries, win): fetch(entries) win.destroy() def ask(): win = Toplevel() ents = makeForm(win, fields) Button(win, text='OK', command=(lambda: show(ents, win))).pack() win.grab_set() win.focus_set() win.wait_window() root = Tk() Button(r...
true
acd392c93c10dd1cfd2377f2a08ac7c819119dcc
Python
Adnan-Sait/task-tracker
/models/ExcelDataConsolidation.py
UTF-8
2,739
3.25
3
[ "MIT" ]
permissive
import datetime class ExcelDataConsolidation: def __init__(self): """Instantiates the ExcelDataConsolidation Object""" self.__dateRecorded = None # type: datetime.date self.__startTime = None # type: datetime.time self.__leavingTime = None # type: dat...
true
aef10294900751de4b742173a0901912b23c736d
Python
Aasthaengg/IBMdataset
/Python_codes/p03409/s990336452.py
UTF-8
890
3.0625
3
[]
no_license
def main(): from sys import stdin def input(): return stdin.readline().strip() n = int(input()) red = [tuple(map(int, input().split())) for _ in range(n)] blue = [tuple(map(int, input().split())) for _ in range(n)] red.sort() blue.sort() now = 0 for i in blue: ...
true
ead65bf96a6b1fdd2df2fa07cfeaaa642cacb3fc
Python
Computer-engineering-FICT/Computer-engineering-FICT
/II семестр/Дискретна математика/Лаби/2016-17/Бурбіль 6203/Лабораторна №3/Laboratorna3.py
UTF-8
6,527
2.984375
3
[]
no_license
from tkinter import * import matplotlib.pyplot as plt import networkx as net from tkinter import messagebox root = Tk() class Cell(Entry): def __init__(self, parent,c): self.value = StringVar() Entry.__init__(self, parent, textvariable = self.value, width = 7, justify='center' ) ...
true
a6aee67bf987e5b9efb42025da3f4836907157fe
Python
humdan123/TelegramGamesBot
/Card_Classes.py
UTF-8
2,438
4.03125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 8 16:26:46 2018 @author: humza """ import random class Player: """ A class with the player information """ def __init__(self, name: str, is_bot: bool): self.name = name self.hand = [] self.is_bot = is_bot ...
true
13e1dab68de511c5d8bd2fa8a986eec4e21a7774
Python
Alkanoor/Hamming_stegano
/comparaison/lsb_comparaison.py
UTF-8
1,678
2.546875
3
[]
no_license
#!/usr/bin/python import os import inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) os.sys.path.insert(0,parentdir) import matplotlib.pyplot as plt from utils import utils from PIL import Image import numpy as np import argparse p...
true
fb6932b2b75e1b52f60eac544f79fe47e1f05097
Python
RongyiLi/multiple-layer-perceptrons
/data/wine/wine_to_excel.py
UTF-8
329
2.921875
3
[]
no_license
import pandas as pd data_file = 'wine.data' data = [] file = open(data_file, 'r') for i in file.readlines(): i = i.strip().split(',') d = list(map(float, i[1:])) d.append(int(i[0])) data.append(d) file.close() df = pd.DataFrame(data=data, columns=None) df.to_excel('wine.xlsx', index...
true
ff7db6ac521f49244d32167144952dd7e0d72412
Python
renji01/learning_python
/junior_spider-master/07-BBS/boards.py
UTF-8
1,907
2.84375
3
[]
no_license
import re from lxml import etree import requests import time import global_var class BoardsCrawler: domain = 'http://www.newsmth.net/' base_url = domain + '/nForum/section/{}?ajax' def __init__(self, interval = 1): self.interval = interval def get_board_of_section(self, section_idx): ...
true
44eb249a9c87de80ec6727f8a8241593c84ac719
Python
gitarjun/Paytm-mon
/conwriter.py
UTF-8
1,377
3.28125
3
[]
no_license
from sys import stdout from threading import Thread import time class conprint(Thread): def __init__(self,space=80,speed=1): Thread.__init__(self) self.statement = None self.string = space self.running = True self._counter = 0 self.speed = speed self.pattern ...
true
d5c017b9bf9014e8bd69c174f9dfdc49703e1eed
Python
Are-Oelsner/WritingAid
/Tarot.py
UTF-8
4,972
4.28125
4
[]
no_license
# Author : Are Oelsner # Description : Tarot deck simulator commissioned as a writing aid for creating plot points and character arcs import random ### Deck Functions # __init__() Deck constructor # shuffle() Shuffles current deck # reset() returns drawn cards to deck and resets order and...
true
eea578de97d6bae27cc5569d606229eb61d992ed
Python
django/django
/tests/one_to_one/models.py
UTF-8
3,044
2.734375
3
[ "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "GPL-1.0-or-later", "Python-2.0.1", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-permissive", "Python-2.0" ]
permissive
""" One-to-one relationships To define a one-to-one relationship, use ``OneToOneField()``. In this example, a ``Place`` optionally can be a ``Restaurant``. """ from django.db import models class Place(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=80) def __...
true
88d3e1b8147fc5af75a547e77996eb77b2d8125a
Python
shereshevsky/xgb_tests
/main.py
UTF-8
348
2.546875
3
[]
no_license
import pandas as pd import xgboost as xgb import json from time import time s = time() x = pd.read_parquet('/opt/data/group_X_train.pq') y = pd.read_parquet('/opt/data/group_y_train.pq') model = xgb.XGBRegressor(**json.load(open("/opt/data/params.json", "rt"))) model.fit(x, y) model.predict(x) print(f"Execution s...
true
4af9598f168d9705293b5260c7e4c20ce8802e38
Python
ssangitha/guvicode
/binary_form.py
UTF-8
69
2.75
3
[]
no_license
n=int(input()) s=bin(n) s=s[2:] print(s) #.....binary form of n.....
true
9a16c86ce7f42e1d826b67de35c866885e79c9b6
Python
merileewheelock/python-basics
/dc_challenge.py
UTF-8
2,153
4.90625
5
[]
no_license
# 1) Declare two variables, a strig and an integer # named "fullName" and "age". Set them equal to your name and age. full_name = "Merilee Wheelock" age = 27 #There are no arrays, but there are lists. Not push, append. my_array = [] my_array.append(full_name) my_array.append(age) print my_array def say_hello():...
true
3ed43dae03089c3ffb2ec15c5553819a30376c3f
Python
raphaelrrcoelho/Python_codes
/old/queries.py
UTF-8
2,711
2.875
3
[]
no_license
# coding=utf-8 import conexao class Queries(object): """ Classe com queries mais utilizadas no projeto Modo de uso Queries.tickers() - retorna um frame com o resultado da query """ conexao = conexao.Conexao() @staticmethod def tickers(): """Função que retorna a lista de tick...
true
adc6bee27afd4664b03ff11bb29cbac0e5618f2e
Python
markpolyak/conf-automation
/msnk/report.py
UTF-8
8,451
2.734375
3
[]
no_license
from datetime import datetime from docx import Document from docx.enum.text import * from docx.shared import * import gspread from oauth2client.service_account import ServiceAccountCredentials import sys def main(): rowData = getData() createReport(getMeetingMembers(rowData)) def createReport(data): """ ...
true
ad148e2f2b02249f57a06a80c2f0cef4a9915394
Python
TylerSandman/mopy
/tests/nim_test.py
UTF-8
2,169
2.984375
3
[ "MIT" ]
permissive
from mopy.impl.nim.state import NimState from mopy.impl.nim.action import NimAction from mopy.impl.nim.game import NimGame import pytest @pytest.fixture def game(scope="module"): return NimGame() @pytest.fixture def new_state(game): return game.new_game() @pytest.fixture def mid_state(): ...
true
7bc17ecefbe6c2efbe204cf83641e1c3e52eec95
Python
rmahanti-work/hfpython
/mymodules/vsearch.py
UTF-8
1,276
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jul 15 14:12:34 2020 @author: Ravi """ # ============================================================================= # def search4vowels(): # """Display any vowels found in an asked-for word.""" # vowels_set = set('aeiou') # word = input('Provide a word to sear...
true
2998ee0fc55a1b335e731ab1c1c05efbf81658ce
Python
srilaksh/project
/last_name.py
UTF-8
200
3.484375
3
[]
no_license
#!/usr/bin/python file = open("name.txt","r") my_string=file.read() print "full name is %s" % my_string #splitting the string last_name=my_string.split(":",1)[1] print "last name is %s" % last_name
true
16ab7552e5861a489823334c5907d3b57354cebb
Python
LiamStewartekksdee/SocketProgamming
/chatbot.py
UTF-8
3,379
3.65625
4
[]
no_license
#Sources Used: https://linuxacademy.com/blog/linux-academy/creating-an-irc-bot-with-python3/ import socket #Imports the Socket library import datetime #Imports the datetime library #Sets the socket,server,channel and bot name here thesocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server = "127.0.0.1"...
true
ab38a37faec4445947ed390c4993adf1336e9582
Python
Alexander-Jing/code_for_UIST
/BCI_framework/library/src/utils/post_experiment.py
UTF-8
1,160
2.734375
3
[]
no_license
from pandas import DataFrame import pandas as pd def store_subject_feedback(app, experiment_id, subject_id, results): """Store the feedback for the current subject 1. Load data storage path for post-experiment from the config file: instance/config.py 2. In the subject folder for post-experiment, c...
true
85cd04f709347942ee47e47cd49c03dfaaf076ac
Python
MatteoRagni/ShapeSorter
/dataset/create_data.py
UTF-8
3,256
2.671875
3
[]
no_license
#!/usr/bin/env python import itertools as it #from math import floor import pickle from time import sleep import socket import json from glob import glob from os import stat frequency = 60 target_sim = ("localhost", 9999) config = { "elements": 3, "rows": 5, "cols": 5, "el_name": ("l3", "l4", "lr"),...
true
10c3fcacc5f0ca8f326d808b95d1546b401b4474
Python
muratali016/NEURAL-NETWORKS-IMAGE-RECOGNITION
/OPEN_THE_DOOR_WITH_YOUR_FACE.py
UTF-8
1,596
2.640625
3
[]
no_license
import cv2 import face_recognition from playsound import playsound from gtts import gTTS import os import random import tkinter as tk import tkinter as tk def face(): def speak(string): tts=gTTS(string ) rand =random.randint(1,10000) file='audio-'+str (rand)+'.mp3' tts.save(file)...
true
fca45ff50e9caab09dc1102e48c5a8f28de5866e
Python
matilda-art/Software-test
/selenium测试/newpackage/mouse_opreation.py
UTF-8
823
3.109375
3
[]
no_license
from selenium import webdriver import time # 在执行鼠标事件时需要导 ActionChains 包 from selenium.webdriver.common.action_chains import ActionChains driver = webdriver.Firefox() driver.get("https://www.baidu.com/") driver.maximize_window() time.sleep(3) driver.find_element_by_id("kw").send_keys("朱一龙") driver.find_element_by_id...
true
fda5768fd40ff85d9c65b0bc0439d969a0d1ab70
Python
MagoRditox/TI3-Digital_Motion
/blob_mas_rendimiento.py
UTF-8
4,601
2.96875
3
[]
no_license
import cv2 import numpy as np import time promedio = float(0) dividido = float(0) for k in range (0,1212,1): try: if k < 10 and k >=0: Imagen = 'Seq/Img00000'+str(k)+'.jpg' if k < 100 and k >=10: Imagen = 'Seq/Img0000'+str(k)+'.jpg' if k < 1000 and ...
true
3d98e2517c2ff65c4a57b7db0c30c3bc7aad659f
Python
treyhakanson/speechli-api
/src/tests/test_discovery_suggestion.py
UTF-8
1,372
2.578125
3
[]
no_license
from routes.discovery import Suggestion def test_init_and_serialize(): document_id = 'test_document_id' text = 'test text' score = 1 author = 'test author' suggestion = Suggestion(document_id, text, score, author) suggestion_dict = suggestion.to_dict() assert(document_id == suggestion_dict['document_id']) ass...
true
c63e5b4bfb3a0be3e995851226e76e38ce9ffaf8
Python
Sibiryak82/MarkLutzLearningPython2.
/registry-deco.py
UTF-8
1,520
3.953125
4
[]
no_license
# Файл registry-deco.py # Регистрация декорированных объектов в API-интерфейсе registry = {} def register(obj): # Декоратор для классов и функций registry[obj.__name__] = obj # Добавление в реестр return obj # Возвращение сам...
true
0963849a5237f4324d77fe5e4beb9ec7278d73bf
Python
Vitotuxedo/floof-bot
/app.py
UTF-8
860
2.59375
3
[]
no_license
import json import os import random import sys import requests import xmltodict from flask import Flask, request app = Flask(__name__) # Webhook for all requests @app.route('/', methods=['POST']) def webhook(): data = request.get_json() log('Recieved {}'.format(data)) msg = '' if data[...
true
958d86a8c8cfccaae867e20c20d71129aa5e8f47
Python
981377660LMT/algorithm-study
/17_模式匹配/后缀数组/字典序第k小的子串.py
UTF-8
1,841
3.515625
4
[]
no_license
# https://blog.csdn.net/Elemmir/article/details/50988467 # 字典序第k小的子串 # !二分出排名为K的子串是哪一个后缀的第几个未被计算过的前缀(每个后缀贡献子串数是这个后缀的长度减去其LCP) from itertools import accumulate from SA import useSA def solve(s: str, k: int) -> str: """字典序第k小的子串 k>=1""" n = len(s) ords = [ord(c) for c in s] sa, _, height = ...
true
15d6d42132fd9ee3aea4384d62bc13e8da892447
Python
OOCZC/ML_in_Action
/kNN/kNN_dating.py
UTF-8
2,829
3.015625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import operator import matplotlib import matplotlib.pyplot as plt def classify0(inX, dataSet, labels, k): dataSetSize = dataSet.shape[0] diffMat = np.tile(inX, (dataSetSize,1)) - dataSet sqDiffMat = diffMat**2 sqDistances = sqDiffMat.sum(axis=1) #a...
true
261e6088458c2919b0b25ec56e80547071e4508f
Python
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1_neat/16_0_1_ALMN_CodeJam16_1.py
UTF-8
799
3.078125
3
[]
no_license
import os case_num = 1 def final_number(n): if n == 0: return 'INSOMNIA' if n != 0: a = range(0, 10) digits_seen = [] multiplier = 0 while digits_seen != a: multiplier += 1 n_string = str(n * multiplier) for i in range(0...
true
53807e2b53ca76ec512909f6fb5df92c4e2d22ce
Python
renzhongpiao/python-snippets
/notebook/list_2d_sort.py
UTF-8
2,973
3.046875
3
[ "MIT" ]
permissive
import pprint print([100] > [-100]) # True print([1, 2, 100] > [1, 2, -100]) # True print([1, 2, 100] > [1, 100]) # False l_2d = [[20, 3, 100], [1, 200, 30], [300, 10, 2]] pprint.pprint(l_2d, width=20) # [[20, 3, 100], # [1, 200, 30], # [300, 10, 2]] pprint.pprint(sorted(l_2d), width=20) # [[1, 200, 30], # [20,...
true
efb390a528315563549cb503e970b4c4d56925f2
Python
PacktPublishing/Learn-Python-Programming-Second-Edition
/Chapter10/ch10/comm_queue.py
UTF-8
660
3.390625
3
[ "MIT" ]
permissive
import threading from queue import Queue SENTINEL = object() def producer(q, n): a, b = 0, 1 while a <= n: q.put(a) a, b = b, a + b q.put(SENTINEL) def consumer(q): while True: num = q.get() q.task_done() if num is SENTINEL: break print(f...
true
71ad506a0d88b4bbaf64d6b05186cbafc2ea03a7
Python
willem88836/Digital-Pianola
/FourierTransformTrials/KeyAnalyzeWav-vb.py
UTF-8
6,268
2.90625
3
[ "MIT" ]
permissive
from joblib import Parallel, delayed import multiprocessing import math import librosa import soundfile from functools import cmp_to_key from piano import PIANO_KEYS from util import * import progress_bar as pb progress = None class analysis_settings: def __init__(self, seconds, key_threshold, test_interval,...
true
ff75a9e304a5b3150faa2bbc299751df0f397abc
Python
dalreak/algorithm
/baekjoon_algorithm/bruteforce/devil.py
UTF-8
183
3.328125
3
[]
no_license
num = 664 result_list = list() count = int(input()) while len(result_list) != count: num = num + 1 if "666" in str(num): result_list.append(num) print(result_list[-1])
true
2d5cc413cdc72260a66918603cb4122b6b3af7c0
Python
websauna/websauna
/websauna/tests/model/test_column_utcdatetime.py
UTF-8
879
2.734375
3
[ "MIT", "Apache-2.0" ]
permissive
"""Tests UTC datetime.""" # Standard Library import datetime # SQLAlchemy from sqlalchemy import Column from sqlalchemy.ext.declarative import declarative_base import pytest # Websauna from websauna.system.model.columns import UTCDateTime def test_UTCDateTime_restricts_timezone_to_utc(): Base = declarative_b...
true
a967e2d8ebd6dce482de369a5766a90361aa72fe
Python
buzzfeed/caliendo
/test/test_patch.py
UTF-8
1,637
2.671875
3
[ "MIT" ]
permissive
import os import unittest from caliendo.patch import patch from caliendo.patch import patch_lazy from test.api.myclass import InheritsFooAndBaz, LazyLoadsBar def run_t_est_n_times(test, n): for i in range(n): pid = os.fork() if pid: os.waitpid(pid, 0) else: test(i)...
true
8fb9f1ab60fa9a7109e7603a893029d4fcd116ce
Python
ShahzebFarruk/Shahzeb_Private_Repos
/3_speech_recog_NLP/code/3_3_Speech.py
UTF-8
1,920
2.9375
3
[]
no_license
import numpy import pandas as pd from sklearn.metrics.pairwise import euclidean_distances import numpy as np from sklearn.metrics.pairwise import cosine_similarity import seaborn as sns import matplotlib.pylab as plt import numpy as np import pandas as pd import soundfile #Install as pysoundfile, Run the Command: pip ...
true
9f3a756bacdb0b354680522b15ae9c33170f41a3
Python
YiseBoge/CompetitiveProgramming
/CodeForce/Contest/A2SV Custom Contests/A2SV7/B.py
UTF-8
798
3.15625
3
[]
no_license
def can_win(alice, bob, target, n): quadrants = [lambda curr, bad: curr[0] < bad[0] and curr[1] < bad[1], lambda curr, bad: curr[0] > bad[0] and curr[1] < bad[1], lambda curr, bad: curr[0] > bad[0] and curr[1] > bad[1], lambda curr, bad: curr[0] < bad[0] and curr[1...
true
a4a5975e79a710b0eb3182edc3050e3c36ebd597
Python
samueller9/cli-games
/string-practice.py
UTF-8
451
3.984375
4
[]
no_license
name = "Cleetus" age = 43 location = "Florida" height = 48 def greeting(name, age): print(name.lower()) def is_grownup(age): print(age >= 18) def introduction(name, location): print(f"Hi im {name} and im from {location}") def too_short (height): if height >= 48: return print("You're all goo...
true
70adbb63e1105c97796aee22f4c59f13ab7d40db
Python
leehangjoo/TCPIP
/final/test1.py
UTF-8
574
3.3125
3
[]
no_license
import tkinter as tk def add_input(): f = int(en_first.get()) s = int(en_second.get()) lbl_result.configure(text=f+s) def enter_pressed(e): add_input() w = tk.Tk() w.title('Event Handling') w.bind('<Return>',enter_pressed) btn_add = tk.Button(w, text='더하기', command=add_input) lbl_result = tk.Label(w...
true