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
0cdae70621b717e0fb80f08b412d325c07f8fcb6
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4312/codes/1838_1275.py
UTF-8
209
2.859375
3
[]
no_license
from numpy import* from numpy.linalg import* matriz = array(eval(input("Insira a matriz: "))) vet = zeros(matriz.shape[0], dtype=int) for i in range(matriz.shape[0]): vet[i] = sum(matriz[i,:]) print(vet)
true
5c5a65c1a5eba657c11672d57aecc50a39495bb8
dingrongchang/isdhw
/min.py
UTF-8
153
2.84375
3
[]
no_license
import time for i in range(1,10): s=" " y=" " for j in range(i,10): s+=str.format("{0:1}*{1:1}={2:<3}",i,j,i*j) print(((i*7)-7)*y,s) time.sleep(5)
true
021bf4a8bbd26aef3afcce12f4802fe59139460a
clayliau/Full-Stack-Foundations
/Lesson-4/My-Final-Project/finalproject.py
UTF-8
6,192
2.71875
3
[]
no_license
from flask import Flask, render_template, url_for, request, redirect, flash, jsonify from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Restaurant, Base, MenuItem from sqlalchemy.orm import scoped_session OK = True NoOK = False engine = create_engine('sqlite:///Les...
true
5f72b32d9b1f3ced2710a85176cb1f66389e3144
chaparron02/encriptador
/hackeos.py
UTF-8
3,713
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Nov 29 19:15:14 2020 @author: chaparron02 """ "Hackeos" import encriptadores, math # Brute-force para cifrado cesar clasico def HackCesar (): message = str(input(" Mensaje a descifrar: ")) symbols = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopq...
true
c6275bb2d714c5ecaa81ecfb07ec136ffe00380d
ClusterLabs/ha_cluster_exporter
/.ci/gh_release_to_obs_changeset.py
UTF-8
2,679
2.59375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 import argparse import json import os import sys import textwrap import urllib.request import urllib.error from datetime import datetime from datetime import timezone import tempfile parser = argparse.ArgumentParser(description="Add a GitHub release to an RPM changelog", usage=argparse.SUPPRESS...
true
9a79a90646f1645343ac3fe273035baf448ba669
myliu/python-algorithm
/leetcode/longest_substring_with_at_most_two_distinct_characters_v1.py
UTF-8
617
3.03125
3
[]
no_license
class Solution(object): def lengthOfLongestSubstringTwoDistinct(self, s): """ :type s: str :rtype: int """ maxlen = l = 0 distinct = {} for r, c in enumerate(s): if c not in distinct and len(distinct) == 2: lowest = min(distinct.val...
true
f294ae2f0553f2a6d34f6e57e556bed7d0e1d881
panda-luminosity-detector-group/LMD-Alignment
/various/combineTestFunctions.py
UTF-8
8,581
2.859375
3
[]
no_license
""" This is a test bed for ways I combined matrices in the matrix combiner. Most of the functions worked and were at one time useful to me, but they no longer belong in the MatrixCombiner. So I'll put them here as long as I need a reminder how certain things worked, but in the future, these can be deleted. """ if F...
true
28a62ebb53a3abc0fea8d60af43190e64a832c6d
Inimesh/PythonPracticeExercises
/5 List exercises/Ex_127.py
UTF-8
925
4.5
4
[]
no_license
## Program that uses the 'Sieve of Eratosthenes' method to find prime numbers. # in a given range. It involves crossing out numbers in a numberline from 0 to # the limit of the range however it relies on the numbers simply being crossed # out on a piece of paper and not disappearing from the list alltoghether. # To sim...
true
008d130e6c6dedceb299b38d2c5cacfc27840dc0
iepisas/python-crash-course
/while_loops/movie.py
UTF-8
240
3.75
4
[]
no_license
age = int(input("Please enter you age: ")) if age < 3: print("your ticket is free.") elif 3<= age <= 12: print("Your ticket is $10.") else: print("your ticket is $15.") while True: age = int(input("Please enter you age: "))
true
88990fe78cb40478abf70b8213d11388a3d54cf9
hsolbrig/ICD11OWLConverter
/ICD11OWLConverter/ConverterGateway.py
UTF-8
3,884
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Copyright (c) 2014, Mayo Clinic # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list of ...
true
adcf603da5b287a10d0d74a5400687f373475f56
anvitgupta/zmq_chat_app
/client/app.py
UTF-8
4,698
2.734375
3
[]
no_license
import base64 import sys import zmq import threading from Crypto import Random from Crypto.PublicKey import RSA SERVER_IP = "ec2-54-164-205-229.compute-1.amazonaws.com" if len(sys.argv) < 2: sys.exit("Must provide a username in order to connect to Dark Messenger.") username = sys.argv[1] PORT = "9000" if len(sys...
true
17435090e5a90cac22e67fa6ed6124343555565f
liu666197/data1
/8.11/14 集合.py
UTF-8
180
3.171875
3
[]
no_license
# a = {12,32,43,4,4,'adsa','qweqw','三大',4} # print(type(a)) # print(a) # 空集合 # a = set() # print(type(a)) a = [123,354,3,545,56,56,545,3] a = set(a) a = list(a) print(a)
true
84fc5a8bc8df31b9bf7c8be86f01004cee08af71
mzb2599/python
/list/nestedlist.py
UTF-8
176
3.71875
4
[]
no_license
matrix = [] for i in range(5): matrix.append([]) for j in range(5): matrix[i].append(j) # for i in range(5): # print(matrix[i][i]+'\n') print(matrix)
true
012e5478308f0d5d912ad3df2b4b2c4a78e6019f
g-buzzi/Padaria
/controladores/controlador_central.py
UTF-8
2,619
2.609375
3
[]
no_license
from controladores.controlador_abstrato import Controlador from telas.tela_central import TelaCentral from controladores.controlador_ingredientes import ControladorIngredientes from controladores.controlador_receitas import ControladorReceitas from controladores.controlador_produtos import ControladorProdutos from cont...
true
7967d2e708fd8894bc8cf6ef0c5e06e8bac8aff6
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_95/2432.py
UTF-8
559
3.109375
3
[]
no_license
#!/usr/bin/env python2 transform = {"y": "a", "n": "b", "f": "c", "i": "d", "c": "e", "w": "f", "l": "g", "b": "h", "k": "i", "u": "j", "o": "k", "m": "l", "x": "m", "s": "n", "e": "o", "v": "p", "z": "q", "p": "r", "d": "s", "r": "t", "j": "u", "g": "v", "t": "w", "h": "x", "a": "y", "q": "z", " ": " "} count = int(...
true
6a26ef4cc53b955a98306b03c895c19e94264020
elle-johnnie/Arduino_Py
/edX_CS_exercises/number_guess_bisect.py
UTF-8
988
4.46875
4
[]
no_license
# The program works as follows: you (the user) thinks of an integer between 0 (inclusive) and 100 (not inclusive). # The computer makes guesses, and you give it input - is its guess too high or too low? Using bisection # search, the computer will guess the user's secret number! # edX wk 2 Algorithms # solution attempt ...
true
5a9fd01073e4c2bb1ff0f6e0f90603a6cb3e6f1c
Khaotich/Jezyki-Skryptowe
/LISTA5/zad1.py
UTF-8
828
3.765625
4
[]
no_license
def zamien(x): x = x.replace(' ','') jednosci = {'jeden':1,'dwa':2,'trzy':3,'cztery':4,'pięć':5, 'sześć':6, 'siedem':7, 'osiem':8, 'dziewięć':9} nascie = {'dziesięć':10,'jedenaście':11, 'dwanaście':12, 'trzynaćie':13, 'czternaście':14, 'piętnaście':15, 'szesnaście':16, 'siedemnaście':17, 'osiemnaście':18, ...
true
1e0353fc5fb78f29f0760df2b1716c45cabb0edb
timur9831/FEDOT
/test/test_synthetic_chain.py
UTF-8
2,082
2.65625
3
[ "BSD-3-Clause" ]
permissive
import numpy as np import pytest from core.models.data import InputData from core.repository.dataset_types import DataTypesEnum from core.repository.tasks import Task, TaskTypesEnum from utilities.synthetic.chain import \ (chain_balanced_tree, chain_full_random, chain_with_random_links) # TODO: get rid...
true
c5eb74408d2b8338fbfb662e65c62aa765fe22eb
gongran/scrapytest
/scrapytest/fenxi/compareHuoBi.py
UTF-8
1,059
2.796875
3
[]
no_license
import json class HuoBiCompare: def __init__(self): self.marketMap={} def compareCoin(self): aa={} with open("coins.txt",'r') as fileReade: while True: lines=fileReade.readline() if not lines: break pass...
true
0a33f08fcf6b6345db6e365b2fe70e4ceec4f790
omtvad/BSc_report_chatbot-Copy-
/thesis/Code/histogramCode.py
UTF-8
1,473
3.03125
3
[]
no_license
import matplotlib.pyplot as plt import matplotlib def get_histogram(df, shape=(3, 3), bins=10, super_title=None, super_title_size=10, title_size=6, alpha=0.5, figsize=(8.27, 11.69)): matplotlib.style.use('ggplot') # Changes the plot style subfigs_per_fig = (shape[0] * shape[1]...
true
a9b0850af75b90d817990a1d6ba4cfeda604eb82
saipoojavr/saipoojacodekata
/primelen.py
UTF-8
265
3.34375
3
[]
no_license
astr=input() count=0 for i in range(0,len(astr)): if(astr[i]!=" "): count+=1 if count > 1: for iter in range(2, count//2+1): if ((count % iter) == 0): print("no") break else: print("yes") else: print("no")
true
6d656475391233b487b629b44f974faf3cada2c7
mitre-cyber-academy/2013-grabbag-500
/ballad/test/miditest.py
UTF-8
396
2.546875
3
[ "Apache-2.0" ]
permissive
from midiutil.MidiFile import MIDIFile midi1 = MIDIFile(1) track = 0 time = 0 midi1.addTrackName(track, time, 'Test track') midi1.addTempo(track, time, 120) for i in range(13): track = 0 channel = 0 pitch = 60 + i time = i duration = 1 volume = 100 midi1.addNote(track, channel, pitch, time, duration, volume) ...
true
8fea62085e48132eadb7b3921e36480292dd4116
hungpchu/code-interview
/Array and String/(Google)addOneToArray.py
UTF-8
280
3.203125
3
[]
no_license
array = [9,9,9,9] stringArray = "".join(str(number) for number in array) number = int(stringArray,10) number += 1 result = str(number) finalResult = [] for i in range(len(result)): num = int(result[i],10) finalResult.append(num) print(finalResult) print(array)
true
83e39f8fbcb27d85004d8fa69ff0fe5133c88f30
silviogrizzly/Tarea2
/P1.py
UTF-8
1,192
3.640625
4
[]
no_license
#Creacion de ecuacion Catenaria para encontrar ceros import numpy as np import matplotlib.pyplot as plt # Para la funcion catenaria en el enunciado se aplicó condiciones dadas para tener la funcion que entregará los ceros def f(x): #funcion y=x*np.cosh(10/x)-x-7.5 return y def df(x): #Derivada de la ...
true
b5e8dd997e056ac3f55e101ce1635689fb9ce2bf
TeissierYannis/Pokemon_Win_Prediction
/train.py
UTF-8
2,396
2.609375
3
[]
no_license
import pandas as pnd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import r2_score from sklearn.externals import joblib # setup data def setup_data(): pnd.set_option('display.max_columns', None) pnd.set_option('mode.chained_assignm...
true
5fdd2520e187a669b0986230d77f5d50f6621206
titipata/wos_parser
/wos_parser/tests/test_convert_pubinfo_to_ris.py
UTF-8
1,541
2.90625
3
[ "MIT" ]
permissive
import requests import wos_parser import hashlib example_XML_loc = 'https://raw.githubusercontent.com/yadudoc/wos_builder/master/sample.xml' # Grab sample XML file r = requests.get(example_XML_loc) xml_string = r.text records = wos_parser.read_xml_string(xml_string) def test_convert_pubinfo_ris(): expected = "FN...
true
f5cac557a647edfcca93e6db6159545fff139005
indautgrp/frappe
/frappe/utils/xlsutils.py
UTF-8
728
2.640625
3
[ "MIT" ]
permissive
from __future__ import unicode_literals import frappe, xlwt, StringIO, datetime from frappe import _ def get_xls(data): '''Convert data to xls''' stream = StringIO.StringIO() workbook = xlwt.Workbook() sheet = workbook.add_sheet(_("Sheet 1")) # formats dateformat = xlwt.easyxf(num_format_str= (frappe.default...
true
7a68d033fd6d6e72c3540a24d2d64c33a8bc1474
kristielim/snapling
/translateImage.py
UTF-8
1,094
2.796875
3
[]
no_license
import io import os # Imports the Google Cloud client library from google.cloud import vision from google.cloud.vision import types from google.cloud import translate def get_translation(image_path, target_language): # returns the description of an image def detect_labels(path): client = vision.ImageAnnotatorC...
true
744d021c7d6086f76da6a6967f77bb684f33c4bf
kenial/limelight_rest_wrapper
/limelight_rest_wrapper.py
UTF-8
2,897
2.546875
3
[ "MIT" ]
permissive
import sys import time import urllib import hmac import hashlib import requests import json class LimelightRESTWrapper(object): def __init__(self, limelight_user_id, api_key): super(LimelightRESTWrapper, self).__init__() self.llnw_security_principal = limelight_user_id self.api_key = api_ke...
true
827ec6ac577102d9d56b5187985fd279b8b4dd7a
nikita1610/DSA_in_Python
/Sorting Techniques/Quick_Sort.py
UTF-8
470
3.40625
3
[]
no_license
def quick(a,start,end): i=(start-1) pivot=a[end] for j in range(start,end): if a[j]<pivot: i=i+1 a[j],a[i]=a[i],a[j] a[i+1],a[end]=a[end],a[i+1] index=i+1 return index def quick_sort(a,start,end): if start < end : index=quick(a,start,end) ...
true
0198057e373563857425f14fe52972d0c6ba7391
pnijhara/python-practice
/mit6.00.1x official/week_2_Simple_programs/ 3.-Simple_Algorithms/guess_my_number.py
UTF-8
587
3.90625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 27 17:52:58 2018 @author: prime """ high = 100 low = 0 print ("Please think of a number between 0 and 100!") while True: ans = (high+low)//2 print ("Is your secret number? " , ans) x = input(" Enter 'h' to indiocate the guess is too hig...
true
807cfb8534a5ade79be24e956e53b63ed1593bec
rnaimehaom/molecule-toxicity-prediction
/process_kaggle_data.py
UTF-8
999
2.921875
3
[]
no_license
#%% Imports import pandas as pd # %% helper function to merge smiles and labels def process_kaggle(filepath): smiles = pd.read_csv(filepath+'names_smiles.csv', names=['muid','smiles']) labels = pd.read_csv(filepath+'names_labels.csv', names=['muid','labels']) merged = pd.merge(smiles, labels, on='muid') ...
true
a644f90a3bc6eb3f069d72a6788705825a33a02f
jderiu/deep-sa
/create_alphabet.py
UTF-8
2,567
2.578125
3
[]
no_license
import cPickle import gzip import os from alphabet import Alphabet from tqdm import tqdm from nltk.tokenize import TweetTokenizer from parse_utils import preprocess_tweet,convert_sentiment import numpy as np import getopt import sys from utils import load_glove_vocabulary def main(argv): outdir = "preprocessed_dat...
true
3a3852132643fb9ec52b43a5e9f41913b0fe48d7
Mortal/algorithmicpy
/algorithmic/examples/kmp/kmp.py
UTF-8
1,914
3.15625
3
[]
no_license
GLOBALS = "report".split() PATTERNS = [ ("P[:n]", "#P _{#n}"), ("s.endswith(t)", r"#t \sqsupset #s"), ("report(i)", r"\text{print ``Pattern occurs with shift'' }#i"), ("len(s)", r"#s.\mathit{length}"), ("pi = [None] * m", r"\STATE let $#pi[0..#m-1]$ be a new array"), ] def compute_prefix(P): "...
true
48df3000308275e82b4ef63c377234599da84355
LizinczykKarolina/Python
/String/ex10.py
UTF-8
113
2.796875
3
[]
no_license
def new_string(str1): str2 = str1[-1] + str1[1:-1] + str1[0] return str2 print new_string('kocikot')
true
b831c3387f12ebe21436918c981fabf9fa35c193
Dhrubneil/HackerRank_ProblemSolving
/asterisk_pyramid.py
UTF-8
1,780
3.796875
4
[]
no_license
my_list = [0, 1, 2, 3, 4] for i in range(len(my_list)): print(" " * (len(my_list)-i-1) + "*" * (i+1) + "*" * i) for i in range(len(my_list)): print(" " * my_list[-i-1] + "#" * (i+1) + "#" * i) for i in range(5): #n-i-1 times for j in range(4-i): print(" ", end="") for k in ran...
true
5f87262a9b74b4852c18a649402d3b8d49f778d3
haz060/nlp-stat-test
/testing/logic/power_analysis_norm.py
UTF-8
3,501
3.65625
4
[ "MIT" ]
permissive
""" Power analysis for normal data Description: this script is for a simple illustration of power analysis limited to data that are known a priori normally distributed with known mean and known sd. We conduct power analysis using Monte Carlo simulation which directly simulates data points from the known distri...
true
cde4f2d1c549b9df2bc2e7d8e51b06d1f52ee39d
bwfair/POT_Detection_System
/helloworld.py
UTF-8
91
2.828125
3
[]
no_license
#!/usr/bin/env python string = "Hello world!!" print(string) print(" ") print ("wasssup")
true
8691632d72f6a2cd67c0e1c2da1844aa4ff6e56b
alexandraback/datacollection
/solutions_5670465267826688_0/Python/perel/c.py
UTF-8
2,164
2.6875
3
[]
no_license
import time def init(): global res s=['1','i','j','k'] res={} res[('1','1')]='1' for i in ['i','j','k']: res[(i,i)]='-1' res[('1',i)]=i res[(i,'1')]=i res[('i','j')]='k';res[('j','i')]='-k' res[('i','k')]='-j';res[('k','i')]='j' res[('j','k')]='i';res[...
true
cea313b845db63e0675738a83e874039bd2aeb9d
starrcaft/InformationProtection
/assignment/[IS00]_03_201603867_조성환/xor/프로그램/xor.py
UTF-8
1,154
3.328125
3
[]
no_license
MAX_KEY_SIZE = 26 def getMode(): while True: print('Enter either "encrypt" or "e" or "decrypt" or "d". ') mode = input().lower() if mode in 'encrypt e decrypt d'.split(): return mode else: print('The value you entered its invalid') def getFileName(): print('Enter your file name:'...
true
8fb1c09853f5fb54fa6f7cdee27a034584b8d0a2
alzeih/python-metaname
/examples/renew_in_advance.py
UTF-8
1,676
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# # Performs advance renewals of domain names that are coming to term soon. # # Use: # # account_reference=$YOUR_ACCOUNT_REF api_key=$YOUR_API_KEY python3 renew_in_advance.py # from metaname import Client as Metaname import os from datetime import datetime RENEW_DAYS_PRIOR = 28 #ENDPOINT = 'https://metaname....
true
6d42ee1a04d03789d22415ee3eb59d63d7f28223
streamr-dev/streamr-client-python
/streamr/rest/stream.py
UTF-8
3,930
3
3
[ "Apache-2.0" ]
permissive
""" provide functions to create stream and get stream """ import requests import logging from streamr.util.constant import RestfullConstant __all__ = ['creating', 'getting_by_name', 'getting_by_id'] logger = logging.getLogger(__name__) def creating(stream_name, stream_des, session_token): """ func: ...
true
18a6eedd1a46bf0a97410e104ac91c62c0a60807
Xjint/Machine-learning
/machine_vision/ex_3.py
UTF-8
4,423
2.890625
3
[]
no_license
import cv2 as cv import numpy as np from matplotlib import pyplot as plt def trans_1(i): if i < 0.35: y = 0.3 * i elif 0.35 <= i <= 0.65: y = 0.105 + 2.6333 * (i - 0.35) else: y = 1 + 0.3 * (i - 1) return y def trans_2(i): if i <= 0.5: y = 15.9744...
true
d21feab9defff8faad62b9d6c3abfc5ba74f10f6
anaebonam-izuchukwu/izu
/Dinner game.py
UTF-8
336
3.6875
4
[]
no_license
import random random_seed = int(input(" Put in a random number ")) random.seed(random_seed) payers_list = input(" Everyone input your names separated by a comma ") names = payers_list.split(",") num_items = len(names) choicce = (random.randint(0 ,num_items-1)) payer = names[choicce] print(f"{payer}, would be paying f...
true
2e1d60ed78f70b1c34484c6188047faaf83310d4
candicetay/dr-net
/util.py
UTF-8
5,053
3.140625
3
[]
no_license
import fitz import math from PIL import Image from IPython.display import clear_output, display def convert_pdf_to_image(PDF_path): document = fitz.open(PDF_path, width=1653, height=2339) pages = [] num_pages = len(document) for i, page in enumerate(document): if i not in [0, 1, num_pages - 2,...
true
1027cd93dc0a2016618be9b7577cafddfe440db7
4mile/BQPipe
/examples/bigquery/read_data_with_sql.py
UTF-8
500
2.515625
3
[ "Apache-2.0" ]
permissive
import json import bqpipe # Fetch key file path from config.json file in current directory. with open('config.json') as config_file: data = json.load(config_file) # Authenticate to BQ Project with your credentials. json_file_path = data['json_file_path'] client = bqpipe.BigQueryClient(json_file_path) # Specify t...
true
2806774edd52fd5633ac3758f2d65101db18305a
kunal902/behavioral-cloning
/model.py
UTF-8
4,423
2.890625
3
[]
no_license
import tensorflow as tf import numpy as np from keras.layers import Conv2D, ELU, Flatten, Dropout, Dense, Lambda, MaxPooling2D, Cropping2D from keras.models import Sequential from keras import backend as K import pandas as pd from keras.preprocessing.image import img_to_array, load_img import cv2 def reduce_brightne...
true
2d7b0a1f7c1f311c5004c3be64a6f9aef33767e1
dxcv/pratice_project
/open_price_strategy/get_open_minute_info.py
UTF-8
13,814
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- """ # 本脚本用于计算开盘一分钟比较特殊的情况 # 并计算反方向持有到两个时间节点的利润 # 要将主力和次主力发生错单的情况筛选出去 # 输出一个DataFrame到一个csv中 Tue 2017/3/14 @author: Tracy Zhu """ # 导入系统库 import sys # 导入用户库:: sys.path.append("..") from python_base.open_price_algorithm import * from python_base.get_open_volume_series_instrument import * open...
true
048b53c4db4f974f21327c89e969f6b029417fc8
samirpatil2000/RestApi
/api/test/test_models.py
UTF-8
420
2.671875
3
[]
no_license
from django.test import SimpleTestCase, TestCase, Client from api.models import Text import random class TestModels(TestCase): def setUp(self) -> None: self.slug="Name1"+str(random.randint(99,999)) self.project1=Text.objects.create( name="Name1", num=10, slug=s...
true
48deea670bb2d81eb0ddb307b5e4f3c9fc01f25e
Valentinacolme/transferencia_calor
/transferencia_calor.py
UTF-8
1,544
3.828125
4
[]
no_license
import math #Funcion para calcular el diametro interno y externo en Cedula 40 def calcDiametro(diametro): if diametro == '1': diamint = 0.087 diamext = 0.110 elif diametro == '1(1/4)': diamint = 0.115 diamext = 0.138 elif diametro == '2': diamint = 0.172 diam...
true
ec50b690025d2b852ab3837408d81a0a05528903
FluffyFu/Leetcode
/238_product_of_array_except_self/solution3.py
UTF-8
269
3
3
[]
no_license
def product(nums): if len(nums) < 2: return None res = [1] for n in nums[:-1]: res.append(res[-1] * n) i = len(nums) - 1 cum_p = 1 while i >= 0: res[i] *= cum_p cum_p *= nums[i] i -= 1 return res
true
43548f4e591d83f0194ad0462a060ab764e2979c
TRI-ML/packnet-sfm
/packnet_sfm/utils/types.py
UTF-8
1,243
2.59375
3
[ "MIT" ]
permissive
# Copyright 2020 Toyota Research Institute. All rights reserved. import yacs import numpy as np import torch ######################################################################################################################## def is_numpy(data): """Checks if data is a numpy array.""" return isinstance(d...
true
06c96e6a8447cf1a9c75900743ed45bed53f6c8a
koolkhan2006/BITSPilani
/flask-tutorials-master/select_onchange/app.py
UTF-8
1,063
2.78125
3
[]
no_license
######################################### # # Submit form on select option # change event # # by # # Code Monkey King # ######################################### # packages from flask import * # create app instance app = Flask(__name__) # create UI route @app.route('/') def...
true
ed8d4211e66bf30fab0900062f7b8b2faeb03dc5
Tabish43/Hello-World
/hello.py
UTF-8
427
3.90625
4
[]
no_license
# print ("hello world") # person = "I am" # print (person) # me = "Owais Ansari" # print (me) # print ("my weight is") # weight = "68" # print (weight) # age = 80/4 # print (age) # qualification = "i have done class" # level = 100/20+7 # print (qualification) # print (level) print ("tell me the name...
true
760ba70d17bd9dbd2479fed2871a19224c3df0e0
fob413/physiodoc-bend
/models/helper/security.py
UTF-8
262
3.09375
3
[]
no_license
import bcrypt def generate_password_hash(password): return bcrypt.hashpw(password, bcrypt.gensalt()) def check_password_hash(hashed_password, password): if bcrypt.checkpw(password, hashed_password): return True else: return False
true
198abfda47878ef4ed7b662115617c7c1840e744
Jane11111/Leetcode2021
/077_5.py
UTF-8
564
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2021-07-17 20:56 # @Author : zxl # @FileName: 077_5.py class Solution: def recurFind(self,n,idx,k,ans,lst): if len(lst) == k: ans.append([item for item in lst]) for i in range(idx,n+1): lst.append(i) self.recurFind(n,i+1,k...
true
17ff470cdfe1affb0222b2fc9557d2b469b1b258
mikemudge/adventofcode17
/puzzle25/puzzle25.py
UTF-8
1,346
3.453125
3
[]
no_license
class Update(object): def __init__(self, write, direction, next): self.write = write self.direction = direction self.next = next def __repr__(self): return '%d %s %s' % (self.write, '<-' if self.direction == -1 else '->', self.next) def main(): states = { 'A': [ ...
true
8efaaa652fe371d72db330ea8b4c8270134f3a7d
abekermsx/AdventOfCode2019
/Day1/Day1-1.py
UTF-8
171
3.359375
3
[ "MIT" ]
permissive
def fuel_requirement(mass): return int(mass) // 3 - 2 with open('Day1.txt') as file: totalFuel = sum(map(fuel_requirement, file.readlines())) print(totalFuel)
true
440c48cd3401d94476154bee3fafe8efb90503e8
brunogomes30/PROJ-FPRO
/main.py
UTF-8
10,570
2.640625
3
[]
no_license
import time import variables from Button import Button from Player import Player from Enemy import Enemy from EnemyT2 import EnemyT2 from Shot import Shot from utils import * from pygame import * from Label import Label from QuadTree import QuadTree from variables import screen,all_entities, time_delta, FPS, HEIGHT, WI...
true
e28b3b13e02d1894e387ea5351ac479216e9acbf
JeffHoogland/bodhi3packages
/python-neet/usr/lib/python2.7/dist-packages/ecfg/parser.py
UTF-8
8,810
3.109375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python ''' An Enlightenment config parser. See: http://wiki.openmoko.org/wiki/Enlightenment_.cfg Requires pyparsing: https://pyparsing.wikispaces.com/. Author: Jimmy Campbell <jcampbelly@gmail.com> Version: 0.1.0 License: MIT ''' import json import decimal from collections import OrderedDict import py...
true
79cf1d58db2eaadd01e3814001f7898b6cc22ca0
computational-imaging/spad_single
/models/loss.py
UTF-8
6,150
2.96875
3
[]
no_license
import torch from torch.nn import MSELoss, L1Loss def get_depth_metrics(depth_pred, depth_truth, mask): """ Takes torch tensors. :param depth_pred: Depth prediction :param depth_truth: Ground truth :param mask: Masks off invalid pixels :return: Dictionary of metrics """ metrics = dict(...
true
5a59880dcb1c19ad6e3ec7912cc66731fb876192
alvas-education-foundation/ECE-3year-Code-Challenge
/RASHMITHA_4AL17EC077.py
UTF-8
449
3.328125
3
[]
no_license
print('Enter correct username and password to continue') count=0 while count < 3: username = input('Enter username: ') password = input('Enter password: ') if password=='e3$WT89x' and username=='Micheal': print('login successful') break else: count += 1 ...
true
12ad3b2db911ced05fb6f0ae5bbc69c094a33081
CaioHenriqueMachado/Contribuindo_com_Python
/03_desenvolvimento_avancado_python_com_flask_e_REST_API/05_dev_api_with_SQLAlchemy/utils.py
UTF-8
1,006
2.8125
3
[ "MIT" ]
permissive
# Só para testar se a conexão está funcionando from models import Pessoas, Usuarios def insere_usuario(login, senha): usuario = Usuarios(login=login, senha=senha) usuario.save() def consulta_usuarios(): usuarios = Usuarios.query.all() print(usuarios) #pessoa = Pessoas.query.filter_by(nome='Caio')....
true
46b21553311e9463a64b1b7da4c009f804e84546
DavinderSohal/Python
/Explanations/11-IntroToOOP__PT2/exercise2.py
UTF-8
967
3.703125
4
[]
no_license
#Exercise 2 - The code is incomplete, add your classes from exercise one and add a get_names method class StudentGroup: def __init__ (self, students=[]): '''Constructor. The list of students''' self.students = students '''Constructor add a new student to the group''' def add_student(se...
true
777c5d790e51912e3c9c56aa2b3262913f929f3f
Markay12/learningPython
/Chapter2/word_problem.py
UTF-8
407
4.375
4
[]
no_license
# Word Problem # Demonstrates Numbers and Math print("If a 2000 pound pregnant hippo give birth to a 100 pound calf.") print("but then eats 50 pounds of food, how much does she weigh?\n") input("Press the ENTER key to find out.\n") print("2000 - 100 + 50 =", 2000 - 100 + 50) # Here, the numbers are used input("\n\nPr...
true
e028d1dc1dc6a621a0fddffc92ba56e7d82299ed
ATYUYTA/tensorflow
/add_layer.py
UTF-8
1,428
2.9375
3
[]
no_license
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(input,in_size,out_size,activation_function=None): Weights=tf.Variable(tf.random_normal([in_size,out_size])) biases=tf.Variable(tf.zeros([1,out_size])+0.1) Wx_plus_b=tf.matmul(input,Weights)+biases if activation_fun...
true
a4ddafcb06c64814819ffda264c4348a11465552
imtanmays/Coding-Problems
/Arrays/stock_trading.py
UTF-8
1,241
3.859375
4
[]
no_license
''' Topic : Arrays Problem : Best Time to Buy and Sell Stocks I Link : https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ ''' def maxProfit(prices): if prices == []: return 0 max_index, min_index, profit = 0, 0, 0 for i, price in enumerate(prices): if p...
true
2431e05ee0c5c4a24493187ed614a9e77d8c64a3
denisazevedo/eNannyBot
/telegrambot.py
UTF-8
4,805
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import configparser import logging import audioplayer from aiogram import Bot, Dispatcher, executor, types from filters import RestrictUsersFilter, is_user_authorized config = configparser.ConfigParser() config.read('config/config.ini') TOKEN = config['BOT']['TOKEN'] ALLOWED_USERS = [el.strip()...
true
48c61bd44c5e0948ec75f00995200643ee4627e1
Shalimov-Denis48/MyPythonProject
/Python_Files/my_car.py
UTF-8
266
2.703125
3
[]
no_license
# import Car импортирование всего модуля from Car import * from Electrical_car import ElectricCar a4 = Car('audi', 'a4', 2018) print(a4.description_name()) tesla = ElectricCar('tesls', 's', 2016) tesla.battery.description_battery()
true
fae698c5143743e4cd0a0f1f345da955b408ec70
Kami32l/street-crossing
/street-crossing/scoreboard.py
UTF-8
1,088
3.546875
4
[ "MIT" ]
permissive
from turtle import Turtle FONT = ("Arial", 20, "normal") class Scoreboard(Turtle): def __init__(self): super().__init__() self.hideturtle() self.penup() self.goto(-100, 160) self.level = 1 self.print_level() def add_level(self): self.level += 1 ...
true
7a784e1334a455ce75bbd78aafecb7b6ab2a09c7
zhangzongyan/python20180319
/day0b/hw.py
UTF-8
368
3.203125
3
[]
no_license
from operator import itemgetter d = {"chaoqian":87, 'caoxu':90, 'caohuan':98, 'wuhan':82, 'zhijia':89} l = [11,22,33,44,55,66] b = itemgetter(2) print(b(l)) l = list(d.items()) # [('chaoqian', 87), ('caoxu', 90), ('caohuan', 98), ('wuhan', 82), ('zhijia', 89)] print(l) print(list(sorted(l, key = itemgetter(1))))...
true
d6d75a472e08a6d36dd261655158da33a782f8f5
Shovon588/Programming
/Data Structure & Algorithm/Disjoint Set Union/459 - Graph Connectivity.py
UTF-8
829
2.75
3
[]
no_license
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def makeset(n): par[n] = n def find(r): if par[r] == r: return r par[r] = find(par[r]) return find(par[r]) def joint(a,b): u = find(a) v = find(b) if u!=v: par[u] = v def generate_result(): for i in range(1,n+1): temp = ...
true
3f1db854d7e59f5e57d1b63e64436629f8687efb
clegaspi/dash-cytoscape
/tests/test_interactions.py
UTF-8
7,505
3.09375
3
[ "MIT" ]
permissive
"""Notes for the hardcoded values in the `init_pos` dictionary: It's impossible to programatically get the initial rendered positions of the nodes, since we would need to obtain the node object (in dictionary format), which can be done either by (a) using the tapNode callback, which paradoxally requires you to click t...
true
b2cb3efb4a7888624505c4c1dce6d1ef3d51f544
osmanfataw/calculator
/new.py
UTF-8
619
4.15625
4
[]
no_license
def add(a, b): result = a + b print("The result is ", result) def sub(a, b): result = a - b print("The result is ", result) def div(a, b): result = a / b print("The result is ", result) def multiply(a, b): result = a * b print("The result is ", result) operator = input("Please select op...
true
21a72478daea2cb6c858a5408a7bd028f5c2c8da
hellocook/Leetcode
/Best Time to Buy and Sell Stock.py
UTF-8
456
3.296875
3
[]
no_license
class Solution: # @param prices, a list of integer # @return an integer def maxProfit(self, prices): if not prices: return 0 cur = prices[0] low =0 for i in range(1,len(prices)): if prices[i]<cur: cur...
true
c7f405ae11cccdc6284bcf862bc90d001882a8fa
rasine/code
/python.py
UTF-8
615
3.15625
3
[]
no_license
# -*- coding=UTF-8 -*- import sys #改动点 #显示中文 reload(sys) sys.setdefaultencoding('utf8') class ClassTest(object): """docstring for ClassTest""" data = ["value1","value2","value3"] x = 7 def __init__(self,name,color): self.name = name self.color = color def sayHello(self): print "%s hello" %(self.name) d...
true
659f62064fd9a43b9ce192c3f4d658a0ed52b956
ramadhan-zain/pythonseleniumpytest
/PythonSelfFramework/utilities/BaseClass.py
UTF-8
1,379
2.5625
3
[]
no_license
import inspect import logging import pytest from selenium.webdriver.support.select import Select from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions @pytest.mark.usefixtures("setup") class BaseClass: def ...
true
94e1d2f08c62fca09fffa4b2fad407ef0d5bcfbf
cndqjacndqja/algorithm_python
/ndb769/그래프 이론/page_398.py
UTF-8
996
3.296875
3
[]
no_license
n = int(input()) def find(parent, x): if parent[x] != x: parent[x] = find(parent, parent[x]) return parent[x] def union(parent, a, b): a = find(parent, a) b = find(parent, b) if a < b: parent[b] = a else: parent[a] = b def solved(): x, y, z = [], [], [] for ...
true
ba9cbd705d4dd04fab7aa77b596866cc4255ab46
wildpieces/coding_test_note
/section7/break_down_coin/break_down_coin.py
UTF-8
543
3.234375
3
[]
no_license
import sys sys.stdin = open("section7/break_down_coin/in5.txt", "rt") # RESOLVE THIS PROBLEM!!!!! def DFS(L): global res if L == n: diff = max(money) - min(money) if res > diff: tmp = set() for x in money: tmp.add(x) if len(tmp) == 3: res = diff else: for i in range...
true
91579a8d92e1340c4a5c6318ef03bde685ed663a
mperrin/pynrc
/pynrc/maths/image_manip.py
UTF-8
42,030
2.796875
3
[ "MIT" ]
permissive
from __future__ import absolute_import, division, print_function, unicode_literals # The six library is useful for Python 2 and 3 compatibility import six from scipy.ndimage.interpolation import rotate #__all__ = ['pad_or_cut_to_size', 'frebin', \ # 'fshift', 'fourier_imshift', 'shift_subtract', 'align_LSQ...
true
1befaee80eb805a268a4023155582eebda9bb72a
kirillmipt/iris_dvc_project
/src/train.py
UTF-8
1,491
2.65625
3
[]
no_license
import argparse import os import pickle from sklearn.ensemble import RandomForestClassifier import yaml import pandas as pd def train(input_file_path_train, out_model_file_path, params_seed, params_n_estimators): df_train = pd.read_csv(input_file_path_train) x_train = df_train.drop(columns=['Species']) y...
true
088639146108b0cdc318cbe0c514c7589b292233
JanKPeters/Eng_calc
/heattransfer.py
UTF-8
426
2.765625
3
[]
no_license
def conductive_resistance (L, k, A): Rk = 0 Rk = L/(k*A) return Rk def convective_resistance (h, A): Rh = 0 Rh = 1/(h*A) return Rh def conduction (T1, T2, R): Qcond = 0 Qcond = (T1-T2)/R return Qcond def heat_transfer_coef (v): h = 0 h = 10.45-v+10*v**...
true
917a6e01e9236981fd17f47ab4dff02dd1acb2d2
bielcardona/OTSun
/otsun/ray.py
UTF-8
13,701
2.734375
3
[ "MIT" ]
permissive
"""Module otsun.ray for the modelization of light rays The module defines the class `Ray` """ from autologging import traced from .logging_unit import logger from .materials import vacuum_medium, PVMaterial, SurfaceMaterial, TwoLayerMaterial, PolarizedThinFilm from .optics import Phenomenon, OpticalState import numpy...
true
ab77f0dde3aeb462b251de58e74df6e5ff4944b2
xiaozhi5448/python-linux
/crawler/scrapy/yunqiCrawl/yunqiCrawl/spiders/yunqi_qq_com.py
UTF-8
3,172
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from yunqiCrawl.items import YunqiBookListItem,YunqiBookDetialItem class YunqiQqComSpider(CrawlSpider): name = 'yunqi.qq.com' allowed_domains = ['yunqi.qq.com'] start_urls = ['...
true
5923b7223c6123895361cc25b77bb24958a09d42
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc067/A/4869730.py
UTF-8
107
2.921875
3
[]
no_license
A, B = map(int, input().split()) print('Possible' if A%3 == 0 or B%3 == 0 or (A+B)%3==0 else 'Impossible')
true
34fb7a62abc9e467dc8fa0ffea867a780f6d17c2
kojobobo/TurtleZ
/player.py
UTF-8
1,060
2.984375
3
[]
no_license
from turtle import Turtle import random STARTING_POSITION = (0, -280) MOVE_DISTANCE = 10 FINISH_LINE_Y = 280 C_LIST = [(202, 164, 110), (240, 245, 241), (236, 239, 243), (149, 75, 50), (222, 201, 136), (53, 93, 123), (170, 154, 41), (138, 31, 20), (134, 163, 184), (197, 92, 73), (47, 121, 86), (73, 43, 35), (145, 178,...
true
e40957b3e2c942006645a173109ffa4ebcab940b
Iamthankyou/buff
/pythonProject/03.py
UTF-8
523
3.21875
3
[]
no_license
if __name__ == "__main__": x1,y1 = map(float,input().split()) x2,y2 = map(float,input().split()) x3,y3 = map(float,input().split()) x4,y4 = map(float,input().split()) print((1/2*((x1*y2-x2*y1)+(x2*y3-x3*y2)+(x3*y4-x4*y3)+(x4*y1-x1*y4)))) ''' A = np.array([[x1,x2],[y1,y2]]) B = np.array([[x...
true
35c0ebef2eb42ba3ebe6a3ce9eaae6bd6b40ca2f
jdynamite/autorigger
/modules/eyelids/singleEyelid.py
UTF-8
3,017
2.6875
3
[]
no_license
''' Writing rig modules with this autorigger Class: SingleEyelids Notable procs: Notable variables: self.joints: list of joints self.guides: list of guides self.placeGuides: places guides in .setup() according to positions input. part.setup() will create your joints and guides, but it's up to you ...
true
984c21fa0cc831ba8857baef943b5110c838d8b7
jreidy/cs124PA6
/test.py
UTF-8
8,838
2.9375
3
[]
no_license
import codecs import re import nltk import copy # list of italian sentences corpus = [] # list of translations translation = [] # dictionary of terms mapping italian -> english tree_dict = {} dictionary = {} reverse_dictionary = {} # english part of speech pos_dictionary = {} verb_tenses = {} # italian split sente...
true
7f261b378102e51c36755ec4649b0a2c9fbf24ee
aliothyuheng/recon
/relationTable/result.py
UTF-8
1,584
2.625
3
[]
no_license
import csv #import file datafile = open('F:\\ID-new\\primary database\\reaction2input_1.csv', 'r') datareader = csv.reader(datafile) data_1 = [] for row in datareader: data_1.append(row) reactionfile = open('F:\\ID-new\\primary database\\enzyme2reaction2gene.csv', 'r') datareader = csv.reader(reactionfile) react...
true
8f46a135343573abbc02cecddb2729f593746ecb
WeilerWebServices/Yahoo
/SparkADMM/ADMMDataFrames.py
UTF-8
1,546
2.984375
3
[]
no_license
# Copyright 2016 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. import numpy as np import pandas class SparseDataFrame(pandas.DataFrame): """when A and B have different dimension, they can be added or multiplied, assuming 0 when missing""" d...
true
38be124cb38767eaf626d612004ba2dba8bd8f49
leamont-siue/ME492
/W3d2P3_where.py
UTF-8
441
3.25
3
[]
no_license
from matplotlib.pyplot import * from numpy import * t = arange(0,1,0.01) y = 2*sin(2*pi*t) import copy y_pass = copy.copy(y) figure(1) clf() plot(t,y,'r--') # find indices where y is below 0.5 inds1 = where(y<0.5)[0] #set the value of y for those indices to 0 y_pass[inds1] = 0 #plot results figure(1) clf() plot(...
true
952ac2f9ed4c6c6209b7d0aec75e483db9b5644f
BrentGTR/AGENT
/components/page-analyzer/tests/test_concrete_state_featurizer.py
UTF-8
14,771
3
3
[ "Apache-2.0" ]
permissive
import json import pandas as pd import pytest from services.concrete_state_featurizer import calc_color_distance, calc_point_distance, sigmoid, get_nearest_color, \ normalize, ConcreteStateFeaturize, basic_html_tags class TestConcreteStateFeaturize: def test_calc_color_distance_same_color(self): # A...
true
13f7798fe95030aff507d109ca96076cc82b3c32
QuantumAtom/PythonLearning
/chapter4/squares.py
UTF-8
64
2.640625
3
[]
no_license
squares = [coolnum**2 for coolnum in range(1,11)] print(squares)
true
3ee8df9a6cf3d81eda376f51d949dbb206abe685
BrenoSDev/PythonStart
/Introdução a Programação com Python/TrabalhandoStrings15.py
UTF-8
134
3.859375
4
[]
no_license
#Preenchimento de strings com espaços s="tigre" print(s.ljust(20)) print(s.rjust(20)) print(s.ljust(20, ".")) print(s.rjust(20, "-"))
true
fecb14e34dd70715b7b7648ac0eab0eddabf1fd7
Mocolate/SIMON
/src/zalandoNetwork.py
UTF-8
3,607
2.8125
3
[]
no_license
# Import libraries import numpy as np import tensorflow as tf from tensorflow.python.framework import ops from tensorflow.examples.tutorials.mnist import input_data # Import Fashion MNIST fashion_mnist = input_data.read_data_sets('input/data', one_hot=True) def model(train, test, learning_rate=0.0005, num_epochs=16...
true
8bb9cb231ed4bfd3850f4543cb4d01ceec5b18bf
hihumi/enjapy
/print_ja/a_ja.py
UTF-8
441
3.28125
3
[]
no_license
#!/use/bin/env python3 """aの日本語意味を出力する(これはif-elif-elseの先頭のifに使うだけ。testに使うだけ) """ def a_ja_func(): """aの日本語意味を出力する関数 doctest: >>> a_ja_func() a: えい・えー """ print('a:') a_ja_words = """えい・えー""" print(a_ja_words) if __name__ == '__main__': import doctest doctest.testmod()...
true
89d166383b671b8b60d12bf29e7e2b4951833550
felixpelletier/backend-coding-challenge
/src/suggestions/city_infos/geoname_gazetter_city_infos_provider.py
UTF-8
1,595
2.734375
3
[]
no_license
from src.suggestions.city_infos import provider_interface class GeonameGazetterFileCityInfoProvider(provider_interface.CityInfoProvider): def __init__(self, geoname_tsv_file_path): self.geoname_tsv_file_path = geoname_tsv_file_path def get_city_infos_list(self): geoname_formatted_city_info_...
true
68c8e143979df07feeb2fcfc38347e972066315f
rafaelmessias/projlib
/quality/trustworthiness.py
UTF-8
3,788
2.734375
3
[]
no_license
import numpy as np from scipy.spatial.distance import cdist from projlib.quality.metric import DistanceBasedMetric from numba import jit from setdiff1d import setdiff1d from sklearn.neighbors import NearestNeighbors def trustworthiness(D_high, D_low, k=7): n = D_high.shape[0] nn_orig = D_high.argsort() ...
true
4cee758292778bd6d5a4b377ba946b4c28fade00
carrieyin/python-study
/classdemo.py
UTF-8
637
3.453125
3
[]
no_license
# by y_dd # 时间 2021/04/12 class Employee: '所有员工的基类' empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCount += 1 def displayCount(self): print("Total Employee ", Employee.empCount) def displayEmployee(sel...
true