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
36f04257dbde96321a051b553bf2a6f39fd3c3e1
eddiechapman/merge-docs
/merge_docs.py
UTF-8
5,319
3.078125
3
[]
no_license
""" merge_docs.py Concatenate the mission and skills documents for each degree. Create a 'description' document is created for degrees that have a valid skills and valid mission document. The resulting document combines the two. Incomplete, invalid, course, and unknown documents are copied to new directories for ins...
true
75ae440c1d0b09069d24b8baac7b1ccee414ac70
mich-chen/code-challenges
/trees/sum-root-leaf-binary/sum_root_leaf_binary.py
UTF-8
1,377
3.875
4
[]
no_license
from typing import TreeNode # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right def sumRootToLeaf(root: TreeNode) -> int: """ Using int(string, base) to convert string o...
true
2918047cb5ee1ae5eb73ccd0ee72743e0a12b94e
yu5shi8/AtCoder
/ABC_C/ABC152C.py
UTF-8
372
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- # C - Low Elements # https://atcoder.jp/contests/abc152/tasks/abc152_c N = int(input()) P = list(map(int, input().split())) ans = 0 check = 10**9 + 7 for i in range(N): if check > P[i]: ans += 1 check = P[i] print(ans) # [1] 23:34 - 23:57(TLE / 解説を閲覧)- 0:04(TLE) - 0:07(T...
true
d80c6b4b81f9cd9a9317b6c10fe8656eebad1b9d
whsasf/python
/self/tets.py
UTF-8
408
3.25
3
[]
no_license
#!/usr/bin/python3 import turtle as t print (t.position()) t.color("blue") num = 0 while num < 5: # 当前位置拷贝一份箭头形状 stamp_id = t.stamp() t.fd(50) num += 1 t.pensize(15) t.forward(200) t.right(90) t.dot(50, "blue") t.forward(200) t.right(90) t.dot(50, "red") t.forward(200) t.right(90) t.dot(50, "yellow")...
true
577bfe6354f3ee117b286fb6554a0e3851a81b4d
AKumanov/Multidimensional_Lists
/Multidimensional Lists/Excercise/problem_1.py
UTF-8
1,089
4.03125
4
[]
no_license
def read_board(n): matrix = [] for i in range(n): matrix.append([int(x) for x in input().split(', ')]) return matrix def find_first_diagonal(board): first_diagonal = [] for i in range(len(board)): for j in range(len(board)): if i == j: first_diagonal.app...
true
8aaae25565e78d254d10c8d6e86917e82de6fb8f
jasonsewall/maze_challenge
/bozo_walker.py
UTF-8
1,951
2.96875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Copyright 2018 Jason Sewall (jasonsewall@gmail.com) # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
true
4b512899c92fe009af69910db7a98f1f227b719f
parampavar/leon
/bridges/python/src/sdk/network.py
UTF-8
2,777
2.609375
3
[ "MIT" ]
permissive
import requests import socket from typing import Any, Dict, TypedDict, Union, Literal, Optional from ..constants import LEON_VERSION, PYTHON_BRIDGE_VERSION class NetworkOptions(TypedDict, total=False): base_url: Optional[str] class NetworkResponse(TypedDict): data: Any status_code: int options: Dic...
true
66223a81980f78b2ba2ae10349598a9720588b0f
kotetsu-n/miscellaneous
/PyOpenGLtest/elements/cube.py
UTF-8
3,105
2.890625
3
[]
no_license
from OpenGL.GL import * from OpenGL.GLU import * def draw_cube(size): half = size * 0.5 # bottom glBegin(GL_QUADS) glColor3f(1, 0, 0) glVertex3f(-half, -half, -half) glVertex3f(-half, half, -half) glVertex3f(half, half, -half) glVertex3f(half, -half, -half) # top glColor3f(0,1,0...
true
74012b7ecc78be88f377509593310938421fe2fe
jgshu/Thesis
/data_preprocessing/data_normalization.py
UTF-8
2,165
2.671875
3
[]
no_license
import pandas as pd import numpy as np import os from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import StandardScaler from .utils import find_files def normalization(df, norm): # TODO: 提取需要归一化的特征(特征改变需要重新设置!!!) features = df.columns.values[-6:] scaler_df = df.loc[:, features] ...
true
7e69cde0ec34da119f2c28b3e9cc8b002bb84ec6
gakonst/curve-contract
/tests/test_admin.py
UTF-8
3,907
2.515625
3
[]
no_license
import pytest import random from itertools import permutations from time import time from eth_tester.exceptions import TransactionFailed from .conftest import UU, use_lending, approx N_COINS = 3 def test_transfer_ownership(tester, w3, swap): alice, bob, charlie = w3.eth.accounts[:3] # Only admin can withdra...
true
9b445c6dcd4846367f33e5611e245054b3021dd4
azadeh-fs/APItest
/testcases/TestxServerTime.py
UTF-8
579
2.5625
3
[]
no_license
import json import unittest import test_utils as tu import time class TestxServerTime(unittest.TestCase): def setUp(self): tu.log_out() def tearDown(self): return def test_server_time(self): input = json.dumps({ "time": 1 }) server_time_response = tu...
true
cae3921d1af90607f20488190b9a35104bda714e
albertmaharjan94/red_truck
/RED_TRUCK_PYTHON/picture.py
UTF-8
432
2.6875
3
[]
no_license
import cv2 import sys import numpy as np original_stdout = sys.stdout f = open('banner.txt', 'w') sys.stdout = f img = cv2.resize(cv2.cvtColor(cv2.imread("./banner.png"), cv2.COLOR_BGR2GRAY),(50,50) , interpolation = cv2.INTER_AREA) for j in img.tolist(): for i in j: if(type(i)== "int"): if(i ...
true
f063169ec81c0e989da04e0e108bb3d776d5cca2
Harrison97/CTCI
/ch1/1.1.py
UTF-8
657
3.453125
3
[]
no_license
import unittest chars = 128 def has_unique_chars(s: str) -> bool: memo = chars*[0] for c in s: memo[ord(c) % chars] += 1 if memo[ord(c) % chars] > 1: return False return True class Test(unittest.TestCase): def test_1(self): self.assertEqual(has_unique_chars('aAsSdD...
true
39626256a620c0ab47db46cdde2d7f9eb1925a89
ibrahimsha23/datastructures
/binary trees/level_up_order_structure.py
UTF-8
581
3.5
4
[]
no_license
from binary_tree.base import Node, BinaryTree, print_tree class LevelUpOrder(BinaryTree): def tree_order(self, arr, n, i, root): if i < n: if root is None: root = Node(arr[i]) if root.left is None: root.left = self.tree_order(arr, n, i*2 + 1, root...
true
4edaf6b5013a9f8fc8406218ce04cd21e2d52f76
csdaiwei/getpath
/getpath.py
UTF-8
19,524
2.796875
3
[]
no_license
#encoding:utf-8 import cv2 #todo: use PIL instead of cv2 import pickle import numpy as np import Parameter as Para from math import sqrt from PIL import Image from dijkstra_algorithm import * from collections import defaultdict from heapq import * class ModisMap: def __init__(self, inputfile, probfile): ...
true
48157441f8ef328ea6c6d6c062cef131bef509ac
kusa/Python-test
/text.py
UTF-8
381
3.90625
4
[]
no_license
print("Zadavejte cisla \n") cislo = 0 soucet = 0 while True: cislo = input("cislo: ") if cislo: try: number = int(cislo) except ValueError as err: print(err) continue except EOFError: break soucet += number els...
true
c721fa82867a1fb0c50ed23cc94661adcab9711a
eitherWei/augmentDoc
/processingClass.py
UTF-8
11,605
2.828125
3
[]
no_license
from getData import returnData import pandas as pd import re import numpy as np import networkx as nx from nltk.corpus import stopwords from nltk.corpus import wordnet as wn from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans stop = set(stopwords.words('english')) token_p...
true
08debf2f9dc2682c84fc2819366938b2f60d1994
mnfienen/HTCondorHelloWorld
/demo/HolaCruelWorld/demo_parallel_local/consol_data.py
UTF-8
879
2.703125
3
[]
no_license
import os if os.path.exists('results'): cpath = os.path.join(os.getcwd(),'results') else: cpath = os.getcwd() # list the files in the results directory allfiles = os.listdir(os.path.join(cpath)) # grab the number from each filename filenums = [] for cf in allfiles: if cf.endswith('.dat'): cn = ''...
true
10baf455b40f688106725f632e2736ca15c601af
CinnamonRolls1/daa-project
/Greedy/greedy_test.py
UTF-8
4,930
2.6875
3
[]
no_license
#-------------------IMPORTING LIBRARIES------------- import sys sys.path.insert(0, '../imports') from imports import Assignment sys.path.insert(0,'../Greedy') from itertools import product from operator import attrgetter #---------------------------------------------------- #-------------------------------DATA AND GL...
true
25adc727dae4de3f74181ddef311464ce5f6b2b1
Terminal-Redux/master-python
/14-sistema-archivos/ficheros.py
UTF-8
1,493
3.4375
3
[]
no_license
from io import open import pathlib, shutil # Abrir archivo ruta = str(pathlib.Path().absolute()) + "/fichero_texto.txt" archivo = open(ruta, "a+") # Escribir archivo.write("*******Soy un texto metido desde python********\n") # Cerrar archivo archivo.close() # Abrir archivo ruta = str(pathlib.Path().absolute()) + "/...
true
72ea5f9b1ccdf4ead581abaa33811f9b3e1b2c2b
dSalazar10/Course-Exploring_Deep_Learning
/DeepLearning/Networks/Word2Vec/word2vec.py
UTF-8
12,521
3.171875
3
[ "MIT" ]
permissive
import re from collections import Counter import random import numpy as np import torch from torch import nn import torch.optim as optim class NegativeSamplingLoss(nn.Module): def __init__(self): super().__init__() def forward(self, input_vectors, output_vectors, noise_vectors): """ Custom Loss functi...
true
fe4c048f2a75278575dcc3a5db271cb7ae4e9c08
HarrisonMS/JsChallenges
/Python/codewars/pipe_fix.py
UTF-8
70
2.53125
3
[]
no_license
def pipe_fix(nums): return list(range(nums[0], nums[-1] + 1))
true
c574dfcd90e02bb1f455a613137d485e5671c196
ThanhChinhBK/interview-programing-questions
/practice/leetcode/1041_robot-bounded-in-circle.py
UTF-8
401
3.0625
3
[]
no_license
class Solution: def isRobotBounded(self, instructions: str) -> bool: x, y, dx, dy = 0, 0, 0, 1 for instruction in instructions: if instruction == "L": dx, dy = dy, -dx elif instruction == "R": dx, dy = -dy, dx else: ...
true
b4226bf70a608b6f203e93153b47f5efcea0cd18
javiercarpio57/AnalizadorSintactico
/lexico.py
UTF-8
20,013
3.375
3
[]
no_license
import functools epsilon = 'ε' class Token(): def __init__(self, attr, value): self.Atributo = attr self.Valor = value class SyntaxTree(): def __init__(self, regular_expression, firsts): self.firsts = firsts self.tabs = 0 self.last_operation = None sel...
true
585bf590d932e79af18075437c47c39daa4ae61d
Levi-Huynh/JS-INTERVIEW
/pract.py
UTF-8
2,082
3.203125
3
[ "MIT" ]
permissive
# https://www.hackerearth.com/practice/algorithms/graphs/breadth-first-search/practice-problems/algorithm/great-graphs-afc1a343/ from util import Queue from graph import Graph myG = Graph() given_v1 = 5 given_v2 = 3 given_v3 = 1 myG.add_vertex(5) myG.add_vertex(3) myG.add_vertex(1) myG.add_vertex(4) myG.add_vertex...
true
41f886ad5f661dcaa9c1983d262041f2d7897fce
mijikm/algorithm-practice-leetcode
/python/003_Longest_Substring_Without_Repeating_Characters.py
UTF-8
1,166
3.875
4
[]
no_license
class Solution(object): # 1. Approach: Count only indexes # - Find last occurrence of the char, and calculate length of the string # between current pointer and last occurrence of the char + 1 # Time Complexity: O(n) # assume that n represents the length of the string "s" # Space Complexity:...
true
06dba57bb12494be408508e51df433ab9e5ce6bc
hubiao7/python-testcase-generator
/test/lib/IO.py
UTF-8
359
2.6875
3
[ "MIT" ]
permissive
import platform from io import StringIO, BytesIO # String IO supporting "str" is difference between Python2 and Python3. # Python2: StringIO => unicode , BytesIO => str # Python3: StringIO => str(unicode), BytesIO => bytes version = platform.python_version_tuple() if version[0] == '2': BaseIO = BytesIO elif ve...
true
cc55ecdb3b621dd9bb4bce84cfb0e41c4b07fe29
PythonClassRoom/capitulo_4
/reference_ejemplo.py
UTF-8
205
3.25
3
[]
no_license
def sumar(a,b): return a + b a = (1,2) resultado = sumar(*a) #print(a) #print(resultado) pass kargs = {'a': 2, 'b':1, 'z':3} resultado = sumar(**kargs) print(*kargs.values()) print(resultado) pass
true
d4b1820d34f1f3687a068cbda3da2c4774225a95
CornellDataScience/Insights-Databowl
/modeling/cnn_cdf_model.py
UTF-8
8,358
3.140625
3
[]
no_license
# %% import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import tensorflow as tf import tensorflow.keras.backend as K from tqdm import tqdm from sklearn.model_selection import train_test_split # %% [markdown] # # What's a Convolution? # # Gonna make a convolutional neural net ...
true
603e0efa5a9360186a4160b04ed101b8b291fea9
Twishar/Python
/PythonPandas.py
UTF-8
607
2.828125
3
[]
no_license
#Получить данные с сайта, который не предоставляет API import pandas as pd calls_df = pd.read_html("http://apps.sandiego.gov/sdfiredispatch/", header = 0, parse_dates=["Call Date"]) print(calls_df) print(calls_df.to_json(orient = "records", date_format = "iso")) #calls_df.to_csv('calls.csv', index = False) print...
true
dec3f96a7962837f348eead531c823fe05b83add
CadenZhao/PythonDataAnalysis
/fastaTOblabla/fastaTO@@.py
UTF-8
2,024
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Apr 11 22:49:28 2018 @author: Caden """ import re import os #函数功能:将fasta格式数据处理成导入数据库的数据格式(@@分割每个蛋白的五种数据;换行符分割蛋白) def fstClear(fname='C:\\Users\\Caden\\Desktop\\NRProtein.txt', targetDir='C:\\',targetName='data.txt'): #读取fasta文件 file=open(fname,'r') da...
true
4a367fb9344e0ff98c534692420077ecfec469fd
lyhiving/cainiao
/cainiao/errors.py
UTF-8
2,187
2.765625
3
[ "MIT" ]
permissive
class BaseException(Exception): pass class RequestFailedError(BaseException): def __init__(self, status: int = None): self.reason = \ ("Request cainiao API was failed," " response status code is {}").format(status) super(BaseException, self).__init__(self, self.reason)...
true
b2065a382c36d84100497a77de8e1421394fdfae
brain-bzh/elu616-introtoai
/session6/lab/rl.py
UTF-8
5,948
3.25
3
[ "MIT" ]
permissive
import numpy as np import pickle ## Part 1 - Linear Model Training using SGD # This part can be skipped unless you want to understand the details of how the linear model is being trained using Stochastic Gradient Descent. # A starting point can be found here : https://medium.com/deeplearningschool/2-1-linear-regressi...
true
71f012ace9c11fe5359e5585586c29064c24059e
Natana-92/algorithm
/0509/음료수얼려먹기.py
UTF-8
621
3.59375
4
[]
no_license
import sys sys.stdin = open("../input.txt", "r") # 생성된 아이스크림의 총 개수를 구하면 된다. # BFS로 count를 주면서 길을 구한다. graph = [] for i in range(4): graph.append(list(map(int, input()))) print(graph) def dfs(x,y): if x <= -1 or x >= 4 or y <= -1 or y >= 4: return False if (graph[y][x] == 0): graph[y][...
true
743fd8a106d43ba4d7c24e32b8ab48ccee37ddf4
hansnam1105/fbcrwal
/process.py
UTF-8
1,400
2.828125
3
[]
no_license
from openpyxl import load_workbook from konlpy.tag import Kkma from konlpy.tag import Twitter from collections import Counter import pandas as pd import numpy as np import openpyxl twitter = Twitter() from konlpy.utils import pprint wb = load_workbook('search.xlsx') sheet = wb['Sheet'] row = 1 sentences = list() wh...
true
79a2b923e84277e340f4b6e0d040295874c84035
LizaChelishev/class1010
/page15_3.py
UTF-8
255
3.59375
4
[]
no_license
# v= pi*r^2*h height = int(input('Insert the height of a pot: ')) radius = float(input('Insert the radius of the base of the pot: ')) pi = 3.14 if radius and height > 0: v = (radius ** 2) * pi * height print('The volume of the pot is: ' + str(v))
true
8cd9bd9cdbccb64b8a5dcd0c120360e5cf35f8b6
jkloosterman/tracera
/simulator/simulator/WarpScheduler.py
UTF-8
3,049
2.65625
3
[]
no_license
class WarpSchedulerOutput(object): def get_width(self): raise NotImplementedError() def get_type(self): raise NotImplementedError() def can_accept(self): raise NotImplementedError() def accept(self, warp): raise NotImplementedError() class WarpScheduler(object): def ...
true
65a74aa7730eba0d1e3809fe45fca945c69c26e2
anishst/Learn
/Programming/Python/exception_handling/ExceptionHandling.py
UTF-8
1,992
3.875
4
[]
no_license
# Exceptions # https://docs.python.org/3/tutorial/errors.html try: f = open("Test.txt") # var = 5/0 pass except FileNotFoundError: print("Sorry, This file does not exist") except Exception as e: print("Error:{}".format(e)) else: # if no exceptions run this print(f.read()) f.close() finally:...
true
9915cdd7174d4998807f33bcae2e163699541fd6
vsubbotskyy/utility-scripts
/organize-photos.py
UTF-8
881
2.90625
3
[]
no_license
import glob, os, re, time, shutil def get_image_file_names(): files = glob.glob('**/*.jpg') return files #just in case we'll need them in future) available_drives = (re.findall(r"[A-Z]+:.*$",os.popen("mountvol /").read(),re.MULTILINE)) def sort_photos(): images = get_image_file_names() for image in images: c...
true
b0763a7018678e3748da8c2367d57257d5330fdc
amatlynd/SudokuSolver
/A2/BT.py
UTF-8
2,721
2.890625
3
[]
no_license
from helper import * import time BTStates = [] BTTotal = 0 BTnodes = 0 #used for file writing def BTreset(): global BTStates global BTTotal global BTnodes BTStates = [] BTTotal = 0 BTnodes = 0 #fills board with 1's def initialize_board(num): string_board = "" for i in range(81 - nu...
true
b9c7939db3f70f9e44ee37f547cdf1bd2a5bfe5c
satyam9090/80CP
/3 MaxOfMin.py
UTF-8
659
3.421875
3
[]
no_license
arr = [10, 20, 30, 50, 10, 70, 30] n = len(arr) left = [-1]*(n+1) right = [n]*(n+1) stack = [] for i in range(n): while(len(stack) != 0 and arr[stack[-1]] >= arr[i]): stack.pop() if(len(stack) != 0): left[i] = stack[-1] stack.append(i) stack = [] for i in range(n-1,-1,-1): while(len(stack) != ...
true
fa4ff088e96c014fd9a94410163de659267122cc
imraviagrawal/SHPR2video_git
/helper.py
UTF-8
3,616
2.859375
3
[]
no_license
import pandas as pd import numpy as np import glob import warnings warnings.filterwarnings('ignore') #import matplotlib.pyplot as plt import itertools import numpy as np import statsmodels.api as sm from scipy import stats import seaborn as sns import matplotlib.pyplot as plt # Machine Learning libraries. from sklearn ...
true
af8ff1eff19eab14eebaf7016a8f1c0e2d194064
prottayislive/mini_projects
/madlibs.py
UTF-8
1,346
3.921875
4
[]
no_license
# a madlibs project using string concatenation # taking all possible words for the madlibs adj1 = input("Adjective: ") adj2 = input("Adjective: ") adj3 = input("Adjective: ") adj4 = input("Adjective: ") adj5 = input("Adjective: ") adj6 = input("Adjective: ") adj7 = input("Adjective: ") noun1 = input("Noun: ") ...
true
e90fb533a0477be308566852438c7bf6e7868609
dcdanko/gimmebio
/gimmebio/stat_strains/gimmebio/stat_strains/api.py
UTF-8
5,173
2.828125
3
[ "MIT" ]
permissive
import pandas as pd from multiprocessing import Pool from scipy.spatial.distance import cdist, pdist def entropy_reduce_position_matrix( original, r, metric, min_fill=2, centroids=None, sep=',', logger=None ): """Return an Entropy Reduced version of the input matrix. Return a pandas dataframe wi...
true
60fd4bae685970a35442053a6b484b83c74038d5
srea8/cookbook_python
/designmethon/objectpool.py
UTF-8
2,038
3.546875
4
[]
no_license
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Srea # @Date: 2020-04-25 23:01:28 # @Last Modified by: srea # @Last Modified time: 2020-04-25 23:33:18 #****************************# # 对象池模式, 或者称为对象池服务, 其意图为: 通过循环使用对象, 减少资源在初始化和释放时的昂贵损耗 # 在实际应用中还需要考虑池的最小值、最大值、池化对象状态(若有,重点考虑)、异常处理(如满池情况)等方面,特别是池化对象状态 # 注意:...
true
778508fadf102057ab8462bd4b52b9b037332232
miro-balaz/tctl
/test/bar_union/generator2.py
UTF-8
252
2.875
3
[]
no_license
import random n = 10000 bound = 10000 print(n) for i in range(n): # x0=random.randint(0, bound) y0=random.randint(0, bound) coef=random.randint(0, 1) y1=y0+random.randint(1, bound) if not coef: coef=-1 print(y0,y1,coef)
true
ea6149efe373bb351460a4ac1fae349091ed0f64
muriloviscondi/curso-em-video-python
/ex006 - Dobro, triplo, raiz quadrada.py
UTF-8
281
4
4
[]
no_license
from math import sqrt num = float(input('Digite um numero: ')) doble = num * 2 triple = num * 3 root = sqrt(num) print( 'Analisando numero {}' '\nSeu dobro: {}' '\nSeu triplo: {}' '\nSua raiz quadrada: {:.2f}' .format(num, doble, triple, root) )
true
aaba4475d6c61ce3d9e27e03ebe1cbca745c37ab
rnsdoodi/Programming-CookBook
/Back-End/Databases/PostgreSQL/Python-API/02_insert_data.py
UTF-8
1,035
3.25
3
[ "MIT" ]
permissive
users = [ ("James", 25, "male", "USA"), ("Leila", 32, "female", "France"), ("Brigitte", 35, "female", "England"), ("Mike", 40, "male", "Denmark"), ("Elizabeth", 21, "female", "Canada"), ] user_records = ", ".join(["%s"] * len(users)) insert_query = ( f"INSERT INTO users (name, age, gender, nat...
true
d1bf46f68d03b467d27e7753dde79f23e09914ec
AndroZa0812/python_ml_notebook
/pycharm/Project2/numpy_xcr/slice.py
UTF-8
188
2.65625
3
[]
no_license
import numpy as np a = np.arange(1, 49).reshape(3, 4, 4) """task 1""" print(a[:,1,:2]) """task 2""" print(a[2, 0,:1:-1]) """task 3""" print(a[:, ::-1,0]) """task 4""" print(a[:, ::-1, 0])
true
b5320a31c006d3320dc8e36682931601eeacc2df
seokhwandan/TIL
/python/0119/2027_3.py
UTF-8
140
3.671875
4
[]
no_license
for i in range(5): s = '' for j in range(5): if i == j: s += '#' else: s += '+' print(s)
true
669a26713002b3b184715542ef4d6fa071a2d420
MilkClouds/Ars-Magna_2019
/DCGAN_고양이 이미지 생성/dcgan.py
UTF-8
5,370
2.734375
3
[]
no_license
import keras, os from keras import layers from keras.preprocessing import image import numpy as np import random class class_GAN: def __init__(self, latent_dim, height, width, channels): self.latent_dim = latent_dim self.height = height self.width = width self.channels = channels ...
true
63906ee363266b153e637b2985b56692dcf81cac
sachinshikhare/coding-challanges
/python/DecodeWays.py
UTF-8
750
3.359375
3
[]
no_license
class Solution: def numDecodings(self, s: str) -> int: cache = [0 for _ in range(len(s))] return self.ways(s, 0, len(s), cache) def ways(self, string, index, length, cache): if index >= length: return 1 if cache[index] != 0: print("cache used") ...
true
64eb8aded5018fcd8ae74aa2cc8aa298dfb06c4f
845788173/copy
/python1809/flask/TPP/app/tools.py
UTF-8
689
2.765625
3
[]
no_license
import hashlib import time import uuid # 获取token def get_token(): hash = hashlib.sha512() hash_str = str(uuid.uuid4()) + str(int(time.time())) hash.update(hash_str.encode('utf-8')) return hash.hexdigest() # 密码加密处理 def generate_password(password): hash = hashlib.sha512() hash.update(password.e...
true
ec728481c9192f55d0a88821bf3b434ea85f56ea
karolismatul/BitCollect
/News/scrapeconfig.py
UTF-8
8,082
2.765625
3
[]
no_license
#Predefine xpath selectors for article info we want to scrape here. #These are basically the structure configs for each separate website #Change these in case the website changes; modular, doesn't break anything else #References parsed LXML tree, so just putting it in the loop for now #Need to do if statements, oth...
true
402bc3708c4b5c7f2560841bdb9b40b0e766d1b1
20130353/Leetcode
/target_offer/dfs+bfs+动态规划/背包/背包问题的模板.py
UTF-8
3,339
3.296875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : 背包问题的模板.py # @Author: smx # @Date : 2019/8/19 # @Desc : def knapsack01(n, cost, v, W): dp = [0] * W for i in range(n): for j in range(W - 1, cost[i] - 1, -1): dp[j] = max(dp[j], dp[j - cost[i]] + v[i]) return dp[W - 1] # 完全背包和...
true
b3ba92e7c392ad1900925102f4cc39136e9027f1
JACKHAHA363/translation_game_drift
/ld_research/text/test_dataloaders.py
UTF-8
2,555
2.515625
3
[]
no_license
""" Created by yuchen on 10/28/18 Description: """ import torch from ld_research.settings import EN, FR, DE, BOS_WORD, EOS_WORD from ld_research.text import IWSLTDataset, IWSLTDataloader, Multi30KLoader, Multi30KDataset def test_iwslt(): """ Test iwslt data loader """ dset = IWSLTDataset(src_lang=FR, ...
true
c2852e19c06f7431f5ed675153b401c2142b5d43
lecamit83/btai
/matrixfactorizontion.py
UTF-8
856
2.84375
3
[]
no_license
import numpy def matrix_factorization (R, H, W, K, steps, beta) : step = 0 while (step < steps) : for i in range(0, len(R)): for j in range(0, len(R[0])) : if(R[i][j] > 0) : eij = R[i][j] - numpy.dot(H[i,:], W[:,j]) for k in range(0...
true
c8e75340ccac2d751437a2ffc9f2923d76450f97
lidapang/uvm_agent_gen
/agent_gen.py
UTF-8
4,013
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Walk the template directory and spit out a matching set of files/directories rendered from the templates. """ import argparse import os from jinja2 import Template from jinja2 import Environment, PackageLoader import ConfigParser # Unit testing import unittest # ***************************...
true
391757e8180352cb628c6eba972e4d451c74fb8e
danielnee/discrete_optimization
/facility/solver.py
UTF-8
7,918
2.796875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import pandas as pd import numpy as np from pulp import * from io import StringIO def euclidean_distance(x_1, x_2, y_1, y_2): return np.sqrt( np.square(x_1 - x_2) + np.square(y_1 - y_2) ) def mip_solver(F, C, f, c, s, d, m, n): ### Create Problem/ Solver prob =...
true
013a8e1390ec6d6bc9ee5852607a421e6e84ed41
kb5706/Practise
/choseText.py
UTF-8
682
2.765625
3
[]
no_license
import sys import linecache import random #text_source = 'd:/Harry.txt' #f=open("d:/Harry.txt","r",encoding='gbk', errors='ignore') #f= open("d:/Harry.txt","r",encoding='gbk') #a = random.randrange(1, 547) #1-9中生成随机数 #print (a) #从文件poem.txt中对读取第a行的数据 #theline = linecache.getline(r'd:/Harry.txt', a) #theword = theline...
true
c43a58ab1c12ff921d6c633815ca95c52c4b7fb9
kakainc/Digital-image-processing
/img_threshoud.py
UTF-8
2,298
2.65625
3
[]
no_license
# ---> # Created by liumeiyu on 2020/3/16. # '_' import cv2 import numpy as np import matplotlib.pyplot as plt from graphy import Graph '''图像二值化''' class Binary(Graph): def __init__(self, img_path): super().__init__(img_path) def img_biny_np(self, thrd): img_b = self.copy_img() for ...
true
6ac2fd1505823c22a756040126fa464aeb726505
sdegrace/NorseGame
/game/lib/lib.py
UTF-8
12,071
2.71875
3
[]
no_license
import yaml import pandas as pd import numpy as np from PIL import Image class GameObject: def __init__(self, registered=False, built=False, _registry_lookup=None): self.registered = registered self.registry_lookup = _registry_lookup self.built = built def build(self, game): ...
true
296a86d165777cd86753ff46cc373e90cb6fd0b5
stanCode-Turing-demo/projects
/stanCode_Projects/boggle_game_solver/boggle.py
UTF-8
4,158
4.15625
4
[ "MIT" ]
permissive
""" File: boggle.py Name: Josephine ---------------------------------------- This program can find all words in a 4x4 square grid which input by the user. """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it FILE = 'dictionary.txt' # Global Variables di...
true
f86a9148243000c4076ec0592702897b7d3c61ac
sudhanshu-jha/python
/python3/Python-algorithm/DynamicProgramming/createStack/createStack.py
UTF-8
2,737
3.890625
4
[]
no_license
# Given stack of n boxes, with widths w(i), heights h(i) and # depth d(i). The boxes can only be stacked on top of each other # if each box in the stack is strictly larger than the box above it # in all three dimensions. Find height of tallest possible stack. # Height of stack is the sum of heights of each box. class...
true
7d4503424f928c2e51963005f977166af0a303dd
hautahi/HPC_IM
/analysis/1.gather_results.py
UTF-8
8,009
2.671875
3
[]
no_license
""" This program compiles the results from the various simulation runs """ import pandas as pd import os.path #------------------------- # Construct Loop 1: multicore # ------------------------- def get_results(fname): if os.path.isfile(fname): temp = pd.read_csv(fname) t = temp['t...
true
3060815589adc14204fb906b7c1451d91652bd00
kimi0230/filegen
/filegen.py
UTF-8
1,519
3.40625
3
[]
no_license
#!/usr/bin/env python3 import argparse import os import sys def write_random_data(file, size, progress_callback=None): remaining = size while remaining > 0: n = min(remaining, 2**18) random_data = os.urandom(n) file.write(random_data) remaining = remaining - n ...
true
8ab04dd64c88c048f273302ba21ee4f0e9d87fe8
jcrosskey/design_patterns
/src/patterns/factory.py
UTF-8
9,000
4.0625
4
[]
no_license
""" Factory Pattern (twofer!) The Factory Method Pattern defines an interface for creating an object, but let subclasses "decide" which class to instantiate. Factory Method lets a class defer instantiation to subclasses. The Abstract Factory Pattern provides an interface for creating families of related or dependent ...
true
9aa815d6f15a0ff615d8573cedbb118fe34928b6
mf734/target_offer
/09.用两个栈实现队列.py
UTF-8
596
3.8125
4
[]
no_license
# 两个栈实现队列 class Solution: def __init__(self): # stack1用于push,2用于pop self.stack1 = [] self.stack2 = [] def push(self, node): self.stack1.append(node) # self.stack1.insert(0, node) def pop(self): #如果stack2已经有,直接pop if self.stack2: return self.stack2.pop() #如果stack2没有,而且stack1也没有,直接none ...
true
6ccf4aa6cdbe0419b9be44efa3747fdf87964b98
aaasenin/prob-model-examples
/model2.py
UTF-8
11,636
3
3
[]
no_license
from scipy.signal import fftconvolve import numpy as np def calculate_log_probability(X, F, B, s): """ Calculates log p(X_k|d_k,F,B,s) for all images X_k in X and all possible displacements d_k. Parameters ---------- X : array, shape (H, W, K) K images of size H x W. F : array, sha...
true
37d3eccf33ed15a3158e38a37ef5b7444928009a
shaurya-src/Elementary-ToDo
/ToDo.py
UTF-8
1,553
4.28125
4
[]
no_license
def show_menu(): print('MENU:') print('1. Add a task') print('2. Show To-Do list') print('3. Mark as done') print('4. Exit') def add_tasks(task): with open('data.txt', 'a+') as f: f.write(task) f.write('\n') def show_todo(): with open('data.txt', 'r+') as f...
true
ad233656de224762b457e53f9981c6eb56a50c49
xuanxuan-good/MyCode
/之前做过的/1-quick_sort.py
UTF-8
717
4
4
[]
no_license
''' 双指针实现快排? ''' # 从头到尾遍历数组,大的放在pivot右边,小的放在pivot左边 def quick_sort(begin, end, nums): if begin >= end : return pivot_index = partition(begin, end, nums) quick_sort(begin, pivot_index-1, nums) quick_sort(pivot_index+1, end, nums) def partition(begin, end, nums): pivot = nums[end] mark = ...
true
caf6e24fac1518eeae26957109fd352591041ebf
pointtonull/processfeed
/processfeed.py
UTF-8
8,379
2.6875
3
[]
no_license
#!/usr/bin/env python #-*- coding: UTF-8 -*- """ Very sexy script to process feed using simple rules """ from ConfigParser import SafeConfigParser from optparse import OptionParser import feedparser import logging import os import re import sys try: from collections import OrderedDict except ImportError: ...
true
50c29194f3808fb7917d1d7654f5a994a103c662
n0aaz/Compression_Image
/Python/section8x8.py
UTF-8
2,615
3.453125
3
[]
no_license
import imageio as im import numpy as np #le programme consiste a prolonger un image en recopiant la derniere ligne et la derniere colonne le nombre de fois necessaire pour obtenir un nombre de ligne et un nombre de colonnes multiples de 8. Ensuite, le programmes enregistre sous formes d'images indépendantes tous le...
true
0296156a58ffa0c663f5c851f6a94b900ddcd1fd
huqizhi/pythonLearn
/web/socketServer.py
UTF-8
752
2.828125
3
[]
no_license
import socket import _thread from time import ctime # 为线程定义一个函数 def sockethandle(c,addr, delay): print("创建新线程:",addr) while True: try: data = c.recv(1024).decode() print("收到", addr, ":", data) except: print("客户端",addr,":强制关闭") break if no...
true
f3d3318325090082af1f580f1a0c646791f880c2
Oclean14/delivrone
/Simulator/parametersModel.py
UTF-8
905
2.734375
3
[]
no_license
"""Ce fichier permet de renseigner tous les parametres""" #Aerianspace aerianSpace = [] #Drone numberDrone = 100 averageSpeed = 10 failureFrequency = 0.1 #panne/heure de vol/drone #Station numberStation = 10 batteriesPerStation = 20 chargingTime = 3 #(pourcentage de accumule par minute) changingTime = 60 #(nombre ...
true
147fb0e4d1d88b220ec9622642981f2bc11ca87a
grasshopperTrainer/coding_practice
/baekjoon/accepted/14939 불 끄기.py
UTF-8
993
3.109375
3
[]
no_license
from sys import stdin def solution(board): N = 10 DELTA = ((0, 0), (-1, 0), (1, 0), (0, -1), (0, 1)) OFF, ON = '#', 'O' def turn_switch(x, y, board): for dx, dy in DELTA: nx, ny = x + dx, y + dy if 0 <= nx < N and 0 <= ny < N: board[nx][ny] = ON if boar...
true
d3ef7572e49a3466e69e408b624e9f2d437c617c
sjvrijn/codejam
/2020/1C/B.py
UTF-8
612
3.078125
3
[]
no_license
from collections import Counter T = int(input()) for case in range(1, T+1): N = int(input()) data = sorted((input().strip().split(' ')[1] for _ in range(10000)), key=len) letters = set() for string in data: letters = letters.union(set(string)) if len(letters) == 10: break ...
true
c682bc7f4440c85392cc42eb9585802a9af401b6
mohamedslf/Connected_Garden
/app.py
UTF-8
1,395
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- from flask import Flask, render_template, jsonify import json import requests app = Flask(__name__) API_KEY = "9IAQFSILSKAZUNTC" if API_KEY is None: mkr = "https://api.thingspeak.com/channels/1173906/feeds.json?api_key=PE1R3IX43BN54299&results=120&average=60" else: mkr = "http...
true
55ca63f71cdd565a7917bfc5f01818eac8850c0f
jussikarlgren/canonicals
/canonicalstudy.py
UTF-8
2,850
2.875
3
[]
no_license
import hyperdimensionalsemanticspace from nltk import sent_tokenize from nltk import word_tokenize import simpletextfilereader # for each text # compare polar terms with canonical terms in vector space # establish if polar opposites have systematic correlation with canonical opposites canonicalgood = ["good", "alive"...
true
c30f111e40d41fe827e7c94b840ca440439f9577
Siddie123/Practice-Exercises
/Exp1_PL-2/Task14.py
UTF-8
337
3.359375
3
[]
no_license
p = float((input("enter the principle amount: "))) t = float((input("enter the time period: "))) r = float((input("enter the rate of interest: "))) compound_interest = p * (pow((1 + r / 100), t)) print("") print("principle = ", p) print("rate of interest = ", r) print("time = ", t) print("Compound Interest = ", compou...
true
3718e3d1e8360de3f063e4e7a70d151eb260ad37
RajajiVignan/Foobar-Code
/Level1_i_love_lance_and_janice.py
UTF-8
563
3.765625
4
[]
no_license
def solution(s): #creating a function to extract character out of string def split(word): return [char for char in word] r = split(s) d = '' for i in s: x = i if ord(x) >= 97 and ord(x) <= 122: y = 122 - ord(x) #using ord we get the a...
true
7d35270bc31d66fc2bb692ad6d0acaab1dafcb11
ajaydr16/team-10
/Day5-1.py
UTF-8
180
3.40625
3
[]
no_license
l=[int(x) for x in input('Enter the array of integers sepearated by space:').split()] l.sort() for i in range(0,len(l)-1,2): if l[i]^l[i+1]: print(l[i]) break
true
ca1b7e7dbe1378bff49069c9312e71d084a3d362
Evan-Wang-ch/twitterAnalysis
/paths_statistics.py
UTF-8
1,350
2.921875
3
[]
no_license
#Draw the picture about the coverage of entities in tweet datasets import xlwt import xlrd, sys import matplotlib.pyplot as plt import numpy as np def open_excel(file = '172003.xls'): try: data = xlrd.open_workbook(file) return data except: info = sys.exc_info() print(info[0], "...
true
5bbb4d586ba7c4f105541c141dc19cadd303898a
AlyAssem/Algorithms-and-ProblemSolving
/Candies.py
UTF-8
1,640
4.1875
4
[]
no_license
"""Description""" # The function below must return the minimum number of candies Alice must buy. # candies has the following parameter(s): # n: an integer, the number of children in the class # arr: an array of integers representing the ratings of each student. def give_candies(number_students, students_rate): ...
true
ea0bb6fc05547250c0018556d71e9f123258dbc2
jun-yoshiyoshi/algorithm_python04
/chapter04/code04_6.py
UTF-8
531
3.21875
3
[]
no_license
import time import random from code04_4 import merge_sort from code04_5 import quick_sort from code04_7 import quick2_sort def performance_check(method, data, num=3): s = time.time() for i in range(num): for v in data: method(v) e = time.time() return e - s sample_data = [[random...
true
43451b99f68d63b155eb63c78e28b09a8abadb23
dm-alexi/acmp
/0601_0700/0694/0694.py
UTF-8
183
2.875
3
[]
no_license
with open("input.txt", "r") as f, open("output.txt", "w") as q: f.readline() s = [int(x) for x in f.read().split()] q.write("NO" if max(s[::2]) > min(s[1::2]) else "YES")
true
fdf048b4ed13e8ac2f7f6cf5817640c547266371
cyrilbois/book-python
/good-engineering-practice/src/debugging-docstring.py
UTF-8
743
4.1875
4
[ "MIT" ]
permissive
class Astronaut: """ Nowy astronauta """ def __init__(self, name): self.name = name def say_hello(self, lang='en'): """ wyświetla przywitanie w zalezności od języka >>> Astronaut(name='José Jiménez').say_hello(lang='es') ¡hola José Jiménez! >>> Ast...
true
f12d47aadb3789a8bc2e673064d6f574585a1122
sujithananth/audioreader
/audioreader.py
UTF-8
1,749
3.265625
3
[]
no_license
import pyttsx3 #pyttsx3 is a python module used to generate voices from text import PyPDF2 #module used to reads the pdf file print("1.enter the book name u want with .pdf \n 2.enter 'read' or 'write'\n read = reads the pdf page \n write = copy text into audio as .mp3 file \n 3.enter which page to be read or...
true
b7e3e847712ad6cedd57d8e00fd53dc2eeeb08c2
mrwlwan/workspace
/Python/人才网/tools/simple_copy.py
UTF-8
1,144
2.515625
3
[]
no_license
# coding=utf8 import model import model_old import itertools class CopyProcess: def __init__(self): self.key_map = { # target.key: source.key 'name': 'name', 'code': 'corp_code', 'address': 'addr', 'contact_person': 'contact_person', ...
true
88fdec3d1ee5d5b74ab7b8c679f6bf4adfb489bb
dagtann/learning
/python_da/p4da/ch7.py
UTF-8
419
3.40625
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd data = pd.DataFrame(np.random.rand(7, 5)) data.iloc[:4, 1] = np.nan data.iloc[:2, 2] = np.nan data.fillna({1: 0.5, 2: 1}) data.fillna({1: 0.5}) # NOTE: dict approach fills only stated cols data = pd.Series([1., np.nan, 3.5, np.nan, 7.]) # fill mean of a series data.fillna(dat...
true
39bcb4e92c88f41fb7133844b9cbdd9e40717581
NurFaizin/SDP
/Printing/ex2.py
UTF-8
358
2.796875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Sebuah comment, agar Anda bisa memahami program ini kapanpun. # Apapun setelah # akan diabaikan oleh Python print "I could have code like this." # dan comment setelahnya akan diabaikan # Anda juga bisa menggunakan comment untuk "disable" potongan baris kode # print "Th...
true
95ca9999682e6db79f6cc4a83903414b2c16ae2d
martinsallandm/particle-density
/src/levitador.py
UTF-8
1,060
2.765625
3
[]
no_license
#%% levitador.py import numpy as np import cv2 cap = cv2.VideoCapture('../dataset/levitador/levitador.mov') cv2.namedWindow("frame", cv2.WINDOW_KEEPRATIO) cv2.namedWindow("diff" , cv2.WINDOW_KEEPRATIO) frame_number = 0 while 1: ret, frame = cap.read() if not ret: print("Can't rec...
true
8d7d58db0ec613d925e766a55452a30bfc46c459
takin6/algorithm-practice
/at_coder/abc/old/130/d.py
UTF-8
837
2.671875
3
[]
no_license
N,K = map(int,input().split()) A = list(map(int,input().split())) cumsum = [0] for a in A: cumsum.append(cumsum[-1]+a) res = 0 r = 0 # for i in range(N): # l = i # while r+1 <= N and cumsum[r]-cumsum[l] < K: # r += 1 # if cumsum[r] - cumsum[l] >= K: # res += (N+1) - r sum = 0 right = 0 ...
true
9be50b036f01c3eed669e79db5bda2ed86f5201d
Shunichi09/RNN_practice
/2nd/count_base.py
UTF-8
5,901
3.390625
3
[]
no_license
# RNN基礎学習 # 0から始めるdeeplearning 2 import sys sys.path.append('..') # これで上のディレクトリをpathに追加 import numpy as np from common import ptb from sklearn.utils.extmath import randomized_svd # コーパス作成(要は辞書) # corpus = ['id_1', 'id_2', 'id_1'] のように,テキストのデータ順にidが割り振られらもの! def preprocess(text): # 文字を分割して,単語ごとにid化,さらに単語のidののリストを返す ...
true
3065e495a3912192d4d6a2e9ef99e17992d0edb2
RasanenTapio/OldCompetitions
/eeg/stacking_models.py
UTF-8
5,866
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Forked from: https://www.kaggle.com/karma86/grasp-and-lift-eeg-detection/rf-lda-lr-v2-1/run/41141 @author Ajoo forked from Adam Gągol's script based on Elena Cuoco's """ import numpy as np import time import pandas as pd from scipy.signal import butter, lfilter from sklearn.linear_model i...
true
3d8096bc2e17da4a19b3eabfa5b921069d692fd5
ayusinghi96/CodeChefPrograms
/TSORT(quick sort).py
UTF-8
561
3.171875
3
[]
no_license
def quick(x, first, last): if first < last: pivot = first i = first j = last while i < j: while x[i] <= x [pivot] and i < last: i += 1 while x[j] > x[pivot]: j -= 1 if i < j: x[i],x[j] = x[j],x[i] ...
true
34a55c20303d28136151302d81ccd044617152bb
huangyingw/submissions
/990/990.satisfiability-of-equality-equations.233996715.Accepted.leetcode.py
UTF-8
871
2.8125
3
[]
no_license
class Solution(object): def equationsPossible(self, equations): graph = [[] for _ in range(26)] not_equal = [] for eqn in equations: first, op, second = eqn[0], eqn[1], eqn[3] first, second = ord(first) - ord("a"), ord(second) - ord("a") if op == "=": ...
true
0eb0f97a6ac97d52cddbe7a7497f5a32ebb4982b
BoltedLabs/beegees
/bins/beegees
UTF-8
6,721
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ PyBeeGees: quickly change your background. -------------------- Features: - Change background image when script is invoked - Set location and option to download backgrounds of pybeegees site """ import subprocess import os import random import sys import click import logging logging.basicCon...
true
dc487fa3a0b84a4bd58136bfe4a1cce87fcfdb57
shivaji50/PYTHON
/Program66.py
UTF-8
241
3.71875
4
[]
no_license
# A Program to know the effect of copy() method from numpy import * a=arange(1,6) b=a.copy() print("Original array:",a) print("New array:",b) b[0]=99 print("After modification") print("Original array:",a) print("New array:",b)
true
38c88f9ba0ef3cfe3d47f63c0923af2e16dff7b3
alu-rwa-dsa/summative-linda_david_caleb
/High_Fidelity/module/__init__.py
UTF-8
16,081
3.171875
3
[]
no_license
from snake_game_GUI import SnakeGameGUI import pygame import time import random import numpy as np rand = random.Random() class SnakeGameAI(SnakeGameGUI): def __init__(self, headless_mode=False): super().__init__(headless_mode) self.reverse = 1 # flag to allow snake to alternate directions ...
true