blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
842887ea36a0a019eae06afbedde1a86e74ddb9f
Python
ageelg-mobile/100py
/Week008/d053_d054_mymath.py
UTF-8
196
2.90625
3
[]
no_license
#Ageel 10/11/2019 #100 Days of Python #Day 053 & 054 - quiz def add(x,y): return x+y def sub(x,y): return x-y def divide(x,y): return x/y def multiply(x,y): return x*y
true
8ea51e679df1793723ea3c04f6146729c80ff0f1
Python
xiyangyang410/Learning-Python-Code
/38_2.py
UTF-8
2,242
3.046875
3
[]
no_license
traceMe = False def trace(*args): if traceMe: print('[' + ' '.join(map(str, args)), +']') def accessControl(failIf): def onDecorator(aClass): if not __debug__: return aClass else: class onInstance: def __init__(self, *args, **kargs): ...
true
f28e2a537691c8db02d4f3d5e80cc20c6efd376e
Python
rk50895/capstone
/app.py
UTF-8
15,101
2.578125
3
[]
no_license
import os import json from flask import ( Flask, request, abort, jsonify ) from sqlalchemy import exc from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from auth import ( AuthError, requires_auth ) from models import ( db, setup_db, Actor, Movie, actor_mov...
true
4d65ed48d060183305ccb91392640406c91d09e8
Python
percyfal/tskit
/python/tests/test_ibd.py
UTF-8
22,880
2.796875
3
[ "MIT" ]
permissive
""" Tests of IBD finding algorithms. """ import io import itertools import random import msprime import pytest import tests.ibd as ibd import tests.test_wright_fisher as wf import tskit # Functions for computing IBD 'naively'. def find_ibd( ts, sample_pairs, min_length=0, max_time=None, compare...
true
9544988873297909fd565bc45a813fcf7f8b24db
Python
gebeto/nulp
/_parsing/formatter.py
UTF-8
632
2.515625
3
[ "MIT" ]
permissive
import requests from bs4 import BeautifulSoup import io ID = 166770 data = io.open("{}.html".format(ID), "r", encoding="utf-8").read() soup = BeautifulSoup(data, 'html.parser') formatted = soup.prettify() imgs = soup.find_all('img') for img in imgs: if img.src: # img.parent.insert(img.parent.index(img)+1, Tag(soup...
true
34de74931d3a8b4143581abff61ef80167eea99b
Python
sankarpa/daily-coding
/python-problems/arrays/src/smallest_window_to_be_sorted.py
UTF-8
426
3.65625
4
[]
no_license
def smallest_window_to_be_sorted(nums: list): maximum, minimum = -float("inf"), float("inf") length = len(nums) left, right = None, None for i in range(length): maximum = max(maximum, nums[i]) if nums[i] < maximum: right = i for i in range(length - 1, -1, -1): m...
true
37cfe021e3afcb6c207e7136ff40cecd92d83b7d
Python
DinakarBijili/Python-Preparation
/Data Structures and Algorithms/Data Structures/Array/array.py
UTF-8
1,608
4.1875
4
[]
no_license
class Array(object): def __init__(self, sizeOfArray, arrayType = int): self.sizeOfArray = len(list(map(arrayType, range(sizeOfArray)))) self.arrayItems =[arrayType(0)] * sizeOfArray # initialize array with zeroes def __str__(self): return ' '.join([str(i) for i in self.ar...
true
a47fade7b799c6d21498d2c132ab8149284904dd
Python
BrookhavenNationalLaboratory/pyRafters
/pyRafters/handlers/np_handler.py
UTF-8
8,140
2.8125
3
[ "BSD-3-Clause" ]
permissive
""" A set of sources and sinks for handling in-memory nparrays """ from __future__ import (absolute_import, division, print_function, unicode_literals) import six from six.moves import range import numpy as np from ..handler_base import (DistributionSource, DistributionSink, ...
true
151c24c72746add09089e8d9e61891c9372de8e7
Python
ashkanyousefi/Algorithms_and_Data_Structures
/HW2/week1_basic_data_structures/1_brackets_in_code/check_brackets.py
UTF-8
3,656
3.921875
4
[]
no_license
# # python3 # from collections import namedtuple # Bracket = namedtuple("Bracket", ["char", "position"]) # def are_matching(left, right): # return (left + right) in ["()", "[]", "{}"] # def find_mismatch(text): # opening_brackets_stack = [] # for i, next in enumerate(text): # if next in "([{":...
true
8fb083b80286b7ae4b1c147bbd091e5c41d0b9ef
Python
ddebettencourt/adventofcode2020
/day6.py
UTF-8
600
2.921875
3
[]
no_license
data = open("C:\\Users\\djdeb\\Desktop\\Random Stuff\\Advent of Code 2020\\day6input.txt") str = data.read() puzzle_array = str.splitlines() #print(puzzle_array) alphabet = [0 for i in range(26)] total_count = 0 num = 0 for line in puzzle_array: if line == "": print(alphabet) total_count += sum([a for a ...
true
6e2b573abe43ad7718806696aaf8d934700f8c4d
Python
aga-moj-nick/Python-List
/Exercise 002.py
UTF-8
168
4
4
[]
no_license
# 2. Write a Python program to multiply all the items in a list. liczby = [1, 2, 3, 4, 5] print (2 * liczby) liczby1 = [1, 2, 3, 4, 5] print (liczby1 + liczby1)
true
bce27ea874eb066d6df04a5fab09617145179c0e
Python
icasarino/ProjectEuler
/Euler18/main.py
UTF-8
961
2.984375
3
[]
no_license
import triangleList as tl tvalues = tl.triangle svalues = tl.copyMatrix(tvalues) size = len(tvalues) def calcular(): for i in range(size - 1): llen = len(tvalues[i]) for j in range(llen): valor = tvalues[i][j] if tvalues[i].index(valor) < llen - 1: ...
true
c7e84c8af3425affe59bd73121b183acd48f9027
Python
Ruben-hash/bina-dec-machine
/entier_vers_binaire.py
UTF-8
144
3.3125
3
[]
no_license
def entier_vers_binaire(n): b = [] while n > 0: b.append(n%2) n = n //2 b.reverse() return b
true
6c95c09b5b70b2e3db45f28a936d3f3c2d0b12ec
Python
skadldnr89579/Python-Practice
/005 - Data type.py
UTF-8
401
3.4375
3
[]
no_license
int_data=1 #integer float_data=3.14 #float complex_data=1+5j #complex number str_data1='I love Python' #string (English) str_data2="파이썬 좋아" #string (Korean) list_data=[1,2,3] #list tuple_data=(1,2,3) #tuple dict_data={0:'False',1:'True'} #dictionary print(int_data) print(float_data) print(complex_data) print(str_data1...
true
c230de9d340da44a678ce809cba41cc7a7a99611
Python
itm-dsc-tap-2020-1/tap-practica-3-web-scraping-mysql-AlondraZM
/practica3.py
UTF-8
1,859
2.859375
3
[]
no_license
import tkinter as Tk from tkinter import ttk from urllib.request import urlopen from bs4 import BeautifulSoup import mysql.connector as mysql conexion = mysql.connect( host='localhost', user= 'alondra', passwd='garu', db='practica3' ) operacion = conexion.cursor() operacion.execute( "SELECT * FROM web" ) pag_inicia...
true
6716714bac4e840e993b50155e9771a1004da091
Python
ROHINI-23/Patterns
/Pyramid_Shape_Reverse.py
UTF-8
183
3.484375
3
[]
no_license
n = int(input()) k = n for i in range(n,0,-1): for j in range(0,n-i): print(end=" ") for j in range(0,k): print("*", end=" ") k = k-1 print()
true
1468f2752363cd389dc06c3fda137eae10f46ec0
Python
MarianDanaila/Competitive-Programming
/Leetcode Contests/Biweekly Contest 24/Find the Minimum Number of Fibonacci Numbers Whose Sum Is K.py
UTF-8
397
3.296875
3
[]
no_license
class Solution: def findMinFibonacciNumbers(self, k: int) -> int: stack = [] fib1 = 0 fib2 = 1 while fib2 <= k: stack.append(fib2) fib1, fib2 = fib2, fib1 + fib2 count = 0 while k > 0: if stack[-1] <= k: k -= stack[...
true
aa00d2aeaad4ead38c2aaf5eb6cab0471f59a9c8
Python
luckyboy1220/tutorial
/advertise/make_sample.py
UTF-8
2,239
2.546875
3
[]
no_license
# encoding=utf-8 """ @author : peng """ from feature import Feature,FeatureType import logging import pandas as pd BIN_COLS = ['item_id', 'item_brand_id', 'shop_id'] VAL_COLS = ['item_posrate', 'recent_15minutes', 'shop_score_delivery'] def init_feature_list(): logging.info("init feature list") buf = [] ...
true
e56b4af8f422799ba13e291906da7be583b03cb8
Python
xslogic/taba
/py/tellapart/taba/taba_event.py
UTF-8
1,562
2.78125
3
[ "Apache-2.0", "MIT" ]
permissive
# Copyright 2012 TellApart, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
true
263a4239a5a018f04995ff46fa21b5d18dbe4cca
Python
PhiCtl/NorthernLights
/utils.py
UTF-8
4,907
3.125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np #-------------------------------------------------LOSSES-------------------------------------------------------------# def compute_loss_MSE(y, tx, w, L1_reg, lambda_): """Calculate the MSE loss (with L2 regularization if lambda is not 0)""" e = y - tx.dot(w) if ...
true
651ac4862985a09111b93420632382c760e894a2
Python
dtgit/dtedu
/Archetypes/ref_graph.py
UTF-8
4,919
2.765625
3
[ "BSD-3-Clause" ]
permissive
""" Graphviz local object referencs, allows any refrerenceable object to produce a graph and a client side map. When we can export this as SVG (and expect clients to handle it) it will be much easier to style to the look of the site. Inspired by code from Andreas Jung """ from urllib import unquote from cStringIO im...
true
a6ec2fe3d941879dcad75c855a5b1926e5ac180c
Python
tony-yuan33/IBI1_2019-20
/Practical11/24Points.py
UTF-8
3,657
3.953125
4
[]
no_license
# -*- coding: utf-8 -*- # Use `Fraction` to avoid floaring-point errors from fractions import Fraction def is_24_points_solvable(numbers: list) -> (bool, int): # Pick two numbers, merge them, then put it back to the list # Do this recursively until there is only one number left. # If this number equals 24,...
true
9cfabec9508142e7549a617b44ac5cfb2154ce8e
Python
turicfr/wikia-chatbot
/plugins/tell.py
UTF-8
5,935
2.53125
3
[]
no_license
import json from datetime import datetime from contextlib import contextmanager from chatbot.users import User from chatbot.plugins import Plugin, Command, Argument @Plugin() class TellPlugin: def __init__(self): self.client = None self.logger = None self.just_joined = set() @staticme...
true
e21a64140b36c48725d72f677129eebeab9c5c25
Python
saadiabayou/Redshift-z
/raie_Hydro.py
UTF-8
612
3.203125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Feb 20 19:47:10 2021 @author: Saadia Bayou """ """ Programme raie_Hydro : calcul de la longueur d'onde """ # Données evJ=1.6076634e-19 # Joules -> 1 electronvolt vaut 1,6076634.10e-19 Joules RH=1.10e7 # RH = 1.10e7 m-1 h=6.63e-34 # h = 6.63e-34 m2.kg....
true
95233a8286160a56621528cc8bf47b090712b974
Python
maxpipoka/seminario1
/.vscode/TUTI - Cardozo Roque Martin - TP Integrador.py
UTF-8
14,447
3.421875
3
[]
no_license
''' El INYM desea generar una solución que permita modernizar el monitoreo de plantaciones de sus productores asociados. Para ello, se desea implementar un sistema de monitoreo con dispositivos de tipo IoT. El sistema se compone de un conjunto de ​dispositivos de los cuales se conocen su ID, descripción, zona de despli...
true
054d492ad0f621bd8552bddf1b83a06341673585
Python
saikumarballu/PythonPrograms
/dictionaries.py
UTF-8
361
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Mar 1 14:08:42 2019 @author: saib """ a = [1,2,3,4,5,6,7,1,1] b = [1,2,3,4,5,6,7,1,1] #c={name=['sai','kumar','ballu','hello'],id=[1,2,3,4]} d= {'name':'sai','idd':1234,'pass':'password','extn':3211} d['name']='kumar' d['cel']=87686876 print(d) del d['name'] #print(d.f...
true
256e2b79ca667397a4add53be98e3ecb77ef3620
Python
danielleaneal/Neal_Danielle_DIG5508
/Project-2/Free-Project-2.py
UTF-8
1,240
3.859375
4
[]
no_license
#Free Project 2, free project 11-1 from Programming Textbook #putting text on a picture #%% from PIL import Image, ImageDraw def transformimage(text, bgcolor): img = Image.new('RGB', (100, 30), color = bgcolor) d = ImageDraw.Draw(img) d.text ((10,10), text, fill=(255,255,0)) return img transformi...
true
eb18e168767a06b34775d99e5215888c70074698
Python
lair60/diyblog
/blog/models.py
UTF-8
2,200
2.53125
3
[ "MIT" ]
permissive
from django.db import models from django.contrib.auth.models import User from django.urls import reverse #Used to generate URLs by reversing the URL patterns # Create your models here. class BlogAuthor(models.Model): user= models.OneToOneField(User,on_delete=models.SET_NULL, null= True) bio= models.CharFiel...
true
befb6568d360d7dd069570ae3273d1a8c01515e8
Python
dodonmountain/algorithm
/2019_late/20191104/boj_1181_단어정렬.py
UTF-8
152
3.15625
3
[]
no_license
n = int(input()) arr = set() for i in range(n): arr.add(input()) arr = sorted(list(arr)) arr.sort(key= lambda x:(len(x))) for i in arr: print(i)
true
a57e2d2344805eb4c0cbc104ed0139d727b2732b
Python
trancuong95/hoc_git
/some_exercise_other/level_65_01_hay.py
UTF-8
162
3.515625
4
[]
no_license
def f(n): if n == 0: return 0 else: return f(n-1)+100 # Bài Python 65, Code by Quantrimang.com n = int(input("Nhập số n>0: ")) print(f(n))
true
010525509b2177f3bd7065f63e762209658d6518
Python
sealove20/Maratona-de-programa-o
/UriJudge/1016.py
UTF-8
97
3.453125
3
[]
no_license
distancia = int(input()) x = 60 y = 90 tempo = int(distancia/(y-x)*60) print("%d minutos"%tempo)
true
1f9e814ad93adbe11f900155dc2337ad7f7f0c57
Python
scarlett-kim/bit_seoul
/Study/keras/keras13_shape.py
UTF-8
1,038
3.0625
3
[]
no_license
# 데이터 shape import numpy as np x = np.array([range(1,101), range(711,811), range(100)]) y = np.array(range(101,201)) print(x) print("transpose하기전" , x.shape) #transpose하기전 (3, 100) print("t" , y.shape) #(100, ) x= np.transpose(x) y= np.transpose(y) print("transpose 하고 난 후" ,x.shape) #transpose 하고 난 후 (1...
true
ddc5caf0412756e86b5f885660155cf820ce8d73
Python
miguelfdezc/neural-networks-pk
/Class 8/Lab10_Cross-validation/SoftMaxLinear_XValidation.py
UTF-8
6,418
3.171875
3
[]
no_license
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt class SoftMaxLinear: def __init__(self, inputs_num, outputs_num): self.inum = inputs_num self.onum = outputs_num self.W = (-1 + 2*np.random.rand(inputs_num, outputs_num))/100.0 #neurons as columns self.b = np.z...
true
5ac4960cea859fa7f098c787224a854297ec3562
Python
karpalexander1997org1/FLSpegtransferHO
/utils/CmnUtil.py
UTF-8
8,686
2.671875
3
[]
no_license
"""Shared methods, to be loaded in other code. """ import numpy as np ESC_KEYS = [27, 1048603] MILLION = float(10**6) def normalize(v): norm=np.linalg.norm(v, ord=2) if norm==0: norm=np.finfo(v.dtype).eps return v/norm def LPF(raw_data, fc, dt): filtered = np.zeros_like(raw_data) for i ...
true
ce6bc8a3a9c7f9675c97500bc888881d5b10c676
Python
clpachec/COMPSCI-175
/Process_Text.py
UTF-8
861
3.34375
3
[]
no_license
''' Created on Sun Mar 13 010:21:32 2016 @author: Arielle ''' import re import nltk def Clean_Text(text: str): """ Returns a string cleaned of non-word related characters such as <br/ <p> due to source of generated text Parameters ---------- text : str Text to be cleaned and formatt...
true
fbc9f6c49868e5911b2dc6a47f5c3a68b2347874
Python
ksyoung/grasp_post_process
/clean_grid_file.py
UTF-8
1,836
3
3
[]
no_license
# hacked together code to read, edit, and rewrite a .grd file. # 'clean' refers to the error where 1.242E-110 is written to file as # 1.242-110. # code searches for these, and fixes these import optparse import sys import pdb # optparse it! usage = "usage: %prog <input_file>" parser = optparse.OptionParser(usage) #...
true
b77fa8ad08f2b68af71f160a0271823116bb989d
Python
vincentnawrocki/aws-tooling
/all-region-modifier/all_region_modifier.py
UTF-8
3,600
2.765625
3
[]
no_license
"""Module to apply a change on multiple regions for multiple AWS accounts.""" import json import boto3 from botocore.exceptions import ClientError import argparse import tqdm import actions from actions.ebs import enable_ebs_default_encryption from logger.logger import LOG def all_region_modifier(role: str, account_f...
true
f72bbc1cc4aae7571b2c56d917dc1dddf7e27602
Python
rgzfx/django-challenge-001
/jungledevs/utils/base_model.py
UTF-8
660
2.671875
3
[]
no_license
from django.db.models import DateTimeField, Model from django.utils.translation import ugettext_lazy as _ class BaseModel(Model): created_at = DateTimeField(auto_now_add=True, verbose_name=_("Creation Date")) updated_at = DateTimeField(auto_now=True, verbose_name=_("Update Date")) class Meta: abs...
true
fac56fc2154ce5012d984a8046c9b508184f9503
Python
eskog/inline_args
/inline_args.py
UTF-8
871
2.859375
3
[]
no_license
#!/usr/bin/python import sys import getopt def main(argv): # Stuff before arguments grammar = "Default value" debug = 0 try: opts, args = getopt.getopt(argv, "hg:d", ["help", "grammar"]) except getopt.GetoptError: usage() sys.exit(2) for opt, arg in opts: if op...
true
e8ae772f75aa083c204ac3436b2b91f59be02c04
Python
git-guozhijia/Python006-006
/week01/1.py
UTF-8
989
3.890625
4
[]
no_license
# 布尔运算 --- and, or, not print(111) if 1 or 2 else print(222) print(111) if 1 and 2 else print(222) print(111) if not 1 else print(222) # 111 # 111 # 222 # 比较运算 print("对") if 1 > 2 else print("错") print("对") if 1 < 2 else print("错") print("对") if 1 >= 2 else print("错") print("对") if 1 >= 2 else print("错") print("对") i...
true
4c2a4c0b0d2e3b2bee7e4190d7bb7caf9379ac44
Python
rustiri/OO_Python
/magic_methods/equality_compare.py
UTF-8
1,693
4.65625
5
[]
no_license
# Example of using __eq__ and __lt__ magic methods class Book: def __init__(self, title, author, price): super().__init__() self.title = title self.author = author self.price = price # TODO: use the __eq__ method to check for equality between two objects def __eq__(self, value): # t...
true
ecb69a6a0a1562a8bbe2fd3fd50657fac46f7dc1
Python
mohakbhardwaj/deep-rl
/rl_common/ReplayBuffer.py
UTF-8
5,459
3.015625
3
[]
no_license
#!/usr/bin/env python """ Replay Buffer Module for Deep Q Network Author: Mohak Bhardwaj Based of off Berkeley Deep RL course's dqn implementation which can be found at https://github.com/berkeleydeeprlcourse/homework/blob/master/hw3/dqn_utils.py This implementation is optimized as it only keeps...
true
f43d591dd23880097b9739264f31df9799b1ed92
Python
Jeffrey-Huang11/jhuang11
/05/krewes.py
UTF-8
982
3.328125
3
[]
no_license
# Team Rising Drago (Jeffrey Huang, Dragos Lup, & Ryan Ma) # SoftDev # K05 -- Teamwork, but Better This Time/ went through a dictionary, randomly selected a # key/group and randomly selected a "name" from the key/group # 2020-09-30 # Import random to use 'random.choice' function, which goes through a list and randoml...
true
99b5f538f2368575ffd4529578f38865fb8906db
Python
JopRijks/Amstelhaege
/code/helpers/location.py
UTF-8
4,927
3.625
4
[]
no_license
""" location.py Wordt gebruikt om de vrijstand van een huis te berekenen en om te controleren of de locatie van een huis aan de vereisten voldoet. Programmeertheorie Universiteit van Amsterdam Jop Rijksbaron, Robin Spiers & Vincent Kleiman """ def location_checker(house, neighbourhood): """Checks if the placem...
true
ef2872966849bc5654710e01e14042baebf698d8
Python
colinrdavidson/Baseball-Integer-Program
/make_team.py
UTF-8
1,887
2.9375
3
[]
no_license
#Default Modules import argparse import os.path import subprocess import sys #Custom Modules from generate_data_file import generate_data_file as gdf #Set up arg parser parser = argparse.ArgumentParser(description="Generate an optimal draft team.") parser.add_argument("--input", "-i", dest="input_file", nargs=1, requ...
true
2f9c1a210d0c1ddd7f090b12a4b4ea3152d0790a
Python
yura20/logos_python
/hw_04/palindrome.py
UTF-8
283
4.3125
4
[]
no_license
text = input("enter your word :") def palindrome(text=""): text1 = text text2 = text[::-1] if text1 == text2: print('{palin} is palindrome'.format(palin = text1)) else: print("{palin} isn't palindrome".format(palin = text1)) palindrome(text)
true
39715aaa4acf391e1cfbe66144ea7fc466d586f2
Python
QMrpy/InteractiveErrors
/gpt2.py
UTF-8
2,965
2.65625
3
[]
no_license
import argparse import json import logging import os import torch from transformers import GPT2LMHeadModel, GPT2TokenizerFast from tqdm import tqdm def generate_candidate_leakages(leakage, model, tokenizer, args): device = "cpu" if (args.no_cuda or not torch.cuda.is_available()) else "cuda" candidate_leakag...
true
9d73279591a346bdf159fce20d602b5ec640d063
Python
pombredanne/detools
/detools/sais.py
UTF-8
6,577
3.15625
3
[ "BSD-2-Clause", "MIT" ]
permissive
# Based on http://zork.net/~st/jottings/sais.html. S_TYPE = ord("S") L_TYPE = ord("L") def build_type_map(data): res = bytearray(len(data) + 1) res[-1] = S_TYPE if not len(data): return res res[-2] = L_TYPE for i in range(len(data) - 2, -1, -1): if data[i] > data[i + 1]: ...
true
9475e08099ef8cce375b658c7936e354104ec066
Python
edeane/learning-opencv-stuff
/histogram.py
UTF-8
2,055
3.140625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 3 10:22:53 2017 @author: applesauce https://www.pyimagesearch.com/2014/01/22/clever-girl-a-guide-to-utilizing-color-histograms-for-computer-vision-and-image-search-engines/ """ import cv2 import numpy as np import matplotlib.pyplot as plt def gr...
true
98003230d6784153a08f8521e42526d09815ad1e
Python
ajflood/lampSeminar_dataAnalysis
/DOE_example.py
UTF-8
1,956
3.15625
3
[]
no_license
from DOE import * ### NOTE YOU WILL NEED TO TAKE CARE OF RANDOMIZING THAT IS CURRENTLY NOT SUPPORTED def convert_doe_to_levels(doe, factor_levels): Converting the 0's and 1's to actual factor levels number_of_factors = len(factor_levels) converted_doe = numpy.zeros_like(doe) for factor_id in range(number_of_fac...
true
63cea74780ecf2145edca527dbd0e9205c66ddea
Python
CodingLordSS/BMI-Calculator-Developer-CodeLordSS
/BMI.py
UTF-8
683
3.625
4
[]
no_license
// Developer CodeLordSS // Programmning language: Python Height=float(input("Enter your height in centimeters: ")) Weight=float(input("Enter your Weight in Kg: ")) Height = Height/100 BMI=Weight/(Height*Height) print("your Body Mass Index is: ",BMI) if(BMI>0): if(BMI<=16): print("you are severely underweight") eli...
true
fc54fe330a8fcc7e62560ac9c979bb57552fd8e2
Python
shaiwilson/algorithm_practice
/may12.py
UTF-8
382
3.53125
4
[]
no_license
def compress(theStr): """ implement a method to perform basic string compression """ outstring = [] lastChar = "" charCount = 0 for char in theStr: if char == lastChar: charCount += 1 else: if lastChar != "": outstring.append(lastChar + str...
true
d14ebbae7b73a9d1242f098bb3da0c88267b99da
Python
shockflux/python_basics
/basic17.py
UTF-8
120
3.5625
4
[]
no_license
#returning avg of two numbers using functions def average(a,b): return (a+b)/2 #main program print(average(2,2))
true
19f72b359daafd49ac300c093f3cf7b8621b4f8e
Python
witklaus/simulationQueue
/passenger.py
UTF-8
1,738
2.796875
3
[]
no_license
import pandas as pd import random import numpy as np from lotnisko.conf import CONFIG class PassengerRegistry(object): def __init__(self, env): self.passengers = [] self.env = env self.waitsum = 0.0 def create_passenger(self, number): passenger = Passenger(number, self.env, se...
true
b71f4ed07c540bfbf8a4f51c2626111f05557365
Python
tcmcginnis/python
/pytest.py.python2
UTF-8
485
3.625
4
[]
no_license
#!/usr/bin/python3 """ this is a comment """ spam = "That is Alice's cat." # print "asdasd \n" # print "aaa:",spam # print "a",spam[3] # print spam.upper() # print spam[3:] linein = raw_input() print "a",linein # print "a",linein.lower() # print('How are you?') # feeling = raw_input() # if feeling.lower() == 'great': ...
true
e0fc887ec5a2aa1a1e10a56bf352eb6ed4d63a29
Python
Rifleman354/Python
/Python Crash Course/Chapter 8 Exercises/favoriteBook.py
UTF-8
255
3.453125
3
[]
no_license
def display_message(favorite_book): # The business end: the function """Display's the developer's favorite book""" print("The Archmagos' favorite book is " + favorite_book.title()) display_message('Bushcrafting 101') # Input arguement for function
true
2f08efc218d8220244b6ba37278ce6d37dc9d6ce
Python
dylancallaway/ee49_project
/training/run_inference.py
UTF-8
5,130
2.640625
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt import tensorflow as tf from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util import socket import pickle from PIL import Image import time clas...
true
a2ed3cb2dfc06f837edb937e681b12ed2d9500e7
Python
xdaniel07x/python-for-everybody-solutions
/exercise7_1.py
UTF-8
320
4.25
4
[]
no_license
""" Exercise 1: Write a program to read through a file and print the contents of the file (line by line) all in upper case. Executing the program will look as follows: """ fileName = input('Enter a file name: ') fhand = open(fileName) for line in fhand: capital = line.upper().strip() print(capital)
true
ebd40b56aedddcbb4fad56ba09c83063d5553ff5
Python
jillwuu/6700-proj
/tictactoe.py
UTF-8
3,516
3.75
4
[]
no_license
import random from minimax import Minimax class TicTacToe: def __init__(self): self.minimax = Minimax() self.game_size = 3 self.player_0 = 'X' self.player_1 = 'O' self.player = self.player_0 self.empty = ' ' self.board = [[self.empty for _ in range(self.game_size)] for _ in range(self.game_size)] sel...
true
74d9c99712d4be6884a8b63e2e29342e45b05d11
Python
vsseetamraju/multiples
/multiplesGIT.py
UTF-8
231
4.21875
4
[ "Unlicense" ]
permissive
# Ask for the user input userNum = input("Tell me a number ") # convert to float userNum = float(userNum) # Do the computation for i in range(2,10): answer = userNum * i print("{} times {} is {}.".format(userNum, i , answer))
true
f81b70152b69b2bc2779a4be5e51f65da8fd64c8
Python
Artemigos/advent-of-code
/2021/21/solution.py
UTF-8
2,158
3.125
3
[ "MIT" ]
permissive
from collections import Counter, defaultdict p1_start = 3 p2_start = 4 # part 1 rolls = 0 def roll(): global rolls rolls += 1 return ((rolls-1)%100)+1 p1 = p1_start p2 = p2_start p1_points = 0 p2_points = 0 while True: p1 += roll()+roll()+roll() p1 %= 10 p1_points += p1+1 if p1_points >...
true
d451bf4af50603d5d3ec94dc10377dc9aa92099e
Python
andreashappe/mod_security_importer
/log_importer/log_import/parser.py
UTF-8
3,493
3.09375
3
[]
no_license
""" This module converts the string representation of an incident into a python (or rather sqlalchemy) object. """ # urllib.parse in python2/3 from future.standard_library import install_aliases install_aliases() import re import datetime from urllib.parse import urlparse REGEXP_PART_A = '^\[([^\]]+)\] ([^ ]+) ...
true
b98643f704d8044c1d3182f1d94096ee7afb9bc0
Python
linyuchen/py3study
/py3.5/scandir.py
UTF-8
272
3.125
3
[]
no_license
# -*- coding:UTF-8 -*- import os __author__ = "linyuchen" __doc__ = """ os.scandir,更快的遍历目录,os.walk内部也用os.scandir实现了 返回的是个生成器 """ for i in os.scandir("."): print(i, i.name, i.path, i.is_dir(), i.is_file())
true
5cad2e3a4c163b0cbcac0ea769168117105fcdd8
Python
AroraTanmay7/Technocolabs-Minor-Project
/check-app.py
UTF-8
2,129
2.765625
3
[]
no_license
import streamlit as st import pandas as pd import numpy as np import pickle from sklearn.ensemble import RandomForestClassifier st.set_option('deprecation.showfileUploaderEncoding', False) st.sidebar.header('User Input Features') # Collects user input features into dataframe uploaded_file = st.sidebar.file_uploader(...
true
920a608a0e88b13d9173099f3a9bf22fefc87677
Python
PatLor77/zadania-9-wd
/zadanie6.py
UTF-8
277
2.65625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import xlrd csv = pd.read_csv('zamowienia.csv',sep=';') sumy = csv.groupby(['Sprzedawca']).agg({'Utarg':['sum']}) suma_og = sum(csv['Utarg']) sumy = (sumy/suma_og)*100 sumy = round(sumy) plt.show()
true
0dd3c114ea3138ca9015fe56c16515f916c1aa79
Python
Samridh-Dhasmana/Recommendation_System
/app.py
UTF-8
2,079
3.234375
3
[]
no_license
import flask import pandas as pd #reading the dataset df=pd.read_csv('movies.csv') #Storing movie titles from dataset m_titles = [df['title'][i] for i in range(len(df['title']))] #creating flask object app = flask.Flask(__name__, template_folder='templates') def create(): from sklearn.feature_extraction.text i...
true
82ec2f8a99dcefbd90ca8473bcf205764636408b
Python
zdyxry/LeetCode
/design/1352_product_of_the_last_k_numbers/1352_product_of_the_last_k_numbers.py
UTF-8
327
3.515625
4
[]
no_license
class ProductOfNumbers(object): def __init__(self): self.A = [1] def add(self, a): if a == 0: self.A = [1] else: self.A.append(self.A[-1] * a) def getProduct(self, k): if k >= len(self.A): return 0 return self.A[-1] / self.A[...
true
678ea15cd6850b5217031e0d8b7ca7895d99d5a2
Python
A-biao96/python-MP
/scripts/select_file.py
UTF-8
762
2.921875
3
[]
no_license
#!/usr/bin/python3 # encoding:utf-8 import os def select_file(*args, destdir='./'): try: os.listdir(destdir) except: return -1 suffix=['.cc', '.py', '.txt', '.md'] if len(args): suffix.extend(args) flist = [f for f in os.listdir(destdir) if os.path.splitext(f)[1].lower() in suffix] flist.sort() ...
true
18475a17a10202da8566abfabd9aa5b3e6e2eb9e
Python
saintifly/leetcode
/变位词组归类.py
UTF-8
921
3.3125
3
[]
no_license
class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: import numpy as np s1List = [0]*26 strsToOrd = [] for i in strs: for j in i: s1List[ord(j)-ord('a')] +=1 print(s1List) s1List = [str(x) for x in s1List] ...
true
adf226480fe3a3fe4b8ea12723a7cfe41181bbe1
Python
AsummerCat/crawer_demo
/qiubai_crawer.py
UTF-8
3,728
3.171875
3
[]
no_license
# -*- coding:utf-8 -*- ''' 糗百_爬虫 利用Beautiful Soup 库 和 requests conda install -c conda-forge beautifulsoup4 conda install -c conda-forge requests ''' ''' 简单实现抓取糗百的数据 抓取流程: 获取页最大页数->根据最大页数遍历查询->抓取单页面的 title及其内容保存到列表中->进行渲染成字符串->导出文件 ''' import os import requests from bs4 import BeautifulSoup import re from time impo...
true
3cfe5d99485672528a22b32b99ff91169745df97
Python
kbrewerphd/robotSim
/robot.py
UTF-8
9,660
3.296875
3
[ "MIT" ]
permissive
""" Program name: robot.py Author: Dr. Brewer Initial Date: 20-Nov-2018 through 05-Dec-2018 Python vers: 3.6.5 Description: A simple robot simulation environment. Code vers: 1.0 - Initial release """ from typing import List,Any import math import random as r import time class Robot(): """...
true
2fe6282ce0bc4c3229170646040918f67b5de839
Python
ericjtaylor/random-fat
/random-fat.py
UTF-8
11,517
3.171875
3
[]
no_license
from __future__ import division import itertools import numpy as np import numpy.random as rng import matplotlib.pyplot as plt # Name: Random Function Analysis Tool # Author: Eric Taylor # # Generates a random sequence, calculating the probability # mass function of the intervals and the entropy of the # output given...
true
55ed09e2c3dff07d4bba25ecc565fb68face06b9
Python
CQU-yxy/bigdata_NYCAirbnb
/代码文件及配置说明/WordCount.py
UTF-8
1,718
2.875
3
[]
no_license
#-*- coding:utf-8 -*- from pyspark import SparkConf, SparkContext from visualize import visualize import jieba SRCPATH = '/home/hadoop/proj/src/' conf = SparkConf().setAppName("proj").setMaster("local") sc = SparkContext(conf=conf) def getStopWords(stopWords_filePath): stopwords = [line.strip() fo...
true
67a3b738d63949f6bf1b5bba50273c04c63d939f
Python
jalague/Projects
/BioInformatics/Assingments/assignment1.py
UTF-8
3,667
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Aug 25 11:46:10 2016 @author: John mRNA Translator, into 6 frames Read in file of sequence translate into three letter codons parse for start and stop codons and mark them for position 1 2 and 3 find reverse compliment of sequence and repeat """ import sys...
true
f28f602c7026ce8197afbc98ef90359288d33423
Python
ericssy/smart-home-security
/SVM & Autoencoder/app/ab_one_class_svm.py
UTF-8
1,436
3.171875
3
[]
no_license
import pickle import numpy as np from sklearn import svm class OneClassSVM_Ab: def __init__(self, file_name): self.clf = pickle.load(open(file_name, 'rb'), encoding='latin1') # temp_change_f: times of temperature changes within the 100s window # temp_avg_f: average temperature within the ...
true
8bcf62b780d93ddb9c8711d672a8fe08b1c44ef6
Python
CptThreepwood/TropeStats
/src/scraping/get_trope_list.py
UTF-8
1,228
2.515625
3
[]
no_license
import os import bs4 import yaml import time import requests from config import TROPE_INDEX, TROPE_INDEX_DIR TROPE_LIST_BASE = "https://tvtropes.org/pmwiki/pagelist_having_pagetype_in_namespace.php?n=Main&t=trope" def get_trope_list_page(n=1): response = requests.get('{}&page={}'.format(TROPE_LIST_BASE, n)) ...
true
e1582d443eb4bf3d066a0099955620a766a348f4
Python
jxjk/git_jxj
/opencvfiles/copymakeborder_demo.py
UTF-8
1,895
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ 9.5 为图像扩边(填充) cv2.copyMakeBorder(src,top,borderType,value) • src 输入图像 • top, bottom, left, right 对应边界的像素数目。 • borderType 要添加那种类型的边界,类型如下 – cv2.BORDER_CONSTANT 添加有颜色的常数值边界,还需要 下一个参数(value)。 – cv2.BORDER_REFLECT 边界元素的镜像。比如: fe...
true
fff97196771b5ab9c6a3ddb53c4141fd62af94ff
Python
Lazy-yin/LeetCode-practice
/Questions/q0001TwoSum/BruteForce.py
UTF-8
235
3.203125
3
[]
no_license
def twoSum(self, nums, target): ans = [] for i in range(len(nums)-1): leave = target - nums[i] for j in range(1,len(nums)): if nums[j] == leave: return [i,j]
true
81de9971c6333b50bc64a9ffe9cb66d66cf931f7
Python
hidemori0422/codewars
/tests/test_create_phone_number.py
UTF-8
493
2.921875
3
[]
no_license
#! /usr/bin/env python3 from src.create_phone_number import create_phone_number def test_phone_number0(): digits = [0] * 10 result = create_phone_number(digits) expected = '(000) 000-0000' assert result == expected def test_phone_number1(): digits = [i for i in range(10)] result = create_ph...
true
6180fb010ebfd239eb6089cc8e9dd497a080c5a6
Python
Raushan117/Python
/033_list.py
UTF-8
307
3.796875
4
[]
no_license
# To iterate over a list with the numbers a = ['Python', 'is', 'a', 'great', 'programming', 'lanuage'] for i in range(len(a)): print(i, a[i]) # Passing a number of strings to a file # where file is an file object def write_to_file_many_item(file, separator, *args): file.write(separator.join(args))
true
244f786e87f7fc585efd75a614cde03291dbc983
Python
ROXER94/Project-Euler
/055/55 - LychrelNumbers.py
UTF-8
430
3.9375
4
[]
no_license
# Calculates the number of Lychrel numbers below 10,000 def isPalindrome(string): return string == string[::-1] def Lychrel(string): return int(string) + int(string[::-1]) total = 0 for i in range(10000): L = True count = 0 value = str(i) while count < 50: value = Lychrel(str(value)) if isPa...
true
a8cdca63b29340449b2731ad4fa6c486593bf2ca
Python
Crazy-Ginger/MOSAR
/modules/craftmodule.py
UTF-8
810
2.96875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3.5 """Module class to hold data on individual modules that form part of the morsecraft structure""" from numpy import array, round __author__ = "Rebecca Wardle" __copyright__ = "Copyright 2020 Rebecca Wardle" __license__ = "MIT License" __credit__ = ["Rebecca Wardle"] __version__ = "0.5" class ...
true
563c01ee21677405d58f6ec151e207b268518329
Python
shariquemulla/python_basics
/control-flow-1.py
UTF-8
4,525
3.96875
4
[]
no_license
season = 'spring' if season == 'spring': print('plant the garden!') elif season == 'summer': print('water the garden!') elif season == 'fall': print('harvest the garden!') elif season == 'winter': print('stay indoors!') else: print('unrecognized season') ############################...
true
f1e02cac88ac8f38283b53ee458f3c3190d791ba
Python
MrRabbit0o0/LeetCode
/python/172.py
UTF-8
476
3.515625
4
[]
no_license
# coding: utf8 class Solution(object): def trailingZeroes(self, n): """ :type n: int :rtype: int """ return 0 if n < 5 else n / 5 + self.trailingZeroes(n/5) if __name__ == '__main__': import random n = random.randint(0, 10000000) print n print Solution().tr...
true
a2a454e2e682ce41b0b357fa6e2972233aebe8f6
Python
stevenjwheeler/AntiScamAI
/wit_response_engine.py
UTF-8
1,641
2.59375
3
[]
no_license
import gvoice_response_engine import error_reporter import logger def respond(wit_response, time): if wit_response['_text']: try: text = wit_response['_text'] intent = wit_response['entities']['intent'][0]['value'] intentconfidence = "{0:.0f}%".format(wit_response['entit...
true
d7a8eb6d65a78dcb1ff9868e4d3b351cd3b5700a
Python
Joyita01/Stream_tweets
/Streaming_replies.py
UTF-8
3,445
3.1875
3
[]
no_license
""" Following code, streams tweets of username 'x1' containing specific keywords and stores the replies to those tweets in a JSON file. """ from tweepy import TweepError import json from tweepy import API from tweepy import Cursor from tweepy.streaming import StreamListener from tweepy import OAuthHandler ...
true
4faced3e8a0c83a97ea83c5b1011b44de0d7a39e
Python
efedorow/data-science
/simple-tensorflow-model-unit-conversion.py
UTF-8
2,046
3.484375
3
[]
no_license
import tensorflow as tf import logging import numpy as np logger = tf.get_logger() logger.setLevel(logging.ERROR) #these are the input values in kilograms meters_in = np.array([1, 5, 8, 15, 23, 34, 49, 69, 82, 96]) #these are the output values in pounds determined via the conversion formula pounds_out = np.array([2....
true
540ec7883267b993cf5853640c3af3c2aae3a307
Python
sassaf/VehicleValueEstimator
/value_estimator.py
UTF-8
4,788
2.703125
3
[]
no_license
from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D as Conv2D from keras.layers import MaxPooling2D, SeparableConv2D from keras.optimizers import SGD, rmsprop import numpy as np import scipy import cv2 import os from copy import copy fr...
true
a60b561905f6f1dae79c9f014f5e0fd728bf7f58
Python
Esiravegna/0pizero_sensors
/sensors/MQX/MQ135.py
UTF-8
5,737
2.625
3
[ "Apache-2.0" ]
permissive
from __future__ import division import time import math from utils.log import log log = log.name(__name__) class MQ135(object): ######################### Hardware Related Macros ######################### RL_VALUE = 10 # define the load resistance on the board, in kilo ohms ...
true
99da4b388ad0d84145dfc50ebaf5cb34d4b38acb
Python
chenjiahui1991/LeetCode
/P0212.py
UTF-8
1,419
3.4375
3
[]
no_license
class Solution: def findWords(self, board, words): """ :type board: List[List[str]] :type words: List[str] :rtype: List[str] """ trie = {} for word in words: t = trie for ch in word: if ch not in t: t...
true
c38c0c6fb166d79ce43e9ac65e032e589f7cd5c3
Python
zhaosiheng/SR-GNN_PyTorch-Geometric
/src/utils.py
UTF-8
2,799
2.671875
3
[]
no_license
import networkx as nx import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.utils import to_networkx class NodeDistance: def __init__(self, data, nclass=4): """ :param graph: Networkx Graph. """ G = to_networkx(...
true
eac74145405021ad3003ca38e7a72bd279836732
Python
osgioia/LosSimpsonsFrasesBot
/main.py
UTF-8
595
2.671875
3
[]
no_license
import json import requests import tweepy from keys import * auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) # Create API object api = tweepy.API(auth) # Creamos la petición HTTP con GET: r = requests.get('https://los-simpsons-quotes.herokuapp.com/v1...
true
ae343316c56c5cbf1e0fc294a1e9a2959ebf1a53
Python
bhabicht/gravity-sim
/tests/leap_frog_algorithm_test.py
UTF-8
2,777
2.796875
3
[]
no_license
import unittest import numpy as np import sys import scipy.constants as const from code.leap_frog_algorithm import update_all_positions from code.leap_frog_algorithm import calculate_all_forces from code.leap_frog_algorithm import update_all_velocities from code.planet_system_creation import Massiveobject sys.path.a...
true
ed3594ed74d378674d43ffbc4d10a147f61cb8a2
Python
vlad24/Univiersity-Computer-Vision
/solovyev/src/gamma.py
UTF-8
1,818
3.015625
3
[]
no_license
''' Created on Mar 9, 2017 @author: vlad ''' import cv2 import matplotlib.pyplot as plt import numpy as np def gamma_correction(img, correction): result = img[:] result = result / 255.0 result = cv2.pow(result, correction) return np.uint8(result * 255) def log_correction(img): result = np.c...
true
5638e712e10f4cb8531ff5eaa8a7c69ea5a12e8c
Python
stellaluminary/Baekjoon
/15684.py
UTF-8
1,983
3.234375
3
[]
no_license
""" Method 2 시간 초과 """ n, m, h = map(int, input().split()) visited = [[False] * (n+1) for _ in range(h+1)] combi = [] for _ in range(m): a, b = map(int, input().split()) visited[a][b] = True def check(): for i in range(1, n+1): now = i for j in range(1, h+1): if visited[j][now-1...
true
2fb202a77566f145421182adcd85aaa00e26987e
Python
Trietptm-on-Coding-Algorithms/eulerproject
/046.py
UTF-8
447
3.140625
3
[]
no_license
#! /usr/bin/env python from eulerutils import genprime,isprime def goldbach(): gp = genprime() p = gp.next() q = gp.next() while True: for com in xrange(p+2,q,2): if not isop(com): return com p = q q = gp.next() def isop(com): ...
true
ef1a845c21de45c1d96b2fd9d0a460663a401839
Python
kirin7890/ABC
/ABC/056/A.py
UTF-8
175
3.125
3
[]
no_license
a, b = map(str, input().split()) if a == 'H': ac = 1 else: ac = -1 if b == 'H': tcd = 1 else: tcd = -1 if ac * tcd > 0: print ('H') else: print ('D')
true
3c0e2567dc032ff9e81884a0146793b2e88ae93d
Python
RyanIsCoding2021/RyanIsCoding2021
/exercises/culculate.py
UTF-8
3,014
3.203125
3
[ "MIT" ]
permissive
import pygame import random from itertools import cycle class Cloud(pygame.sprite.Sprite): def __init__(self, x, y): super().__init__() self.image = pygame.Surface((50, 20)) self.image.set_colorkey((11, 12, 13)) self.image.fill((11, 12, 13)) pygame.draw.ellipse(self.image, p...
true
f1fe43f3805d89556f27449b1d45d9b0889cdb27
Python
zwy-888/drfday06-andRBAC
/api/authenticator.py
UTF-8
1,197
2.703125
3
[]
no_license
from rest_framework import exceptions from rest_framework.authentication import BaseAuthentication, BasicAuthentication from api.models import User class MyAuthentication(BaseAuthentication): def authenticate(self, request): print('111') # 获取认证信息 , 没有就返回None get不会报错 auth = request.META....
true
5e1c4f748e95fd9069864fb63880e9c0c2c98580
Python
clchiou/scons_package
/rule.py
UTF-8
2,106
2.53125
3
[ "MIT" ]
permissive
# Copyright (c) 2013 Che-Liang Chiou from collections import OrderedDict from scons_package.label import Label, LabelOfRule, LabelOfFile from scons_package.utils import topology_sort class RuleRegistry: def __init__(self): self.rules = OrderedDict() def __len__(self): return len(self.rules...
true