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
c87c8cca6605c87e2782b79d630d2918033c0551
boonchu/python3lab
/coursera.org/python2/list_extend_many.py
UTF-8
1,083
3.75
4
[]
no_license
#! /usr/bin/env python #following defines one way to concatenate multiple lists. For example, #list_extend_many([[1,2], [3], [4, 5, 6], [7]]) returns [1, 2, 3, 4, 5, 6, 7] #and doesn't mutate anything. # OK #def list_extend_many(lists): #"""Returns a list that is the concatenation of all the lists in the given...
true
89294b68f5687734528a7a356d6dc97a91d85421
ZainIbrahim/repair2
/test.py
UTF-8
1,160
3.078125
3
[]
no_license
''' import requests helo = requests.get('http://www.hipstercode.com' , 'w') outfile = open("/Users/zeinalabidin/desktop/ccc/text.txt") outfile.write(str(helo.text.encode('utf-8'))) #print(helo.text.encode('utf-8')) ''' ''' #Email validator import re f= open ('ValidEmails.txt', 'w') def is_email(): email=inpu...
true
28f2764a275645ffc44c83c361081d7504f2707c
masheransari/Python-Practice-1
/Test7.py
UTF-8
118
3.6875
4
[]
no_license
mass = int(input("Enter Mass in Kilogram: ")) massStone = (mass * 2.2)/14 print("Total Mass Stone "+str(massStone))
true
ba47380a146b215d017cdf906d7ff63260c97fa9
nesteves/introcs
/scripts/introcs/fibonacci_calc.py
UTF-8
508
4.21875
4
[]
no_license
__author__ = 'nunoe' def fibonacci_comp(n): """ Returns the nth Fibonacci series term :param n: int, the value for which the Fibonacci series term is to be computed :return: int, the nth term in the Fibonacci series """ if n == 1 or n == 0: return 1 return fibonacci_comp(n - 1) + fibon...
true
e080be5b91cd9b7eb31aaa6c407862e471ea31c9
rohitx/DataScienceProjects
/Stop_Frisk_data/clean_text.py
UTF-8
477
3.234375
3
[]
no_license
from collections import defaultdict with open('CrimeCode.txt', 'r') as f: data = f.readlines() d = defaultdict() for line in data: number = line[:3] if not number.isdigit(): number = number[:len(number)-1].strip() text = line[2:] else: text = line[3:] d[int(number)] = text...
true
033f81a4418fe198a0ca7199b8a841c83b8b1fe6
Aasthaengg/IBMdataset
/Python_codes/p03261/s017570522.py
UTF-8
215
3.125
3
[]
no_license
n = int(input()) a = [input() for i in range(n)] if n!=len(set(a)): print("No") else: for i in range(1,n): if a[i-1][-1]!=a[i][0]: print("No") break else: print("Yes")
true
1b19688bb07cb5af9ee5ad1f61a2d58d79c1bd89
RagingPolo/proxitable
/battleships/BtlBoard.py
UTF-8
3,290
3.4375
3
[]
no_license
from BtlShip import BtlShip from BtlMove import BtlMove import random from os import urandom # ------------------------------------ # CLASS BtlBoard | # | # Maintain the state of a single | # board | # ------------------------------...
true
12f71d300e497dd365638ed0a4fbb99240f9c115
igalashow/stepik-autotest
/lesson2_1_step5.py
UTF-8
841
3.171875
3
[]
no_license
import math from selenium import webdriver import time def calc(x): return str(math.log(abs(12*math.sin(int(x))))) try: link = "http://suninjuly.github.io/get_attribute.html" browser = webdriver.Chrome() browser.get(link) x_element = browser.find_element_by_css_selector('#input_value').get_attribute('valuex') ...
true
3e014a0c4642d8a4a91a3cabbc986b54169306e3
kb211/Thesis2017
/evaluation/evaluation.py
UTF-8
3,233
2.5625
3
[]
no_license
import numpy as np import pandas as pd from costcla.metrics import savings_score class evaluation: def __init__(self, Amounts): self.columns = ["recall", "precision", "specificity", "saving", "C_recall", "C_precision", "C_specificity", "C_saving"] self.results = [] self.amounts = Amounts ...
true
df14a1091c562f7118b1d10844dee4e576aeaf1f
alessandrovendrame/IIoT-anno1
/Python/20200124/esercizio.py
UTF-8
1,837
4.25
4
[]
no_license
""" #-------------------------APPUNTI------------------------- Liste [.....] --> MUTABILI, posso inserire e modificare i valori al suo interno { type = list() myList = [] --> Lista vuota myList = list() --> costruttore myList = [10,20,30] --> Lista con oggetti all'interno print(myList[2...
true
d6cfe6dbfc5abd890ad2b1b5d5e0389085200b8f
zjwyx/python
/day15/01_作业讲解.py
UTF-8
1,941
3.40625
3
[]
no_license
# def wrapper(f): # # f = func # def inner(*args,**kwargs): # print(111) # ret = f(*args,**kwargs) # print(222) # return ret # return inner # # # @wrapper # func = wrapper(func) # def func(): # print('in func') # func() # inner() # 看代码写结果 # def wrapper(f): # d...
true
120cbafc9295387f83aa9f2ab9296f5aa0420b2f
DOE-NCI-Pilot1/Normalization
/src/utils.py
UTF-8
6,858
2.671875
3
[ "MIT" ]
permissive
from pathlib import Path import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm from pandas.api.types import is_string_dtype, is_numeric_dtype from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA # ComBat imports import p...
true
5584ee0f8d4e5f19bc06d17887d9fe9c3fb1b0b3
djaychela/advent_of_code_2020
/08_2.py
UTF-8
1,490
3.046875
3
[]
no_license
import pathlib file_name = "08.txt" current_dir = pathlib.Path(__file__).parent.absolute() file_path = pathlib.Path(current_dir / "data" / file_name) with open(file_path, "r") as file: code = file.readlines() final_instruction = len(code) memory = {} modification_needed = True memory_locations = range(len(code...
true
d08b8a1b73b4982f6d3e64d5a7d7d6690e0f0c95
Alex-zhai/learn_practise
/leetcode/29.py
UTF-8
118
2.921875
3
[]
no_license
from collections import Counter c = Counter(list(map(int, input().strip().split()))) print(c.most_common(1)[0][0])
true
2f0375f15efe148ab3132df215bc951085b3bbc6
ballcarsen/Spotify-Challenge
/challenge.v1/Sheny/Category1_Recommender.py
UTF-8
5,736
3.15625
3
[]
no_license
# coding=utf-8 import json import nltk.corpus import nltk.tokenize.punkt from nltk.tokenize import WhitespaceTokenizer import nltk.stem.snowball import string import Levenshtein from operator import itemgetter import numpy ''' Proposal on how to make recommendations to empty playlists given title of playlist only a...
true
6eff4ba3ffcd05127a7464253e8dba80d5cff863
hyunbeen/python--training
/trycatch/sample2.py
UTF-8
851
2.8125
3
[]
no_license
try: # f = open("C:/app/py_workspace/trycatch/sample1.py","r") # 4/0 #error 발생순서의 따라 발생 f = open("../py_workspace/trycatch/sample3.py","r") f = open("../py_workspace/trycatch/sample1.py","r") #워크 스페이스 기준 #상대경로,절대경로 가능 except FileNotFoundError as e: print(e) # d = 3 # print(...
true
d2e18a57e14aea057c3f65c9ec8989ddcfd62484
silky/mystic
/tests/test_1d2d_expect.py
UTF-8
1,411
3
3
[ "BSD-3-Clause" ]
permissive
from mystic.math.measures import * from mystic.math.discrete import * from mystic.math import almostEqual def f(x): return sum(x)/len(x) d2 = measure([point_mass(1.0, 1.0), point_mass(3.0, 2.0)]) d1 = measure([point_mass(3.0, 2.0)]) d2b = measure([point_mass(2.0, 4.0), point_mass(4.0, 2.0)]) p1 = product_measure([d1])...
true
91a29c348544e0b02138bceff2f102ddb7160deb
orhanakpinar/codefights
/WizelineBot/sourceCode.py
UTF-8
3,608
3.15625
3
[]
no_license
def countAPI(calls): # go through calls, fill out two maps: # 1) hierarchy map: pathToParent (string) --> [pathToChild] (list of strings) # 2) count map: path (string) --> numberOfTimesPathEncountered (int) # also keep a list of the projects (to know the order in which to search) # go through highe...
true
7330232316f2224a416178069e15773e1f893f75
marcotello/PythonPractices
/Trees/path_to_Node.py
UTF-8
649
4.125
4
[]
no_license
class BinaryTreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def path_from_root_to_node(root, data): """ :param: root - root of binary tree :param: data - value (representing a node) TODO: complete this method and return a list contain...
true
b9934855079344f05b7a24c38f6ded0b09b33772
eldarknz/algorithms_data_sctructures
/fib_recursion_automemo.py
UTF-8
312
3.421875
3
[]
no_license
import time from functools import lru_cache @lru_cache(maxsize = None) def fib(n): if n < 2: return n return fib(n - 2) + fib(n - 1) # Check result if __name__ == '__main__': start_time = time.time() print(fib(30)) print("--- {} seconds ---".format(time.time() - start_time))
true
1e169591dc9e44b26a83c1b1d3d67106ae363534
ddavid/supervisely
/plugins/import/fsoco_sly_format/fsoco_lib/fsoco_watermark.py
UTF-8
3,764
2.609375
3
[ "MIT" ]
permissive
# coding: utf-8 import os import time import cv2 import numpy as np from collections import defaultdict from PIL import Image, ImageDraw, ImageFont import supervisely_lib as sly from supervisely_lib import fs from supervisely_lib import TaskPaths from supervisely_lib.io.json import load_json_file # Watermark text c...
true
25ae1b50f505b9c585a375595a02da05bf49a366
VitalC-3026/information-retrieval
/hw4.py
UTF-8
42,496
3.0625
3
[]
no_license
import sys import pickle as pkl import array import os import timeit import contextlib import nltk import re import heapq # try: # os.mkdir('output_dir') # except FileExistsError: # pass # try: # os.mkdir('tmp') # except FileExistsError: # pass # # sorted(os.listdir('pal-data')) # ...
true
b6614a0a1bb5a8eb373c65e89cac726773160a8f
tomgale98/product-catalogue-update-tool
/product_catalogue_update_tool.py
UTF-8
20,794
2.8125
3
[]
no_license
"""Product Catalogue Updater Author: Thomas Gale - thomas.gale@vodafone.com ***Version 3 - 2021-28-04*** Changelog: *main function added *columns titles are now printed in the HW and SW reports *the HW and SW column titles have been made global variables for ease of changing them *added num...
true
870556f2e145ae385b8c10757189b23afd34ff3f
miyashiiii/tic_tac_toe_reinforcement_learning
/player_mc.py
UTF-8
1,481
3.375
3
[]
no_license
import random from player import Player class PlayerMC(Player): def __init__(self): name = "MC" super().__init__(name) def win_or_rand(self, board, turn): acts = board.get_possible_pos() # see only next winnable act for act in acts: tempboard = board.clone...
true
204eba1b0311d2cba74ca5f05caf85268e5a4ec4
hliang/toolbox
/google-python-exercises/copyspecial.py
UTF-8
2,611
3.203125
3
[]
no_license
#!/usr/bin/python # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ import sys import re import os import shutil import commands """Copy Special exercise """ #...
true
06ca2a82d2f891352f98c61802b5287178722718
JcobCN/PyLearn
/replaceFile.py
UTF-8
283
2.75
3
[]
no_license
y = open('233','r') y_new = open('233_new','w') tihuan = input('输入要替换的替换:') tihuan_new = input('输入要替换的替换:') for i in y: print('for:' + i) if tihuan in i: i = i.replace(tihuan,tihuan_new) y_new.write(i) y.close() y_new.close()
true
5536f9451d3c2ccc9f6d1f63055e1a2c57dde089
aherculano/fwl-project
/fwl-automation-decisions/domain/src/domain/model/environment/EnvironmentName.py
UTF-8
448
3.375
3
[ "MIT" ]
permissive
class EnvironmentName(object): # TODO : VALIDATION def __init__(self, environment_name: str): self.value = environment_name @property def value(self): return self._value @value.setter def value(self, val: str): self._value = val.strip().upper() def __eq__(self, o:...
true
64b830c2490b52b86671414428331686f719a8d6
adborroto/reinforcement_learning
/open_gym/pong-ram-v0.py
UTF-8
2,956
2.703125
3
[ "MIT" ]
permissive
import gym import numpy as np import math import time import seaborn as sns; import matplotlib.pyplot as plt from cart_pole_v0 import epsilon_greedy, max_action sns.set() Q = {} np.random.seed = 32 def Q_state(state): if not state in Q: Q[state] = {} return Q[state] def Q_state_action(state, action,...
true
b48f52525f5605059c20030ce8eed6303a619742
richardhj/vicc-variation-normalization
/variation/tokenizers/protein_frameshift.py
UTF-8
1,149
2.796875
3
[ "MIT" ]
permissive
"""Module for tokenizing Protein Frameshift.""" import re from typing import Optional from .tokenizer import Tokenizer from .caches import AminoAcidCache from variation.schemas.token_response_schema import Token, TokenMatchType class ProteinFrameshift(Tokenizer): """The Protein Frameshift Tokenizer class.""" ...
true
8cbda08ff979592fa08fff3cd7ee91d0cd06603a
slowback/myproject
/main.py
UTF-8
1,302
3.453125
3
[]
no_license
import argparse morse_code = { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--'...
true
405dabb7137598dba00de29262a9b66d03bcb9d4
learning-12/course
/Demo/python_jichu/newclass2.py
UTF-8
1,094
3.546875
4
[]
no_license
# author:lyr time:2019-10-17 # from random import randint#随机数包 # print(randint(0,1)) class Tigter: def rora(self): print('父类t属性') @staticmethod def tell(): print('父类t静态属性') class Tigter2: def rora(self): print('父类t2属性') @staticmethod def tell(): print('父类t2静态属性') ...
true
5f2be95f4b14952634c8d120bfda5e45f98e3495
mhb8898/Sadjad-AI-PyClient
/ai.py
UTF-8
124
2.671875
3
[]
no_license
from random import randint class AI: def turn(self,map): print map return randint(0, 9),randint(0, 9)
true
931eeaf284c4e1b0f91a2b1afbb32a72654b4763
AidanTek/RPi_Pico_Examples
/03_external_led.py
UTF-8
313
3.125
3
[]
no_license
# External LED ''' Connect an LED to GPIO15, use a 470ohm to connect the LED cathode to ground For reference: https://datasheets.raspberrypi.org/pico/Pico-R3-A4-Pinout.pdf ''' from machine import Pin from time import sleep led = Pin(15, Pin.OUT) while True: led.toggle() sleep(1) # Sleep for 1 second
true
9b81b67cb0dbdf19ea425c5c82d4ccb5f07324b3
neeraj12121/dprint
/dprint/_impl.py
UTF-8
4,345
3.34375
3
[ "MIT" ]
permissive
import tokenize import inspect import token import sys import re import io import os _NAME_MATCHING_REGEX = re.compile(r'\bdprint\b') def dprint(value): """A simple printing debugging helper. Designed to be used on any expression, to print the value of an expression, without modifying the result of the ...
true
e5fab811b2a740bc9457eae1e60756239a6001fc
meeree/junk
/plot/plot_poisson.py
UTF-8
725
3.03125
3
[]
no_license
import matplotlib.pyplot as plt spiketrains = [] idx = 10 with open('../mnist/OUT_POISSON_' + str(idx) + '.txt', "r") as fl: for line in fl: spiketrains.append([int(e.strip()) for e in line.split(',') if e != '\n']) x_pos = [] y_pos = [] for spiketrain in spiketrains: for spike in spiketrain: x...
true
cf1284bbbda6acbf9e215dde965898d47bb40780
KavinJey/AlgoQuestions
/Problem45.py
UTF-8
787
3.75
4
[]
no_license
def triangle(n): number = (n*(n+1)) / 2 return number def pentagon(n): number = (n*(3*n-1)) /2 return number def hexagonal(n): number = (n*(2*n-1)) return number x = 285 tri_set = [] pen_set = [] hex_set = [] list_1 = [] tri_set = set(tri_set) pen_set = set(pen_set) hex_set = set(hex_set) ...
true
174d81451b7e921462fc04c35fa63b02d6a61ed9
maxd0se/scripts
/filesearcher.py
UTF-8
649
3.3125
3
[]
no_license
#!/usr/bin/env python3 import sys red_start = '\033[91m' green_start = '\33[92m' color_end = '\33[0m' filename = input('File to search: ') with open(filename) as fobj: text = fobj.read().strip().split() while True: try: x = input('Enter string to search: ') ...
true
492334654e4d5f3d148b7846279fe0f8368cbe3f
chuchip/djangorestcrud
/library/views.py
UTF-8
1,587
2.53125
3
[]
no_license
from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from library.models import Books from library.serializers import BooksSerializer @api_view(['GET', 'POST']) def book_list(request): """ List all code Books, or create a new Book. "...
true
3b7c9ebfbb2fa7ef6488d32dcf07b153e6b69270
JatinKinraAis/cloudlaunch-1
/django-cloudlaunch/baselaunch/util.py
UTF-8
379
3
3
[]
no_license
import operator from importlib import import_module def getattrd(obj, name): """ Same as ``getattr()``, but allows dot notation lookup. """ try: return operator.attrgetter(name)(obj) except AttributeError: return None def import_class(name): parts = name.rsplit('.', 1) cls ...
true
08a9f8604ec8b32bf0238c5ac2f309f5ae49fa92
Nickbonat22/422P2
/422P1/logService.py
UTF-8
1,591
2.9375
3
[]
no_license
#!/usr/bin/env python3 ''' Author: Nicholas Bonat Created on: 4-7-2019 Create daily log file and write to it ''' from student import Student import datetime import sys import csv import os HOME_PATH = os.getenv('HOME') sys.path.append('../Resources/') #open file, the current date to the daily log, then close it so it...
true
7ed8b9340f55f682d9b402ce6087f3822febeb33
raccurso/Cajamar_UniversityHack_2019
/BEAMBIT.py
ISO-8859-10
20,272
3.21875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.metrics import median_absolute_error from sklearn import preprocessing import xgboost as xgb from sklearn.model_selection import RandomizedSearchCV, GridSearchCV from sklearn.model_selection import KFold import os ...
true
752991d45501ef6dcdfbf602ae6367963414605c
noveljava/study_leetcode
/completed/93_restore_ip_addresses.py
UTF-8
890
3.203125
3
[]
no_license
from typing import List class Solution: def restoreIpAddresses(self, s: str) -> List[str]: result = [] def backtracking(current_position, s, info): if current_position == 4: current_info = ".".join(info[:]) if len(s) == 0 and current_info not in result: ...
true
149775e27a72346c34cc38a5d01be42fe31e5305
sarahbawabe/oscar-scripts
/rgg-tau-cbar.py
UTF-8
2,045
2.765625
3
[]
no_license
import networkx as nx import numpy as np import random import collections def plot_degree_dist(G): degrees = [G.degree(n) for n in G.nodes()] plt.hist(degrees) alpha = [] s1 = [] s2 = [] ll = [] max_clq_sz = [] max_clq_num = [] tau = [] cbar = [] z = 'z0' #TODO: update redshift n = 406793 # TODO: update numb...
true
fd998d2c45200578ff8e37c18c3ccfacf7d4e287
AaronYXZ/PyFullStack
/Leetcode/Backtracking/L401_BinaryWatch.py
UTF-8
1,006
2.984375
3
[]
no_license
class Solution: def readBinaryWatch(self, num: int): times = [480, 240, 120, 60, 32, 16, 8, 4, 2, 1] def backtrack(result, path, index, num, times): if len(path) == num: hour = sum(path) // 60 % 12 minute = sum(path) % 60 time = str(hour) ...
true
9b1b670dd3d024a752af5f64d694e47be719cffe
murilosisnando2003/python4linux
/funcoes.py
UTF-8
262
3.796875
4
[]
no_license
#!/usr/bin/python3 def somar(x, y): return x + y b = somar(3,2) print(b) exit() def boas_vindas(nome,idade=24): return('Ola sou o {} e tenho {} anos '.format(nome,idade)) a = (boas_vindas('maria',25) ) # print(boas_vindas('jose',30)) print(a)
true
cbfacb6a11bafda6e1f5d23ee55541885134c91d
marmida/LUKSmounter
/luksmounter.py
UTF-8
5,862
2.78125
3
[]
no_license
''' Manage LUKS volume mounts in a GUI, so you don't forget to lock them when they're no longer in use (because it has a Unity launcher entry still active). Should be launched with elevated privs / gksudo. ''' # setup pygtk for version selecting import pygtk pygtk.require('2.0') import ConfigParser import gtk import...
true
f7f96e621939f666dc9d3ffb17ba26ed686733c0
hengyangKing/python-skin
/Python基础/code_day_2/trigon.py
UTF-8
95
3.171875
3
[ "MIT" ]
permissive
i = 0; while i<5: j = 0; while j<=i: print("*",end=""); j+=1; print (""); i += 1;
true
50f02d174a38b4892f914681945bdac7b2f5df2a
jmery24/python
/ippython/funciones_calificaciones_357.py
UTF-8
7,181
3.1875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jun 7 06:57:01 2013 @author: daniel """ #programa: funciones_calificaciones_357.py #input: matriz mXn, datos por cada fila: numero alumno, calificaciones #examenes presentados, sino presento el examen la calificacion es -1 #definir 9 funciones para diferentes calculos #eje...
true
6b096757de3c44e4f2ea5f548cce79bf93765f36
Meghnakrishnan/programming-lab
/15-6.py
UTF-8
389
4.125
4
[]
no_license
#write python function to generate all factors of a number def factors(n): print("factors of %d are:",n) #checking factors of the given number for i in range(1,n+1): if (n%i==0): print(i)#print the factors n=int(input("enter the number:"))#input a number factors(n) '''output ...
true
000c9fb3a1c253780c918c40a5bafca35c75009e
bgrochal/GeneticEdgeDetector
/common/data/image.py
UTF-8
315
2.828125
3
[]
no_license
""" This class contains a model of an image. """ import numpy as np class Image: def __init__(self, image_matrix, file_name): self.shape = image_matrix.shape self.image_matrix = image_matrix self.edge_matrix = np.ones(image_matrix.shape, dtype=bool) self.file_name = file_name
true
abaacae6bad5d4a98caf86114a5bd7883ff580e1
PacktPublishing/Learning-Python-Application-Development
/Chapter 2/heal_exception_example.py
UTF-8
2,118
3.640625
4
[ "MIT" ]
permissive
from __future__ import print_function """heal_exception_example Supporting example code for 'exception handling' (Chapter 2) This module is compatible with Python 3.5.x AND Python 2.7.9 It contains supporting code for the book, Learning Python Application Development, Packt Publishing. This is a simplified version o...
true
0dd2eb62c27f947d5d9e312a3fc2522f6a18983c
matdombrock/Spyware1
/gui.py
UTF-8
583
2.75
3
[ "MIT" ]
permissive
from tkinter import Tk, Label, Button import payload import config class GUI: def __init__(self, master): self.master = master master.title(config.title) self.label = Label(master, text=config.label) self.label.pack() self.greet_button = Button(master, text=config.button_...
true
4e487ec941f9527c53c8d3262cb7351a1c24509f
Murrkeys/Biofuel-Simulation
/find_max_and_oscillation.py
UTF-8
1,753
4.15625
4
[]
no_license
""" Purpose : Define a function that finds the maximum amount of internal biofuel and the amount of oscillation in the level of internal biofuel. Created on 30/4/2020 @author: Murray Keogh Program description: Write a function that finds the maximum value and its indices in the input array. ...
true
2c1b1c800aae6efbf7a0c07718ec74830b28bdbf
happy0000/python
/20190523.py
UTF-8
4,167
3.8125
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: sum=0 count=1 while count <=10: sum=sum+count #sum += count count+=1 print('1+2+3+...+10=',sum) # # 銀行利息規範 # In[2]: x = 10000 year = 0 while x < 20000: year +=1 x=x * 1.0104 print(str(year),'年後,存款金額加倍') # # 帳號密碼程式 # In[3]: id='tony' pwd='1234' ...
true
d62088f3c7fb302ea701cdddf0c2e773ee1ef4e4
renatodev95/curso-python
/secao5-modulos-python/csv1.py
UTF-8
2,019
3.828125
4
[ "MIT" ]
permissive
""" CSV -> Comma Separated Values (Valores separados por vírgula) É um formato de dados muito usado em tabelas (Excel, Google Sheets), bases de dados, clientes de ee-mail, etc... """ import csv with open('clientes.csv', 'r') as file: dados = csv.reader(file) # caso não queira que a primeira linha do arquivo se...
true
b00149a9ca587be897e49e5d8daf47d6619bccaf
JerryHu1994/LeetCode-Practice
/Solutions/940-Distinct-Subsequences-II/python.py
UTF-8
411
2.703125
3
[]
no_license
class Solution(object): def distinctSubseqII(self, S): """ :type S: str :rtype: int """ dp = [1] dic = {} for ind, c in enumerate(S): currcnt = dp[-1]*2 if c in dic: dp.append(currcnt - dp[dic[c]]) else: ...
true
5c8f2beea60b1927652ae38a76f46ed4b58ed2ae
AswinBarath/image-processing
/images.py
UTF-8
817
2.921875
3
[]
no_license
from PIL import Image, ImageFilter img = Image.open('./Pokedex/pikachu.jpg') # Image Filters filtered_img = img.filter(ImageFilter.BLUR) filtered_img.save("blur.png", 'png') filtered_img = img.filter(ImageFilter.SMOOTH) filtered_img.save("smooth.png", 'png') filtered_img = img.filter(ImageFilter.SHARPEN) filt...
true
6bdce18170715eb472113afb4b4ef6a1f7e593bb
M-110/learning-python-complexity
/--Wolfram/continuous_ca.py
UTF-8
481
3.296875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from math import floor rows = 67 cols = rows grid = np.zeros((rows, cols), dtype=float) grid[0,rows//2] = 1 for i in range(1, rows): for j in range(1, cols-1): new_value = (grid[i-1, j-1] + grid[i-1, j] + grid[i-1, j+1])/3*-4.68 + .9 i...
true
d14fd51c14f84205113748acc8e73d89806c1866
Priyanka1-tech1/module3assgn3
/mod3assign3_new_line.py
UTF-8
239
3.125
3
[]
no_license
test_list = ['gf\ng', 'i\ns', 'b\nest', 'fo\nr', 'geeks\n'] print("The original list : " + str(test_list)) res = [] for sub in test_list: res.append(sub.replace("\n", "")) print("List after newline character removal" + str(res))
true
62474a9a171afe612e3472bc9902661dbe603f33
johannvk/tma4212_pr2
/task2.py
UTF-8
6,999
2.828125
3
[]
no_license
# Numerical Libraries: import numpy as np from scipy.integrate import solve_ivp # Plotting libraries: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # For 3-d plot from matplotlib import cm import matplotlib.gridspec as gs # Type enforcing: from typing import Union, Callable, Tuple, Iterable...
true
dfbcf18a16d156868a20fa4bb0073121c834e506
OuYangMinOa/Axion
/analyse/01_11/BMP_compare.py
UTF-8
3,418
3.140625
3
[]
no_license
from matplotlib.pyplot import * import matplotlib.mlab as mlab from numpy import * from scipy.optimize import curve_fit from scipy.special import factorial from scipy.stats import norm, chisquare, poisson, chi2 class Noise: def __init__(self,mu,sigma,length): self.noise = np.random.normal(mu,sigma,length) self.fi...
true
34de6c4f41ce55a2d84f78457a3ab6ad74ed3dac
talsky1/Python3-course
/if/5-3_alien_colors.py
UTF-8
199
3.171875
3
[]
no_license
alien_colors = ['red', 'green', 'red'] if 'green' in alien_colors: print('You have killed green alien, you got 5 points!') #V2 - Fail if "black" in alien_colors: print("Failed!!!!")
true
67f3c805cca9fd3691a006b955e36cf17f8a8685
howardc72150/mathquiz
/01_startGame_v2.py
UTF-8
9,480
3.203125
3
[]
no_license
import time import random from tkinter import * from functools import partial class Start: def __init__(self, root): round_number = IntVar #round_number.set(1) self.frame = Frame() self.frame.grid() self.headingFrame = Frame(self.frame, width=500, height=18, b...
true
ac52b63a7f9f635e4cc776b96909a9e4626bfa22
cutiebananaface/Thesis-code
/sortcellarraybyfield_python.py
UTF-8
1,332
2.59375
3
[]
no_license
# Generated with SMOP 0.41 # from libsmop import * # sortcellarraybyfield.m import numpy as np def sortcellarraybyfield(database,fieldname,upordown="ascend"): #check direction if upordown == "ascend": upordown= 1 #'ascend' # sortcellarraybyfield.m:3 if upordown=='descend': up...
true
0a28d97517f4b8839c81d4c528a7ad4e77febfad
Prince9ish/Music-Gesture-Recognition
/Leap_Listeners.py
UTF-8
2,697
2.703125
3
[]
no_license
# ------------------------------------------------------------------------------- # Import import Leap, sys, thread, time, math from Leap import CircleGesture, KeyTapGesture, ScreenTapGesture, SwipeGesture from Music_Control import* # ---------------------------------------------------------------------------...
true
98ad169d8f26b0ab2f233f7d3baaff34fd1a7124
8NMN8/Advance
/Linear search/Линейный поиск - 7.py
UTF-8
246
3.078125
3
[]
no_license
N = int(input()) a = [int(i) for i in input().split()] minimum1 = minimum2 = 2000 for i in range(N): if a[i] < minimum1: minimum2, minimum1 = minimum1, a[i] elif a[i] < minimum2: minimum2 = a[i] print(minimum1, minimum2)
true
8b3113fde95412f00dd5855927fdb2501ddc0b43
ijkilchenko/snakes_on_a_pyRLane
/test_Board.py
UTF-8
2,362
3.453125
3
[ "MIT" ]
permissive
import unittest import time import numpy as np from Board import Board, Snake class TestBoard(unittest.TestCase): def test_get_drawing(self): board = Board(15, 0) # Make a 15x15 board. drawing = board.get_drawing() self.assertEqual(len(drawing), 17) self.assertEqual(len(drawing[0])...
true
b7b121e4167c5f2b8e747766543f434f1aa7d842
matiasdamelio/devAPI
/cotizaciones.py
UTF-8
6,223
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jul 16 14:28:02 2019 @author: mdamelio """ from gui_ui import Ui_MainWindow import APIS.DevApi as dev from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QMainWindow, QApplication from PyQt5 import QtGui, QtWidgets, QtCore import sys import time from ...
true
d9b54b2ecb2723e601e555c16e0e4171ebb5ac50
infezek/RNA
/Exercicio 02/03.py
UTF-8
2,575
3.171875
3
[]
no_license
import numpy as np taxa_apredizado = 0.03 epocas = 2 entradas_saidas = np.array([ [1, 0, 0, 1, 0], [1, 1, 0, 1, 1], [1, 0, 0, 0, 0], [1, 1, 1, 0, 1], [1, 0, 1, 1, 0], [1, 1, 0, 0, 1], ]) peso = np.array([0.2, 0.6, .1, .3]) def entrada(x): xx = entradas_saidas[x][0:-1] return xx de...
true
17315c277754453518e1024350a1f799b1f6ec0b
getshorty/poker-player-python
/getRandomDeckforHands.py
UTF-8
573
2.75
3
[ "MIT" ]
permissive
__author__ = 'szszrenko' import random #USAGE #import getRandomDeckforHands #getRandomDeckforHands.hv.getChoice() class RandomDeck(object): def __init__(self, cards): self.cards = cards self.card1 = cards[0] self.card2 = cards[1] def getChoice(self): return self.cards hv= Rand...
true
a9c0afac9e12ae11e4bb1d23c9e27680fd3016cf
enlike/docker_django1
/docker_django1/apps/core/models/operations/customIndex.py
UTF-8
2,783
2.875
3
[]
no_license
# coding=utf-8 from django.contrib.postgres.indexes import GistIndex from django.db.models import Index class UpperGistIndex(GistIndex): """ В операции __icontains... Используется оператор UPPER. Cделан override дефолтного GistIndex с указанием поля UPPER() Возможно нужно будет удалять эт...
true
cc7857f39b2ab43c2875c6e70be8a732eff20de6
Oordell/Tartarus-Game-With-AI
/map.py
UTF-8
7,637
3.015625
3
[]
no_license
#!/usr/bin/env python import random as rand from constants import * class TartarusMap(object): def __init__(self): self.map = None self.valid_map = False self.robot_pos = [-1, -1] #[y, x] self.robot_direction = None self.sensor_readings = [] self.new_map() ...
true
dd66976949fb72b580a54ff72e4886204fe837da
smaroukis/workoutDB
/gui.py
UTF-8
4,296
3.15625
3
[]
no_license
""" A program that stores the following workout information: Type, Intensity, Duration, Description User can: View all Search by Type, Intensity, Duration Add entry Update entry Delete Close """ #TODO restrict to only low, med, high intensities #TODO restrict only to bike, swim, run #TODO better user interface (scroll...
true
eee1129a0489cd40d01a0c33a66e74c30e0347f6
MarvinT/annorxiver
/biorxiv/word_vector_experiment/biorxiv_generate_embeddings.py
UTF-8
6,906
2.90625
3
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # coding: utf-8 # # Generate BioRxiv Document Embeddings # This notebook is designed to generate document embeddings for every article in bioRxiv. # In[ ]: from pathlib import Path import re import sys sys.path.append("../../modules/") from gensim.models import Word2Vec import pandas as pd ...
true
88bc08cf10379fee96523cb6ff63ec584eb5e76b
xiaoxue11/hank_practice
/Listlink/insertNodeAtHead.py
UTF-8
1,005
3.53125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 2 23:48:41 2019 @author: 29132 """ class SinglyLinkedListNode: def __init__(self, node_data): self.data = node_data self.next = None class SinglyLinkedList: def __init__(self): self.head = None self.tail=None def prin...
true
d303cb3ac70bbbad3d79f1ded220b599a8402d8a
ralf-boltshauser/humanbenchmark-scripts
/reactiontime.py
UTF-8
586
2.90625
3
[]
no_license
import pyautogui import win32gui from time import sleep import keyboard def rgbint2rgbtuple(x, y): RGBint = win32gui.GetPixel(win32gui.GetDC(win32gui.GetActiveWindow()), x, y) d = dict() d['b'] = RGBint & 255 d['g'] = (RGBint >> 8) & 255 d['r'] = (RGBint >> 16) & 255 return d stop = False whi...
true
1f60d9db9ab7adbdca58a63f543288dc35bfc026
SumitM0432/Malicious-Webpage-Classifier
/src/processing_fns/https_http.py
UTF-8
442
2.890625
3
[ "MIT" ]
permissive
import http.client def http_https(url): try: if 'https://' in url: url = url.split('https://')[1] else: url = url.split('http://')[1] conn = http.client.HTTPSConnection(url) conn.request("HEAD", "/") conn = conn.getresponse() if conn...
true
ac3da20e5fa135ab8b3f5ade32bd8b3b82da1434
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4135/codes/1638_2450.py
UTF-8
168
4.0625
4
[]
no_license
nome1 = input("Digite um nome:") nome2 = input("Digite outro nome:") if (nome1.upper()<nome2.upper()): print (nome1) print (nome2) else: print (nome2) print (nome1)
true
2639b4d5af3be30dd0817a2e3c49a7f1d779d346
harsh1909/Billing-Project
/page4.py
UTF-8
8,185
2.515625
3
[]
no_license
from PyQt5.QtWidgets import * import page1,database from PyQt5.QtGui import QFont from PyQt5.QtCore import Qt,QSize,QDate from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure import matplotlib.pyplot as plt plt.style.use(['dark_background']) from col...
true
f2c40b811f4952d530f0a16fd89f454ddeab7797
daniyal9538/CID
/CIDv0.1 -v0.2 (unorganized code)/Test scripts/Gameplay recording test/test_data.py
UTF-8
656
2.921875
3
[]
no_license
#Author: Daniyal Selani import numpy as np import cv2 #this program iterates through data files and displays the images and onehot keypress arrays in dataset #is needed to verify if data collection is working correctly start_file = 1 end_file = 4 name = 'demo-data-' for i in range(start_file, end_file+1): ...
true
a33b558033b831f7f8195f1f4f3918f8cc984e8b
fagan2888/bayesian_network
/bayesian 2.py
UTF-8
2,470
2.8125
3
[]
no_license
# First, we build bn, which is a dictionary, from bn.txt. bn = {} f = open('bn.txt', 'r') c = 0 for line in f: if line.split(' ')[0] == '%': c = c + 1 continue if c == 1: vars = line.replace('\n','').replace(' ','').split(',') # vars is a list where we put our events. fo...
true
d53f90201adf2689ee838523e2bd4b2c33a28d96
samikhan66/Data-Augmentation-Script
/create.py
UTF-8
18,174
2.640625
3
[]
no_license
import os import json import argparse import numpy as np import random import math from PIL import Image, ImageEnhance import xml.etree.ElementTree as et import shutil import re root_path = os.getcwd() # Entrypoint Args parser = argparse.ArgumentParser(description='Create synthetic training data for object detection a...
true
1b7a57e309583c9f622b5273ccd62531c7f07027
KimAnnie/Python
/geometry/area/circle.py
UTF-8
184
2.828125
3
[]
no_license
# coding: utf-8 # In[ ]: #!/usr/bin/python # -*- coding: UTF-8 -*- import math def circle_area(r): print("半径为%.2f圆形面积为:%.2f"%(r, math.pi * r * r)) return
true
00d130c13b4ffc71cb8ca8794c4cbb4bbb80c101
wmylxmj/ID3-decision-tree
/shannonent.py
UTF-8
854
3.125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jun 22 22:21:13 2018 @author: wmy """ import math def CalcShannonEnt(dataset,feature): #数据的长度 num=len(dataset) #记录类和次数的字典 labelcounts={} for element in dataset: #选择数据的特征类别 currentlabel=element[feature] if currentlabel not in label...
true
bb559b86d737e73cd2c839f637bee1bc56fc2552
achmadafriza/DDP1
/Lab 08/Lab08_Achmad Afriza Wibawa_1906315821_FE.py
UTF-8
2,536
3.78125
4
[]
no_license
# ******************************************************************* # lab08 # DDP1 / FPROG1 -- 2019 # Recursively translates words into a decimal integer # with active web-based GUI # ******************************************************************* from flask import Flask, render_template_string, request fr...
true
11753603dae2152e5f435585f717dda3c8df1a84
Youga810/ProgrammingContest
/paiza/B/081.py
UTF-8
309
2.9375
3
[]
no_license
# ????????????????????????? h, w = map(int, input().split()) map = [] # print(map) for i in range(h): map.append(input().split()) print(map) for i in range(h): for j in range(w): if(i == 0 or j == 0): print(map[i][0][j], end="") # print(new[i][j]) # pass
true
74df89aeb43a3228b082358bce3e1ac62d7003c0
osmium18452/test
/main.py
UTF-8
2,479
2.6875
3
[]
no_license
import tensorflow as tf import numpy as np from tqdm import tqdm mnist=tf.keras.datasets.mnist def to_one_hot(dimension,tensor): rtn=[] for i in tensor: vec=np.zeros(dimension) vec[i]=1 rtn.append(vec) return np.array(rtn) (x_train, y_train), (x_test, y_test) = mnist.load_data() import matplotlib.pyplot as p...
true
d8ab77a83132982eac916653652f40fa66be78ce
gchure/phd
/src/chapter_07/code/ch7_figS2.py
UTF-8
3,576
2.671875
3
[ "MIT", "CC-BY-4.0" ]
permissive
#%% import numpy as np import pandas as pd import scipy.stats import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import seaborn as sns import phd.thermo import phd.viz colors, palette = phd.viz.phd_style() # Load the prior predictive check data. data = pd.read_csv('../../data/ch7_mutants_si/epRA...
true
3ac5629eb2213d0ef5c0697a5062c17b03a7ed84
mrwillbarnz/Python_FAB_Reimplementation
/Chapter_7/trivia-game/trivia-game.py
UTF-8
2,688
4.28125
4
[]
no_license
# Trivia Challenge # Demonstrates Files and Exceptions # Trivia game that reads a plain-text file. # # TODO # 1. Improve the Trivia Challenge game so that each question has a unique # point value associated with it. The player's score # should be the total of all the point values of the questions # he or she answers co...
true
598bf005de8ace92a8a4ca8ad57aa2269c0a85c7
yiz202/leetcode
/nine_chapter/475.py
UTF-8
1,433
2.875
3
[]
no_license
class Solution(object): def findRadius(self, houses, heaters): """ :type houses: List[int] :type heaters: List[int] :rtype: int """ # Time complexity: max(O(nlogn), O(mlogn)) # houses = sorted(houses) # heaters = sorted(heaters) # res = 0 ...
true
c04d05fb4b67d38e5c5c74791f937054976e739e
3elDU/SoStrategy
/libs/rendering/Renderer.py
UTF-8
6,714
2.546875
3
[]
no_license
import pygame from libs.Constants import * class RenderingMode2: def __init__(self, w, h, mgr): self.w, self.h = w, h self.mgr = mgr self.blockSize = 16 class RenderingMode1: def __init__(self, x, y, world, buildings, ores, w, h, mgr, creator, rescaler): self.rescaler = resc...
true
1b2301b1d3e5f15ec3c78755f8a9237d2fba6ac2
dilipksahu/django_class
/python_revision/HackerRank/AppleandOrangeCount.py
UTF-8
2,547
4.15625
4
[]
no_license
''' Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point, and is the endpoint. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the trees are located on a singl...
true
ab11658fa90f7aa35b3b8533386d97b2ee8fb432
MrHamdulay/csc3-capstone
/examples/data/Assignment_8/mtrdud001/question2.py
UTF-8
479
4.15625
4
[]
no_license
""" using recursion to count repeated strings Dudley Mutero 9 may 2014""" def numberofpairs(message): """characters in a string with repitition""" if len (message) > 1 : if message[0] == message[1]: return 1 + numberofpairs(message[2:]) else: return 0 + numbero...
true
7958a44b9022f36830e9c39d4a0b7377e5a77d96
zdgeier/CSC-101
/ZacharyGeier_CS_6-8.py
UTF-8
588
4.125
4
[]
no_license
def celsiusToFahrenheit(celsius): return (9/5) * celsius + 32 def fahrenheitToCelsius(fahrenheit): return (5/9) * (fahrenheit - 32) def main(): print("Celsius", "Fahrenheit", "|", "Fahrenheit", "Celsius", sep=" ") print('-' * 51) c = 40.0 f = 120.0 for i in range(0,10): li...
true
55b104d0d86c184b1c63d73177deaa54a2602411
cz-fish/advent-of-code
/2018/14.py
UTF-8
1,737
3.25
3
[ "MIT" ]
permissive
#!/usr/bin/python3.8 from aoc import Env e = Env(14) e.T("9", "5158916779", None) e.T("5", "0124515891", None) e.T("18", "9251071085", None) e.T("2018", "5941429882", None) e.T("51589", None, 9) e.T("01245", None, 5) e.T("92510", None, 18) e.T("59414", None, 2018) SEED = [3, 7] def do_iterations(n): scores = S...
true
1e1e22d3982bef949af7ff1698fe8e78659a759d
haidfs/LeetCode
/Hot100/组合总和II.py
UTF-8
2,088
4.0625
4
[]
no_license
# 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 # # candidates 中的数字只能够使用一次。 # # 说明: # # 所有数字(包括 target)都是正整数。 # 解集不能包含重复的组合。 # 示例 1: # # 输入: candidates = [2,3,6,7], target = 7, # 所求解集为: # [ # [7], # [2,2,3] # ] # 示例 2: # # 输入: candidates = [2,3,5], target = 8, # 所求解集为: # [ # [2,2,2,2...
true
fbbffbe54ba6bc1d3fe252a3fba8a7a0fbab03a3
camilacalderon123/Reto1MisionTIC
/reto1.py
UTF-8
551
3.421875
3
[]
no_license
print("Bienvenido al sistema de ubicación para zonas públicas WIFI") nombreDeUsuario = int(input("Ingrese su usuario: ")) if(nombreDeUsuario == 51636): contrasena = int(input("Ingrese su contraseña: ")) if(contrasena == 63615): numero1 = nombreDeUsuario % 1000 numero2 = int(6/(6 % 5+1)) suma = in...
true
204b0e4745a07daf53425860cbb9d2919e2f2d6d
DenisFeoktistov/CasinoProject
/pythonProject/Классы интерфейса/Классы CasinoWindow/DiceGame.py
UTF-8
5,644
2.890625
3
[]
no_license
from PyQt5.QtWidgets import QPushButton, QLabel, QSlider, QLineEdit from PyQt5.QtCore import Qt, QTimer from PyQt5.QtGui import QPixmap from PyQt5 import QtCore import Fonts # класс, который реализует вторую игру. Содержит слайдер, кнопку запуска, поле для ставки, # поле с овозможным выигрышем, а также некоторые лей...
true
6fa4028c4e0cef47c4b869c21e977e2a5b9c386e
wor/tokenizer
/src/wor/bidirgencache.py
UTF-8
8,660
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4 """BidirGenCache generator wrapper with caching. """ import collections class BidirGenCache(object): """Generator wrapper which caches past values and allows peeking. It's basically a memoryview for a generator. Other functionality mainl...
true
3472f5bbc84e64c50cd40fc8931017879da4d89a
bobmwaniki/ticket_booking_service
/test_event_function.py
UTF-8
1,165
2.6875
3
[]
no_license
import unittest, sqlite3, time, datetime from event_functions import create_event, view_all_events, edit_event, delete_event from unix_time_conversions import unix_to_readable, readable_to_unix conn = sqlite3.connect('test_dummy_data.db') c = conn.cursor() c.execute("CREATE TABLE IF NOT EXISTS events (event_ID INTEGE...
true