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
e0f86ec1fd1b044be37d408bfc9831e436d35b89
mddiallo/AML-service
/01_train_mnist.py
UTF-8
7,398
2.53125
3
[]
no_license
# Train a model #%% import numpy as np import matplotlib.pyplot as plt # %matplotlib inline import azureml.core from azureml.core import Workspace # check core SDK version number print("Azure ML SDK Version: ", azureml.core.VERSION) #%% # Connect the workspace # load workspace configuration from the config.jso...
true
bba90c0d399f0ddc1aeb7e90a49b25022671e189
DevilInChina/Wallpaper
/main.py
UTF-8
2,474
2.6875
3
[]
no_license
import matplotlib.image as mpimg import numpy as np import sys from scipy.sparse import csr_matrix import os def print_hi(name): print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. class CSR: def __init__(self,dense_matrix): self.csr=csr_matrix(dense_matrix) def __bytes__(self): ...
true
0ff0728a292aa093c5f2c08027fbb5cb286ca1eb
dhruvramani/SentimentClassifcation-Pytorch
/embedding.py
UTF-8
3,533
3.21875
3
[]
no_license
import torch import string import itertools import torch.nn as nn from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence """ Source : https://gist.github.com/DuaneNielsen/4e45408948b0aca9b66b7a55ddec8950 Used it as the iterators of torchtext were giving a ...
true
36aa1daaac8ac0e7531bfe013fa7496dd295b121
hzfmax/Evasive-Path-Planning
/models.py
UTF-8
17,604
3.25
3
[]
no_license
import numpy as np import collections import math from game2d import * from helper_funcs import * from consts import * import sys import heapq """ MODELS OF THE GRID AND THE ELEMENTS WITHIN IT. PRETTY MUCH EVERYTHING EXCEPT THE ACTUAL PATH PLANNING """ class Grid: #A SQUARE collection of cells with som...
true
ede12b706eda2e295beb6205d4689a87ac364398
AlibekovMurad5202/openvino-dl-benchmark
/src/config_maker/view/tables/table.py
UTF-8
1,204
2.75
3
[ "Apache-2.0" ]
permissive
from PyQt5 import QtCore from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem class Table(QTableWidget): def __init__(self, parent): super().__init__(parent) self._count_row = 0 self._count_col = 0 self._selected_rows = [] self.clicked.connect(self.clicked_table) # n...
true
70684f11aa37f66bee3c3c042aef4a9dceb09e4c
naveeharn/python101
/py21_functions.py
UTF-8
253
3.84375
4
[]
no_license
# function # a block of code witch is executed only when it is called def func(number): print("qwert "+str(number+109)) func(3) def name(firstname,lastname): print("Hello Sir " + str(firstname) + " " + str(lastname)) name("john","mamacita")
true
7f678c99ccc7a4b236b6c7f6aece9a59ed130c00
ooakind/CSED331-Algorithm
/assn1/assn1-2.py
UTF-8
749
3.0625
3
[]
no_license
import sys T = int(sys.stdin.readline()) for _ in range(T): N = int(sys.stdin.readline()) points = [] for _ in range(N): points.append(tuple(map(int, sys.stdin.readline().split()))) points.sort(key=lambda x: (x[0], x[1])) max_s = -1 # abs((points[0][1] - points[1][1]) / (points[0][0] - po...
true
20757103fc0473c0efd1f4306c3ad49c24e408de
VanaraSugriva/repo
/tasks/22_textfsm/task_22_1.py
UTF-8
790
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Задание 22.1 Создать функцию parse_command_output. Параметры функции: * template - имя файла, в котором находится шаблон TextFSM * command_output - вывод соответствующей команды show (строка) Функция должна возвращать список: * первый элемент - это список с названиями столбцов * остальные ...
true
934611ea796fe65e143ef0d4147874dd807e75b8
donghakang/Football_POV
/despin_video/view_expansion/triplet_generator.py
UTF-8
16,391
2.8125
3
[]
no_license
import numpy as np from collections import deque import cv2 import matplotlib.pyplot as plt class TripletGenerator: def __init__(self, max_frames, frame_height, frame_width, valley_frame_distance): # set constructor values self._max_frames = max_frames self._queue_len = (((valley_frame_dis...
true
b114c937dc89049f14b6b50955540fce21bffdfc
imyelo/sudoager
/base/grid.py
UTF-8
14,258
3.1875
3
[]
no_license
#coding=utf-8 # Filename: grid.py import convertor # grid class grid: def __init__(self): self.__cells = [cell(i) for i in range(81)] self.__numbers = [number(i + 1) for i in range(9)] # load(data)载入谜题data def load(self, data): self.__init__() data = list(data) cel...
true
3eed1d89746367beb5299e4c0331520064f79d31
lfstos/backend_challenge
/solution/car.py
UTF-8
1,390
3.125
3
[]
no_license
class Car: def __init__(self, tyres=4, liters=1250, total_km=0, disagree=0, piece=''): self.tyres = tyres self.liters = liters self.total_km = total_km self.disagree = disagree self.piece = piece '''Viagem''' def travel(self): if self.total_km <= 10000 and se...
true
c166e92ca30f4ce99ebfc3afec4ae45354b783cf
klspavani1/Python
/Ass4_frequency_of_char.py
UTF-8
385
3.875
4
[]
no_license
#Python Program to implement frequency_of_chars new_string = list('asdsadDASDFASCSAASAS') l1 = []#list containing unique chars from l l2=[]#list containing frequencies of chars in l for i in new_string: if i not in l1: l1.append(i) for i in range(0, len(l1)): l2.append(ne...
true
339805428c189f3c95e5d4f82bee66b2a05fa673
ItsFadinG/Python-100-Day-of-Code-Walkthrough
/100Python_Day_Code_Challenges/Day16-18/Bite 5. Parse a list of names.py
UTF-8
1,215
3.703125
4
[]
no_license
NAMES = ['arnold schwarzenegger', 'alec baldwin', 'bob belderbos', 'julian sequeira', 'sandra bullock', 'keanu reeves', 'julbob pybites', 'bob belderbos', 'julian sequeira', 'al pacino', 'brad pitt', 'matt damon', 'brad pitt'] def dedup_and_title_case_names(names): """Should return a li...
true
79ad049bfac981c85c13f3a721e352210cf13948
petrov-anna/lab_chat
/chat.py
UTF-8
3,741
2.953125
3
[]
no_license
import socket import threading import queue import sys import random import os d = "000" key = 567 # Ключ шифрования # Код клиента, отправление информации и создание крипта def ReceiveData(sock): global d, key while True: try: data, addr = sock.recvfrom(1024) print(data.decod...
true
7a748627b3e7a3cb7733334a0d63f800545bddd5
nataliakulikowska/kuptelefonik
/src/data_scraping/data_scraping/scrapers/base_scraper.py
UTF-8
325
2.578125
3
[]
no_license
from abc import ABC, abstractmethod from decimal import Decimal class PhoneOfferScraper(ABC): @abstractmethod def __init__(self, offer_page_html: str) -> None: ... @abstractmethod def is_phone_available(self) -> bool: ... @abstractmethod def get_price(self) -> Decimal: ...
true
37c08ba04367f7f2d34c8b12ed1e4ec8f4f3adf9
kanr/blackjacksim
/blackjack.py
UTF-8
10,529
3.125
3
[ "MIT" ]
permissive
from random import shuffle #import tensorflow as tf import re import random import sqlite3 import numpy as np class Shoe: # A shoe object # size is number of decks. e.g. six decks in a shoe. def __init__(self, size): self.cards = [] for k in range(size): for x in range(2,11): ...
true
901552e9daf548b7cefb28cbd80cb91035ec4c2c
ARQtty/deepvk-test-task
/hparams.py
UTF-8
1,109
2.984375
3
[ "MIT" ]
permissive
import yaml def _load_hparam(filename): stream = open(filename, 'r') docs = yaml.load_all(stream, Loader=yaml.SafeLoader) hparam_dict = dict() for doc in docs: for k, v in doc.items(): hparam_dict[k] = v return hparam_dict class Dotdict(dict): __getattr__ = dict.__getitem_...
true
c1eb19c6df5aa19363aa8c665340193469886437
stevenodb/adventofcode2017
/_04_passphrases/test_has_duplicates.py
UTF-8
435
2.796875
3
[]
no_license
from unittest import TestCase from _04_passphrases.passphrases import has_duplicates class TestHas_duplicates(TestCase): def test_has_duplicates(self): self.assertTrue(has_duplicates(['one','two','three','one'])) self.assertTrue(has_duplicates(['one', 'two', '', ''])) self.assertTrue(has_d...
true
4d982c99a48643926253c51178beb0275d8f571d
lesleyfon/Sprint-Challenge--Data-Structures-Python.
/reverse/reverse.py
UTF-8
1,451
3.984375
4
[]
no_license
class Node: def __init__(self, value=None, next_node=None): self.value = value self.next_node = next_node def get_value(self): return self.value def get_next(self): return self.next_node def set_next(self, new_next): self.next_node = new_next class LinkedList...
true
057549751b5e29ecd0d4b943a5c8be8a1c9f3af7
the-explorer-of-dreams/alien_invasion
/settings.py
UTF-8
1,837
3.046875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: settings Description : Author : william date: 2018/9/19 ------------------------------------------------- Change Activity: 2018/9/19: ---------------------...
true
bfae157168cd9b464be13bedab08be4d447bf9d2
ayang923/bts-share
/test.py
UTF-8
7,688
3.15625
3
[]
no_license
import numpy as np import tensorflow as tf import cv2 mod_path = "yolov3-tiny.tflite" img_path = "testImage.png" def process_image(image_path, input_height, input_width): """ Takes any image and transforms it into the format needed for object detection with yolov3. Parameters ---------- image_path...
true
c65bd27adfe28f9299c542347a8d108bf52b0b41
williams040315/Will-Lab
/concours_drive/spot-detect.py
UTF-8
3,877
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: Williams BRETT @date: 24-01-2019 @brief: convert 16bits to 8bits, apply color mapping, adjust gamma, brightness and contrst auto """ import numpy as np import cv2 import os from PIL import Image def nothing(x): pass def getsize(img): h, w = img.shape[:2] ...
true
d145b8f6f69cd1dd645d10ec267241a61fefcb0f
reactivespace/Steemit-Fork-2.0
/tests/api_tests/list_comment.py
UTF-8
1,768
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ Create list of all clout comments in file. Usage: list_comment.py <server_address> [<output_filename>] """ import sys import json from jsonsocket import JSONSocket from jsonsocket import cloutd_call def list_comments(url): """ url in form <ip_address>:<port> """ last_cashout_time = "...
true
6095d8dbbf18023703e2a7db97a7e93eb3d17c3b
sd691876/Python
/106360145_林裕國(3.4.5).py
UTF-8
2,191
3.6875
4
[]
no_license
from math import sqrt from random import randint def Standard_deviation(number): summation = 0 N =len(number) for i in range(len(number)): summation = summation + number[i] mean = summation/N sum_sd = 0 for j in range(len(number)): sum_sd = sum_sd + (number[j] - mea...
true
74c656f5268d4e58a7fe5fcf3820df10c32a555f
devilhtc/leetcode-solutions
/0x0044_68.Text_Justification/solution.py
UTF-8
1,332
3.03125
3
[]
no_license
class Solution: def fullJustify(self, words, maxWidth): """ :type words: List[str] :type maxWidth: int :rtype: List[str] """ def patch_lines(line): num_spaces = len(line) - 1 if num_spaces == 0: return line[0] + " " * (maxWidth...
true
5106fbc8dfff1bf0b40cf2746821e221eae99dc8
marclus49049/programs
/SEM1/Python/Assignment/renameFile.py
UTF-8
427
3.640625
4
[]
no_license
# Marclus Lopes # If a file has spaces change the spaces to '_' import os path = './' for file in os.listdir(path): file_name = '' flag = False if ' ' in file.strip(): for alpha in file.strip(): if alpha == ' ': alpha = '_' flag = True file_na...
true
d410edb3b9fc8cc54524cd89ad3d8c0e3952a6fd
ForeverWintr/metafunctions
/metafunctions/exceptions.py
UTF-8
749
2.90625
3
[ "MIT" ]
permissive
class MetaFunctionError(Exception): pass class CompositionError(MetaFunctionError, TypeError): "An exception that occureds when MetaFunctions are composed incorrectly" pass class CallError(MetaFunctionError, TypeError): "An exception that occures when a MetaFunction is called incorrectly" def _...
true
b8a50e4c763724b0591c81948790b9494e9a3302
NotAlwaysRignt/Personal_Study
/Note and Code/编程/python/语法和python基本模块/关于attr(get_set_has)的操作/attr.py
UTF-8
1,035
4.15625
4
[]
no_license
#coding:utf-8 #python中,(不需要导入)全局可用的函数getattr(a,"b")等价与a.b #注意第二个参数要写成字符串形式 #而在类中,__getattr__方法,会在你访问类的成员变量时被触发,就好像运算符的重写 #让你在访问类成员时有不一样的行为 #setattr(obj,"a",b)等价与 obj.a = b 注意第二个参数要写成字符串形式 #在类中重写了__setattr__方法,会在你改变类的成员变量时触发这个函数 #hasattr(obj,"a") 判断obj中是否有成员a(第二个参数a要写成字符串),如果有则 #返回True,否则返回False #hasattr,getattr和se...
true
f7d83f17c4b35f391f93e99921fc6c6e031f79e4
lileist/myScripts
/expectra/blz_gr.py
UTF-8
3,760
2.703125
3
[]
no_license
#!/usr/bin/env python """ This code is used to extract geometry and exafs for given energy and s (chi_deviation). How to use: dot_selection [energy] [s] [pl_steps] [bh_steps] [species_number] """ import sys import os import copy import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as anima...
true
d28387b1e230a0df74b1e1d952176eb9d60ecd78
lgdelacruz92/FlappyBird
/tests/test_pipe_manager.py
UTF-8
1,881
3.203125
3
[]
no_license
import unittest from unittest.mock import Mock from src.pipe_manager.pipe_manager import PipeManager class TestPipeManager(unittest.TestCase): def test_get_path(self): ''' Test that pipe manager gives proper path ''' SCREEN_HEIGHT = 400 BIRD_PATH = 0.10 # 10% of the screen ...
true
4043e8ffc72b0fd5725e31be1138a94d0823ccb5
ChangxingJiang/LeetCode
/0201-0300/0246/0246_Python_1.py
UTF-8
871
3.703125
4
[]
no_license
class Solution: def isStrobogrammatic(self, num: str) -> bool: # 翻转180度后的对应表 reverse_lst = { "0": "0", "1": "1", "6": "9", "8": "8", "9": "6" } left, right = 0, len(num) - 1 while left <= right: if num[l...
true
84f831b83c5d6726494311002a91ad256f42a5a4
SeoMinJong/gis_test_of_test
/decorators.py
UTF-8
252
3.328125
3
[]
no_license
def decorator(func): def decorated(input_text): print('func start!!!') func(input_text) print('func end...') return decorated @decorator def new_create(input_text): print(input_text) new_create('first create')
true
66d314796d1370e9b48d5f2590688bf677a48dbe
yuntai/BCAI_kaggle_CHAMPS
/models/model_M/modules/hierarchical_embedding.py
UTF-8
1,898
2.921875
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np __author__ = "shaojieb" class HierarchicalEmbedding(nn.Module): def __init__(self, n_hierarchy, n_tokens, d_embeds): super().__init__() self.n_hierarchy = n_hierarchy d_embeds = d_embeds if type(d_embed...
true
547e9993b987218a4385fa9f3650b7003649f525
AyushiSrivastava20/Python-Practice
/regex1.py
UTF-8
234
3.015625
3
[]
no_license
import re name = raw_input("Enter file:") if len(name) < 1: name = "regex_sum_42.txt" handle = open(name) sum=0 text = handle.read() lst = re.findall('[0-9]+',text) print lst for x in lst: val=int(x) sum=sum+val print sum
true
7a528c0979544ef6c616054d7f77c6fa77c432fa
luckyzachary/Algorithms
/Python3/Textbook/sort/out_sort/file_io.py
UTF-8
2,047
2.8125
3
[]
no_license
import os import numpy as np import csv import random def delete(): os.system("rm io_files/urandom.*") os.system("rm io_files/*.tmp") os.system("rm io_files/out.*") def create_input_csv(row, col): data = np.random.randint(-2 ** 32, 2 ** 32 - 1, size=(row, col)) file = open("io_files/urandom.csv"...
true
7a4f67cad33528822a1b8d9c27d0d930cc0e8493
muhdhisham/SCIENTIFIC-COMPUTING-LAB
/Lab-2/answers/vect_add-matrix.py
UTF-8
301
3.625
4
[]
no_license
import numpy as np x = np.array([ [0,1,2], #Initializing MATRIX-1 [3,4,5], [6,7,8]]) y = np.array([ [-4,-3,-2], #Initializing MATRIX-2 [ 0, 2, 1], [ 1, 4, 2]]) print("Sum of matrices:\n",np.add(x,y)) #Printing Result
true
9a3fdfe360dcdd7f439e65d4ca9381d868619556
thekevlau/roku
/quotes/andee_quotes.py
UTF-8
709
3.484375
3
[]
no_license
# Sandy's Personal Quotes # Personal Quotes are only sent to the specific individual andee_quotes = [ ("Whatever you exercise gets stronger. Build concentration, build the" " ability to resist distraction. It will eventually become easier."), "Never put off to tomorrow what you can do today.", ("Co...
true
91654127cd6685e7b13c937ce5c2d8a0e15dbcce
Poojaps99/python
/python/package/graphics/tdgraphics/cuboid.py
UTF-8
111
2.96875
3
[]
no_license
def area_cuboid(l,b,h): return 2*(l*h + b*h + l*b) def perimeter_cuboid(l,b,h): return 4*(l+b+h)
true
0bd82e26bbb83505dbe3dbb3f48a7751ed70630b
jacksonicson/twospot
/HelloWorldDjango/src/hellopython/test/test.py
UTF-8
281
2.640625
3
[]
no_license
''' Created on Nov 7, 2009 @author: Andreas Wolke ''' from django.http import HttpResponse def test(request): # print "Hello World Django" value = "" for i in range(0,100): value += "test \n" response = HttpResponse(value) return response
true
280f83019729e47f41006f2177e63b931bba6eea
ly2/codeBackup
/ForthPythonProject/basic.py
UTF-8
25,271
3.578125
4
[]
no_license
# COMP3620/6320 Artificial Intelligence # The Australian National University - 2014 # Nathan Robinson (nathan.m.robinson@gmail.com) """ Student Details Student Name: Sai Ma Student number: u5224340 Date: 09/05/2014 """ """ This file contains the methods you need to implement to create a basic (non-sp...
true
7a4f785e2733077aeceebf7a19ae653975f0a6a9
kgho/RainbowSeven_S
/server_assets/scripts/base/Room.py
UTF-8
15,565
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- import KBEngine from KBEDebug import * from PLAYER_INFO import TPlayerInfo, TPlayerList class Room(KBEngine.Space): """ Room的base部分 注意:它不是一个实体,并不是真正的space 真的的space存在于cellapp内存中 通过这个实体与之关联并操纵space """ def __init__(self): KBEngine.Space.__init__(self) ...
true
b7f0d8372613c906e53748803dcb71590c4c2ab5
xiaohaier66/python_practice1
/14.py
UTF-8
587
3.828125
4
[]
no_license
# 题目:判断101-200之间有/多少个素数,并输出所有素数。 primes = [3,5,7,11,13] #穷举开始无需计算 results = list() #结果集 i = 15 while(i<201): flag = True j = 0 for j in range(0,len(primes)): if(i % primes[j] == 0): #合数的因子中必然有素数 flag = False break if(flag == True): primes.append(i) if(i >...
true
4ca430cc71aaa9b8f579403463933020cc713470
libdwct/2019-KAKAO-BLIND-RECRUITMENT
/오픈채팅방(Open Chat room).py
UTF-8
993
3.25
3
[]
no_license
''' name : ByeongJun Ahn nation : KOREA contact : 010-2736-5474 or ahnbj0@naver.com source: 2020 KAKAO BLIND RECRUITMENT "오픈채팅방" ''' def solution(record): dic = {} for r in record: if r[0] == "E": lt = r.split(" ") dic[lt[1]] = lt[2] if r[0] == "C": ...
true
4fee1e4cc5201b67a9a707deb1431244c85d1bdf
Sauasmast/Webscrapper
/webscrapper/playgame.py
UTF-8
2,647
3.390625
3
[]
no_license
import scrape import random import data_deal as data from bs4 import BeautifulSoup class playgame(): def __init__(self, quotation_list): self.quotation_list = quotation_list self.random_created = [] self.score = 0 self.hint = 0 self.total_question = 0 self._selectra...
true
eb127c33e70f3bed9c64d07b00cd63531a53cea0
ssv273/work
/Recomendations/Recom_2.0/1_prepare_df.py
UTF-8
1,228
2.59375
3
[]
no_license
import pandas as pd import numpy as np from tqdm import tqdm # In[2]: df = pd.read_csv('recom.csv', sep=';', encoding='PT154') # In[3]: df['item_quantity'] = df['item_quantity'].replace( to_replace=r',', value='.', regex=True).astype('float32') # In[4]: del df['order_number'] del df['order_date'] del df...
true
b1769dcfa70cbe37b80cbd5425c9afc1a90c1d90
Mavrepis/DeepLearning_FoodSafety
/reinforcement_learning/rl_evaluation.py
UTF-8
2,481
2.578125
3
[ "MIT" ]
permissive
import os import re import numpy as np import pandas as pd import torch from utils import * from dqn_agent import Agent N_ACTIONS = 20 NUMBER_OF_TEST = 46 PREDICTION_LEN = 4 data = [] if __name__ == '__main__': args = parse_arguments() current_agent = Agent(state_size=10, action_size=N_ACTIONS, seed=0) ...
true
0802b78a5c8eb94d7e6ac2dc5cb8cbad30fbb8bd
BreezySYP/pyleetcode
/findMaxForm.py
UTF-8
190
2.609375
3
[]
no_license
#https://leetcode-cn.com/problems/ones-and-zeroes/ def findMaxForm(strs, m, n): if m == 0 and n == 0: return 0 dp = [[0 for _ in len(n + 1)] for _ in len(m + 1)]
true
efbc097703ad8f866b14a01350fd9e7154807aa0
paha/serfclient-py
/serfclient/connection.py
UTF-8
2,525
2.84375
3
[ "MIT" ]
permissive
import socket import sys import msgpack try: from serfclient.result import SerfResult except ImportError: from result import SerfResult class SerfConnectionError(Exception): pass class SerfConnection(object): """ Manages RPC communication to and from a Serf agent. """ def __init__(self...
true
2ba6832872c5d127639acaa26a6f14db1d7b0ccd
86xiang/python60
/27.py
UTF-8
1,788
2.875
3
[]
no_license
import wx import os import pygame import random import time import threading class wxGUI(wx.App): def OnInit(self): frame = wx.Frame(parent=None, title='MP3Player', size=(250, 150), pos=(350, 350)) panel = wx.Panel(frame, -1) self.buttonOK = wx.Button(panel, -1, 'Play', pos=(30, 60)) ...
true
7e96fa87cc885cf334d2d5119557baa09052e9b8
arjunmantri/pythonNgram
/ngram.py
UTF-8
2,441
3.6875
4
[]
no_license
#import collections import math, sys #TODO: probability in one function! def make_ngrams(plain_text, n): ngram_array = [] array_text = list(plain_text) for i in range(len(array_text) - n + 1): ngram = [] for j in range(i,i+n): ngram.append((array_text[j])) ngram_array.append(tuple(ngram)) return ngram_ar...
true
71ff99269d02b5a8b07c5552a35fa2c582596bc6
HzCeee/Algorithms
/LeetCode/DFS/617_MergeTwoBinaryTrees.py
UTF-8
812
3.59375
4
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def mergeTrees(self, t1, t2): """ :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode ...
true
a8589bbfd2d3f5462a73683e8d068be27b815933
andysitu/algo-problems
/problems_analysis/house_robber.py
UTF-8
1,291
3.84375
4
[]
no_license
""" Brute Force: Can use recursive function to calculate every single combination Due to the recursive nature where 1 function call will lead to 2 more, with n depth, the runtime I think would be 2^n """ """ DP In the brute force approach, many of the calculations are redundant and you can skip them saving the calcula...
true
72afccb97cf71a5d20a83a1f4862e04a05f1f77c
ChristopherBacon/Politweets
/twitter_handles_list.py
UTF-8
3,380
3.53125
4
[]
no_license
""" Politweets Python Project Using Twitter API to scrape tweets then sentiment analysis with Textblob, finally present using Streamlit This is the cleaning twitter handles and creating party column section """ import pandas as pd # The handles are all from the excellent website https://www.politics-social.com stumbl...
true
ca8710d24dd9d6e75b3c3e90d55483ceb9dcac01
acatthatlovedafish/FreeCodeCamp-Scientific_Computing_with_Python_exercises
/08-Files/02-read_file_and_find.py
UTF-8
871
4.03125
4
[]
no_license
# Exercise 2: Write a program to prompt for a file name, and then read through the file and look for lines of the form: # X-DSPAM-Confidence: 0.8475 # When you encounter a line that starts with “X-DSPAM-Confidence:” pull apart the line to extract the floating-point number on the line. # Count these lines and then comp...
true
bc1531b007f2e43d7e4845a25141a2ef685ab262
toshikish/atcoder
/abc/abc033_a.py
UTF-8
63
2.84375
3
[]
no_license
N = set(input()) print('SAME' if len(N) == 1 else 'DIFFERENT')
true
c466ffd8ea5a0399991552756bde86e830fc6542
AlexLinGit/SICP-and-Other-Code
/Python Crash Course Exercises/chapter 7 - while and input/counting.py
UTF-8
86
3.421875
3
[]
no_license
num = 0 while num < 10: num += 1 if num % 2 == 0: continue print(num)
true
c26829467e2df4deee61fb276b6a4960af200c84
scottdbrown/self-immunopeptidome_cancer
/makeContigsFromUniqueNmers.py
UTF-8
4,428
2.734375
3
[]
no_license
''' Make Contigs From Unique N-mers Join together all unique n-mers with n-1 overlaps. Increases protein length to be submitted to netMHCpan, decreasing compute time. Date: August 23, 2016 @author: sbrown ''' ## Import Libraries import sys import argparse DEBUG = False VERB = False ## For pseudocode, assuming 8m...
true
0e6a326e7eaf0985afd3fde34d142fecaa3e6ed4
black-star32/OSN
/OtherFeatures/test.py
UTF-8
1,735
2.796875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt x = np.arange(start=0,stop=2,step=0.4) _list1 = [0.873589164785553, 0.9221218961625283, 0.9247554552294959, 0.8784800601956358, 0.8747178329571106] _list2 = [0.8611738148984198, 0.9014296463506396, 0.9040632054176072, 0.8660647103085026, 0.8645598194130926] # DL =...
true
749904d460930594f36790f847ed3f915eef2f2e
gabriellaec/desoft-analise-exercicios
/backup/user_106/ch52_2020_07_24_04_09_49_731089.py
UTF-8
158
2.875
3
[]
no_license
def calcula_total_da_nota(precos, quantidades): valor = 0 for i in range(0, len(precos)): valor += precos[i] * quantidades[i] return valor
true
21c0976be840cfe09deb48354b93b7ec96cec80e
arvin1384/Arvin
/Arvin_2/list.py
UTF-8
220
3.5625
4
[]
no_license
a= ["Arvin","Kourosh","Arvand","Darya","Romina"] print(a[4]) b = ["Red",42,True,3.14,0] print(type(b)) c = ["Kiwi","Apple"] c.append("Watermelon") print(c) p = ["A","B","C","D"["1","2"]] print(p[5])
true
86e4ce6029d0e22989cae54efd92bc70469a5be4
kseniajasko/Python_study_beetroot
/hw15/hw15_task3.py
UTF-8
1,303
4.1875
4
[]
no_license
# Write a decorator `arg_rules` that validates arguments passed to the function. # A decorator should take 3 arguments: # max_length: 15 # type_: str # contains: [] - list # of symbols that an argument should contain If some of the rules' checks returns ' # False, the function should return False and print the reason i...
true
e907f5c92c78602fca2f8699baf0f4c6b8e71401
GinnyCosine/web_work_study
/SanQienSui/js/headwears/generateJSON.py
UTF-8
493
2.65625
3
[]
no_license
import json import csv items_list = [] with open('headwears.csv', newline='') as csvfile: content = csv.reader(csvfile, delimiter=',') for row in content: items_list.append({ 'name': row[0].strip(), 'intro': '', 'id': row[1].strip(), 'image': 8 })...
true
ce0177eaeb1143156dd348a1d3e91ea4ec29c466
MAyeshaSiddiqa/West_Experiment
/convert_matrix.py
UTF-8
2,810
2.59375
3
[]
no_license
import itertools import numpy as np from numpy import linalg as LA from nltk import ngrams import urllib2 import urllib from bs4 import BeautifulSoup import re import requests import justext import unicodedata inp = open('oldpage_ml.txt').readlines() dict_cols = {} dict_rows = {} global_2d = [] #global_2d.append([]) ...
true
4dd23df998d613d402bef3ffecbfa773013e6dc6
ThomasHJorgensen/Sensitivity
/GP2002/tools/linear_interp.py
UTF-8
10,431
2.875
3
[]
no_license
""" Class and functions for multi-linear interpolation """ import numpy as np from numba import njit,prange, boolean, int64, double, void from numba.experimental import jitclass info = [ ('dimx',int64), ('x',double[:]), ('dimy',int64), ('y',double[:]), ('Nx',int64[:]), ('facs',int64[:]), ...
true
6b7fc89f081e57477d6ab33a1ebae42c9cbf23b8
nelsondressler/testegitvscode
/Geral/Exemplos/Exemplos_Python/idade.py
UTF-8
356
2.9375
3
[]
no_license
nome = 'Nelson' sobrenome = 'Dressler' anoNascimento = 1990 anoAtual = 2019 aniversarioAnoAtual = True idade = anoAtual - anoNascimento if aniversarioAnoAtual else (anoAtual - 1 - anoNascimento) lista = [['Pro', 'fes', 'sor'], 'da', 'ByLearn', ':)'] if idade >= 18: dirigir = True else: dirigir = False pri...
true
31137bcbde387b1a8e64790f73144e075661d1de
tanatyu12/AtCoder
/abc162/a.py
UTF-8
227
2.984375
3
[]
no_license
import sys input = sys.stdin.readline def main(): N = input().rstrip("\r\n") ans = "No" for s in N: if s == "7": ans = "Yes" break print(ans) if __name__ == "__main__": main()
true
5ba3d01e310feb8ef9ac6a98bab8aa012ad9e5e4
EwaGrela/decorators
/logg.py
UTF-8
676
3.171875
3
[]
no_license
import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) #decorator: def log_this(logger, **kwargs): def inner(func): def functor(*args, **kwargs2): all_arg = tuple([str(x) for x in args] + [str(x)+"="+str(y) for (x,y) in kwargs2.items()]) res = func(*args, **kwargs2) l...
true
ed368ada6d6c1aeed31cbaa8e47e17009eacd057
Aasthaengg/IBMdataset
/Python_codes/p03000/s542647842.py
UTF-8
167
2.5625
3
[]
no_license
n,x=map(int,input().split()) Y = list(map(int,input().split())) Z = [0]*n a = 0 for i in range(n): a +=Y[i] Z[i]=a import bisect print(1+bisect.bisect_left(Z,x+1))
true
f02dd6c2eba2cea710e52992d5f80e766db5431c
pablodarius/mod02_pyhton_course
/Python Exercises/4_question4.py
UTF-8
732
4.09375
4
[]
no_license
import unittest # Concatenate two lists in the following order def mixed_words_list(l1, l2): result = [x + y for x in l1 for y in l2] return result class testing(unittest.TestCase): def setUp(self): print("Preparing context...") self.input_list1 = ["Hello ", "take "] self.input_li...
true
d2e38bf5cea0197b62b7d37fb43dbc72603a4df7
wojgrochola/Lab_2
/tic_tac_client.py
UTF-8
2,059
3.1875
3
[]
no_license
# telnet program example import socket, select, string, sys class Client: def __init__(self): self.PORT = 5000 self.HOST = 'localhost' self.RECV_BUFFER = 4096 self.createTcpIpSocket() self.connect() def createTcpIpSocket(self): self.client_socket = socket.sock...
true
616215bbf11123a0d14885a039ad9a7b2962f600
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_75/565.py
UTF-8
3,292
2.84375
3
[]
no_license
''' @author: Shawn McClelland ''' ### Enter filename for input and output filename = 'B-test' filename = 'B-small-attempt0' filename = 'B-large' file_in = open('%s.in' % filename) #### Get first line of file as number of cases number_cases = int(file_in.readline()) #### Get lists of data for each C...
true
4e3a990faa55c99903cd821cf9ab59097d12f9b3
vijaychirag/EcommerceWebsite_V001
/pythonBasics/classandobjects.py
UTF-8
1,942
4.3125
4
[]
no_license
# Create Object class MyClass: x = 5 p1 = MyClass() print(p1.x) # The __init__() Function: Constuctor # Note: The __init__() function is called automatically every time the class is being used to create a new object. # Note: The self parameter is a reference to the current instance of the class, # and is us...
true
9f12b436c7f96c4acf488cc52f27d22989ad680b
Aceinna/python-openimu
/src/aceinna/devices/dmu/eeprom_field.py
UTF-8
2,272
2.9375
3
[ "Apache-2.0" ]
permissive
import struct from abc import ABCMeta, abstractmethod def bytes2binstr(b, n=None): s = ''.join(f'{x:08b}' for x in b) return s if n is None else s[:n + n // 8 + (0 if n % 8 else -1)] def getbytes(bits): done = False while not done: byte = 0 for _ in range(0, 8): try: ...
true
eb99245068ab8bf319a2218a31714e5ff841ed78
MrGloriousFast/dasRepo
/movement.py
UTF-8
3,832
2.828125
3
[]
no_license
import pygame,math, numpy, random, time from pygame.locals import * from OpenGL.GL import * from OpenGL.GL.shaders import * from OpenGL.GLU import * import obj, shader, movement from display import * import pyrr class WorldModel(): def __init__(self, pos= [0,0,0], rot= [0,0,0], scale = [1.0,1.0,1.0]): ...
true
bc4e08a1d18731cf082d950fb4629607e0b9618b
nathanwilk7/mls
/ryan/naive_bayes.py
UTF-8
13,258
2.953125
3
[]
no_license
import itertools import numpy as np import numpy.matlib import numpy.linalg import math import random import statistics import matplotlib.pyplot as plt from scipy.sparse import csr_matrix import sys # Set the number of features available numFeatures = 0 # Set the data set directory path dataSetPath = '.' trainSetName...
true
a71f6446c0f1afeb374ecb6d70e50865c99aaa53
leeenglestone/CodeSnippets
/Python/tuple.py
UTF-8
80
3.4375
3
[]
no_license
def quadcube (x): return x**2, x**3 a, b = quadcube(3) print(a) print (b)
true
d0994ecd1102696b211381e5ff298f6e0f7deb15
adamhaney/retickrtools
/retickrtools/distance_functions.py
UTF-8
3,585
3.8125
4
[]
no_license
""" Often times in life, and data mining, you would like to know the distance between two points. There are many many different functions that will provide this information for us. This module aims to include them so that when you're writing code you don't have to implement these distance functions yourself """ import...
true
c4a62e10245ddd037efa48dc1b459a516668c6ec
spider-tronix/portable-braille
/Code/Old Codes/test_tesseract.py
UTF-8
1,443
3.296875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ ************************************************************************************** * Simple OCR * =============== * This program is intended to perform simple OCR in a given image/ * MODULE: test_tesseract * Filename: test_tessera...
true
a9bb6f2103c9a814fc5544796f5cb09e19b9570d
BigBricks/PythonChallenges
/Divisors.py
UTF-8
156
3.578125
4
[]
no_license
def divisors(integer): j = [x for x in range(2, integer) if integer % x == 0] if j == []: return "{0} is prime".format(integer) return j
true
062dd2f4e39f2717373640faa8b3533d619e7965
Halatnaby/WISB256
/Opdracht1/ManyGreetings.py
UTF-8
117
3.65625
4
[]
no_license
Name=input("What is your name?") Greetings =input("How many greetings?") print (Greetings + " x Hello," + Name +"!")
true
e0ec4cee4d226a9db119223954b7ee5a98f33971
mobeets/FOMOBot
/bin/instagram_likes.py
UTF-8
518
2.625
3
[]
no_license
from instagram_start import handle h = handle() def user_max_likes(username): user_id = h.user_search(username)[0].id recent_media, next = h.user_recent_media(user_id=user_id) max_lc = 0 max_url = None for media in recent_media: lc = media.like_count if lc > max_lc: ma...
true
2c2466e4a52253865ab177791d2491dda83a3cf7
kaleidoescape/prepare_mt_data
/extractors.py
UTF-8
10,799
3.0625
3
[]
no_license
""" Extract parallel source/target language files for machine translation from other common parallel formats. """ import argparse import os import re from typing import * import xml.etree.ElementTree as ET class ExtractorError(BaseException): """Raise for errors extracting parallel data from files.""" def fix_br...
true
eed2137d4573ce7e3fc333d366948c027dd2a45a
QauAli/ImageServer
/applicant.py
UTF-8
1,288
2.515625
3
[]
no_license
from flask_restful import Resource, reqparse import werkzeug from PIL import Image from flask import send_file import uuid class Applicant(Resource): parser = reqparse.RequestParser() parser.add_argument('image', type=werkzeug.datastructures.FileStorage, ...
true
097af83639428afe5ed012e242b40f665634b202
yenru0/CodeObjecct
/zeta_python/completed/2981.py
UTF-8
678
3.125
3
[]
no_license
def divisor(x): divs = [] for i in range(1, int(x ** (1 / 2)) + 1): if x % i == 0: divs.append(i) for d in divs[::-1]: t = x // d if d == t: continue divs.append(x // d) return divs def gcd(x1, x2): while x2 != 0: temp = x1 % x2 ...
true
265e29fb02170f46c7555fe9f8959e6caf5da558
Membrizard/PyVaporation
/pyvaporation/optimizer/optimizer.py
UTF-8
12,340
2.953125
3
[ "Apache-2.0" ]
permissive
import typing from copy import copy from pathlib import Path import attr import joblib import json import numpy from scipy import optimize from ..diffusion_curve import DiffusionCurve, DiffusionCurveSet from ..plotting import plot_graph, plot_surface @attr.s(auto_attribs=True) class Measurement: """ Paramet...
true
70b5ccfe7de4054e2087e370ae8e3e50404cfd8d
s-garg0001/acadview-python
/assignment 3.py
UTF-8
1,314
4.28125
4
[]
no_license
#1. Create a list with user defined inputs. a=input("enter integer value") b=input("enter float value") c=input("enter complex value") l=[] l.append(a) l.append(b) l.append(c) print(l) #end #2. Add the following list to above created list: i=["google","apple","facebook","microsoft","tesla"] l.append...
true
1891c732a4956ae219194b2c176569e24f756dcc
zhaozhaoqueue/ds504-project1
/sampling_app.py
UTF-8
1,294
2.703125
3
[]
no_license
import time import json import crawler as cl from genupc import upc_sampling # Add your API Key here API_KEY1 = "" API_KEY2 = "" API_KEY3 = "" COMPANY_UPC = "885306" # create a instance of crawler using apikey wal1 = cl.Walcrawl(API_KEY1) wal2 = cl.Walcrawl(API_KEY2) wal3 = cl.Walcrawl(API_KEY3) results =...
true
9176dc354cd912e7442bf46ad29e8fde14dd659d
tuvokki/data-api
/modules/quotes.py
UTF-8
1,232
2.859375
3
[]
no_license
from modules import * import os from random import choice from pymongo import MongoClient from bson.json_util import dumps class QuotesView(FlaskView): # Get a reference to the MongoDB connect_string = 'mongodb://%s:%s/' % (os.getenv('MONGO_HOST', 'localhost'), os.getenv('MONGO_PORT', '27017')) client = M...
true
12af0e8947367f51e0682eecacaa630305e48557
dosherow/Spotify-Ladder
/spotapi.py
UTF-8
5,331
2.671875
3
[]
no_license
from datetime import datetime, date import pandas as pd import spotipy from spotipy.oauth2 import SpotifyClientCredentials import pandas_gbq from playlists import country_Ids, electronic_Ids, indie_Ids, pop_Ids, rap_Ids, rnb_Ids def daily_pull(): # defining scopes and auth token and spotipy object variable to ...
true
8e273838a2a80698eb5757e3ef5b51f34c157cd4
mbrad26/DL_Text_Sequences
/rnn_LSTM_imdb.py
UTF-8
1,211
2.765625
3
[]
no_license
import matplotlib.pyplot as plt from keras.datasets import imdb from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.layers import Embedding, LSTM, Dense (x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=10000) train = pad_sequences(x_train, maxlen=500) ...
true
bbb2ad5b7b8794697697fbbb16c635fcce88ad5a
najeex/Competitive-Programming
/01. STL Challenges/bubble_sort.py
UTF-8
255
3.546875
4
[]
no_license
def bubble_sort(arr): for i in range(len(arr)-1): for j in range(0,len(arr)-i-1): if arr[j] > arr[j+1]: arr[j+1],arr[j] = arr[j], arr[j+1] return arr arr = [5,4,3,2,1,-4,-10] arr = bubble_sort(arr) print(arr)
true
ecdfd20be98b0e534b855a3a101dac9fc1e3a968
tfchan-rob/Code-War
/Descending Order.py
UTF-8
694
3.828125
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Descending Order # Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number. # example: # # Input: 42145 Output: 54421 # ...
true
b6269f52fc72dd613f6550bc2ec44feacda2385b
19minnicka/osdev
/OSD.py
UTF-8
6,352
2.671875
3
[]
no_license
import sys try: f=open(sys.argv[1]+".osd",'r') except: f=open(input("file name>")+".osd",'r') prog=f.read() f.close() tmp="" tokens=[] prg=True for i in prog: if(i=='\n' or i==' ')and prg: tokens.append(tmp) tmp="" elif i=='"': prg=not prg elif (i=='='or i=='/' or i=='*' or i...
true
0a909e37b7a64fbea9b8008d1285e6b0a2eca66e
OpM3TA/WED-Framework
/framework.py
UTF-8
6,667
2.734375
3
[]
no_license
# Imports from config import * seta="ABCDEFGHIJKLMNOPQRSTUVWXYZ" setb="abcdefghijklmnopqrstuvwxyz" setc="0123456789" # It looks pretty on paper :p def Nop(i): return "\x90"*i # Uses ndisasm def Disasm(sc, mode, bFile=False): ret = "" if bFile ==True: ret = execute("%s -b %d %s"%(NDISASM, mode, ...
true
f72ecb1e8812a88ac41f3eebb5357718418c88c4
Fransueudes/Funcoes_Python
/asdasd.py
UTF-8
128
3.078125
3
[]
no_license
lista=['A','B','C'] juncao = ' depois de ' novaString = juncao.join(lista) print("Lista =", lista) print("Texto =", novaString)
true
f90a772cae4fb6d623fe09c9fde69e67a76bf355
shivamsangal1/crypto-simulation
/test.py
UTF-8
742
2.859375
3
[]
no_license
""" Used for debugging graph dumping and pruning of blockchains. """ from node import Node from block import Block from simulation import Simulator if __name__ == '__main__': # Dummy node n = Node(1, 1, True) # Create a dummy simulator s = Simulator(0, 0, 0, 0) s.nodes = [n] # Manually crea...
true
9f437c99b4ec535365dc3aa07bf38adc6e373915
jawzal19-meet/YL1-201718
/lab5/lab5.py
UTF-8
638
3.359375
3
[]
no_license
from turtle import Turtle import random # def__init__(self,size) # Turtle.__init__(slef) # self.shapesize(size) # self.shape("square") # def random_color(): # r = random.randint(0, 256) # g = random.randint(0, 256) # b = random.randint(0, 256) # self.color(r, g, b) #EXTRAAAAAAA #############################...
true
0be301b075045b521e4a83b2874eb7ee7c77b61f
angieshadder/electoralcollege
/electoralcollege.py
UTF-8
621
3.40625
3
[]
no_license
import pandas as pd from random import choice as ch import matplotlib.pyplot as plt state_data = pd.read_csv("electoral_data.csv") choice_list = ["R", "B"] new_col = [] for row, value in enumerate(state_data.values): if value[2] == "P": new_col.append(ch(choice_list)) else: new_c...
true
90b8a4042771a5d0601ba03ad7fcb3a5396f3ce5
ljiatu/cs231n
/utils/age_detection_utils.py
UTF-8
926
3.25
3
[]
no_license
import torch from torch.nn import functional as F def check_result(scores, y) -> (int, int): num_classes = scores.size(1) expected_classes = ( (F.softmax(scores, dim=1) * torch.arange(end=num_classes).cuda()).sum(dim=1).round().type(torch.cuda.LongTensor) ) num_correct = (expected_classes == y...
true
6581989629e5e9716e000b0308fb031b53be66db
ggorlen/euler
/p027.py
UTF-8
957
3.578125
4
[]
no_license
""" https://projecteuler.net/problem=27 """ # http://stackoverflow.com/questions/15285534/isprime-function-for-python-language def is_prime(n): if n == 2 or n ==3: return True if n < 2 or n % 2 == 0: return False if n < 9: return True if n % 3 == 0: return...
true