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
f573039b2746a63b91cfe450d5ddfb966818e2eb
Aissen-Li/LeetCode
/113.pathSum.py
UTF-8
700
3.140625
3
[]
no_license
from typing import List # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: def dfs(path, res, target, node): if no...
true
baf2f9988dff1bc922906e59d40fe3872fb0a9b4
EdoardoDone/birthdays
/csv_function.py
UTF-8
187
2.84375
3
[]
no_license
import csv from mypackage.birthdays import birthdays with open('birthdays.csv', 'wb') as f: writer = csv.writer(f) for row in birthdays.iteritems(): writer.writerow(row)
true
9c17112bfaef470bb70ad8cd8cd6fe740aba905d
shi0524/algorithmbasic2020_python
/Python2/class19/Code03_StickersToSpellWord.py
UTF-8
3,942
3.515625
4
[]
no_license
# -*- coding: utf-8 –*- """ 691. 贴纸拼词 我们给出了 N 种不同类型的贴纸。每个贴纸上都有一个小写的英文单词。 你希望从自己的贴纸集合中裁剪单个字母并重新排列它们,从而拼写出给定的目标字符串 target。 如果你愿意的话,你可以不止一次地使用每一张贴纸,而且每一张贴纸的数量都是无限的。 拼出目标 target 所需的最小贴纸数量是多少?如果任务不可能,则返回 -1。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/stickers-to-spell-word """ from collections import defaultdic...
true
e48286f1dc58b343866fb8b83e1de952d811279b
lukaszamora/Generative-Art
/seaCreature.pyde
UTF-8
1,341
3
3
[]
no_license
from random import choice, randint def pCreature(tSize, step, sca, offset): for i in range(0,tSize + step, step): for j in range(0, tSize + step, step): x = round(map(noise(i*sca, j*sca), 0, 1, -offset, offset)) y = round(map(noise(j*sca, i*sca), 0, 1, -offset, offset)) ...
true
fde82dfca45c55a88038e3629f05aec69543d34e
wenxin615/How-to-Think-Like-a-Computer-Scientist-Python---Solutions
/7.10 Exercises Q3.py
UTF-8
242
2.96875
3
[]
no_license
with open('readme.txt','r') as f, open('readmecopy.txt','w') as copy: counter = 0 for line in f: counter += 1 #counters = str(counter) copy.write("{0:04d}".format(counter)+" "+line+"\n")
true
3494e61bd1f0636f90f8e61ec19b7b889e4b1416
sagarnikam123/learnNPractice
/hackerRank/tracks/languages/python/3_strings/13_theMinionGame.py
UTF-8
2,014
4.40625
4
[ "MIT" ]
permissive
# The Minion Game ####################################################################################################################### # # Kevin and Stuart want to play the 'The Minion Game'. # # Game Rules # # Both players are given the same string S. # Both players have to make substrings using the letter...
true
d8d7428564d0bb2dceba759058c5e9424b04aebe
lioralehrer/appleseeds
/week11/from client to DB/list-of-actors-name/insert.py
UTF-8
1,100
2.8125
3
[]
no_license
import pymysql import json my_actors=[ {'id': 85008898, 'full_name': 'Butch Wilhelm', 'gender': 'M'}, {'id': 85009098, 'full_name': 'Celia Fushille-Burke', 'gender': 'M'}, {'id': '1', 'full_name': 'Richard Gear', 'gender': 'M'}, {'id': '2', 'full_name': 'Simon Pegg', 'gender': 'F'}, {'id': '3', 'full_name': 'lev le...
true
bb5f1965d2f591dc8f6a2d28ba3cde66f5c6ca6d
ajmalbinnizam/crossroads
/crossroadspython/ex.py
UTF-8
155
3.390625
3
[]
no_license
print('It\'s a bad string!') a=int(input("your number")) b=input() c=10 sum1=a+int(b) print("result is" , sum1) print("result is "+str(sum1))
true
eefa4573c71d60d27c6b0f0d377b0eb904d242b6
swq19930922/practice
/practice/Algorithm/DrawRepeat.py
UTF-8
685
3.921875
4
[]
no_license
def draw_repeat(strs): '''字符串去重,修改多少次可以使相邻字符不重复''' lenth = len(strs) count = 0 swap = False # 默认未修改 i = 1 while i < lenth: if strs[i] == strs[i-1] and not swap: # 若与前一个元素相等且未修改,则计数加1,swap = True count += 1 swap = True else: swap ...
true
cdf56728d81fa69de66fe7d45683538426365443
sktime/sktime
/sktime/transformations/series/holiday/country_holidays.py
UTF-8
6,260
3.046875
3
[ "BSD-3-Clause" ]
permissive
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Implements transformer to add binary column based on country holidays.""" import pandas from sktime.transformations.base import BaseTransformer __author__ = ["yarnabrina"] class CountryHolidaysTransformer(BaseTransformer): """Country Hol...
true
cabc22ee2ffaa1e0ece8526087cad6b012c73fd3
900914/TIL
/ML/lightGBM_basic_regression.py
UTF-8
1,789
2.875
3
[]
no_license
# 回帰問題 import lightgbm as lgb from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error import numpy as np import matplotlib.pyplot as plt import optuna from optuna.integration import lightgbm_tuner def main(): # load dataset boston = ...
true
823b95145d9ad509bac8f6a7fda9485dfefea062
anzemur/smart-snake
/q_learning_algorithm/snake_agent.py
UTF-8
8,194
3.03125
3
[ "MIT" ]
permissive
from copy import copy from random import randint, random #Actions FORWARD = 0 LEFT = 1 RIGHT = 2 class snakeAgent(): learingRate = 0.1 discountFactor = 0.8 greedyEpsilon = 1 QTable = {} # Get current state of the agent. def getState(self, player, apple, game): # State is an array of values: # cle...
true
6c84429c8ff6d940fbeb1913324fa8a3b0ac88a6
jut4eva/led-controller
/bin/led_control_classes/get_build_status.py
UTF-8
1,071
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # Gets the build status of specific Bamboo builds from Jut's Bamboo instance import requests # The list of builds we're interested in builds = ["CAM-AMT", "CAM-CMT","CAM-SMOKE","CAM-IMT","CAM-QUAM","CAM-JUM","CAM-VIM","CAM-EAM","CAM-SMT"] #builds = ["CAM-PMT"] build_results = [] # Get the stat...
true
30b4dd8a32de6a1c6791890cc63511e671509462
I7RANK/holbertonschool-higher_level_programming
/0x0B-python-input_output/3-write_file.py
UTF-8
297
3.40625
3
[]
no_license
#!/usr/bin/python3 """ this module contains the write_file function """ def write_file(filename="", text=""): """ writes a text in a file and return the number of lines written """ num_lines = 0 with open(filename, 'w') as fl: num_lines = fl.write(text) return num_lines
true
d99dcc5d9f2c63c0e0f9aae3d0557f863420ca67
fifthace63/Weather
/weather/BlackJack.py
UTF-8
5,010
3.90625
4
[]
no_license
# from random import randint # from IPython.display import clear_output # # create the blackjack class, which will hold all game methods and attributes # class Blackjack(): # def __init__(self): # self.deck = [] # set to an empty list # self.suits = ("Spades", "Hearts", "Diamonds", "Clubs") # ...
true
8d4bedeb5599d9d12c5870331a5cac90eac77467
tiginamaria/crypto
/hw5/a5.py
UTF-8
2,592
3.15625
3
[]
no_license
from crypt_utils import int_to_bits, text_to_bits, bits_to_text class A5: def __init__(self): self.r1, self.r2, self.r3 = None, None, None def encrypt(self, key, text): return self._crypt(key, text) def decrypt(self, key, text): return self._crypt(key, text) def _crypt(self...
true
81e5c0d039eaa3d55f9c3c136f3c54034ba5ac7d
ClownLi/Clownli-python-bio
/Evaluate_Assembly/evaluate_assembly_gene.py
UTF-8
3,204
2.765625
3
[]
no_license
import re import os import argparse from Bio import SeqIO from Bio.Seq import Seq from collections import OrderedDict from Bio.Alphabet import IUPAC Gene_all = [] GeneSeq_length = [] def get_AllGene_length(file): GeneDict = OrderedDict() re_name = [] result = [] for seq_record in SeqIO.parse(file,"fas...
true
45426ddbedc1f302160a9afe49360d4ac55573a6
Roberto09/Python-Para-MAEs-3-Sesiones
/Sesion2.py
UTF-8
4,173
4.25
4
[]
no_license
def main(): # 6.1 Estatutos de repetición para programación iterativa. # For Loops n = 10 # range(start, end, increment) donde se itera en el rango [start, end) # valores por default: range(start = 0, end, increment = 1) for i in range(0, n, 1): print(i) # Se simplifi...
true
98a51c90d59457a42fa6c06cf1cde7bb01d81254
TimVan1596/ACM-ICPC
/python/deep_learning/TensorFlow/第4章 TensorFlow基础/4.9 数学运算.py
UTF-8
1,983
3.6875
4
[ "Apache-2.0" ]
permissive
import os os.environ['TF_CPP_MIN_LEVEL_LOG'] = '1' import tensorflow as tf if __name__ == '__main__': ### 4.9 数学运算 ##### 4.9.1 加、减、乘、除运算 # 分别通过tf.add, tf.subtract, tf.multiply,tf.divide函数实现, # TensorFlow已经重载了 +、 − 、 ∗ 、 / 运算符(推荐) # a = tf.range(5) # b = tf.constant(2) # print(a % b) ##...
true
654307a5545adf552ddddae3b5b68fda7aac1d7e
mhee4321/python_basic
/chapter08_function/8-7.function_scope.py
UTF-8
251
2.953125
3
[]
no_license
def my_func(): print(param) param = 'Modified by my_func' print(id(param)) #함수 밖에서 선언한 변수이므로 전역변수(Global Variable)이다. param = 'Create from outside' my_func() print(param) print(id(param))
true
a326924349ab2df67fba8c5654efb35c9abeaa1f
camvaz/PyScheduler
/file2.py
UTF-8
992
2.609375
3
[]
no_license
class Process: def __init__(self, lle, exe, pri, nram): self.llegada = lle; self.ejecucion = exe; self.prioridad = pri; self.ram = nram; self.espera = 0; class Scheduler: __pids = {} __queue = [] def __init__(self, args): # for i in range(arg...
true
1e7a73f5f6df5aeb79875ea7e59d3db66bd1ac76
PatrickKutch/minioncontainers
/collectd/ContainerLauncher.py
UTF-8
1,110
2.65625
3
[ "Apache-2.0" ]
permissive
import argparse import subprocess import os def main(): parser = argparse.ArgumentParser(description='Minion Launcher.') parser.add_argument("-o","--oscar",help='specifies the IP:PORT of target Oscar',required=True,type=str) parser.add_argument("-n","--namespace", help="Namespace for collectors",required=T...
true
f12c453c7d145b5c9f4cd90fc2fa072d9afb3459
titus-ong/chordparser
/src/chordparser/music/quality.py
UTF-8
7,894
3.046875
3
[ "MIT" ]
permissive
class Quality: """A class representing the quality of a `Chord`. The `Quality` class composes of its base `Chord` quality, extensions to the `Chord`, and optional flats on the extended `Note`. Parameters ---------- quality_str : str The `Quality`'s notation. ext_str : str, Optional ...
true
c16b47143a04a9162aaaff198c2292e88ac98f5a
spellex/Python_Learning
/09_functions/task_9_3.py
UTF-8
2,245
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- ''' Задание 9.3 Создать функцию get_int_vlan_map, которая обрабатывает конфигурационный файл коммутатора и возвращает кортеж из двух словарей: * словарь портов в режиме access, где ключи номера портов, а значения access VLAN: {'FastEthernet0/12': 10, 'FastEthernet0/14': 11, 'FastEthernet0/16'...
true
14b5b5b2494fcbfdb79ec2c8a4b60891b5cfd13d
janiaaltonen/hangman-game
/classifier.py
UTF-8
4,639
3.296875
3
[]
no_license
class Classifier: """Class has (at least) one problem: when more than object are created from class, duplicate words are written to files. e.g. file 'expert.txt' has 2 times same words if 2 objects are created and so on. Now no time to fix this bug but in next version will be fixed if needed further. ...
true
d52263b9157b6ddc7f6e9287896066bfd0e63a46
gaurav9926/Mario-Game
/Enemy.py
UTF-8
423
3.34375
3
[]
no_license
from mario import * class Enemy1(): def __init__(self,x): self.x = x def printEnemy(self,arr,x): arr[33][x] = 'E' arr[33][x+1] = 'E' return arr def deleteEnemy(self,arr): arr[33][self.x] = ' ' arr[33][self.x+1] = ' ' return arr def moveEnemy(self,arr): if arr[33][self.x-1] == ' ': self.deleteEnem...
true
690f5f2a07015a32e67b7880a3ef33791ff71283
LordHades13/MCMCSimulations
/unchargeddiffusion.py
UTF-8
4,269
3.359375
3
[]
no_license
# 2D gas diffusion using Metropolis-Hastings Algorithm import random import matplotlib.pyplot as plt from math import e, pi def ljpotential(sigma, epsilon, r): # Lennard Jones potential A = 4*epsilon*(sigma**12) B = 4*epsilon*(sigma**6) V = (A/(r**12)) - (B/(r**6)) return V def...
true
5d6c7321317496b607b6613d4bffc2e57174ff2e
rahulmahajan01/flask_test01
/app.py
UTF-8
373
2.8125
3
[]
no_license
import datetime from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html', variable="Rahul", var= False) @app.route('/<name1>') def name(name1): now=datetime.datetime.now() return f'<h1>Hello! {name1}<br> {now.day} - {now.month} - {now.year}<br...
true
9d6059e13556bf98a2c2db30e4630597b04199a9
Spycro/pyCharmTraining
/myProject/fermatTheorem.py
UTF-8
293
3
3
[]
no_license
def check_fermat(a,b,c,n): sum1 = pow(a,n) + pow(b,n) sum2 = pow (c,n) if n>2 and sum1 == sum2 : print("Fermat was Wrong") else: print("no probleme here") a = int(input("a")) b = int(input("b")) c = int(input("c")) n = int(input("n")) check_fermat(a,b,c,n)
true
361ea67eaf47a9efc5f8f7365e046cfcb2fb449f
Vinitpal/devsnest-dsa-problems
/day10/world_record.py
UTF-8
281
3.15625
3
[]
no_license
# cook your dish here T = int(input()) for i in range(T): k1, k2, k3, v = list(map(float, input().split())) win = 9.58 v2 = k1*k2*k3*v v3 = 100/v2 nV = round(v3,2) if nV < win: print("Yes") else: print("No")
true
c8ead747345c39e19037282c85876094793d6f82
bdjackson/Thesis
/scripts/plot_page_numbers.py
UTF-8
6,444
3.0625
3
[]
no_license
import matplotlib.pyplot as plt import pandas import datetime import time ## ----------------------------------------------------------------------------- # read the page numbers file into a data frame page_number_file_name = 'PageNumbers.md' page_number_df = pandas.DataFrame.from_csv(page_number_file_name, ...
true
82b9b97e502c264509ea24cba1eb736bd0d6009e
cloudmesh-community/fa19-516-170
/cloudmesh-exercises/cloudmesh-common-2.py
UTF-8
238
2.828125
3
[ "Apache-2.0" ]
permissive
# fa19-516-170 E.Cloudmesh.Common.2 from cloudmesh.common.dotdict import dotdict color = {"red": 255, "blue": 255, "green": 255, "alpha": 0} color = dotdict(color) print("A RGB color: ", color.red, color.blue, color.green, color.alpha)
true
580e0028745c0d844906feef6df1f9a722b510ee
zarcs95/nn_code
/nn_iris.py
UTF-8
3,956
3.171875
3
[]
no_license
import tensorflow as tf import numpy as np # Translate a list of labels into an array of 0's and one 1. # i.e.: 4 -> [0,0,0,0,1,0,0,0,0,0] def one_hot(x, n): """ :param x: label (int) :param n: number of bits :return: one hot code """ if type(x) == list: x = np.array(x) x = x.flatt...
true
f5b5a6b1f3c7901f86ad182567d6edce90dbfc4e
kongil/MachineLearning
/Tensorflow2/tensroflow2_1_matmul.py
UTF-8
982
2.921875
3
[]
no_license
import tensorflow as tf import numpy as np loaded_data = np.loadtxt('./data-01.csv', delimiter=',') x_data = loaded_data[:, 0:-1] t_data = loaded_data[:, [-1]] print("x_data.shape = ", x_data.shape) print("t_data.shape = ", t_data.shape) W = tf.Variable(tf.random_normal([3, 1])) b = tf.Variable(tf.random_normal([1]...
true
7763194b4dc60ef435dffc5b294496d27167287e
robdobsn/RobotPlay2048
/Tests/TestCameraCaptureSpeeds/TestCameraFromVideoPort.py
UTF-8
978
3.015625
3
[ "MIT" ]
permissive
import picamera import cv2 import io import numpy as np import time def captureImage(camera): # saving the picture to an in-program stream rather than a file stream = io.BytesIO() # capture into stream camera.capture(stream, format='jpeg', use_video_port=True) # convert image into numpy array ...
true
b418ec8d1ae62924b62e6daf2e659be99f281a0c
Abhijeeth-7/Algorithms
/Dijkstra's.py
UTF-8
1,932
3.25
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 22:24:35 2020 @author: kanch """ import sys def getPath(dest,path): if path[dest] is None: print(dest,end='->') return getPath(path[dest],path) print(dest,end='->') def Dijikstra(V,source,dest): considered=[0]*V ...
true
90f9ccd7db1904f8e364969579337e71b15c5322
kimje0322/Algorithm
/백트래킹/BJ1182. 부분수열의 합.py
UTF-8
389
2.625
3
[]
no_license
N, S = map(int, input().split()) data = list(map(int, input().split())) cnt = 0 selected = [0]*N def backtraking(idx,sumV): global cnt if idx >= N: if sumV == S: cnt += 1 return selected[idx] = 1 backtraking(idx+1, sumV+data[idx]) selected[idx] = 0 backtraking(idx+1,...
true
0e3aae2f48c788075c7f42698b494e28ee9e1cd8
TESTUDENT101exe/CompSciHW
/Openning files/file.py
UTF-8
608
3.640625
4
[]
no_license
# open('TXT file', 'r'="read") # .strip()=Removes part at the end of the string # .split()=split when a certain Character appears #V1 '''f=open('Something.txt', 'r') lines=[] for line in f.readlines(): print(line.strip()) line=line.strip().split() line=tuple(line) lines.append(line) f.close...
true
adf4ddd6381cf8c857f16b7d6d5120376f5c9d5c
8BitJustin/2020-Python-Crash-Course
/Chapter 3/3-3 Your_Own_List.py
UTF-8
237
2.84375
3
[]
no_license
cars = ["WRX", "STI", "S209", "TypeRA"] message = "One of the cool sports cars that Subaru has created is, the " print(message + cars[0] + ".") print(message + cars[1] + ".") print(message + cars[2] + ".") print(message + cars[3] + ".")
true
6980a1483e923263b1ef30d194a471e47a63f426
MatthewGoff/CodeNames
/src/networking/messaging/sm_overwrite_cards.py
UTF-8
1,523
3.140625
3
[]
no_license
from networking.messaging.messaging_constants import MessagingConstants from networking.messaging.message import Message from game.card import Card class SMOverwriteCards(Message): def __init__(self, cards): self.cards = cards def serialize(self): byte_array = b"" byte_array += MessagingConstants.SM_OVERWR...
true
455fd51a6283b644fa9d7625929c124a56d23a0d
kevinliu726/2020ML
/hw4/main.py
UTF-8
2,688
2.53125
3
[]
no_license
import os import sys import torch import random import argparse import numpy as np from torch import nn from gensim.models import word2vec from sklearn.model_selection import train_test_split from utils import load_training_data, evaluation from preprocess import Preprocess from model import LSTM_Net from data import T...
true
3025f34a5ec8506955d260bb5940f090223f82bf
kingbj940429/Coding_Test_Solution
/beak_joon/b_1012.py
UTF-8
888
3.46875
3
[]
no_license
'''1012 유기농 배추 ''' import sys sys.setrecursionlimit(10**9) def init_graph(graph, K): for i in range(K): m, n = map(int,input().split()) graph[n][m] = 1 return graph def dfs(x,y): if x<0 or x>=N or y<0 or y>=M: return False #배추가 심어져있을때 if graph[x][y] == 1 : ...
true
826ca2c8e56983984146ec189993584e722f534f
Cangerana/estrutura-de-dados-II
/avl_tree/tree.py
UTF-8
6,605
3.796875
4
[]
no_license
from node import Node class AVLTree: def __init__(self, value=None): self.root = Node(value) if value else None def is_empty(self): return not bool(self.root) def in_order(self): return print('Tree is empty!') if self.is_empty() else self._in_order(self.root) def pre_ordem(s...
true
b5734c148c007107ea50a00f3a862d71b2ea4d52
LeRoiFou/codemy_excel
/006_changedCell.py
UTF-8
818
4.03125
4
[]
no_license
""" Excel et python Dans ce programme on charge un classeur Excel, on change les données d'une cellule et on enregistre le fichier Excel Éditeur : Laurent REYNAUD Date : 28-01-2021 """ from openpyxl.workbook import workbook # création d'une classeur Excel from openpyxl import load_workbook # chargement d...
true
1ed79216f38d0d93302356180e8d4ca871fa938b
sadiesbens/ControlTool
/GUI.py
UTF-8
4,045
2.703125
3
[]
no_license
import maya.cmds as cmds '''Mercedes James This program will create a GUI called create controls that will have 2 buttons that will create IK or FK controls on selected joints The FK button will place a self grouped control on each selected joint. The control and the group will have frozen transformations ...
true
d2db52201fd1d10324d25bf28e2efe41da3cef0b
Computational-Mathematics-Research/math-labs
/math-lab5/main.py
UTF-8
7,867
3.390625
3
[]
no_license
# Лабораторная работа #5 (19) # @ Свиридов Дмитрий, PЗ213 import numpy as np import matplotlib.pyplot as plt from math import sin, sqrt, factorial def lagrange_polynomial(dots, x): """ Многочлен Лагранжа """ result = 0 n = len(dots) for i in range(n): c1 = c2 = 1 for j in range(n): ...
true
aef02422653e80eebd1ce12f994b4501df058076
Felix-xilef/Curso-de-Python
/Desafios/Desafio89.py
UTF-8
1,625
3.46875
3
[ "MIT" ]
permissive
from os import system from auxiliar import receberInt system('title Administrador de Notas') alunos = list() notas = list() while True: system('cls') op = receberInt(f""" \t +{'-' * 24}+ \t | Administrador de Notas | \t +{'-' * 24}+ \t | 1 - Adicionar aluno | \t | 2 - Boletim geral ...
true
2822bfdfc9baea5b8ef4749c02cabb10e4064fcb
runtothedevil/lab
/MASSandFAQ/FAQ/10.py
UTF-8
165
3.109375
3
[]
no_license
def a(mass): seen = set() seen_add = seen.add return [x for x in mass if not (x in seen or seen_add(x))] mass=[4,7,6,1,7,5,5,1,2,4,6] print(a(mass))
true
4f093743e95531bd3e6178d791ea89c0f0b7ae3b
KamilJed/WorldSim-Python
/WorldSim/Organisms/Plants/Dandelion.py
UTF-8
558
2.71875
3
[]
no_license
from WorldSim.Organisms.Plants.Plant import Plant class Dandelion(Plant): __pollinationChance = 3 def __init__(self, x, y, world, strength=None): super().__init__(x, y, world, strength) self._initiative = 0 if strength is None: self._strength = 0 self._color = "ye...
true
6c3b253252a329433b5ea6b4ea4268d1f47dc8e7
bryson0083/py_test
/20171030-02.py
UTF-8
276
2.53125
3
[]
no_license
import multiprocessing import time def f(): print("In f") while True: for pass def g(): print("In g") if __name__ == '__main__': functions = {'f': f, 'g': g} func_name = 'f' multiprocessing.Process(target=functions.get(func_name), args=()).start()
true
11948dcb3c61f6a7ffd846cbf887b4cc4269cdf2
jskDr/tictactoe
/code_old/locallib.py
UTF-8
197
2.984375
3
[ "MIT" ]
permissive
def input_default_with(str, defalut_value, dtype=int): answer = input(str+f"[default={defalut_value}] ") if answer == '': return defalut_value else: return dtype(answer)
true
3e71b8c7df18256e4f734be2922c565b3f853660
RayTizocMartinez/Python_lessons
/working_with_loops.py
UTF-8
600
4.3125
4
[]
no_license
done = False people = [] while not done: name = input('what your name is: ') if not name: done = True else: color = input("whats your favorite color: ") age = input("how old are you: ") question = input('do you want to add someone else: ' ) if question == 'no': d...
true
0a5e7056443aac5be8625376dc140b6ba7396c38
lyz21/MachineLearning
/GA/test.py
UTF-8
863
3.640625
4
[]
no_license
# encoding=utf-8 """ Name: test Description: Author: LiuYanZhe Date: 2019/11/28 """ import random import math def test1(): for i in range(30): i = random.randint(1, 2) print(i) # 1 ,2 def test2(): i = 0 while True: print(i) i += 1 if i == ...
true
8e95f4352b2bcbf4650f00796affb6891673a5e1
AlefAlencar/python-estudos
/python_curso-em-video_guanabara/Mundo 2/a12_ex038.py
UTF-8
586
4.53125
5
[]
no_license
# COMPARANDO NÚMEROS # LEIA: dois números inteiros. # Compare-os. # RETORNE: O primeiro valor é maior; # O segundo valor é maior; # Não existe valor maior, os dois são iguais. print('COMPARANDO NÚMEROS') n1 = int(input('Digite o primeiro número inteiro: ')) n2 = int(input('Digite o segundo número inteiro: ')) if n1 ==...
true
856d87f09a729f30a886db71d983d7491fb5350b
DittoPythonDev/DittoPythonDev
/Nesting2.py
UTF-8
815
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 6 13:52:18 2021 @author: Prince """ #Nesting2 davlatlar = { "Ispaniya" : { "poytaxt" : "Madrid" , "hududi" : "329750 km.kv" , "aholisi" : "15456781 mln " } , "Uzbekistan"...
true
110cfa91f68b7225dd1a8a22a11c6aa7c743c07f
bds01/SparkScala
/CodeFiles/Python/SimpleApp.py
UTF-8
540
2.671875
3
[]
no_license
"""SimpleApp.py""" from pyspark.sql import SparkSession logFile = "hdfs://sandbox-hdp.hortonworks.com:8020/user/spark/contents.txt" # Should be some file on your system spark = SparkSession.builder.appName("SimpleApp").getOrCreate() logData = spark.read.text(logFile).cache() numAs = logData.filter(logData.value.cont...
true
60cc0124000e82fdfbbed373582ff0a3495ac6c7
ALittleRunaway/Deep_Learning
/Chapter 4/error_4.1_71.py
UTF-8
155
3.3125
3
[]
no_license
"""Compare""" knob_weight = 0.5 input = 0.5 goal_pred = 0.8 pred = input * knob_weight print(pred) error = (pred - goal_pred) ** 2 print(round(error, 3))
true
3503308134aa2c34b5e0f009621c0f12886cf90c
multics69/danbi
/scripts/colmerge.py
UTF-8
918
3.046875
3
[]
no_license
#!/usr/bin/python import sys def colmerge(outfile, sidx, eidx): # open file and read lines outf = open(outfile, 'w') inf=[0]*eidx infl=[0]*eidx for fi in range(sidx, eidx, 1): inf[fi] = open(sys.argv[fi]) infl[fi] = inf[fi].readlines() # extract column from the input file for li in range(len(infl[sidx])):...
true
5cde8a239812f5d00dd95c5d9a011669cf191a03
kaphys/Variational-Quantum-Monte-Carlo
/Functions/metropolis.py
UTF-8
2,297
3
3
[]
no_license
import numpy as np def metropolis_algorithm(function, N_tries, N_walkers, D): """ This function performs the metroplolis algorithm for important sampling. it sets N number of walkers in a random position It makes a random trail move. The trail function is evauluted at the new configuration and its ratio s...
true
fda06e4626487165e13c791e21150ee19deb189b
maralla/completor-neosnippet
/pythonx/completor_neosnippet.py
UTF-8
1,285
2.515625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import logging from completor import Completor, vim _cache = {} logger = logging.getLogger('completor') class Neosnippet(Completor): filetype = 'neosnippet' sync = True @staticmethod def _get_snippets(): get_snippets = vim.Function( 'neosnippet#helpers#g...
true
f2e29a03d61a04c21acadd0207426bccf8785e58
Introduction-to-Programming-OSOWSKI/2-8-diff21-ZachHill21
/main.py
UTF-8
75
2.90625
3
[]
no_license
def Diff21(n): return 21-n if n < 22 else 2*(n-21) print (Diff21(10))
true
dc3249db33154dac5949d50c663280baa8158286
floatingshed/meats
/opencv_py/showimg.py
UTF-8
3,072
2.828125
3
[]
no_license
#!/usr/bin/env python from __future__ import print_function import argparse import glob import os import sys import time import cv2 import numpy as np try: from tqdm import tqdm except ImportError: tqdm = lambda x: x tqdm.write = print def mse(img1, img2): return np.average((img1 - img2) ** 2) d...
true
99a188dcab6cd2f8fb1fe5e88ba4300513607740
Mohdyusuf786/Canny-edge-detection
/canny.py
UTF-8
192
2.59375
3
[]
no_license
import cv2 img=cv2.inread('village.png') #now detect canny edge canny=cv2.Canny(img, 200, 255) cv2.imshow("original",img) cv2.inshow("canny",canny) cv2.waitKey(0) cv2.destroyAllWindows()
true
af8cbbc940c4933b61cb998d791b5033daf477a3
nikitatarasenko17/homework
/Lesson_7/Lection_7.py
UTF-8
225
2.875
3
[]
no_license
with open('E:/A-Level/Лекции/text_5_3.txt', 'r') as file: int_number = file.read() listToStr = ''.join(map(str, int_number)) t = list(listToStr) print(dict(map(lambda x : (x , list(t).count(x)) , t)))
true
ca56063c24d11a4f6d594fd54fdb46c047f26334
ItsMeMegaMind/HackerRank
/Algorithm/Implementation/Cavity Map/Cavity Map.py
UTF-8
665
2.953125
3
[]
no_license
#!/bin/python3 import math import os import random import re import sys # Complete the cavityMap function below. def cavityMap(grid): for i in range(1, len(grid) - 1): for j in range(1, len(grid[0]) - 1): if grid[i][j] > grid[i + 1][j] and grid[i][j] > grid[i][j + 1] and grid[i][j] > grid[i - ...
true
d690c8d16b4b097ffffbd4d66ac6e6be423feb82
kcp18/Diagnose-Your-Browser
/Domain.py
UTF-8
1,658
3.234375
3
[]
no_license
""" Created on Sun Jun 10 08:33:07 2018 @author: kcp """ from urllib.parse import urlparse def get_domain_dictionary(browser_history_list): d_dictionary = dict() for domain_data in browser_history_list: # in tuple netloc_name = _get_netloc(domain_data[0]) if netloc_name not in d_dictiona...
true
06a803be2855b7c34a15730ea1999e73de5d458a
imranali18/Edifytech-C-
/CS1010Fall2019-master/Homeworks/Homework 2/HW2Q4.py
UTF-8
223
3.296875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 20 16:06:40 2019 @author: uzma """ str1=str(input('Input the string ')) char = str1[0] str1 = str1.replace(char, '&') str1 = char + str1[1:] print(str1)
true
7a1d2ec468c9ba6cef82c3bff8a06c3a7d587a45
daria19-meet/meet2017y1lab3
/sarah.py
UTF-8
102
3.03125
3
[ "MIT" ]
permissive
import turtle #Draw S turtle.penup() turtle.goto(-300,-100) turtle.pendown() turtle.goto(-200,-100)
true
c1ffa9dca9b5d4389f7ba75d0b4ba7bda368257a
yanzongzhen/python-
/面向对象(2)/测试运行时间.py
UTF-8
346
2.796875
3
[]
no_license
import time def run_time(func): def new_fun(*args,**kwargs): t0 = time.time() print('star time: %s'%(time.strftime('%x',time.localtime())) ) back = func(*args) print('end time: %s'%(time.strftime('%x',time.localtime())) ) print('run time: %s'%(time.time() - t0)) retur...
true
83599c961453c1e37f9a2bbbc7201cf92bd1038a
Saipranany/LeetCode-practice-problems
/Rotate_image.py
UTF-8
1,134
3.9375
4
[]
no_license
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. """ # col_1[::-1] -> row_1 # col_2[::-1] -> row_2 # ... # col_n[::-1] -> row_n ''' ...
true
267bda983bf6d015ff7116b0c3382319a5d3d2d0
lz023231/CX.PY
/遍历/递归.py
UTF-8
650
4.3125
4
[]
no_license
''' 递归调用:,一个函数调用了自身,成为递归调用 递归函数:一个会调用自身的函数成为递归函数 凡是循环能干的事,递归都能干 ''' ''' 方式: 1、写出临界条件 2、找这一次和上一次的关系 3、假设当前函数已经能用,调用自身计算上一次的结果,再求出本次的结果 ''' #输入一个数,求和 def sum1(n): #循环 sum = 0 for x in range(1,n +1): sum += x return sum res = sum1(5) print("res =", res) def sum2(n): if n == 1: return 1...
true
93548d3c119dabb5b32d41635a7371cbd0e1950f
openlegaldata/legal-reference-extraction
/refex/tests/test_law_extractor.py
UTF-8
16,770
2.84375
3
[ "MIT" ]
permissive
import os import re from unittest import skip from refex.extractors.law_dnc import DivideAndConquerLawRefExtractorMixin from refex.models import Ref, RefType from refex.tests import BaseRefExTest class LawRefExTest(BaseRefExTest): def setUp(self): self.extractor.do_law_refs = True self.extractor...
true
2e33108fdc6177f996fd12dbb085353c7a0e5f20
Wdiii/LeetCode-exercise-start-from-easy
/easy-Height Checker.py
UTF-8
543
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ class Solution: def heightChecker(self, heights): #heights: List[int]) -> int: final=sorted(heights) count=0 for i in range(len(heights)): if heights[i]!=final[i]: ...
true
66c24f68c7710017011a85db013065cda66c6ec3
jamesadevine/mbed-binary-exporter
/binaries.py
UTF-8
12,470
2.53125
3
[]
no_license
#! /usr/bin/env python2 import os import sys import re import shutil from glob import glob from optparse import OptionParser from datetime import datetime def recursive_remove(dir): dir = '/'.join(dir.split('/')[0:-1]) if len(os.listdir(dir)) == 0: os.rmdir(dir) recursive_remove(dir) return...
true
ba0a4a3acfb73472c3cd0fa72613364b85dd5631
sun30nil/MyProjects
/MyRunnableApps/S&P_Project/S&P_Analysis/Analysis1/ReadDataFile.py
UTF-8
4,969
2.9375
3
[]
no_license
''' Created on Jul 17, 2014 @author: Sunil ''' import collections # to sort the dictionary class ReadDataFile(object): ''' classdocs ''' def __init__(self): self.data_dict = {} self.sample_data_chrono = {} # to store the subset(start_date and end_date) of data_dict self.sample_...
true
5e37e9d72fce6915a61daf2ab0db16378f63e24b
claoidek/Project_Euler
/049_prime_permutations.py
UTF-8
1,376
4.03125
4
[]
no_license
# There are two sequences of three four-digit numbers that fulfil the following # three criteria: # All three are permutations of each other # All three are prime # The middle number is exactly halfway between the other two # # One of the sequences is 1487,4817,8147 # This program finds the other from time import cloc...
true
65eb91a1d3ef444eba454c0ed49e7d6d4d47ba01
alex-ong/NESTrisOCR
/nestris_ocr/scan_strat/scan_helpers.py
UTF-8
6,231
2.53125
3
[]
no_license
from PIL import Image from math import ceil, floor from nestris_ocr.config import config from nestris_ocr.ocr_algo.digit import scoreImage as processDigits from nestris_ocr.ocr_algo.board import parseImage as processBoard from nestris_ocr.ocr_algo.preview2 import parseImage as processPreview from nestris_ocr.ocr_algo.d...
true
3ecc88e97958ac3e0a79248e26502fc941fd5143
mtenenholtz/algorithms
/fizzbuzz/test.py
UTF-8
765
3.34375
3
[]
no_license
from fizzbuzz import fizzbuzz import unittest class TestFizzBuzzFive(unittest.TestCase): def setUp(self): self.sequence = ['1', '2', 'fizz', '4', 'buzz'] def test_equal(self): self.assertEqual(fizzbuzz(5), self.sequence) class TestFizzBuzzFifteen(unittest.TestCase): def setUp(self): ...
true
0107f7b0616c9e0e9544e4b57b04abe073c0b01e
semwalhritvik/Utileyes
/input/Utileyes0.py
UTF-8
2,372
2.765625
3
[]
no_license
import tkinter as tk from tkinter import messagebox import numpy as np import cv2 import speech_recognition as sr import shutil from imageai.Detection import ObjectDetection from gtts import gTTS import pyttsx3 import os def detect(): detector = ObjectDetection() model_path = "D:/Hritvik/Utileyes/model/resnet5...
true
9fc0dac8956536337f97871b2975e099ca80abb7
divyanksingh/test
/app/databasequery.py
UTF-8
1,610
3.109375
3
[]
no_license
import MySQLdb ##This is table EMPLOYEE created in TESTDB database: we will work on it ##+------------+-----------+-----+-----+----------+ ##| FIRST_NAME | LAST_NAME | AGE | SEX | INCOME | ##+------------+-----------+-----+-----+----------+ ##| ABHINAV | KUMAR | 25 | M | 700000 | ##| GYANENDRA | KU...
true
82ae412d56d72a0c2367793c9d3b947a30ced9dd
lpsinger/ligo.skymap
/ligo/skymap/bayestar/ez_emcee.py
UTF-8
5,860
2.609375
3
[]
no_license
# Copyright (C) 2018-2020 Leo Singer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed ...
true
a5cf683bb594987280d0023a96f24b8b765609e8
Andersonabc/practice_Python
/week2-5.py
UTF-8
1,905
4
4
[]
no_license
""" #最佳資費選擇 輸入每月網內、網外、市話、通話時間(秒)及網內、網外簡訊則數,求最佳資費。 費率如下表: 資費類型 183型 383型 983型 月租費 183元 383元 983元 優惠內容 月 租 費 可 抵 等 額 通 信 費 語音費率 網內 0.08 0.07 0.06 (元/秒) 網外 0.139 0.130 0.108 市話 0.135 0.121 0.101 (元/秒) 簡訊費率 網內 1.128 1.128 1.128 (元/則) 網外 1.483 1.483 1.483 --------------- 輸入說明: --------------- 網內語音(秒),整數 網...
true
e664d83f2fd27bcd8a5c46e49bc387b00947eaa5
kdaily/synapsePythonClient
/tests/unit/synapseclient/core/unit_test_pool_provider.py
UTF-8
1,772
2.734375
3
[ "Apache-2.0" ]
permissive
from mock import call, MagicMock from nose.tools import assert_is_instance, assert_equal, assert_false from multiprocessing.sharedctypes import Synchronized from multiprocessing.pool import ThreadPool import synapseclient from synapseclient.core.pool_provider import SingleThreadPool, SingleValue, get_pool, get_value ...
true
eff8a60d5d8b6d76ebb22900730a3cfc66bd6d4b
imsanjoykb/Health-AI
/app.py files/app_liver.py
UTF-8
1,267
2.515625
3
[ "MIT" ]
permissive
from flask import Flask, render_template, request import numpy as np import pickle app = Flask(__name__) model = pickle.load(open('Liver.pkl', 'rb')) @app.route('/',methods=['GET']) def Home(): return render_template('index.html') @app.route("/predict", methods=['POST']) def predict(): if request.method == ...
true
6dec501e094a72fda984137046a5589d50e22d21
wicak29/kijmantap
/DES/DESusingCFB.py
UTF-8
647
2.9375
3
[]
no_license
from DESwork import des if __name__ == '__main__': IV = "kudaliar" msg = ["lari"] key = "12345678" b = len(IV) print "b=", b s = len(msg[0]) print "s=", s def xor(message, key): nilai_xor = [ int(message[x]) ^ int(key[x]) for x in range(len(message)) ] message = "".join(str(x) for x in nilai_xor) ...
true
068bcb240113af96d19c8489e5f509645c97941e
qqueing/pytorch-G2P
/KORDict.py
UTF-8
2,171
2.75
3
[ "Apache-2.0" ]
permissive
import torchtext.data as data import os import random class KORDict(data.Dataset): def __init__(self, data_lines, g_field, p_field): fields = [('grapheme', g_field), ('phoneme', p_field)] examples = [] # maybe ignore '...-1' grapheme for line in data_lines: grapheme, phoneme ...
true
9e971c65145304ef50dffef82aeffa8414586eb2
arlex-it/arlex
/API/Utilities/HttpRequest.py
UTF-8
2,881
2.59375
3
[]
no_license
from flask import request from werkzeug.exceptions import BadRequest from API.Utilities.generic import sub_key class HttpRequest(object): request = None def __init__(self): self.request = request def get_header(self, name, default=None): """ Get a specific head...
true
8859b7e0c55ce699425ecbc20b0feab7792c0cb2
alexanderkell/temporal_granularity
/src/data/make_representative_days_kmeans.py
UTF-8
2,557
2.546875
3
[ "MIT" ]
permissive
from pathlib import Path import sys project_dir = Path("__file__").resolve().parents[1] sys.path.insert(0, '{}/temporal_granularity/'.format(project_dir)) import logging import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np from src.models.manipulations.approximations import App...
true
46777617fe5dc8212c24d478b6086737eb03e0f9
radovanbacovic/leetcode.test
/easy/trailing_zeroes.py
UTF-8
694
3.59375
4
[]
no_license
# https://leetcode.com/problems/factorial-trailing-zeroes/ import unittest import math class Solution: def trailing_zeroes(self, x): res: int = 0 fact = list(str(math.factorial(x)))[::-1] for f in fact: if f == '0': res += 1 else: r...
true
d29eb711098c33dea59a9f8cb5149867ed518b39
aravisv/Cancer_Prediction
/neuralnetwork1.py
UTF-8
2,154
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 22 22:11:37 2019 @author: aravi """ import numpy as np import pandas as pd data=pd.read_csv('breastcancer.csv') print(data) X=data.iloc[:,:9] # 9 features print(X) y=data.iloc[:,9] #output print(y) print(np.shape(X)) #matrix of order 116 X 9 ...
true
b1e36abebdb2111cd34a369fd9c9528a444edba0
kpyrkosz/learning-python
/task9.py
UTF-8
327
4.15625
4
[]
no_license
import random while True: line = input("Enter number or \"quit\" to leave the guessing game: ") if line == "quit": break; rand = random.randint(1, 9) num = int(line) while num != rand: if num > rand: print("Too high!") else: print("Too low!") num = int(input()) print("That's right! The number was",...
true
865c70e69d24c6c43090c2d16172c3fe659a79e6
yuchen45/CQT-VGG16
/processimages.py
UTF-8
2,654
2.71875
3
[]
no_license
from torch.utils.data import Dataset as TorchDataset import os import librosa import numpy as np from sklearn import preprocessing from torchvision import transforms from skimage import io import torch # Custom dataset class class CQTSpectrumDataset(TorchDataset): def __init__(self, file_label_path , image_path="...
true
efc764ba9609d55ec7da7201d56d78022fd6f446
Peter-trillion/Snake
/main.py
UTF-8
5,237
2.578125
3
[]
no_license
import os import pygame import pyautogui as pag import sys, json, random from colorama import * map_size = (500, 500) pygame.mixer.init() pygame.mixer.music.load('resourses\\music\\BGM.mp3') pygame.mixer.music.play(-1) failed_bgm = pygame.mixer.Sound('resourses\\music\\failed.wav') pygame.init() screen = pygame.displa...
true
3bebe8814093cdd545ef71eaba22528c1513751e
seanho00/twu
/python/.old1/tpose.py
UTF-8
349
3.984375
4
[]
no_license
def transpose(matrix): """Return the transpose of a matrix (2D list). pre: m must be a rectangular 2D list, all rows of same length.""" numRows = len(matrix[0]) numCols = len(matrix) tpose = [0] * numRows for row in range(numRows): tpose[row] = [0] * numCols for col in range(numCols): tpose[row][col] = ma...
true
6aa174cef832e2973a80820f8b595f358ba0ebc3
bob-white/advent_2018
/day_17.py
UTF-8
3,370
2.9375
3
[ "MIT" ]
permissive
from itertools import product, count from collections import deque, defaultdict from typing import Tuple, List, Set, Dict data = """ x=495, y=2..7 y=7, x=495..501 x=501, y=3..7 x=498, y=2..4 x=506, y=1..2 x=498, y=10..13 x=504, y=10..13 y=13, x=498..504 """.split('\n')[1:-1] with open('day_17.input', 'r') as f: d...
true
74d018c2b83367ffef977210028f24b3cea8bf6b
praveensonkusare/Tandemloop-Assignment
/Program-4.py
UTF-8
140
3.40625
3
[]
no_license
d = {} lst = [1,2,3,4,5,6,7,8,9,10,11] for i in lst: d[i] = 0 for j in lst: if j%i==0: d[i] = d[i]+1 print(d)
true
5eb962ca4e461021ec014a2276c6c3dda083fee7
liagason/AstroPi-Randomness-Experiment
/main.py
UTF-8
18,382
3.09375
3
[ "MIT" ]
permissive
import os import csv import random import datetime import hashlib from time import sleep from logzero import logger, logfile from sense_hat import SenseHat # Set file paths to save recorded and/or produced data. dir_path = os.path.dirname(os.path.realpath(__file__)) logfile(dir_path + "/entro_pi.log") try: data_fi...
true
8db88c28fd42087049096e9d5888782bdd053913
JJablon/OAST19Z
/run.py
UTF-8
1,415
2.6875
3
[]
no_license
import sys from input_parser import input_parser from ea import ea from bfa import bfa def main(): data = [] option = input("Select file: net12_1, net12_2, net4\n") if option == "net12_1": data = input_parser.Parser.read_file("./files/net12_1") elif option == "net12_2": data = in...
true
f1d803099c03503c55133e43ae8855e83da9013a
PedroM85/Programacion-Orientada-a-Objecto-Lucas-
/Ejercicios 14_08_20/Ejercicio 7_14_08_20.py
UTF-8
658
4.4375
4
[]
no_license
# 7) A un trabajador le descuentan de su sueldo el 10% si su sueldo es menor o igual a 1000. Por encima # de 1000 y hasta 2000 el 5% del adicional, y por encima de 2000 el 3% del adicional. Calcular el descuento # y sueldo neto que recibe el trabajador dado su sueldo. print("Ingresa sueldo devengado:") sueldo=int(inpu...
true
8e577003556e65fe4914a7e321abebb07c43c969
ihedzde/calory_calculator
/ui/main_window.py
UTF-8
11,548
2.75
3
[]
no_license
from tkinter import * from models.physical_stats import PhysicalStats from models.product import Product from models.user_model import User from tkinter import messagebox from tkinter import ttk class MainWindow: def __init__(self, window, user_id, product_service, user_service, physical_stats_service): se...
true