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
d7137d2153b07879759a93d5ca370e006f4220d0
ssoso27/Smoothie2
/pythAlgo/baekjoon/minority_path2.py
UTF-8
991
3.265625
3
[]
no_license
from collections import deque def make_minorities(): N = 10000 is_minority = [True] * N is_minority[0] = is_minority[1] = False for i in range(2, int(N**0.5)+1): for j in range(i+i, N, i): is_minority[j] = False return [idx for idx in range(1000, N) if is_minority[idx]] def...
true
a1c417f03157d78aa13d246d7254c623509855a4
Python3pkg/Flask-Statics-Helper
/flask_statics/helpers.py
UTF-8
1,406
2.6875
3
[ "MIT" ]
permissive
"""Helper functions for Flask-Statics.""" from flask_statics import resource_base from flask_statics import resource_definitions def priority(var): """Prioritizes resource position in the final HTML. To be fed into sorted(key=). Javascript consoles throw errors if Bootstrap's js file is mentioned before jQu...
true
0ce40642550a936c6f9fa7a9de70d05bc5e5f30d
daniel-reich/ubiquitous-fiesta
/vqMFpARj3DvELLDmZ_17.py
UTF-8
142
3.421875
3
[]
no_license
def letters_only(txt): s = '' for i in txt: if i in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': s += i return s
true
2b51633a5a147c2b00a84f5dff203733ba4a0060
infOpen-Deployments/ansible-role-compose-monitoring-node
/molecule/default/tests/test_installation.py
UTF-8
1,877
2.640625
3
[]
no_license
""" Role tests """ import os import pytest from testinfra.utils.ansible_runner import AnsibleRunner testinfra_hosts = AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') @pytest.mark.parametrize('path,user,group,mode', [ ('/opt/infopen', 'root', 'root', 0o755), ('/opt/infopen/monitori...
true
2eeef7576845dd12cd7b159945a5503bdc18656e
gabriellaec/desoft-analise-exercicios
/backup/user_207/ch78_2020_04_12_22_50_51_935717.py
UTF-8
847
3.375
3
[]
no_license
atletas = {'A': 0.01, 'B': 0.02, 'C': 0.03, 'D': 0.10} verificar_atleta =[] perguntar = True while perguntar: x = input ("Quem você deseja medir ? ") if x == 'sair': perguntar = False else: verificar_atleta.append (x) def calcula_tempo (atletas): new_dicio = {} for atleta, acel in ...
true
035b845b66113014b37becedae09eb8846713c97
antonercool/Network-Assignment-2
/Exercise2/rabin.py
UTF-8
3,855
3.40625
3
[]
no_license
#To carefully generate random number we use the secrets library # https://docs.python.org/3.6/library/secrets.html # Large Prime Generation for RSA #https://www.geeksforgeeks.org/rabin-cryptosystem-with-implementation/ from Cryptodome.Util import number from Cryptodome import Random import codecs import sys #Genera...
true
c7eda3c8ebb1c3f584e84dd4320f500ad3101308
MatheusSbaraglini/microblog
/app/auth/forms.py
UTF-8
424
2.625
3
[]
no_license
"""login form""" from flask_wtf import Form from wtforms import TextField, PasswordField from wtforms.validators import Required, Email class LoginForm(Form): """ Login form with wtforms""" email = TextField('Email Addres', [Email(), Required(message='Forgot your email ...
true
9cc6858ebb192e98323998777b0b1df04f082bfa
tecnosam/voyager-backend
/app/models/users.py
UTF-8
3,661
2.515625
3
[]
no_license
from ..exceptions import UserNotFoundException, UserNotSetupException from .posts import Post import datetime from .. import db class User( db.Model ): id = db.Column( db.Integer, primary_key = True, autoincrement = True ) uid = db.Column( db.String( 500 ), unique = True, nullable = False ) name = db.Col...
true
29963db65baeb6d31b1feabfc21f186662dea3e2
danwaterfield/LeetCode-Solution
/python/Dynamic Programming/Number of Subarrays with Bounded Maximum/Number of Subarrays with Bounded Maximum.py
UTF-8
465
2.90625
3
[]
no_license
class Solution(object): def numSubarrayBoundedMax(self, A, L, R): """ :type A: List[int] :type L: int :type R: int :rtype: int """ dp = [0 for i in range(len(A) + 1)] pre = -1 for i in range(len(A)): if A[i] < L: d...
true
bf31ed455e98e9b86df337c0911474f7e4cbd92d
TylerWuebker/Module6.4
/Module 3/test_operators_practice.py
UTF-8
670
3.359375
3
[]
no_license
import unittest class OperatorsTest(unittest.TestCase): def test_equal(self): a = 7 b = -2 self.assertFalse(a == b) def test_notequal_operator(self): a = 8 b = 8 self.assertTrue(a != b) def test_greater_than(self): a = 7 b = 6 self.ass...
true
66b8f0e81508d6d315a664354ac20120557c8d86
nomaanhusain/Login-Signup
/Login Signup GUI.py
UTF-8
2,141
3.0625
3
[]
no_license
import tkinter as tk name=['a','b','c'] pas=['p1','p2','p3'] ct=int(input('Number of actions')) def sig(): nu=entry1.get() np=entry2.get() name.append(nu) pas.append(np) labelsin=tk.Label(win1,text='Not a stranger No more') labelsin.place(x=160,y=150) def login(): uname=entryu.ge...
true
c3a4d8bcb79237962d4b775d6d324eefc35c7ffa
django-group/python-itvdn
/домашка/essential/lesson 8/Marukhniak Denys/L_8_1.py
UTF-8
876
3.8125
4
[]
no_license
# Задание 1 # Напишите скрипт, который создаёт текстовый файл и записывает в него 10000 случайных # действительных чисел. Создайте ещё один скрипт, который читает числа из файла и выводит на экран их # сумму. import random def numbs(): return str(random.randrange(99)) with open('L_8_1_random.txt', 'w') as f: ...
true
b1898523ef6c7b9aaceba9acfd37afe52d782a3a
gbottari/ESSenCe
/src/system/filters.py
UTF-8
9,253
2.8125
3
[]
no_license
''' Created on Sep 22, 2010 @author: giulio @original author: Vinicius Petrucci [http://www.ic.uff.br/~vpetrucci/master.html] ''' from system.Builder import Builder class Filter(object): def apply(self, x): raise NotImplementedError, "Must provide .apply()" class DummyFilter(Filter): def apply(s...
true
e3b2ae96033b4430f23e95fecacec7917db8ff32
denisdenisenko/ComputerVision
/Project/internerty.py
UTF-8
2,353
2.734375
3
[]
no_license
import cv2 import numpy as np MAX_FEATURES = 1000 GOOD_MATCH_PERCENT = 0.5 def alignImages(im1, im2): # Convert images to grayscale im1Gray = cv2.cvtColor(im1, cv2.COLOR_BGR2GRAY) im2Gray = cv2.cvtColor(im2, cv2.COLOR_BGR2GRAY) # Detect ORB features and compute descriptors. orb = cv2.ORB_create...
true
f90c1032b87f8a33a7ad9e6fc57f87f085293ab7
EricCacciavillani/Python_Stats_Class
/Stats_Exam_Python/hypothesis_testing_percent.py
UTF-8
2,351
3.28125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 5 14:08:24 2017 @author: ericcacciavillani """ import math import scipy.stats as st sample_amount = 30 superset_amount = 50 percent_claim = .5 significance_level = .05 #right tailed --Greater than more than #left tailed -- Less than #two tailed ...
true
db68d7894fb680ef63663118fc855054bebce980
mollycr/please-hire-me
/portfolio/models.py
UTF-8
7,523
2.828125
3
[]
no_license
from django.db import models from embed_video.fields import EmbedVideoField class ResumeHeader(models.Model): """ Contact and social media information. For a portfolio/site with a single user, this will probably only have one row. """ #attributes first_name = models.CharField(max_length=255, ...
true
0070335e05ac1fad503c57a64e93c325d6f81fc5
ArtificialIntelligenceToolkit/aitk.keras
/aitk/keras/numpy_ml_utils/testing.py
UTF-8
4,503
3.453125
3
[]
no_license
"""Utilities for writing unit tests""" import numbers import numpy as np MSG_CACHE = set() def warn_once(msg): if msg not in MSG_CACHE: print(msg) MSG_CACHE.add(msg) ####################################################################### # Assertions ...
true
9048e83e53bfbb53a5c9266167c295f83069a3eb
r-sreesaran/PracticeProblems
/Solutions/codechef/DSALearningSeries/complexityAnalysisAndWarmup/carvans.py
UTF-8
381
3.703125
4
[]
no_license
try: t = int(input()) for _ in range(t): cars = int(input()) cars_speed = list(map(int, input().split(" "))) cars_in_maxspeed = 1 max_speed = cars_speed[0] for pos in range(1, len(cars_speed)): if (max_speed > cars_speed[pos] ): cars_in_maxspeed += 1 max_speed =...
true
34eb5913b42219431e76bf9296663926c6041b31
LickIt/usaco
/2.1/frac1/frac1.py
UTF-8
411
3.40625
3
[]
no_license
""" ID: giliev91 LANG: PYTHON3 TASK: frac1 """ import math with open("frac1.in", "r") as f: N = int(f.readline().strip()) fracts = [] for i in range(N+1): for j in range(i, N+1): if math.gcd(i, j) == 1: fracts.append((i, j)) fracts.sort(key=lambda x: x[0] / x[1]) with o...
true
416fa3ea80fd62d620a7ee36ad1d1bc4886eb80d
miliar/tech-stack-demand
/keywords_update/main.py
UTF-8
814
2.640625
3
[]
no_license
import requests import itertools from tags import Tags def batches(batch_size=100): iter_all = iter(Tags().all()) batch = list(itertools.islice(iter_all, batch_size)) while batch: yield batch batch = list(itertools.islice(iter_all, batch_size)) if __name__ == '__main__': for batch in...
true
fb33264bdc7c3fef9770a260969f2b734ba8e9ba
Ellistra/shotgun_ami
/common/utils.py
UTF-8
3,011
2.65625
3
[]
no_license
import logging import shutil import shotgun_api3 import tempfile from common.constants import ReportConstants from contextlib import contextmanager def get_logger(name): """ Get a common logging object Logs debug or higher to log file Logs info or higher to console Returns: ...
true
afeb483097e75f0f01e43b18652f9dc89b9fe5d8
david3355/PyGame
/classes/priest.py
UTF-8
1,859
3.140625
3
[]
no_license
__author__ = 'Jager' from char import Character import random class Priest (Character): def __init__(self, cname, crace, cclass): super(Priest, self).__init__(cname, crace, cclass) self.maxmana = 200 self.mana = self.maxmana def special_attack1(self, opponent, hitdamage_callback, speca...
true
b69954dcd00512e8c53c4282e0df321e96d665c9
SuddenMovements/NEAB
/neab/client.py
UTF-8
10,050
2.75
3
[]
no_license
import socketio import random import time import cv2 import numpy as np import sys from matplotlib.colors import hex2color import math import noise class AgarioClient: def __init__(self, index, screen_size=600, spectator=False): self.socket = socketio.Client() self.screenWidth = screen_size ...
true
d8a2ebc0daed80f6ba4d52a29b5591ce3b3d2584
wmm98/homework1
/7章之后刷题/考题/9. Runaround数.py
UTF-8
495
3.578125
4
[]
no_license
def next_index(cur_index, distance, n_len): return (cur_index + distance) % n_len n = int(input()) n_str = str(n) n_len = len(n_str) visited_cnt = [0] * len(n_str) cur_index = 0 visited_cnt[0] = 1 print(visited_cnt) # [1, 0, 0, 0, 0] while True: if 2 in visited_cnt: print("No") break cur_i...
true
c87d1cfbd9adbb3dc08ca1f614756bcca7414294
jeonghanlee/Work
/Python/CodeExamples/Mathematics/Curve Fitting/linear_curve_fitting_3order.py
UTF-8
511
3.390625
3
[]
no_license
import numpy as np from scipy.optimize import curve_fit import matplotlib.pyplot as plt x = [0, 1, 2, 3, 4, 5] y = [15, 10, 9, 6, 2, 0] def linear_model(x, a, b, c, d): return a * x**3 + b * x**2 + c * x + d popt, pcov = curve_fit(linear_model, x, y) print(popt) plt.plot(x,y, 'ok') xstart = -1 xstop = 6 inc...
true
3e3e05e805da4c32ed5cf43fa72fd199f3c53167
Phophism/Data_Science_Programming
/Ice_cream_shop/icshop.py
UTF-8
850
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Aug 10 21:00:04 2021 @author: Akkapop Prasompon 640631128 Problem solving Ice cream shop """ from scipy.linalg import solve # We have 2 equation # (1) -> 0.5(x1) + 0.2(x2) <= 10 # where 0.5,0.2 means volumn of fresh milk using for make vanilla and strawberry ice cream ...
true
558e6dc5b86f48f3be3389deb18431743181d8c5
rishabhzn200/NaiveBayes
/NaiveBayes.py
UTF-8
3,829
3.640625
4
[]
no_license
import math class NaiveBayes: def __init__(self): pass def mean(self, data): return sum(data)/float(data.__len__()) pass def stddev(self, data): average = self.mean(data) variance = sum( pow(d - average , 2) for d in data ) / float(data.__len__() - 1) retu...
true
1a610ba1eee4cad858b904f19ab7e8229c842db9
askarulymukhtar/datavisualization
/home task 5/part2/pythoncode.py
UTF-8
1,736
2.875
3
[]
no_license
import json from nltk.corpus import wordnet as wn def closure_graph(synset,fn): seen = set() node = set() edge = list() def recurse(s): if not s in seen: seen.add(s) print(s.lemma_names('eng')[0]) for i in range(len(s.lemma_names('eng'))): nod...
true
8c40ee7b483223ec67c681cfea1a5213cf06361e
lczech/genesis-gappa-paper
/biopython/read_fasta.py
UTF-8
590
2.546875
3
[]
no_license
#!/usr/bin/env python import os import sys import time from Bio import SeqIO from Bio import AlignIO # Get data fastafile=sys.argv[1] print "reading", fastafile # Start the clock start = time.time() # Run run run! records = list( SeqIO.parse( fastafile, "fasta" ) ) # We also tried to read them using the alternati...
true
e8af82bb8c0795df76d5c29e9d544d57b2db034f
spiunno/smarriti_rubati
/sr_genera.py
UTF-8
629
2.890625
3
[]
no_license
# genera un file che contiene un elenco di documenti smarriti/rubati di test from optparse import OptionParser from bz2 import BZ2File import csv parser = OptionParser() parser.add_option('-f', '--file', metavar='FILE', dest='filename', help='output filename (default="documents")', default='documents') parser.add...
true
51ac642b5008907228ab5abf27ea3febbe8415de
danielementary/Reconstruction-of-3D-Objects-with-Radial-Imaging
/Prototype/src/filter.py
UTF-8
1,922
2.859375
3
[]
no_license
#this was not used in the final version import numpy as np import cv2 as cv from matplotlib import pyplot as plt THRESHOLD = 20 def filter_valid_matches(filename, views_shape): """Apply thresholding to filter potential outliers according to the distances between left-central and central-right ...
true
15c9695e467d6ed25b75142e9c6da25601636f9c
AlphaBitz/proyecto_arq_sistemas
/servicios/funcionesGenerales.py
UTF-8
1,688
2.765625
3
[]
no_license
# Servicio import socket, sys, json from os import system, name from gestor_base import conexion, crearBase def enviarTransaccion(sock,contenido, servicio): # Generacion de la transaccion # validacion de argumentos if len(servicio) < 5 or len(contenido) < 1: print("Servicio: Los argumentos no cump...
true
d6a6bf0c7d62e7792112ad1744aaf822bb2e5495
yeonkyungJoo/algorithm_study
/yeonkyung/1699. 제곱수의 합.py
UTF-8
320
3.015625
3
[]
no_license
if __name__ == "__main__": import math N = int(input()) dp = [n for n in range(N+1)] for i in range(2, (int)(math.sqrt(N) + 1)): for j in range(i**2, N+1): if j == i**2: dp[j] = 1 else: dp[j] = min(dp[j], dp[j-i**2] + 1) print(dp[N])
true
ec8d8cb5e3e25798bdb71950ae32938acedf9c88
ajrichards/cytostream
/unittests/Template.py
UTF-8
836
2.515625
3
[]
no_license
import sys,os,unittest,time,re from SimulatedData2 import case1, case2, case3 from SimulatedData2 import case1Labels, case2Labels, case3Labels BASEDIR = os.path.dirname(__file__) ## test class for the main window function class MultivarTestPDF(unittest.TestCase): _initialized = False def setUp(self): ...
true
b8cbe277adb528cd89d8a45faa42afe26dfe3295
JohannDickson/super-doodle
/super_doodle.py
UTF-8
1,595
2.9375
3
[]
no_license
import json import logging from random import choice log = logging.getLogger(__name__) def info(): return { "apiversion": "1", "author": "johdicks", "color": "#1B1B1B", "head": "default", "tail": "default", } def move(r): h = r['board']['height'] w = r['board'...
true
ee6f0aa68fcb1efd52e92423646001761c8fe8e3
Naviigator/AdventOfCode2018
/Day_18_2.py
UTF-8
2,106
3.359375
3
[]
no_license
import math GROUND = "." TREE = "|" LUMBERYARD = "#" EMPTY = "" NEIGHBOUR_POSITIONS = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)] def solve(puzzle): land = {} y = -1 x = None for line in puzzle: y += 1 x = -1 for c in line: x += 1 ...
true
51b52cf46f68651038ece667f2d2023e0e5eb4df
chenttxx/CS9163-Assignment2
/app.py
UTF-8
5,620
2.609375
3
[]
no_license
############CS9163 Application Security############ ################################################### ################Tianxiang Chen##################### ################################################### #################Assignment 2###################### from flask import Flask, request, session, render_template,...
true
75789b0d00b0dfcbd55c764f193cda8418ac2847
QianWanghhu/chaospy
/chaospy/poly/collection/linalg.py
UTF-8
3,790
3.515625
4
[ "MIT" ]
permissive
""" Functions mimicing linear algebra operations. """ import numpy import chaospy as cp import chaospy.poly from chaospy.poly.base import Poly def inner(*args): """ Inner product of a polynomial set. Args: args (chaospy.poly.base.Poly): The polynomials to perform inner product on. ...
true
7c6b21027ca2b8abc11242a8d5e2a500e8dff235
artbohr/codewars-algorithms-in-python
/7-kyu/max-min-arrays.py
UTF-8
673
4.21875
4
[]
no_license
def solve(arr): arr_s = sorted(arr) arr_l = len(arr_s) output = [] for x in range(arr_l//2+1): output.append(arr_s[-(x+1)]) output.append(arr_s[x]) return output[:-1] if arr_l%2!=0 else output[:-2] ''' In this Kata, you will be given an array of unique elements, and your task is t...
true
577eb05178dfd7b7dbdf81fae49ec085896c5c3e
udianand/CreditSuisseDemo
/src/model/Mapper.py
UTF-8
6,920
2.53125
3
[]
no_license
import random import json import jsonpickle from Data_Sources import Data_Sources from IndividualInfo import IndividualInfo from ContactInfo import ContactInfo from AssetsInfo import AssetsInfo from TwitterInfo import TwitterInfo from EmailInfo import EmailInfo name_to_email_id = { "Pierre": "pierreebayomidyar@gmail....
true
bee0858d02d9aa7fe516f0d7b9fd90d0bf6a25a2
rjk79/Data-Structures-Algorithms-System-Design
/engine/139_word_break.py
UTF-8
600
3.375
3
[]
no_license
def wordBreak(s, wordDict): dp = [False] * len(s) for i in range(len(dp)): for word in wordDict: # i = 7, word = "leet" with len = 4, s[4:8] # i = 7, other word ends right before we start at [3] # "or ..." allows us to start the string (i = 3, len(word) = 4) ...
true
b2c75b122ddc1ee3a75dd4388791f24e2cae3f92
nonecode404/learn
/day02/getParams.py
UTF-8
536
3
3
[]
no_license
import urllib.request import urllib.parse import string def getParams(): url = "https://ww.baidu.com/s?" params = { "wd":"中文", "key":"zhang", "value":"sad" } paramsStr = urllib.parse.urlencode(params) print(paramsStr) finalUrl = url + paramsStr print(finalUrl) ...
true
77eed05af61caa903680b0a82547e7e76d4f9288
sudeshsubedi/aStarPathFindingAlgorithm
/node.py
UTF-8
975
3.421875
3
[]
no_license
class Node: def __init__(self, parent=None, position=None): self.g = 0 self.h = 0 self.f = 0 self.parent = parent self.position = position def __eq__(self, other): return self.position == other.position def __hash__(self): return (hash(self.position[0...
true
f76982eab25fca644a8636c40cea13d4776317ec
greenfox-velox/BiroSandor
/week-04/day-04/7.py
UTF-8
411
4.09375
4
[]
no_license
# 7. Given a string, compute recursively (no loops) a new string where all the # lowercase 'x' chars have been changed to 'y' chars. def changer(n): if len(n) <= 1: if n[0] == 'x': return 'y' else: return n[0] else: if n[0] == 'x': return 'y' + change...
true
65c7280caad641ada67e022a565f08139a531196
rafaelperazzo/programacao-web
/moodledata/vpl_data/45/usersdata/120/15495/submittedfiles/lista1.py
UTF-8
424
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division #entrada n=input('insira a quantidade de elementos:') l=[] #processamento for i in range(0,n,1): l.append(input('digite um elemento:') somai=0 somap=0 i=0 for i in range(0,n,1): if i%2!=0: somai=somai+l[i] conti=cont+1 if i%2==0: ...
true
4723eabecfe968ad1322ceb6bf674ded8eb4f1af
TheGupta2012/MyQuantum
/Qubit by Qubit(QxQ)/Course Work - Semester 2/Week 21 - Search Algorithms/marked_number_boxes.py
UTF-8
4,555
2.78125
3
[]
no_license
### Written by Abraham Asfaw, IBM Quantum ### Part of talk given at IEEE Quantum Week 2020 ### See https://qiskit.org/textbook/ch-algorithms/grover.html for implementation details import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, Aer, execute from qiskit.quantum_info import Oper...
true
3fd26479fda968a0733f9ebe516b5bf8afb20b27
Ioit-rep/uranium-tablets
/Stanislav_solution/Измерение яркости/_measure_brightness.py
UTF-8
2,923
2.84375
3
[]
no_license
import numpy as np import cv2 from matplotlib import pyplot as plt from functions import load_images from functions import filter_image from functions import get_borders from functions import get_border_image from matplotlib.ticker import (AutoMinorLocator, MultipleLocator) # Load images original_images, images_names ...
true
03927fcbee6b7c91f59df9450f912707b3dc652e
LyceeClosMaire/MP7-la-super-horloge-du-labo
/Code/dashboard.py
UTF-8
10,553
3.015625
3
[]
no_license
from tkinter import* ##On importe différents modules qui seront utiles au programme from tkinter.messagebox import * import socket ##Ce module permet, en particulier, de communiquer sur un réseau IP menubar = False ##On Initialise différentes varibles qui serviront au cours du program...
true
e1f5afc66103866a14fced83a8b25ec6445c3969
CHLMA123/MyPythonStudy
/爬虫系列/demo3.2.py
UTF-8
1,627
3.359375
3
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- '文档注释:a test module' __author__ = 'chlma' '''Cookie,指某些网站为了辨别用户身份、进行session跟踪而储存在用户本地终端上的数据(通常经过加密) 比如说有些网站需要登录后才能访问某个页面,在登录之前,你想抓取某个页面内容是不允许的。那么我们可以利用Urllib2库保存我们登录的Cookie,然后再抓取其他页面就达到目的了。 cookielib模块的主要作用是提供可存储cookie的对象,以便于与urllib2模块配合使用来访问Internet资源。Cookielib模块非常强大,我们可以利...
true
5797bccfc05d9cca1e4d996529f3e9bc578e8dec
VSZM/Advent_Of_Code
/2019/intcode.py
UTF-8
9,641
3.078125
3
[]
no_license
from typing import List from abc import ABC, abstractmethod from enum import IntEnum class OperandMode(IntEnum): POSITION_MODE = 0 VALUE_MODE = 1 RELATIVE_MODE = 2 class ProgramPause(Exception): pass class ThreadState(object): def __init__(self, memory: List[int], ip: int, input_stream: List[i...
true
7ff3b5451450fd045c8f14f072ec975dbdcd7dcc
pranaymate/Python_3_Deep_Dive_Part_1
/Section 7 Scopes, Closures and Decorators/100. Nonlocal Scopes - Coding.py
UTF-8
2,633
4
4
[]
no_license
print('#' * 52 + ' Functions defined inside anther function can reference variables from that enclosing scope, ' ' just like functions can reference variables from the global scope.') def outer_func(): x = 'hello' def inner_func(): print(x) inner_func() outer_func() print('...
true
79d578bac2634ed796c6b08627956cd2a5581b00
DongHyunByun/algorithm_practice
/past_archive/swexpert/1986(zigzag).py
UTF-8
136
3.078125
3
[ "MIT" ]
permissive
for t in range(int(input())): ans=0 for i in range(1,int(input())+1): ans=ans+i*((-1)**(i+1)) print(f"#{t+1} {ans}")
true
80dbbfe2c86297ce3400a19a4277b3aa35449c8b
LyonBeast/PythonCode-1
/Fibonnaci.py
UTF-8
297
3.78125
4
[]
no_license
def fibbonaciRecursive(n): if n <= 2: return 1 else: return fibbonaciRecursive(n-1) + fibbonaciRecursive(n-2) termNumber = int(input("Find term number: ")) if termNumber <= 0: print("Positive numbers only please... ") else: print(fibbonaciRecursive(termNumber))
true
7ec9a2ef73f18efd9cd0bce6f3c024fb6dd9c08c
nicholaskarlsen/FYS3150
/Project_2/code/test_functions.py
UTF-8
2,967
3.40625
3
[]
no_license
from __future__ import division # Nobody expects the integer division import numpy as np import jacobi_eigensolver import main def test_max_dondiag(): testMat = np.array([[10, 2, 4, 6], [2, 11, -9, 5], [4, -9, 12, 3], [6, 5, 3, 13], ]) ...
true
a4460dec019670d1083b162f1ab74f4d319ade2a
BlueBlueSkyZZ/tfLearning
/activation_func.py
UTF-8
1,418
3.375
3
[]
no_license
# -*- coding:UTF-8 -*- import numpy as np import matplotlib.pyplot as plt import tensorflow as tf # 创建输入数据 x = np.linspace(-7, 7, 180) # (-7, 7)之间等间隔的180个点 # 激活函数的原始实现 def sigmoid(inputs): y = [1 / float(1 + np.exp(-x)) for x in inputs] return y def relu(inputs): y = [x * (x > 0) for x in inputs] re...
true
f7953bca7c839c28d7eb898c3f2ee33a1c84c05d
needsomeham/School_Projects
/MAE5350_Kinematics/Project1/Built in Solver.py
UTF-8
157
2.5625
3
[]
no_license
from scipy import optimize import math def function(x): y = math.sqrt(math.exp(x*2)) - 45 return y sol = optimize.newton(function, 3) print(sol)
true
b89f5d7a99c50f9922425ef1aa67ad7505a10bd9
cedadev/cloudhands-ops
/cloudhands/ops/puppet.py
UTF-8
3,044
2.609375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # encoding: UTF-8 from collections import namedtuple from collections import OrderedDict import json import operator import os.path import re import textwrap import urllib __doc__ = """ Puppet_ is a configuration management utility for Unix and Windows systems. It has a declarative language to...
true
e9d0a28525cd732f7bb17979045c2dd5209a5866
HPRIOR/SQL-Server-Mocker
/tests/test_create_tables.py
UTF-8
2,296
2.578125
3
[]
no_license
from SQLServerMocker.get_database import * from SQLServerMocker.create_tables import * db = CreateDataBase(get_json("..\json_tables\\test_table.json")).get_db() db_reverse = CreateDataBase(get_json("..\json_tables\\test_table_reverse.json")).get_db() def test_initial_string(): assert CreateTable(db).initial_stri...
true
a139f4a9e15dd30a1a0e8998a9098a0d2cfa2761
louking/running
/running/competitor2csv.py
UTF-8
5,494
2.71875
3
[]
no_license
#!/usr/bin/python # ############################################################################### # getmembers-competitor - get members who ran competitor race (e.g., Rock 'n' Roll Marathon) # # Author: L King # # REVISION HISTORY: # 03/17/15 L King Create # #################################################...
true
e83d19c9ffacc3e4354e64773533a7a7097d2ec1
tsukushibito/tempura-vulkan
/generator/vkxml2rs/modules/parse.py
UTF-8
3,907
2.765625
3
[ "Apache-2.0" ]
permissive
import xml.etree.ElementTree as ET from .elements import * def parse_vk_xml(xml_path: str): tree = ET.parse(xml_path) root = tree.getroot() elements = Elements() for child in root: if child.tag == 'types': parse_types(child, elements) def parse_basetype(node: ET.Element): t...
true
1b0e7d75e221c0402993093fb3d99cd5a493673c
jack-x/HackerEarthCode
/M_LittleShinoAndTournament.py
UTF-8
2,828
3.046875
3
[]
no_license
def main2(): i = input().split(' ') N=int(i[0]) Q=int(i[1]) f = input().split(' ') fighters = [None] fights = dict() counter=1 indexList = [] for x in f: fighters.append(int(x)) fights[counter] = 0 indexList.append(counter) counter+=1 if (len(fighters) == 2): fight...
true
86470db32aa9e314d7f76b91315af250a9726c41
donutloop/machine_learning_examples
/math/math.py
UTF-8
6,957
3.765625
4
[ "MIT" ]
permissive
import math import numpy as np def basic_sigmoid(x): """ Compute sigmoid of x. Arguments: x -- A scalar Return: s -- sigmoid(x) """ s = 1 / (1+math.exp(-x)) return s def sigmoid(x): """ Compute the sigmoid of x Arguments: x -- A scalar or numpy array ...
true
0fd42c0ee6e79d62d39a1302a7e92878a2201c30
Kamonphet/Project-Python
/60profileig.py
UTF-8
382
2.515625
3
[]
no_license
from bs4 import BeautifulSoup import requests #URL = "ลิงค์ IG" request = requests.get(URL) s = BeautifulSoup(request.text, "html.parser") meta = s.find("meta", property="og:description") s = meta.attrs['content'].split(" ") data = {} data['Name'] = s[-2] data['-'] = s[-1] data['Followers'] = s[0] data['Fo...
true
7c2904dccee6d2f264359eb035936375de01439e
fuchengwang/learn-python-practices
/basic/9.py
UTF-8
468
3.5625
4
[]
no_license
# _*_ coding: utf-8 _*_ """ Write a Python program to display the examination schedule. (extract the date from exam_st_date). exam_st_date = (11, 12, 2014) """ exam_st_date = (11, 12, 2014) "转化成时间后输出格式化的时间字符串" from datetime import datetime d = datetime(exam_st_date[2], exam_st_date[1], exam_st_date[0]) print d.strft...
true
fb4c526275d19bbd6c3af8e79efc42053f08bad9
DaHuO/Supergraph
/codes/CodeJamCrawler/16_2_1_neat/16_2_1_sulan_digit.py
UTF-8
853
3.265625
3
[]
no_license
import math import sys import collections def print_result (case_num,result): print('Case #{}: {}'.format(case_num,result)) T = int(input()) for case_num in range(1,T+1): ss = input() letters = collections.Counter(ss) dd = [0,8,3,2,6,4,7,1,5,9] words = ['ZERO','EIGHT','THREE','TWO','SIX','FOUR','S...
true
63c103f06bd1b37c37fc6bccac541e8cd6e4fe08
Mustafalw02/MustafaPythonAssignment
/exercise_ii_a/add_one..py
UTF-8
379
3.890625
4
[]
no_license
# -*- coding: utf-8 -*- #Taking Input x = input('Enter a five digit number: ') sum = 0 #Calculating Reverse d = int(x[0]) d = d+1 if d<9 else 0 sum += d * 10**4 d = int(x[1]) d = d+1 if d<9 else 0 sum += d * 10**3 d = int(x[2]) d = d+1 if d<9 else 0 sum += d * 10**2 d = int(x[3]) d = d+1 if d<9 else 0 sum += d * 10...
true
c205ad5e6bbfb0ec3910064efaf28a20f5ecbdb4
aravindsriraj/machine-learning-python-datacamp
/Machine Learning Scientist with Python Track/7. Dimensionality Reduction in Python/ch3_exercises.py
UTF-8
10,721
3.40625
3
[ "MIT" ]
permissive
# Exercise_1 # Fit the scaler on the training features and transform these in one go X_train_std = scaler.fit_transform(X_train) # Fit the logistic regression model on the scaled training data lr.fit(X_train_std, y_train) # Scale the test features X_test_std = scaler.transform(X_test) # Predict diabetes presence on...
true
838666d1aa5fd0de9698195f64c18a4c4054c81a
EspiritudeTeflon/etl_python
/ejemplos_clase/1_etl_hello_world.py
UTF-8
1,272
3
3
[]
no_license
#!/usr/bin/env python ''' ETL [Python] Ejemplos de clase --------------------------- Autor: Inove Coding School Version: 1.1 Descripcion: Programa "hello world" de ETL con Bonobo ''' __author__ = "Inove Coding School" __email__ = "alumnos@inove.com.ar" __version__ = "1.1" import bonobo import time ...
true
9bed1a91df2710d7de20d318f62f5951fccf4c43
MZayed47/Handwritten_Bangla_Character_Recognition
/WriteCsv.py
UTF-8
294
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 12 08:57:45 2020 @author: Mashrukh """ import csv with open('MyCsv.csv', 'w', newline='') as f: writer = csv.writer(f) writer.writerow(['label', '1*1', '1*2']) for i in range(1,10): writer.writerow(['1', '2', '3'])
true
d2ed2101531bff5c02cf5a1d801740c845192510
webclinic017/New-Osama-Python
/01Stock Market/all indicators Calculation indicator/test4.py
UTF-8
1,565
2.84375
3
[]
no_license
import talib import pandas as pd import ta import glob # Load data glob.glob("D:\Stock Market\Daily\Test\*.xlsx") for f in glob.glob('D:\Stock Market\Daily\Test\*.xlsx'): df = pd.read_excel(f) # Clean nan values df = ta.utils.dropna(df) # Add all ta features filling nans values df = ta.add_all_ta_f...
true
8fd903906fb3bb2c9bdacbc705901c97098a8b91
EFS-OpenSource/calibration-framework
/examples/classification/utils.py
UTF-8
11,650
2.515625
3
[ "MPL-2.0", "Apache-2.0" ]
permissive
# Copyright (C) 2019-2022 Ruhr West University of Applied Sciences, Bottrop, Germany # AND e:fs TechHub GmbH, Gaimersheim, Germany # # This Source Code Form is subject to the terms of the Apache License 2.0 # If a copy of the APL2 was not distributed with this # file, You can obtain one at https://www.apache.org/licens...
true
4da4dedeb5c2201fcf88edfad7b51cd57e5a6369
leegb/Backtrader-1
/sma.py
UTF-8
1,411
3.375
3
[]
no_license
from strategy import Strategy import pandas as pd from pandas import DataFrame, Series class SMACrossover(Strategy): """ SMA Crossover Strategy Trades based on rolling average crossover of stock prices """ def __init__(self, shortDays=30, longDays=180): """ Constructor short...
true
2152036a27e0f46fde30f7e1505058b812142455
NilEra-K/pytorchOCR
/ptocr/dataloader/RecLoad/DataAgument.py
UTF-8
15,252
2.6875
3
[]
no_license
# -*- coding:utf-8 _*- """ @author:fxw @file: DataAgument.py @time: 2019/06/06 """ import cv2,re import numpy as np from skimage.util import random_noise import os from math import floor from PIL import Image import numpy as np import random import cv2 def Add_Padding(image, top, bottom, left, right, color): padd...
true
852eda9f3333ace9ac2a5b01b3cdb50dea9be6d8
madanneelapu/python3
/random_nums_wo_dup.py
UTF-8
176
3.40625
3
[]
no_license
# create 10 random numbers without duplicates import random randomNums = set() while len(randomNums) < 10: randomNums.add(random.randint(100,200)) print(randomNums)
true
3f5cb941c1f4f43eb6008085b08db29cff60227c
zhankq/pythonlearn
/fenkpython/06/6.6/mmetaclass_test.py
UTF-8
1,035
3.609375
4
[]
no_license
class ItemMetaClass(type): def __new__(cls,name,bases,attrs): #动态类添加一个cal_price方法 attrs['cal_price'] = lambda self:self.price * self.discount return type.__new__(cls,name,bases,attrs) #利用metaclass批量生成一批带特征的类 #定义book类 class Book(metaclass=ItemMetaClass): __slots__ = ('name','price','_discount') def __init__(se...
true
a4c3ac6958c776b8728ecc9bc69d9e13426d078d
yonghanjung/2017F-CS590AML-Course-project
/Case1/case1-1.py
UTF-8
9,718
2.6875
3
[]
no_license
import numpy as np from scipy.optimize import minimize import pandas as pd import matplotlib.pyplot as plt from sklearn import linear_model from scipy.stats import norm def logistic_training(X,Y): clf = linear_model.LogisticRegression() clf.fit(X,Y) return clf def inverse_logit(Z): return np.exp(Z) /...
true
2b1eb08e785a429d76f937037418f6a5d7d40c99
MethodsofRadish/rosalind_repo
/REVC.py
UTF-8
1,555
3.828125
4
[]
no_license
#! usr/bin/env python3.7 import sys import fileinput # DNA_Count Python3.7 Script that takes a file from command line arguments # Prints the output to Standard Out. # Written by Marcus W. on September 12, 2020 # Welcome to DNA to RNA Program in Python 3.7 # This program takes a .txt file of DNA nucleotides (A,T,C,...
true
0690d7c3f12b7bb495e1a1c381edd9f7d14c1815
ses10/practice-review
/cracking the code interview/data-structures/binary-tree-find-paths-equal-to-sum.py
UTF-8
1,903
4.4375
4
[]
no_license
### Problem #You are given a binary tree in which each node contains a value. #Design an algorithm to print all paths which sum to a given value. #The path does not need to start or end at the root or a leaf. ### Solution #We use an array to represent the paths in the tree with each #index in the array corresponding...
true
cb1fa3e28fd89a99c0c802cb478f9ce15e489d26
maksmatviyiv/task
/task1.py
UTF-8
231
3.359375
3
[]
no_license
def task(number): binary = bin(number) # print(binary) counter =0 for i in binary: if (i =="1"): counter = counter +1 print(counter) n = int(input("Введіть число ")) task(n)
true
f8a7158358b636d4bbbf9635cd8112ed4d7950bf
dimmo/anytask
/easyci/execute3.py
UTF-8
20,945
2.671875
3
[ "MIT" ]
permissive
"""This module is wrapper for subprocess which aims to make life easier for anyone who needs to interact with shell commands from Python code. """ import time import os import subprocess import threading import shlex import sys import logging import types PY3 = sys.version_info[0] == 3 PY2 = sys.version_info[0] == 2 ...
true
896038de4c894b6242cac8269d9f0f22d73a517a
SwamyDev/reinforcement
/example/baselines.py
UTF-8
1,844
2.625
3
[ "MIT" ]
permissive
try: import tensorflow as tf import tensorflow.compat.v1 as tf1 except ImportError: raise ImportError("reinforcement requires tensorflow 1.14") from example.log_utils import log_2d_tensor_as_img class ValueBaseline: def __init__(self, session, obs_dims, summary_writer, lr=0.1): self._session ...
true
812b5995fc8f4ab89c81d5b5e9ca618da881d252
old-castle-fansubs/tools
/oc_tools/scripts/detect_crop.py
UTF-8
1,502
2.765625
3
[]
no_license
#!/usr/bin/python3 import argparse import re import subprocess from collections.abc import Iterable from dataclasses import dataclass from pathlib import Path from typing import Any, TypeVar T = TypeVar("T") def most_common(lst: list[T]) -> T: return max(set(lst), key=lst.count) @dataclass class CropArea: ...
true
0c32611b7b9ec6b1b369977d5699b2879da8e889
tomekregulski/python-practice
/lists_and_dictionaries/dictionary_comprehension.py
UTF-8
377
3.546875
4
[]
no_license
numbers = dict(first=1, second=2, third=3) squared_numbers = {key: value ** 2 for key,value in numbers.items()} print(squared_numbers) nums = {num: num**2 for num in [1,2,3,4,5]} print(nums) str1 = 'ABC' str2 = '123' combo = {str1[i]:str2[i] for i in range(0, len(str1))} print(combo) num_list = [1,2,3,4] print({num...
true
5b4f12168edbbc4db314b26a2afef6d91136d594
avani-bajaj/AI-PacMan-Project
/multiagent/multiAgents.py
UTF-8
15,575
3.40625
3
[]
no_license
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.e...
true
9821126ad2c544bbfdfc2f25c08dd9a2ff3abdd5
zhuojuncheng/Cat_Dog_Recognition_CNN
/MyNet.py
UTF-8
1,420
2.59375
3
[]
no_license
import torch import torch.nn as nn class MyNet(nn.Module): def __init__(self): super().__init__() self.conv2d_1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3) self.relu_1 = nn.ReLU() self.maxpool2d_1 = nn.MaxPool2d(kernel_size=2, stride=2) self.conv2d_2 = nn.Co...
true
ffe8e423dea4093f807d73bb25fe878ca2534a92
SBeliq/course_python_intermediate
/dictionary_comprehensions.py
UTF-8
569
3.734375
4
[]
no_license
def run(): # dictionary = {} # for i in range (1, 101): # dictionary[i] = i**3 # print(dictionary) #solo los que no son divisible por 3 # dictionary = {} # for i in range (1, 101): # if i % 3 != 0: # dictionary[i] = i**3 # print(dictionary) #with dictionary...
true
f30307a1be17279902c297ef13312a35c7eb2c4a
Aasthaengg/IBMdataset
/Python_codes/p02399/s402380175.py
UTF-8
98
3.3125
3
[]
no_license
num = input().split(" ") a = int(num[0]) b = int(num[1]) c = a/b print(int(a/b),int(a%b),"%f" % c)
true
38e19065998c770f92a19cf48eeed333b855ef89
raynald/SMI
/name_repositories_new.py
UTF-8
2,405
2.6875
3
[]
no_license
#!/usr/bin/env python2 import xlsxwriter from github import Github import os class RepositoryCreation(): def Convert26(self, num): col_num = "" while num != 0: col_num = str(unichr(65 + (num-1) % 26)) + col_num num = (num - 1) / 26 return col_num de...
true
7b5f490bb3498cc39e4fa482b923d83854d67b32
krieghan/game_common
/game_common/twodee/geometry/convert.py
UTF-8
2,193
3.25
3
[]
no_license
import numpy import math identity3 = numpy.identity(3, dtype=float) def vectorToWorldSpace(vector, localOrigin, localDirection): vectorx, vectory = vector originx, originy = localOrigin c = math.cos(localDirection) s = math.sin(localDirection) ...
true
452ed36a0c17e3c263608ccfa90c6acb7cef2fd6
ifpb-cz-ads/pw1-2020-2-ac04-team-alexfrancisco
/questões/questao_13.py
UTF-8
267
3.5625
4
[]
no_license
numero = 'true' soma,media = 0,0 cont = 0 while(numero != 0): numero = int(input("Type the number: ")) soma += numero cont+=1 media = soma/cont print(" Quantidade de numeros digitados: %d\n Soma: %d\n Média Aritmética: %.1f" %(cont,soma,media))
true
8ddd412aa3f7f586db32a1fd0f15062e81d71e09
natoftheboonies/advent-of-code-2015
/day6.py
UTF-8
1,079
3.125
3
[]
no_license
from collections import defaultdict def countlights(insts): lights = defaultdict(int) brights = defaultdict(int) for inst in insts: cmd = inst.strip().split() start = tuple(map(int,cmd[-3].split(','))) end = tuple(map(int,cmd[-1].split(','))) if cmd[0] == 'turn': if cmd[1] == 'on': for x in range(...
true
101ea04d0ff3051cfac07c090a72a82b506406ed
c-a-c/PythonStudy
/bessyo/20190619/var.py
UTF-8
54
2.984375
3
[]
no_license
var = 1 st = "Hello" var += 2 var = st print(st, var)
true
bc0d2375dbf1265705485f7078588fb01502a150
Tartori/fids
/fids/detection_error.py
UTF-8
388
3.015625
3
[ "MIT" ]
permissive
class DetectionError: def __init__(self, message, level): self.message = message self.level = level def __str__(self): return (f'{self.level} Error Occured:' f'{self.message}') def __repr__(self): return ('DetectionError(' f'message={self.mes...
true
894de0fd91f49fb16a9e7a43e797622a1163409b
Hiroki39/CSCI-UA-381
/Exams/Midterm/Q9.py
UTF-8
462
3.171875
3
[]
no_license
with open("sample_input.csv") as f: lines = f.read().splitlines() with open("sample_output.csv", "w") as f: f.write("Student,Code\n") for i in range(1, len(lines)): line = lines[i] entries = line.split(",") phone_pieces = entries[2].split("-") product = float(entries[1]) * f...
true
54852fd35736216b69e982ef4a851937be85ce01
smilingkunal/TIC-TAC-TOE-Python-
/Tic-Tac-Toe.py
UTF-8
1,094
3.796875
4
[]
no_license
def drawField(field): for row in range(5): if row % 2 == 0: paracR = int(row / 2) for column in range(5): if column%2 == 0: if column != 4: paracC = int(column/2) print(field[paracC][paracR], end="") ...
true
f95476ca3f18b0aa23eabbd407de08ea57b93247
NoahButler/2015_Lopez_Jr
/subsystems/claw.py
UTF-8
1,247
2.6875
3
[]
no_license
_author__ = 'nikolojedison' import wpilib from wpilib.command import PIDSubsystem from commands.manual_commands.manual_claw import ManualClaw import setpoints class Claw(PIDSubsystem): """This is a claw. It does claw things.""" def __init__(self, robot): super().__init__(20, 0, 0) self.robot =...
true
7692f8c2d9d7819e23ca729e75a7c9ebe33ae8d7
ramyasutraye/python-programming-27
/beginner level/swap num.py
UTF-8
63
2.890625
3
[]
no_license
num1,num2=input().split() num1,num2=num2,num1 print(num1,num2)
true
176f742dd3099076df60874f3697783fc2f61367
mando222/PyGameEngine
/PyGameEngine/asset_load.py
UTF-8
957
2.578125
3
[]
no_license
#!/usr/bin/env python3 import os, sys import pygame from pygame.locals import * from pathlib2 import Path from logger import logging ########################################## # Loads an bmp image from a file # name is the name of the file - extention ########################################## def load_image(name, c...
true
b92bffa9d090a3ed9b3016c64ac4560d34511f2f
michaelalbinson/check-it-out
/server/members/member_api.py
UTF-8
2,050
2.546875
3
[]
no_license
import json import requests import os from flask import request from db.HouseMemberCache import HouseMemberCache from db.SenateMemberCache import SenateMemberCache from db.model.SenateMember import SenateMember from db.model.HouseMember import HouseMember def member_api_routes(app): @app.route("/api/member/<stri...
true
7c761cda6d65b9cd109b89263895da854186f326
sharbatc/seqhopfieldnet
/script.py
UTF-8
1,132
2.6875
3
[]
no_license
''' Sharbatc EPFL, Lausanne, March 2017. ''' import sys import numpy as np import hopfield_experiment as exp import visualize as vis # capacity testing max_iter = 10 num_neurons = [50,100,150,200,250,300,350,400,450,500] corr = [0] m = 0.28124365079365077 sd = 0.027596275060292563 f = open('capacity.txt','wb') sys...
true