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
3df8aac3052a34299344879f9d59becf235a3bb1
medical-images-process/EECS598-Deep-Learning
/RNN&LSTM/image_captioning.py
UTF-8
3,660
2.828125
3
[ "MIT" ]
permissive
import time, os, json import numpy as np import matplotlib.pyplot as plt from coco_utils import load_coco_data, sample_coco_minibatch, decode_captions from rnn_layers import * from captioning_solver import CaptioningSolver from image_utils import image_from_url from rnn import CaptioningRNN def main(): # The data...
true
37d005a0bb5f1f30436ca9171fb2de82435c047e
tkhyn/djangorecipebook
/djangorecipebook/recipes/create.py
UTF-8
5,480
2.625
3
[ "MIT" ]
permissive
""" Django project initialization recipe """ import os import sys import shutil import logging import tempfile from random import choice from datetime import date from .base import BaseRecipe from djangorecipebook import templating class Recipe(BaseRecipe): def __init__(self, buildout, name...
true
15157d488f2a2067b7fcd41c71a6bc2416de965c
mewlove/python_projects
/Udemy/CompletePythonBootcampFromZeroToHero/intermediate/milestone_project_2/blackjack.py
UTF-8
6,732
3.671875
4
[]
no_license
import random #from typing import Union suits = ['HEARTS','DIAMONDS','SPADES','CLUBS'] ranks = ['TWO','THREE','FOUR','FIVE','SIX','SEVEN','EIGHT','NINE','TEN','JACK','QUEEN','KING','ACE'] values:dict[str,int] = {'TWO':2,'THREE':3,'FOUR':4,'FIVE':5,'SIX':6,'SEVEN':7,'EIGHT':8,'NINE':9, 'TEN':10,'JACK':10,'QUEEN':10,'KI...
true
4705e192441649d6e9e6ef05bfc5b46334567299
AishwaryaVelumani/Pix2code-Screenshot-to-code-dataset-builder
/training/weights/eval/API/Flask/app/utils/crop_image.py
UTF-8
576
2.515625
3
[]
no_license
#!/usr/bin/python3 # 2018.01.20 15:18:36 CST #!/usr/bin/python3 # 2018.01.20 15:18:36 CST import cv2 import numpy as np #img = cv2.imread("test.png") img = cv2.imread("mana.jpg") # blurred = cv2.blur(img, (3,3)) canny = cv2.Canny(img, 50, 200) ## find the non-zero min-max coords of canny pts = np.argwhere(canny>0) y...
true
9684c7ede7bcbf181e835bf073df211213a09d17
skgande/python
/pythoncoding/com/sunil/basics/search_in_list.py
UTF-8
435
4.15625
4
[]
no_license
class SearchInList: def __init__(self): return if __name__ == '__main__': given_list = [1, 2, 3, 4, 5] element = 3 is_found = False for i in range(len(given_list)): if given_list[i] == element: is_found = True break if is_found: print(f'Element...
true
f005c05454e489a866d9814dce53f3561b3993a8
GuilhermeBMaciel/Carona-Ifes
/insertion/gera.py
UTF-8
7,477
2.828125
3
[]
no_license
#Gera fake usuario. import string import random from faker import Factory import names fake = Factory.create('pt_BR') #### Funções para geração de dados. #Codigo utilizado para gerar os passwords. Não sou o autor. def password_generator(size=8, chars=string.ascii_letters + string.digits): """ Return...
true
edb222d380c7fb08a80b8fb4a6643607641edb3f
ssj018/homelab
/Data_structure_algorithm/queue_project/sim_printer.py
UTF-8
2,094
3.3125
3
[]
no_license
import myqueue import random class Tasks: def __init__(self, time): self.timeStamp = time self.pages = random.randrange(1, 21) def getPages(self): return self.pages def getStamp(self): return self.timeStamp def getwaitTime(self, currentTime): return cu...
true
e453e923f399dd3455a08c07b38108ab800fd4a0
Jwoo5/ai612-ml4h
/project2/preprocess/prepare_labels.py
UTF-8
3,016
2.546875
3
[]
no_license
import pickle import pandas as pd from sklearn.preprocessing import MultiLabelBinarizer from tqdm import tqdm import warnings warnings.filterwarnings('ignore') print("[Ready] prepare data files") with open('train_tokenized_soft.pkl', 'rb') as f: train_notes = pickle.load(f) with open('test_tokenized_soft.pkl', ...
true
891c3dc882cfe1665b9c479cf73d8f8f16ac2dfe
Thina007/Python_Project
/Guessing Number.py
UTF-8
3,497
3.75
4
[]
no_license
import numpy as np from numpy import random while(1): a=random.randint(10) b=random.randint(10) c=random.randint(10) d=random.randint(10) e=random.randint(10) f=random.randint(10) g=random.randint(10) while(1): print("________________________________________________________________...
true
a40099f520c0c0785b3fe07427f292ff33f4562d
HoLyVieR/xcat
/xcat/lib/oob/http.py
UTF-8
5,064
2.5625
3
[ "MIT" ]
permissive
import asyncio import random import email from urllib import parse from aiohttp import server import aiohttp class OOBHttpRequestHandler(server.ServerHttpProtocol): TEST_RESPONSE = random.randint(1, 150) def handle_request(self, message, payload): headers = email.message.Message() for hdr, v...
true
b7a21d688717c0deebb0116a520bbda14329037e
kevindoubleu/wfhsucks
/wsprinter.py
UTF-8
3,179
3.234375
3
[]
no_license
class Table(object): """ headers: list content: 2d list e.g. content[col][row] note: all elements must be str type alignments: str or list items: list of objects note: forums, vidvonfs, to be referenced """ def __init__(self, headers, content, alignments, items=None)...
true
8d4be955c2140db77ed8a1cb14f3a1fbcefddf67
aimhigh53/AlgoWing
/JoonMo/2주차/5201_컨테이너_운반/solution.py
UTF-8
636
2.828125
3
[]
no_license
import os import sys curr_dir = os.path.dirname(__file__) sys.stdin = open(curr_dir + '\input.txt', 'r') T = int(input()) for test_case in range(1, T + 1): N, M = map(int, input().split()) container = list(map(int, input().split())) truck = list(map(int, input().split())) truck.sort(reverse=True) ...
true
f71a6d55f9c705bfd5282caf67a237afac2f8b09
nreitman/landlab
/landlab/components/normal_fault/normal_fault.py
UTF-8
15,545
3.171875
3
[ "MIT" ]
permissive
#!/usr/bin/env python """Rock uplift along a normal fault. Landlab component that implements rock uplift by a normal fault. Note that this component does not make any attempt to advect topography laterally. """ import numpy as np from landlab import Component, FieldError TWO_PI = 2.0*np.pi class No...
true
4c31d8b471d7617a3b85e470df9c0f21fe5ab356
astojmir/qmbpmn-tools
/common/commandtool/__init__.py
UTF-8
25,596
2.734375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-ncbi" ]
permissive
"""\ Tools to write command line interfaces with sub-commands """ import datetime import getopt import inspect import logging import os import posixpath import types import sys from xml.dom.minidom import parseString # # Logging # log = logging.getLogger(__name__) # # AttributeDict # class AttributeDict(dict): ...
true
1a847f613c32e18b81bff6ce4649a82c025bc388
arundavid57/Covid-20
/Traffic/parsetraffic.py
UTF-8
1,250
2.65625
3
[ "MIT" ]
permissive
from PIL import Image import numpy as np from os.path import join from os import listdir tdir='.' # Google maps traffic levels whitecol = 0xffffff greencol = 0x63d668 orangecol = 0xff974d redcol = 0xf23c32 darkredcol = 0x811f1f levels={} cachefn=join(tdir,'trafficlevels') try: with open(cachefn,'r') as fp...
true
b8f0de7ed6938245781a6f7fa5aab6eff72d7cfb
tw9ntyseven/Programming
/Practice/14/Python/my.py
UTF-8
189
3.390625
3
[]
no_license
num = int(input()) def Elevate(a:int): if a == 0: return 0 var = 2 count = 1 while var < a: var *= 2 count += 1 return count print(Elevate(num))
true
3d4bc5095ae4e2a0e68036dd8e19c3d9903e27d0
Tamii-h/test-tamii
/ejerciciosBasico.py
UTF-8
2,544
4.21875
4
[]
no_license
nombre = input("Ingrese su nombre: ") apellido = input("Ingrese su apellido: ") edad = input("Introduzca su edad: ") telefono = input("Ingrese su numero de telefono: ") email = input("Introduzca su direccion de email: ") print("***********************************************************") print("Su nombre es", nombre +...
true
c53a6219c32479ec3d109047df27d08544e7c096
Cardiel91/Algorithm_JavaScript
/practice1.py
UTF-8
1,278
3.5
4
[]
no_license
# for num in range(1, 256, 1): # print(num) # for num in range(5, 1000, 5): # print(num) # for num in range(1, 100): # if (num % 5 == 0): # print('Coding') # elif (num % 10 == 0): # print('Coding Dojo') # for num in range(0, 1000): # if (num % 2 == 1): # prin...
true
9cd69014bdbfa7a9a847dd988dd2c572bc406860
Prashant-Mohania/PracticePython
/before/lc_ex1.py
UTF-8
327
4.15625
4
[]
no_license
# by List comprehension def reverse_func(l): return [name[::-1] for name in l] print(reverse_func(['abc', 'pqr', 'xyz'])) # by normal method def reverse(n): for name in n: new_list = [] for name in n: new_list.append(name[::-1]) return new_list print(reverse(['abc', 'pqr', 'x...
true
e5d3462e1f795fd7ddd5d260a1420aa712695228
sabinzero/various-py
/from 1 to N/main.py
UTF-8
79
3.625
4
[]
no_license
n=input("the value of n is : ") for i in range(1,n+1): print "%d" % (i)
true
26b53535ea66baf627a5d15ddc9e7ef109f69629
bartekpacia/python-training
/python_language/defaultdict.py
UTF-8
487
3.96875
4
[ "MIT" ]
permissive
# defaultdict is like a normal dictionary. The only difference is when # you try to access a key that doesn't exist - defaultdict will create # that key for you, instead of raising an error import collections nums = [1, 2, 3] names = ["one", "two", "three"] normal_dict = dict() default_dict = collections.defaultdic...
true
43e262d29e2bc03612ba0e8fb677bbcc0080cc3b
koudai-tanabe/deep_sample
/network.py
UTF-8
5,887
2.625
3
[]
no_license
import numpy as np import sys sys.path.append('Users/tanabekoudai/deep_sample') import affine import ReLu import softmax_with_loss from collections import OrderedDict class Affine: def __init__(self, W, b): self.W = W self.b = b self.x = None self.dW = None self.db = None ...
true
35b38581abe71bab169b707bd38542250ad61c16
shaoshengsong/DeepSORT_Features
/FunctionsTest.py
UTF-8
1,641
2.90625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 31 14:50:00 2019 @author: santiago """ import torch import torch.nn as nn import torch.nn.functional as F import torch import torch.tensor as tensor a = torch.ones((2,3)) #建立tensor #tensor([[1., 1., 1.], # [1., 1., 1.]]) a1 = (a.norm(...
true
fb19a300a35e90e36d770bce79ca637d8f3d2d71
djmhunt/TTpy
/runScripts/runScript_sim.py
UTF-8
2,703
2.671875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ :Author: Dominic Hunt Notes ----- This is a script with all the components for running an investigation. I would recommend making a copy of this for each successful investigation and storing it with the data. """ #%% Import useful functions import numpy as np import collection...
true
27a4b3f0a9027561ac953c71f96e1e63faa9cf6a
jb31890/100daysofcode
/day_15/main.py
UTF-8
3,261
3.53125
4
[]
no_license
# day 15 coffee machine # 3 types of coffee import sys from copy import deepcopy MENU = { "espresso": { "ingredients": { "water": 50, "coffee": 18, }, "cost": 1.5, }, "latte": { "ingredients": { "water": 200, "milk": 150, ...
true
18e310fccce5920461f07119e9f7151856fe9352
fdiazsmith/h2h
/polarH7/polarH7.py
UTF-8
4,529
2.515625
3
[]
no_license
#https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.heart_rate_measurement.xml import gatt from datetime import datetime import argparse #import mac from UUIDmappings import ser_to_name, char_to_name manager = gatt.DeviceManager(adapter_name='hci0') from pythonosc impor...
true
36a69c9548775abbbb271b8d32618fd3a267c426
tianruichen/SudokuSolver
/sudokuSolver.py
UTF-8
4,217
3.375
3
[]
no_license
class SudokuSolver: def __init__(self, grid): self.grid = grid self.newGrid = grid[:] self.savedStates = [] self.remaining = 0 self.initializeConstraints() self.solveSudoku() self.valid = True def initializeConstraints(self): possibleValues = {} ...
true
112aed644cc5e96667e37d17b96d1b04a4f03514
testlnord/CodeSurf
/src/log_parser.py
UTF-8
2,046
2.640625
3
[]
no_license
__author__ = 'arkady' # coding : utf-8 import re line_code = re.compile(r'^(\d+)\t\s*(.+)$') function = re.compile(r'^#\d*\s*(\w*)\s*\(([\w=,\s]*)\)\s*at\s*[\w\.]*:(\d*)$') var = re.compile(r'^(\w*)\s*=\s*(\w*)$') class Step: def __init__(self, f, l, text): self.fun = f self.line = l self...
true
eec9cc6910eaa2a235f136e0df7c2a4020d9b5e0
itsdeepakverma/anu_repo
/anuja_sharma_09.py
UTF-8
302
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 23 16:16:22 2018 @author: sharm """ str1= input("enter values") #for x in str1[1:-1] list1=list(str1.split(',')) print(list1) new_list= list1[1:-1] print(new_list) sum=0 count=0 for x in new_list: sum= sum+int(x) count=count+1 print(sum/count)
true
f96606b156549f9f3856e37c1aa0f236e6089854
SKhan97/Data-Analysis-Task
/log to csv.py
UTF-8
1,031
3.203125
3
[ "MIT" ]
permissive
import re #Using RegEx to filter through .log file, give each company id an array representing number of logins and write to .csv pattern = re.compile(r'(\d{6}) logged in (\d) times on day (\d)\n') login_data = {} try: with open('engagement_report.log', 'r') as f: contents = f.read() matc...
true
89cddff050286503daea297ec388aebff4edee41
cutyapple/Programming
/알고리즘/프로그래머스/코딩테스트 연습 - Level 1/2016년.py
UTF-8
428
3.65625
4
[]
no_license
def solution(a, b): day_list = ["THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED", ] month_day = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] day = 0 for i in range(a-1): day += month_day[i] print(day) answer = day_list[(day + b) % 7] return answer a = 5 b = 24 print(solut...
true
2583ce87b6f44b783e8157a047a70fd40c267265
ditesh/project-euler
/node.py
UTF-8
891
3.6875
4
[]
no_license
import random class Node: value = None name = None parent = None children = None def __init__(self, value, name=int(random.random()*1000)): self.value = value self.name = name self.children = [] def setParent(self, parent): self.parent = parent # print "My name is " + self.name + " (" + self.val() +...
true
d0a2d095fa29ed40b021a37d2fb679c01532b825
xiebohust/python_study
/learn/飞机大战/wk_06_update方法.py
UTF-8
465
3.359375
3
[]
no_license
import pygame pygame.init() # 创建游戏的窗口 screen = pygame.display.set_mode((480, 700)) # 绘制背景图像 bg = pygame.image.load("./images/background.png") screen.blit(bg, (0, 0)) # 绘制英雄的飞机 hero = pygame.image.load("./images/me1.png") screen.blit(hero, (200, 500)) # 可以在所有绘制工作完成之后, 统一调用 update 方法 pygame.display.u...
true
15f901520b1b473c97ecf9fbbde591c8ecb91e4c
carlosevmoura/courses-notes
/programming/python-curso_em_video/exercises/ex098.py
UTF-8
639
3.921875
4
[ "MIT" ]
permissive
from time import sleep def contador(_inicio, _fim, _passo): for numero in range(_inicio, _fim + _passo, _passo): print('{}'.format(numero), end=' ', flush=True) sleep(1) print('FIM!') print('=' * 40) print('{:^40}'.format('Contando de 1 até 10!')) contador(1, 10, 1) print('=' * 40) print('{:^...
true
cad276717c66552532ae638f42de231ac22fd8e9
sumitshyamsukha/nets213-final-project
/src/final_analysis/separate_ratings.py
UTF-8
737
2.90625
3
[ "MIT" ]
permissive
penn = {} cf = {} with open('penn_ratings.txt') as f: while True: line = f.readline().split(' ') if len(line) < 2: break penn[line[0]] = line[1].strip() with open('cfratings.txt') as f: while True: line = f.readline().split(' ') if len(line) < 2: break cf[line[0]] = line[1].strip() import matplot...
true
bcd176393911926ba7d44e5599106dd33ec89d59
Leeyuxun/PyFortuna
/accumulator.py
UTF-8
1,342
2.84375
3
[]
no_license
# -*- coding: utf-8 -* from generator import Generator from Crypto.Hash import SHA256 import time class Accumulator: pool_number = 32 min_pool_size = 64 # 池的最小长度 reseed_interval = 0.1 P = [] def __init__(self): self.P = [b''] * self.pool_number self.ReseedCnt = 0 # 重新产生种子的...
true
04893ad4bbc6e3db10877c9e227f8c5d78b2c480
gsy/leetcode
/tests/test_balance_binary_tree.py
UTF-8
1,109
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- from balanced_binary_tree2 import Solution from balanced_binary_tree2 import TreeNode if __name__ == '__main__': s = Solution() result = s.bfs(None) assert result == 0 tree = TreeNode(3) tree.left = TreeNode(3) tree.right = TreeNode(20) tree.right.left = TreeNode(...
true
0eb1c4b49ac9c923d27a7c8ebba78b54580bc2e5
kant1724/skip-thoughts
/skip_thoughts.py
UTF-8
9,364
2.65625
3
[ "WTFPL" ]
permissive
"""Module defining the skip-thoughts model.""" import re import time import numpy as np import tensorflow as tf from tensorflow.contrib import seq2seq class SkipThoughts: """Skip-thoughts model. Instantiating this class builds the computational graph Note that this model expects input sequences with the fo...
true
1f107ec4cd5e0d0230a3a99678e62dec7d79014a
sednabcn/Python-Capstone
/geoloc.py
UTF-8
406
2.71875
3
[]
no_license
import requests url = 'https://maps.googleapis.com/maps/api/geocode/json' params = {'sensor': 'false', 'address': 'Regent Park, Toronto'} r = requests.get(url, params=params) results = r.json()['results'] #location = results[0]['geometry']['location'] #location['lat'], location['lng'] print(results) import geocoder g=g...
true
7fe6910fc426d44868b0ae9217ae0d1c77d7ba3f
sophiay98/4182_fuzzer
/src/fuzzer-main.py
UTF-8
786
2.828125
3
[]
no_license
import sys, socket, os from time import sleep from scapy.all import * def connect_to_server(dest,port): try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print ("Socket successfully created") sock.connect((dest, port)) except: # If fail, return null print("cannot...
true
083a97a3da05b0496e85a0b23505050a35443cb5
subdivision/GuiPlayground2
/GuiPlayground/SmoothnessAnalysis.py
UTF-8
1,255
2.75
3
[]
no_license
import math as m import numpy as np #----------------------------------------------------------------------------- def compute_slopes(pts, b_open, subd_iter): N = len(pts) NN = N-1 if b_open else N slopes = [] xs = [4.*float(i)/(2.**subd_iter) for i in range(NN)] for i in range(NN): curr = ...
true
aad3a206cf96c6aea5c52211da34bdcc46e55c6c
BitKnitting/FitHome_Read_Send_CP
/lib/wifi_connect.py
UTF-8
662
3.109375
3
[]
no_license
import network import time def do_connect(ssid, password): wlan_sta = network.WLAN(network.STA_IF) wlan_sta.active(True) if wlan_sta.isconnected(): print('already connected.') return True print('Trying to connect to %s...' % ssid) wlan_sta.connect(ssid, password) for retry in...
true
7d5a84f8bcdafbc92547d6d40d7bc5f7594238fa
ncchen99/2020HSTCWinterCamp
/HSTC2020/ex2.py
UTF-8
939
3.25
3
[]
no_license
import pygame as pg pg.init() #設定視窗 width, height = 640, 480 screen = pg.display.set_mode((width, height)) pg.display.set_caption("NCC's game") #建立畫布bg bg = pg.Surface(screen.get_size()) bg = bg.convert() bg.fill((255,255,255)) #繪製幾何圖形 pg.draw.rect(bg, (255,255,0),[70, 7...
true
04fcb6146fe2832f20fe1a89d3449aab5b6ac394
binonteji/Projects
/Multi HandWritten Digit Recognizer/main.py
UTF-8
1,009
2.578125
3
[]
no_license
import tensorflow as tf #import matplotlib.pyplot as plt mnist = tf.keras.datasets.mnist (x_train, y_train),(x_test, y_test) = mnist.load_data() x_train = x_train.reshape(60000, 28, 28, 1); print(x_train.shape, y_train.shape) # 60000 x_train = x_train / 255.0 x_test = x_test.reshape(10000, 28, 28, 1); p...
true
cecdb916c5f27431bff1f94e434a3539834230dc
Ericsta/leetcode
/1033.py
UTF-8
339
2.90625
3
[]
no_license
class Solution: def numMovesStones(self, a: int, b: int, c: int) -> List[int]: a,b,c = sorted([a,b,c]) if c-b==2 or b-a ==2: min =1 else : min = self.mintwo(a,b)+self.mintwo(b,c) max= b-a+c-b-2 return min,max def mintwo(self,a,b): return ...
true
52269854f490eddd63f2fac0968c2d39d555a566
AngeloJacobo/Python_Scripts
/Arknights_Missions/src/game.py
UTF-8
2,010
2.53125
3
[ "MIT" ]
permissive
import pytesseract import pyautogui from PIL import Image, ImageGrab import re import time import keyboard pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' pyautogui.FAILSAFE=False #CONFIGURE start_coord=(1627,900,1737,948) mission_coord=(1470,700,1644,811) result_coord=(148,825...
true
7d25863ed5270e6c473ac691fa4ff0cd6de28631
rschmaelzle/visbrain
/examples/brain/12_colorbar_control.py
UTF-8
5,018
3.546875
4
[ "BSD-3-Clause" ]
permissive
""" Colorbar control ================ Control the colorbar of selected objects. The colormap of three objects can actually be controlled : * Cortical projection / repartition (name = 'Projection') * Pictures (name = 'Pictures') * Connectivity (name = 'Connectivity') In this example we define some sources...
true
05ac7a06241b85db4ee1f6addf3bed9389977f5b
chirtz/i3stuff
/cstatus/modules/text.py
UTF-8
908
3.25
3
[ "MIT" ]
permissive
from modules.modules import BasicModule from modules.ipcserver import IPCServer class SimpleText(BasicModule): """ Simple Text Module Shows the given text """ defaults = { "text": "" } def __init__(self, template="$text", **kwargs): super().__init__(template=template, **k...
true
574da4858b3b246ae07d79f5573b5752812c4654
t-dawei/leetcode
/code/125. 验证回文串.py
UTF-8
577
4
4
[]
no_license
''' 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false ''' class Solution: def isPalindrome(self, s): """ :type s: str :rtype: bool """ res = [] for x in s: ...
true
06b10014fcf28176ff9072e5b5bcb852097f96de
saarku/fig-explorer
/figure-embeddings/data_generator.py
UTF-8
3,815
3.125
3
[]
no_license
"""Keras data generator. We do not want to load the full data since the pairs have many repeating figures in them.""" import numpy as np import keras class DataGenerator(keras.utils.Sequence): def __init__(self, feature_vectors_dir, figure_pairs_dir, losses, batch_size=64, sequence_length=100, v...
true
2ba2884087f642995c12e4b352166ab2bed52570
sikinmettugi/quotedtweetflattener
/src/app.py
UTF-8
3,403
3.4375
3
[ "MIT" ]
permissive
import tweepy import json # Try authentication via OAuth. def get_tweepy_api(filepath): """ Try Authentication via tweepy. :param filepath: the json file contains consumer/access variables :return: True if everything went well, False otherwise """ consumerVariables = [] accessVariables = ...
true
056609da7daa488bb3bacc22c24afa2d8ed84555
istresearch/scrapy-cluster
/utils/examples/example_zw.py
UTF-8
2,799
2.765625
3
[ "MIT" ]
permissive
from scutils.zookeeper_watcher import ZookeeperWatcher from time import sleep import argparse parser = argparse.ArgumentParser( description="Zookeeper file watcher") parser.add_argument('-z', '--zoo-keeper', action='store', required=True, help="The Zookeeper connection <host>:<port>") p...
true
7cd59e24a9d8d1b2726d1ba638c249c097aeeaf5
Franciscwb/EstudosPython
/Cursoemvideosexercicios/ATP_LOJA.py
UTF-8
2,141
3.75
4
[]
no_license
print('Esta é a Loja Saint Grail.\nSeja Bem-Vindo! \nAqui quem fala é o vendedor Francis de Almeida') print('Faremos uma análise de crédito.\nPara tal, digite o seguintes dados') cargo_empresa = str(input('Qual o seu CARGO NA EMPREGA que trabalha atualmente: ')) salario = float(input('Digite o seu salário atualme...
true
ddcd51b112277cbb1077c5b54bfcbf41f1c76191
Katharina2009/practice_python
/determinant.py
UTF-8
720
3.875
4
[]
no_license
"""Two functions that together calculate the determinant of any matrix. The first function calculates the determinant of a 1x1 matrix, a 2x2 matrix, and adds together the minors of a nxn matrix if n > 2. The second function calculates the determinant of the minors.""" #Practicing calling a function in a function, and ...
true
540bc40d99364926b79a195310e3927d675cf393
mr-teslaa/elderly-care
/application.py
UTF-8
302
2.53125
3
[]
no_license
# importing necessary module from flask import Flask from flask import render_template # passing the flaskapp through 'app' variable app = Flask(__name__) # default route @app.route('/') def index(): return render_template('index.html') if __name__ == "__main__": app.run(debug=True)
true
c48d0bc4660192e6df9815063329afbe2f1d4043
PalashHawee/projects
/imagepro/main.py
UTF-8
54
2.546875
3
[]
no_license
def do_stuff(num): return num+5 print(do_stuff(10))
true
4dff8ae0bbc21b3a9f1b84158a5e6783e262c217
jackgallivan/data-structures-project
/ud_graph.py
UTF-8
14,076
4.28125
4
[]
no_license
# Course: CS261 - Data Structures # Author: Jack Gallivan # Assignment: 6 # Description: Undirected graph ADT implemented using python's list and dictionary. class UndirectedGraph: """ Class to implement undirected graph - duplicate edges not allowed - loops not allowed - no edge weights - vert...
true
97775bd5ba1dcfb99cc08c71e2adac47441fdbd3
noman55/Sand-Dune-Detection
/image_traverser_vertical.py
UTF-8
1,959
3.265625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jun 7 14:28:12 2019 @author: rrscw """ # -*- coding: utf-8 -*- ''' Image traversing algorithm : COMPLETE VERTICAL MASK ''' import cv2 import numpy as np #read the same image in color for drawing colored rectangle image_for_output=cv2.imread("2.png",1) def image_draw(y_s...
true
4aeca59631ec6b2eb4d8946b6cdd846a4379114f
Aledutto23/Sistemi-e-Reti
/es_vacanze_Natale/es_indirizzo_MAC.py
UTF-8
599
3.171875
3
[]
no_license
import random def MACcasuale(): #creo una funzione chiamata MACcasuale esadecimale = [ random.randint(0x00, 0xff), #operazione per randomizzare i 2 numeri in base esadecimale random.randint(0x00, 0xff), random.randint(0x00, 0xff), ...
true
13c8783d28e2fb5a64d3b908aeb0eeee2acff0ed
larsjn/projektarbeit
/Abgegeben/signalgenerierung_ipython/lib/plotwidget.py
UTF-8
31,553
2.515625
3
[]
no_license
# coding: utf-8 import matplotlib.pyplot as plt import numpy as np import random from IPython.display import display from IPython.display import clear_output from ipywidgets import Accordion from ipywidgets import Layout from ipywidgets import Box from ipywidgets import VBox from ipywidgets import HBox from ipywidgets...
true
d2e1d0775e5f0b00f8e9316224385a7031f30e87
Futrell/rnn_psycholinguistic_subjects
/japanese_npi/code/prediction.py
UTF-8
5,219
2.703125
3
[]
no_license
# coding: utf-8 import torch import pandas as pd import parse_data, learning import argparse, os.path class Predictor(learning.Learner): def __init__(self, model_parameter_path, cpu = True): self.retrieve_model(path = model_parameter_path, cpu=cpu) def predict(self, string, prefix_length = 1, suffix_length = 0)...
true
e7ca4a08e97cb15aa29e981e8e61acd77f3c3fcc
husbycodereis/CS50
/pset7/houses/import.py
UTF-8
790
3.109375
3
[]
no_license
from sys import argv import csv from cs50 import SQL # command line argument input checker if len(argv) != 2: print("Usage: python import.py characters.csv") exit(1) # SQL database creation db = SQL("sqlite:///students.db") # csv file opening for read with open(argv[-1], "r") as file: reader...
true
78b5b970976beb3fb73c5da0d460bf1e2a95e8d7
Hirodari/gender-based-car-owner
/.ipynb_checkpoints/main-checkpoint.py
UTF-8
787
2.515625
3
[]
no_license
from parse_utils import group_data from functools import partial from datetime import datetime from constants import * my_date = datetime(2017,3,1) def group_key(item): return item.vehicle_make def filter_key(my_date,gender,row): return row.last_updated >= my_date and row.gender == gender for gender in ("Ma...
true
70488edd63dc0eda62435087cccebc3d308626ec
lixingaaa/Python
/5.列表和元组/练习/test1.py
UTF-8
245
3.5625
4
[]
no_license
# 千年虫问题 year = [89, 98, 00, 75, 68, 37, 59, 90] for index, value in enumerate(year): if str(value) != '0': year[index] = int('19' + str(value)) else: year[index] = int('200' + str(value)) year.sort() print(year)
true
125b4b6483e2ef9910e27ec1aefa89b0e5a1c00e
trangdth55/KTPM_2013
/test_generation/input.py
UTF-8
352
3.1875
3
[]
no_license
def is_triangle(a,b,c): return True if(a<b+c and b<a+c and c<a+b) else False def is_equilateral(a,b,c): return True if a==b==c else False def is_isosceles(a,b,c): return True if a==b or b==c or a==c else False def main(a,b,c): ''' a:[-9;13][15;20] b:[5;10][11;12][17;37] c:[0;9][14;16][45;...
true
7bd7f0d9608dbfdbf0561d0da069a188ef996db6
NaiveTorch/ARC
/src/build/util/concurrent.py
UTF-8
17,114
2.609375
3
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utilities to run tasks in parallel and concurrently.""" import Queue import collections import logging import multiprocessing import multiprocessing.queu...
true
b8c632fe4689f8a2f2ebfc564df2e78959be51aa
Aasthaengg/IBMdataset
/Python_codes/p02662/s576051480.py
UTF-8
311
2.65625
3
[]
no_license
import numpy as np MOD = 998244353 N, S = map(int, input().split(' ')) A = (0, *map(int, input().split(' '))) dp = np.zeros(shape=(N + 1, S + 1), dtype=int) dp[0][0] = 1 for i in range(1, N + 1): a = A[i] dp[i] = 2 * dp[i - 1] % MOD dp[i][a:] += dp[i - 1][:-a] dp[i] %= MOD print(dp[N][S])
true
eaf97f7720eb73ea321125a9c19c6182d03ddcb5
vamshikrishna00/krish
/sortrepeat.py
UTF-8
219
3.109375
3
[]
no_license
list1=[int(x) for x in input().split()] final_list = [] for num in range(len(list1)): for i in range(num+1, len(list1)): if(list1[num]==list1[i]): final_list.append(list1[num]) print(final_list)
true
90ade18c97209a61f31ef529384dd271e71ce62b
CowOfWrath/cpsc-386-TacoCat-SMB
/settings.py
UTF-8
6,676
2.671875
3
[]
no_license
# Ryan Chen - 893219394 # # 10/11/19 Initial creation - RC # 10/17/19 - RC # Added settings for star, coin, and fire flower # Added image scaling # 10/18/19 - JL # added settings for floors, bricks, blocks # added paths for Sounds and Images # added dictionary for point values from os.path import abspath, dir...
true
253960bf6ad181c4d1ac173769ae9d4e6abdd4cf
daniel-reich/ubiquitous-fiesta
/ub2KJNfsgjBMFJeqd_9.py
UTF-8
1,442
3.21875
3
[]
no_license
class Cell: def __init__(self, row=None, col=None): self.row=row self.col = col self.mine = False self.flag = False self.open = False self.neighbors = 0 ​ class Game: def __init__(self, rows=14, cols=18, mines=40): self.rows = rows self.cols = col...
true
e2a3bd9c3d5f258669e8d222956be3c252cb06bf
agerista/Calculator-2
/arithmetic_again.py
UTF-8
1,072
3.9375
4
[]
no_license
def add(nums_list): total = 0 for num in nums_list: total += num return total def subtract(nums_list): total = nums_list[1] for num in nums_list: total -= num return total def multiply(nums_list): total = 1 for num in nums_list: total *= num return tota...
true
b98943aac92246035b3c5036bfc2ce2a61b13145
Isaiah-Ahmad/Your_Journey
/terrain.py
UTF-8
1,763
3.078125
3
[]
no_license
from random import choice from constants import SCREEN_WIDTH, SCREEN_HEIGHT # Options for terrain dictionaries: """ COLOR: tuple OPTIONAL: NPC: list of dicts Dict Contents: SRC: path to sprite image (str) SCALE: Size of the sprite (tuple) POS: Position to place the sprit...
true
1832b446c15f97cb697ce283662898e6cfa314e1
andreclemencio/CE
/sea_perm.py
UTF-8
7,246
2.8125
3
[]
no_license
#! /usr/bin/env python """ sea_perm.py A very simple EA for permutations (TSP). Ernesto Costa, March 2018 """ __author__ = 'Ernesto Costa' __date__ = 'March 2018' from random import random,randint,uniform, sample, shuffle,gauss from operator import itemgetter # For the statistics def run(numb_runs,numb_generations,...
true
f29657c0b1577d650cdbe124eee2d57641b5f4d9
ksbowler/cyber_apocalypseCTF_2021
/crypto/SoulCrabber/1/solver.py
UTF-8
288
2.546875
3
[]
no_license
test = "19500187e1ba0b5bf3e27914c83f1ffd67123543ffc3ae4a4d22a9d54f" #print(len(test)) test_flag = "A"*29 key = [] for i in range(0,len(test),2): key.append(int(test[i:i+2],16)^ord("A")) enc = "1b591484db962f7782d1410afa4a388f7930067bcef6df546a57d9f873" for i in range(len(key)): print(chr(key[i]^int(enc[i*2:(i+1)*2],...
true
9e64bfab45c80b4aab97f3cb7a2eceefb62966fb
rememerme/users-api
/rememerme/users/rest/exceptions.py
UTF-8
948
2.578125
3
[ "Apache-2.0" ]
permissive
from rest_framework.exceptions import APIException ''' Bad Request Exception. ''' class BadRequestException(APIException): status_code = 400 detail = "A Bad Request was made for the API. Revise input parameters." ''' The user was not correctly authorized. ''' class UserAuthorizationException(APIExcept...
true
89d2149ef76489e6788e7d781de09e507f05be2e
mxxu/leetcodeOJ
/longestincreasingpathinamatrix.py
UTF-8
1,354
3.296875
3
[]
no_license
class Solution(object): def longestIncreasingPath(self, matrix): """ :type matrix: List[List[int]] :rtype: int """ if not matrix: return 0 m = len(matrix) n = len(matrix[0]) C = [] for i in range(m): C.append([-1] * n) ...
true
a7b89574bda58f867c4e82e4edbbf25d5299eca5
ilyapanov1202/infa_2019_ivanov
/lab7/moleCOOLa_git.py
UTF-8
6,515
3.1875
3
[]
no_license
from tkinter import * from random import randrange as rnd import time root = Tk() root.geometry('185x170') entry_text1 = StringVar() entry1 = Entry(root, textvariable = entry_text1, font = "Arial 36", bd = 12, width = 6) entry1.insert(0, "") entry1.place(relx = 0, rely = 0) def entry1_g...
true
1f0e91a43c0fc2f5941c2de3e40c4ea75e727690
arunkumaarr/myfirstproject
/montypy.py
UTF-8
127
3.3125
3
[]
no_license
string ='trick or treat' x=len(string) print(x) list=string[len(string)-1:1:-1] print(list) for c in string[::-1]: print(c)
true
1ab02ae8ee6997521d3c2a624f781962b40928ce
dit/dit
/dit/inference/counts.py
UTF-8
6,393
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
""" Non-cython methods for getting counts and distributions from data. """ import numpy as np __all__ = ( 'counts_from_data', 'distribution_from_data', 'get_counts', ) try: # cython from .pycounts import counts_from_data, distribution_from_data except ImportError: # no cython from boltons....
true
cf7b9cad7075b1e96a902a35fc5abb5f6b40bf88
AtharvaBhutani/Jarvis
/Friday2.0.py
UTF-8
3,583
2.640625
3
[]
no_license
import pyttsx3 import speech_recognition as sr import datetime import os import wikipedia import webbrowser import pyjokes import pywhatkit engine = pyttsx3.init('sapi5', True) voices = engine.getProperty('voices') print(voices[1].id) engine.setProperty('voice', voices[1].id) def speak(audio): ...
true
e5435398c38136a088754d895004fa0e39c219f1
C-CCM-TC1028-102-2113/tarea-3-programas-que-usan-funciones-Varuneishon
/assignments/10Bisiesto/src/exercise.py
UTF-8
310
3.484375
3
[]
no_license
def main(): #escribe tu código abajo de esta línea def areaRect(x): w=x/4 w2=round(w,0) if w == w2: print("TRUE") return w else: print("FASE") return w a = int(input("Dame un año: " )) r = areaRect(a) pass if __name__=='__main__': main()
true
934a3ffc8110560c3e6a6ccbe49742d1d9b256fb
McHenro/A-SQL-Model
/models/user.py
UTF-8
4,274
2.859375
3
[]
no_license
import psycopg2 from psycopg2 import Error class User: def __init__(self): self.connection = psycopg2.connect( # Connect to an existing database user= 'decagon', database = 'mchenro_db') self.cursor = self.connection.cursor() # Create a ...
true
69f55dc6b536ea90b427dfb5609b514b10abbc7c
Pradnya1208/Python_tkinter101
/01. Create/iconsImg.py
UTF-8
435
2.875
3
[]
no_license
from tkinter import * from PIL import ImageTk import PIL.Image IMAGE_PATH = 'a.png' IMAGE = '..//back1.jpg' root = Tk() root.title("Icons and Images in tkinter") imgicon = PhotoImage(file=IMAGE_PATH) root.tk.call('wm', 'iconphoto', root._w, imgicon) button = Button(root, text = "Exit", command= root.destroy).pac...
true
ca8a7a302f72f82dc7d125d5d84815d8bb16100c
manuelsh/banana-navigator
/model.py
UTF-8
2,124
2.875
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import torch.nn.functional as F class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...
true
dd2287ea2b3a3edf083d010a17de4120df289986
namhai923/Daily-Problem
/move-zeros/move-zeros.py
UTF-8
346
2.9375
3
[]
no_license
class Solution: def moveZeros(self, nums): curr_len = 0 for i in range(0, len(nums)): if nums[i] == 0: curr_len += 1 if nums[i] != 0: nums[i], nums[i - curr_len] = nums[i - curr_len], nums[i] nums = [0,1,0,3,12] Solution().mo...
true
87afd853430d89baecd61e3d3eb8c7501f463d6c
chuchro3/Bastet
/players/deep_player.py
UTF-8
2,882
3.0625
3
[]
no_license
from pprint import PrettyPrinter from pypokerengine.players import BasePokerPlayer pp = PrettyPrinter() # A skeleton for allowing our trained DeepPlayer to interact with PyPokerEngine. class DeepPlayer(BasePokerPlayer): def declare_action(self, valid_actions, hole_card, round_state): # bet in first round...
true
056e7fdbde31c7cc12bd089cdfb978d4813f14da
Choojj/acmicpc
/단계별/13. 브루트 포스/03. 덩치.py
UTF-8
373
3.15625
3
[]
no_license
import sys weight_height = [] N = int(sys.stdin.readline().rstrip()) for i in range(N): x, y = map(int, sys.stdin.readline().rstrip().split()) weight_height.append([x, y]) for i in range(N): count = 1 for j in range(N): if (i != j): if (weight_height[i][0] < weight_height[j][0] and weight_height[i][1] <...
true
fe6deb95a8eb84d441768f89894afd705527b43a
hpoisner/iliner
/iliner/iliner_load_parse.py
UTF-8
7,292
3.234375
3
[]
no_license
#!/usr/bin/python3 from datetime import datetime import logging import numpy as np import pandas as pd import os import sys class LoadFiles(object): """LoadFiles loads sample files and haplotype files Files must be phased """ def __init__(self, sample, haps_file): self.sample = sample ...
true
eb3627c117cf01446bba4f6f03f0cfa406009a2b
dalarson/ids
/server/server/rootkit.py
UTF-8
574
2.828125
3
[]
no_license
import subprocess from flask import request def get_secret_message(): return request.cookies.get("secret_message") def send_secret_message(res, message): res.set_cookie("secret_message", str(message)) def reverse_shell(res): print("Checking if command is encoded") message = get_secret_message() ...
true
cdfd181ecb4e65b8658b84eaa789dff3a8779145
AinarIbragimov/homework
/lesson01/hw 1.py
UTF-8
870
4
4
[]
no_license
""" 1. Поработайте с переменными, создайте несколько, выведите на экран, запросите у пользователя несколько чисел и строк и сохраните в переменные, выведите на экран. """ print('Здравствуйте! Айнар придумал число для Var1 и текст для Var2') print('Var1=177') print('Var2="Первая домашняя работа"') var3 = int(input('Те...
true
94f76f9bc9ddc1ffacbeb276c2636a159f883c78
DanielAsztalos/Perceptron
/perceptron2.py
UTF-8
929
3.015625
3
[]
no_license
import numpy as np train_data = np.array([ [1, 1, 0, 1, 1, 1, 1, 1, 0, 1], # H [1, 0, 1, 0, 0, 1, 0, 0, 1, 0], # I ]) train_labels = np.array([ [1, 0], [0, 1], ]) def hardlim(val): return 0 if val < 0 else 1 def perceptron_learning(data, labels): N, n = data.shape lr = ....
true
70f5d2df178b5a0a96b7437ff84d1c2a90cff917
Gabrielnero000/cv-test
/warp_and_find_checkers.py
UTF-8
2,025
2.5625
3
[]
no_license
from matplotlib import pyplot as plt from cv2 import cv2 import numpy as np import fire import json import glob import math import os reference_points = np.array([ [0, 0], # tl [1000, 0], # tr [1000, 1000], # br [0, 1000], # bl ]) def process_instance(im, im_info): points = np.array(...
true
a429273e50256bcaa4b0f685b8cdef2f968cc41a
archerImagine/myNewJunk
/6.00SC/Lec_06/Rec_03/src/example07.py
UTF-8
621
4.625
5
[]
no_license
# How to make Factorial? def Factorial(n): #if base case is true, what is the base case. if n == 0: return 1 else: return n * Factorial(n-1) #Test print "Factorial(0): ", Factorial(0) print "Factorial(5): ", Factorial(5) #Can you write it using for loop def loopFactorial(n): result =...
true
78e11f6020f307213a50a2c0219b4d4b230e6fa1
mosesxie/CS1114
/Lab #7/q2.py
UTF-8
396
3.921875
4
[]
no_license
from random import randint number= randint(1,100) a=int(input("Try to guess my number:")) b=True while b==True: if a>number: print("Wrong guess. My number is smaller than yours.") if a<number: print("Wrong guess. My number is bigger than yours.") a=int(input("Try to guess it:")) if a...
true
e94621277099d0a82b5460e1cdb62c96fa40a101
TraceIvan/PythonProjects
/Pro 1/列表常用内置函数.py
UTF-8
1,131
4.375
4
[]
no_license
print('列表比较') """比较""" a=(1,2,3)#元组 b=(1,2,4) print(a,':',type(a)) print(a,'<',b,a<b) from operator import eq print('a==b?',eq(a,b)) print('len、min、max、sum应用') """len、min、max、sum应用""" a=[1,2,3,4] print(len(a)) print(min(a)) print(max(a)) print(sum(a)) a=[1,2,[3,4],[5,6,[7]]] print(len(a)) a={1:1 , 2:5 , 3:8} print(max...
true
69773337ed50835cef6310c4a84267861e2478bf
reddyvamsibme/lazor_project_SC_Fall2020
/lazer_final.py
UTF-8
29,026
3.34375
3
[]
no_license
''' Software Carpentry, Fall 2020 Lazors project Submitted by Vamsi Reddy <vreddy17@jhu.edu> Emad Mohammed Naveed <enaveed1@jhu.edu> ''' # Import packages from itertools import combinations from PIL import Image, ImageDraw import time class Input: ''' This class handles reading and extraction of lazor test fi...
true
09cd5df0c502edcc3a6674c56d2bea17ccfd65ea
pkdism/leetcode
/july-leetcoding-challenge/d4-ugly-number-ii.py
UTF-8
632
3.828125
4
[]
no_license
""" Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. """ class Solution: def nthUglyNumber(self, n: int) -> int: if n == 1: return 1 f2, f3, f5 = 0, 0, 0 uglies = [0]*n uglies[0] = 1 for ...
true
20575af2d94d2e61d1a01f7a0c36063faa8c596b
stafazzoli/Adventure
/data/vocabulary.py
UTF-8
8,557
2.75
3
[]
no_license
""" # SECTION 4: VOCABULARY. EACH LINE CONTAINS A NUMBER (N), A TAB, AND A # FIVE-LETTER WORD. CALL M=N/1000. IF M=0, THEN THE WORD IS A MOTION # VERB FOR USE IN TRAVELLING (SEE SECTION 3). ELSE, IF M=1, THE WORD IS # AN OBJECT. ELSE, IF M=2, THE WORD IS AN ACTION VERB (SUCH AS "CARRY" # OR "ATTACK"). ELSE, IF M=...
true
baf22e1151788ceb007b11df4f9d749aca94b209
eltigueeere/metodosNumericos
/metodos-numericos/main.py
UTF-8
589
3.421875
3
[]
no_license
#!/usr/bin/python3 import os def menuPrincipal(): op="" print ("\n\n\t1.-Pol. Lagrange") print ("\n\tsalir.-salir") op=input("\n\n\tElige una opcion ") return op def polinomioLagrange(): from polinomioLagrange import lalo return 0 salir = False opcion = "" while not salir: opcion = menuPri...
true
b3230693ed1412360be65753fb152cf499540391
chenjiahui1991/LeetCode
/P0145.py
UTF-8
725
3.65625
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 postorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ def dfs(...
true