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
e8d827aca3a85fc8daa234e5abb20bc2dde4d6e0
KATO-Hiro/AtCoder
/ABC/abc251-abc300/abc260/b/main.py
UTF-8
1,057
2.96875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, x, y, z = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) math = sorted([(ai, i) for i, ai in enumerate(a)], key=lambda x: (x[0], -x[1]), reverse=True) english ...
true
7888fdda3be97f0d120c5b624ca6b3c3c52d8ae2
thiagofb84jp/python-exercises
/generalExercises/estruturaSequencial/exercicio07.py
UTF-8
328
4.375
4
[]
no_license
# 7. Faça um Programa que calcule a área de um quadrado, em seguida mostre o dobro desta área para o usuário. lado = float(input("Digite o lado do quadrado (em metros): ")) area = lado * lado print("Área do quadrado: {:.2f}".format(area)) print("Dobro da área do quadrado {:.2f} em metros quadrados.".format(area * 2)...
true
ed7815b8c27f854854b2f896d64891f05984d02d
damiansp/genetic
/neural_net/start.py
UTF-8
344
2.546875
3
[]
no_license
from split_data import DataSplitter DATA_DIR = './data' def main(): data_file = f'{DATA_DIR}/heart.csv' splitter = DataSplitter(data_file) [[X_train, y_train], [X_test, y_test]] = splitter.split_data('target', shuffle=True) if __name__ ==...
true
d515ac7c83b1de944b0ac8d82e99648f9517280b
laurencourtney/Robotics
/class3_ws/install/assignment3/lib/python3.8/site-packages/assignment3/assignment3.py
UTF-8
5,300
3.765625
4
[]
no_license
''' #################### EN605.613 - Introduction to Robotics Assignment 2 Vehicle Kinematics ------- For this assignment you must implement the forward and inverse kinematics functions for the Mechanum class. ================================== Copyright 2020, The Johns Hopkins Univers...
true
9d3a15ed421886641d31bacb000543a69daad2ba
monicadsong/hbc-webapp
/solver.py
UTF-8
2,774
2.671875
3
[]
no_license
from scheduler import * import db_manager as dm import helper from classes import * ### get Dancer objects def get_dancers(): dancers = [Dancer(d.firstname+d.lastname, d.availability.split(';'), d.nonharvard, d.choreographer) for d in dm.get_user_data_list()] return dancers ### get Rehearsal objects def get_p...
true
ae482f62b7756e1f071d36360aab76d34b659dfd
gio-shara-code/console_apps
/python/binary_search.py
UTF-8
1,166
4.84375
5
[ "MIT" ]
permissive
"""You're going to write a binary search function. You should use an iterative approach - meaning using loops. Your function should take two inputs: a Python list to search through, and the value you're searching for. Assume the list only has distinct elements, meaning there are no repeated values, and elements are in ...
true
15c05fb566319d467fe702e287e3eab7d160fce8
Ktm2590/CLDeanon
/install.py
UTF-8
385
2.703125
3
[]
no_license
import os print("\033[33mОбновление python3-pip...\033[0m") os.system("pip3 install --upgrade pip") print("") bib = ["html5lib", "phonenumbers", "requests", "bs4", "urllib3"] for i in range(len(bib)): print("\033[33mУстановка "+bib[i]+"...\033[0m") os.system("pip3 install "+bib[i]) print('\033[32mУст...
true
bca52f339b56d8c9550fa144384c06a1fe718d33
amkatrutsa/edm
/imbalanced_classification/demo_edm.py
UTF-8
7,275
2.6875
3
[ "MIT" ]
permissive
# This script is based on tutorial https://www.tensorflow.org/tutorials/structured_data/imbalanced_data import torch from imbalanced_sampler import ImbalancedDatasetSampler from models import SimpleNet import utils import numpy as np import argparse import os parser = argparse.ArgumentParser() parser.add_argument("-...
true
d0999df33ee2242816e1466cc30e1c60d5c34c34
rshatch/rwh-slack
/rwh.py
UTF-8
6,770
2.5625
3
[]
no_license
import os import time import re import slack from dumper import dump from datetime import datetime, timedelta from random import randint import pickle import logging as log # basic log config. log.basicConfig( format='%(asctime)s %(levelname)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', filename='bot.l...
true
29574341b73b2e4976b85f183fac558e2482ed2d
marydeka/coding_practice
/daily_DS_practice/03.05/parse_str_message_2.py
UTF-8
1,160
4.28125
4
[]
no_license
''' Iteration 2 Time: Current year: 2017 < means go back one year > means go forward one year * doubles the effect of the char two positions before this char (if * points to another *, it doubles effect of existing multiplication) Determine what the final year is. ''' symbols = {'<': -1, '>': 1} string = "<<<*>>*...
true
8c812acc58b06a5bd30367ee006c2a473a591483
dicao425/algorithmExercise
/LintCode/binaryTreePreorderTraversal.py
UTF-8
709
3.25
3
[]
no_license
#!/usr/bin/python import sys """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param: root: A Tree @return: Preorder in ArrayList which contains node values. """ def preorderTraversal...
true
0866b222717c08ce99a19c4f52f6a2977860675b
iamrjkunal/android_malware_detector
/android_malware_detector/config/__init__.py
UTF-8
1,204
2.59375
3
[]
no_license
import os import json def load_config(config_path=""): config = None if not config_path: CONFIG_DIR = os.path.abspath(os.path.dirname(__file__)) config_path = os.path.join(CONFIG_DIR, 'config.json') try: config = json.load(open(config_path)) except Exception, e: print "...
true
6bc34fa7e77aba3dec7d2a07885c3dcbf69a86f1
kodasma/Scrapy
/Scrapy - Koorimine mitmelt lehelt/amazon/amazon/spiders/amazon_spider.py
UTF-8
2,065
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from ..items import AmazonItem class AmazonSpiderSpider(scrapy.Spider): name = 'amazon_spider' page_number = 1 start_urls = [ 'https://www.amazon.com/s?rh=n%3A18145289011&page=1&qid=1586342266&ref=lp_18145289011_pg_2' ] def parse(self, response): ...
true
035616795c5998a67309f5cd9cd7087bfe8acf6f
diekmrcoin/projecteuler
/problem0561/index.py
UTF-8
244
3.0625
3
[]
no_license
def getResult(m,n): return get_even_power_sum(n // 2) * (m + 1) def get_even_power_sum(max): sum = 0; d = 2; while d <= max: sum += max // d; d *= 2; return sum; print(getResult(904961, 8)); print(getResult(904961, 10**12));
true
8894a43fbf2bb8c911e01b9a75dc440977462e53
lengstrom/CaptionTime
/xml2json.py
UTF-8
585
2.625
3
[ "MIT" ]
permissive
import os, sys, pdb, json from bs4 import BeautifulSoup import xml.etree.ElementTree as ET from unicodedata import normalize import requests def make_json_from_xml(lang, vid_id): xml = requests.get('http://video.google.com/timedtext?lang=' + lang + '&v=' + vid_id).text soup = BeautifulSoup(xml, 'xml') fin_...
true
e1b66457c7a451f0b826ddd7405cdeea9bb6ca57
humphrit7/tm470_project
/tests/test_read_contour_data.py
UTF-8
7,927
2.59375
3
[]
no_license
import unittest import read_contour_data as contour import pandas as pd from pathlib import Path import numpy as np import datetime as dt import sqlalchemy as db PADDED_ALT_DF = pd.read_pickle('padded_alt_test_df.pkl') class MyTestCase(unittest.TestCase): def test_read_contour_file(self): filename = Path...
true
ff49a36fd72867084ebcb6cdbbd01ff2d6a53e3d
raj4217/Python_All
/Python core/smpl1.py
UTF-8
417
2.953125
3
[]
no_license
def outFunc(func): def inFunc(): print('unFunc exceuted') return func() return inFunc @outFunc def disp(): print('Disp executed') disp() # fun = outFunc(disp) # fun() ''' def outFunc(msg): # msg = 'Hello' def inFunc(): print(msg) return inFunc print(outFunc('jdfb...
true
2396fa55f6e8982199777acd005625a4c175615b
deepvk/headline_gen_baselines
/utils.py
UTF-8
2,723
2.78125
3
[]
no_license
import ujson from os.path import join from random import shuffle import sentencepiece as spm from nltk.tokenize import sent_tokenize class DataLoader: def __init__(self, data_path="", seed=42, name="ria"): assert isinstance( data_path, str ), "Invalid data_path type. Required {}, but ...
true
bba1fee8a946baaaa5f27c99484cfdec6a50398c
gridl/My_Coding_Challenges
/codeeval/easy/183_details.py
UTF-8
282
2.75
3
[]
no_license
import sys with open(sys.argv[1], 'r') as f: for lines in f: res = [] for i in lines.rstrip().split(','): if i.find('.') < i.find('Y'): res.append(i.count('.')) else: res.append(0) print min(res)
true
e958e1ae3cc60adbba16f5d3d0312a89b8136ed4
PedroHenriqueSimoes/Exercicios-Python
/Mundo 1/ArquivosComCores/File 030.py
UTF-8
149
3.4375
3
[ "MIT" ]
permissive
num = (int(input('\033[36mDigite um numero inteiro: \033[m'))) if num % 2 == 1: print('\033[31mIMPAR\033[m') else: print('\033[32mPAR\033[m')
true
14b300da9a09a20c3cc3835672979fc7c465f4a9
engrjepmanzanillo/problem_solving
/algorithms/birthday_cake_candles.py
UTF-8
932
3.34375
3
[]
no_license
#!/bin/python3 # https://www.hackerrank.com/challenges/birthday-cake-candles/problem # author: @engrjepmanzanillo import math import os import random import re import sys # Complete the birthdayCakeCandles function below. def birthdayCakeCandles(ar): # get the highest candle by getting the # highest element...
true
3e20920f7a9b0309d4122c6fb9568ae9af763418
cbolisetti/multiappfracflow
/3dFracture/matrix_app.py
UTF-8
1,918
2.5625
3
[]
no_license
import os import sys import numpy as np import matplotlib.pyplot as plt production_starts = {} # index into data at which production starts (P_out >= 10.6) for i in ['00', '10', '11', '21', '22']: data = np.genfromtxt(r'matrix_app_out_fracture_app0_' + i + '.csv', delimiter=',', names=True) for ind in range(1,...
true
bf13a803758fa1bd97ebaa62fefd9230c450357c
Jianjiazhang/CS510_lab
/preProcessData.py
UTF-8
3,773
2.859375
3
[]
no_license
# import json import numpy as np import jsonlines import nltk import string from nltk.corpus import stopwords nltk.download('stopwords') nltk.download('punkt') nltk.download('wordnet') from nltk.tokenize import word_tokenize from nltk.stem import PorterStemmer from nltk.stem import WordNetLemmatizer # for preProcessing...
true
7b43ff7009dec7dc180f183ba1c723e3c1b6ffdb
tianzhihen/openmv
/usr/examples/face_detection.py
UTF-8
652
2.90625
3
[ "MIT" ]
permissive
import sensor, time # Reset sensor sensor.reset() # Sensor settings sensor.set_contrast(1) sensor.set_gainceiling(16) sensor.set_framesize(sensor.QQVGA) sensor.set_pixformat(sensor.GRAYSCALE) # Load Haar Cascade face_cascade = HaarCascade("frontalface") print(face_cascade) # FPS clock clock = time.clock() while (Tr...
true
5791435feef15f00ca58270f248574d487d228e9
pawwahn/python_practice
/tkinter/weather_tkinter_application/main.py
UTF-8
2,009
3.265625
3
[]
no_license
import tkinter as tk from PIL import Image, ImageTk import requests root = tk.Tk() root.title("Weather App") root.geometry("600x500") #Key: e4277258bcb8d9fc62ad01058fba0bb5 #API URL: api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key} #link: https://home.openweathermap.org/api_keys def get_weather...
true
c32a8e3fa542b8bf4c09d802a7dee0863bc799b0
WPKENAN/Junior_homework
/opengl/first_no1.py
UTF-8
2,977
2.796875
3
[]
no_license
#coding:utf8 from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * def init(): glClearColor(0.0,0.0,0.0,0.0);# gluOrtho2D(-15.0,15.0,-15.0,15.0) def RenderScene(): glClear(GL_COLOR_BUFFER_BIT);#清除屏幕 glColor3f(1.0,1.0,0.0);#设置颜色 DrawMyObjects() glFlush(); def DrawMyObject...
true
2e516ea6b06f3b41163644203333a274622f6e96
GustavoPMex/practice-pet-adoption-center
/form.py
UTF-8
1,558
2.703125
3
[]
no_license
from extra_fun.generator_id import id_generator class Form: def __init__(self): self._id = id_generator() self._adoption_center = None self._adopter = None self._assessor = None self._pet = None # Id class ...
true
66304761fe7c466e2008a63a707f2c59c827fcda
jgayfer/spirit
/cogs/events.py
UTF-8
13,137
2.6875
3
[ "MIT" ]
permissive
from datetime import datetime from discord.ext import commands import discord from db.query_wrappers import get_event_role, get_event_delete_role from cogs.utils.message_manager import MessageManager from cogs.utils.checks import is_event, is_int, is_message from cogs.utils import constants from cogs.utils.format imp...
true
87766899d34ddc5ddcba3444e143004c222828b5
xuejiaowang/homepage
/helloWorld.py
UTF-8
2,668
2.921875
3
[]
no_license
import webapp2 import cgi form = """ <form method="post"> What is yoru birthday? <br> <label>Month<input type = "text" name = "month" value = %(month)s></label> <label>Day<input type = "text" name = "day" value = %(day)s></label> <label>Year<input type = "text" name = "year" value = %(year)s></label> </div style ...
true
35546458ea34764955a510fde2df5ec32233292e
spohaver/misc
/python_scripts/create_airflow_webtoken_url.py
UTF-8
2,055
2.734375
3
[]
no_license
#!/usr/bin/env python3 # author: spohaver # description: Creates a webtoken URL based on the user credentials import argparse import boto3 import sys # Constants ALB = '' def check_credentials(): """ Use boto3's Security Token Service (STS)'s get_caller_identity to validate credentials, this allows for b...
true
fa92be831681a42f1550d9fb3d45ecdc75f5b2ea
GZHOUW/Introduction-to-Artificial-Intelligence
/P1_Robot_Controller/Robot Controller.py
UTF-8
3,735
3.328125
3
[]
no_license
import helper env_data = helper.fetch_maze() # Number of rows rows = len(env_data) # Number of columns columns = len(env_data[0]) # Extract the element of the third row and sixth column row_3_col_6 = env_data[2][5] print("The maze has", rows, "rows", columns, "columns,the element of the third row and ...
true
944006c9ed375ca3aca153369c140492d319778c
mvoin21/all
/hm11.py
UTF-8
261
3.921875
4
[]
no_license
x = int(input('Введите 1ое число: ')) y = int(input('Введите 2ое число: ')) z = int(input('Введите 3е число: ')) def summarize(x, y ,z): return x + y + z print('Сумма трех чисел:',summarize(x, y, z))
true
b893722f495df583729cd568914028ca5914d611
indreshmishra/marshaler
/src/rwork/marshaler/_marshaler.py
UTF-8
782
2.90625
3
[ "Apache-2.0" ]
permissive
import json class CommonObject: def load_deep_json(self, j): ''' This loads object to two level. ie. If User Entity contains Address Entity object , __init__ of User Entity should contain same name of parameter as the field of Job Entity :param j: is json string ...
true
b31d292f7846d00944633707a865e548e1660d98
allisson/asyncpg-utils
/tests/test_databases.py
UTF-8
2,944
2.65625
3
[ "MIT" ]
permissive
import pytest from asyncpg_utils.databases import PoolDatabase pytestmark = pytest.mark.asyncio @pytest.mark.parametrize( 'selected_database', ( pytest.lazy_fixture('database'), pytest.lazy_fixture('pool_database') ) ) async def test_database_insert(selected_database, post_data): if isin...
true
3aa3ca372dd7a55fb29d5b0d363934e14bcb4371
frankobe/lintcode
/123_word-search/word-search.py
UTF-8
1,871
3.25
3
[]
no_license
# coding:utf-8 ''' @Copyright:LintCode @Author: frankobe @Problem: http://www.lintcode.com/problem/word-search @Language: Python @Datetime: 16-04-14 21:23 ''' class Solution: # @param board, a list of lists of 1 length string # @param word, a string # @return a boolean def exist(self, board, wor...
true
9626a7d594f29dd75a563e32cbba7e7a814ef83d
LukasMosser/SNIST
/data_generation/forward_model/devito/devito/tools/abc.py
UTF-8
5,554
3.078125
3
[ "MIT" ]
permissive
import abc from hashlib import sha1 __all__ = ['Tag', 'ArgProvider', 'Signer', 'Pickable'] class Tag(abc.ABC): """ An abstract class to define categories of object decorators. .. note:: This class must be subclassed for each new category. """ def __init__(self, name, val=None): ...
true
6e1e936a24e53a6ea9287979bccf307b6558205f
ozashu/narupy
/5_processes_have_file_descriptors_closed_file.2.py
UTF-8
229
2.78125
3
[]
no_license
if __name__ == "__main__": with open("/etc/passwd") as passwd: print(passwd.fileno()) passwd.closed try: print(passwd.fileno()) except ValueError: print("The file already has closed")
true
2750203bc20b7ffea6d5d296b459493ff22e0c5f
usama-nayab/Hacktoberfest2021
/Python/diameter_of_a_binary_tree.py
UTF-8
1,261
3.578125
4
[ "MIT" ]
permissive
class BinaryTree: def __init__(self,data): self.data=data self.left=None self.right=None class dandh: def __init__(self,diameter,height): self.diameter=diameter self.height=height def dnh(root): if root==None: val=dandh(0,0) ...
true
b3ff66367a6a4145f3dc581d3a74cd77a3c46d0f
Alwayswithme/LeetCode
/Python/033-search-in-rotated-sorted-array.py
UTF-8
999
3.859375
4
[]
no_license
#!/bin/python # # Author : Ye Jinchang # Date : 2015-06-03 22:39:23 # Title : 33 search in rotated sorted array # uppose a sorted array is rotated at some pivot unknown to you beforehand. # # (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). # # You are given a target value to search. If found in the...
true
e83c99c9af481ed9627d9ff75aa5f719bc118169
plhsu19/leetcode
/242_valid_anagram/sol_hash.py
UTF-8
1,171
3.703125
4
[]
no_license
# hash table solution class Solution: # solution 1: List as hashtable, char -> unicode as key def isAnagram(self, s: str, t: str) -> bool: if len(s) != len(t): return False # hash table + 1 pass solution hash1 = [0]*26 for i in range(len(s)): ...
true
e288533585b3b4be578418393afaca5472331296
BharathiHarsha/JavaBasics
/pythontutorial/Basics/tuples/words.py
UTF-8
326
3.375
3
[]
no_license
complex=(23,'afaf', 52.26, True) for a in complex: print(a) print(complex[1]) if "apple" in complex: print("Yes, 'apple' is in the fruits tuple") else: print('apple not found') thistuple = (1, 3, 7, 8, 7, 5, 4, 6, 8, 5) x = thistuple.count(5) no=thistuple.index(5) print('index of 5=',no) print('count for 5...
true
ee9277d987482ec8630897c02f3467866d11509e
gabriellaec/desoft-analise-exercicios
/backup/user_242/ch60_2020_04_27_20_36_24_885307.py
UTF-8
64
2.703125
3
[]
no_license
def verifica_palindromo(texto): return texto == texto [::-1]
true
b375dc3ca879501e3021aa1a2e325c76ae0bd27b
callmexss/pyhandy
/pyhandy/perf.py
UTF-8
2,696
3.09375
3
[ "MIT" ]
permissive
''' File: perf.py File Created: 2022-10-05 23:56:35 Author: callmexss (callmexss@126.com) Description: handy perf tools. ''' import time class TimeHandy: """Time handy.""" @staticmethod def get_format_time(epoch_time, fmt="%Y-%m-%d %H:%M:%S"): """Convert Epoch time to string fo...
true
497af5eb4123c4c65e0f36c55d66e1fd09adbed6
roddar92/linguistics_problems
/src/ngrams/Diminutive-rnn.py
UTF-8
9,282
3.21875
3
[]
no_license
import pandas as pd from collections import defaultdict, Counter from pathlib import Path from random import choice, random class DiminutiveGenerator: _KA_ENDING = 'ка' _RU_VOWELS = 'аеиоуыэюя' _LAST_LETTER = _RU_VOWELS + 'ь' _DIM_ENDING = '$' _START = '~' LANGUAGE_DEFAULT_PROB = 0.0001 ...
true
035193fe3e2832b2663be12b698bb8c33788319c
Lextal/YATS2S
/seq2seq/contrib/losses.py
UTF-8
500
3
3
[ "MIT" ]
permissive
import tensorflow as tf def contrastive_loss(labels, distances, margin=1.0): """ ## y = 0 - same class, y = 1 - other, No """ # between_class = tf.multiply(1.0 - labels, tf.square(distances)) between_class = tf.multiply(labels, tf.square(distances)) max_part = tf.square(tf.maximum(margin - dis...
true
c1bd8fd64729ad1f409549a1faf01eeac7dd963a
Audiodrome/exercism
/python/series/series.py
UTF-8
370
3.6875
4
[]
no_license
def slices(series, length): if length > len(series) or length == 0: raise ValueError("length", length, "greater than length of series") series_list = [] for i in range(0, len(series)): if i + length <= len(series): tuple = [int(i) for i in list(series[i:i+length])] ...
true
d10021c45d898e3fbc792fe9b0a663e8c2071dc0
JingkaiTang/github-play
/government_or_fact/want_time/new_hand/new_woman/thing/come_early_woman.py
UTF-8
191
2.6875
3
[]
no_license
#! /usr/bin/env python def hand(str_arg): last_day_or_part(str_arg) print('fact') def last_day_or_part(str_arg): print(str_arg) if __name__ == '__main__': hand('company')
true
a654fa8a8912db0c95a0e7dbbd141f8b9fe3512e
guziy/PlotWatrouteData
/src/diagnose_hydrosheds/directions.py
UTF-8
3,193
2.734375
3
[]
no_license
__author__="huziy" __date__ ="$Jul 23, 2011 12:42:17 PM$" from netCDF4 import Dataset import application_properties application_properties.set_current_directory() from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt class Plotter: def __init__(self, path = ''): ...
true
1ef91e9e6a84816fbf75969541b2984b2b2c6eb5
MikeAmy/regexplain
/parse.py
UTF-8
15,145
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- import re from class_extension import ClassExtension digits = re.compile(r'\d') letters = re.compile(r'[a-zA-Z]') class UnrepeatablePattern(object): def __init__(unrepeatable_pattern, repeats, **unused): if repeats: raise Exception('Nothing to repeat') class StartO...
true
cae427d57f43e93e099bf92767b405f913018eb4
elmohafez/ayah-detection
/generate_secure_aya_url.py
UTF-8
903
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python2 import os import sys import argparse from md5 import md5 def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('--recitation_id', type=int, required=True) parser.add_argument('--qaree_id', type=int, required=True) parser.add_argument('--sura_id', type=int,...
true
4e02a78e873beba4ba5d2155da0c5755aa0996de
marcoswebermw/learning-python
/treinamentos/treinamento_ronaldoframos/recursividade.py
UTF-8
759
4.375
4
[]
no_license
# coding:utf-8 import os os.system("clear") print("FATORIAL") # Toda função recursiva chama a sí própria. # Toda função recursiva tem um caso base, caso de parada ou condição de escape, # que finaliza o processo de recursão, e evita loop infinito. def fat(n): if n < 0: return "Erro... valor menor que zero" elif n ...
true
e91f175a4eadf70ec088e182f6ba4e2e20e45ef7
Sarthak-Singhania/Work
/Class 12/Recursive sum.py
UTF-8
207
3.015625
3
[]
no_license
number=int(input()) sum1=0 a=int(input()) def sum(): global number global sum1 if number==a: return sum1 else: sum1+=number number+=1 return sum() print(sum())
true
4b6f6e56c310062d5bdc26cafb85a08b2087b2f0
yashaskumargb/guessing_A_number
/guess.py
UTF-8
1,868
3.671875
4
[]
no_license
import random as r def num_gen(l): x='' nums= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for i in range(0,l): x=x+str(r.choice(nums)) x=int(x) return x #------------------------------------------------------------------------------ player_name = input("Hello, What's your name?") user_len=int(input("enetr the ...
true
a503e9861ea4f07b882697dc2c3052cf6fce956e
sachinpatel160/python
/p11.py
UTF-8
189
3.515625
4
[]
no_license
a=eval(input("Enter a no. of subject: ")) i=0 out={} while(i<a): b=input("Enter subject name: ") c=input("Enter marks: ") i=i+1 out[b]=c print("Database is: \n",out)
true
904c7d9361849188fc4d734723d8b6e2d50b1c92
navy-xin/Python
/黑马学习/if-04多重判断.py
UTF-8
456
4.3125
4
[]
no_license
""" 需求: 如果年龄小于18,为童工,不合法 如果年龄18-60岁之间,为合法工作年龄 如果年龄大于60为退休年龄 """ age = int(input('请输入您的年龄:')) # 童工 if age < 18: print(f'您输入的年龄是{age},童工') # 18-60 elif (age>= 18) and (age <= 60): print(f'您输入的年龄是{age},合法') # 退休 elif age > 60: print(f'您输入的年龄是{age},退休年龄')
true
de8246927fc33b313a9b66d635b33a06f4d852e1
umyuu/Sample
/src/Python3/Q116348/exsample.py
UTF-8
1,167
3.234375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- #====================================================================== # ライブラリ #====================================================================== # GUIを扱う import tkinter #====================================================================== # クラス定義 #=====================================...
true
179622304ca1d6e976e8468c936ee75720c06ce4
Dzhuhnuhmeidzhai/FloorPlanResearcher
/MasksGeneration/Scripts/resizeInput.py
UTF-8
556
2.890625
3
[]
no_license
import numpy as np import cv2 #resizing of raw input image def resizeInput(img): #create empty canvas h_out = w_out = 512 canvas = np.full((h_out,w_out,3),255) h_im, w_im = img.shape[0],img.shape[1] #find resized image height, image width newh = int(h_im * min(h_out/h_im, w_out/w_im)) neww = int(w_im * ...
true
130b81dd9b5ec2f45b9d30158b5405840492b0c2
serboox/ansib-server
/ansib/server/db/repositories.py
UTF-8
2,118
2.8125
3
[]
no_license
import functools import logging LOG = logging.getLogger(__name__) def session(session_fn): def _get_session(fn): @functools.wraps(fn) def newfn(*args, **kwargs): if kwargs.get('session'): return fn(*args, **kwargs) else: with session_fn() as...
true
3a6ed17a1d1be83f70bd94d6a26621bfb605486d
Shiliangwu/python_work
/list_operate.py
UTF-8
1,969
4.375
4
[]
no_license
# -*- coding: utf-8 -*- # @Author: apple # @Date: 2019-01-03 14:06:11 # @Last Modified by: apple # @Last Modified time: 2019-01-03 15:17:10 magicians=['alice','david','carolina'] for magician in magicians: print(magician+", that was a great trick!") print("I can't wait to see your next trick,"+magician.title()+"...
true
1f5d9adc9fb7e0f6d6b7cb291c2b3b280388003c
ShrinathN/MyRFTools
/gengraph.py
UTF-8
2,042
2.609375
3
[]
no_license
#!/bin/python import numpy as np import pandas as pd import matplotlib.pyplot as plt import low_pass_filter import sys def manchester(): data = [] outdata = [] bit_shift = 0 for i in range(1, len(sys.argv)): data.append(int(sys.argv[i])) outdata.append(0) outdata.append(0) outdata.append(0) outdata.appen...
true
95231ac6bb72437b7d0437a9ad30bbd31e9a9dcd
alexnad/HackBulgaria-Programming-101-2
/exam1/tic-tac-toe/game_tests.py
UTF-8
3,233
3.21875
3
[]
no_license
import unittest from game import Game from game import InvalidMoveError class TestGame(unittest.TestCase): def assert_outcome(self, expected_outcome, board): game = Game(board) self.assertEqual(game.calculate_outcome(), expected_outcome) def test_win_by_row(self): self.assert_outcome(...
true
9442ce2a5ed83ed0271ef58598304f13bea5a2ed
m-elhussieny/code
/misc/download.py
UTF-8
2,082
3.171875
3
[]
no_license
#!/usr/bin/env python """ download.py Simple program to download a whole bunch of files from a web page. Fernando Paolo - Jul-2008. (modified from Prahbu Ramachandran) """ import urllib, re import os from sys import argv, exit #------------------------------------------------------------------- url = 'htt...
true
cc6490192e52e6e61cfbbbe8830dc067961f1360
justcoddev/Python100days
/day010/T10FuncionconArgumentos.py
UTF-8
386
3.90625
4
[]
no_license
# Crear una función para sumar los valores recibidos de tipo numérico, # utilizando argumentos variables *args como parámetro de la función y # regresar como resultado la suma de todos los valores pasados como argumentos. def sumarValores(*numericos): resultado = 0 for valores in numericos: resultado ...
true
f701ee5f0d99624bffe41a2e21e040287668f857
chromium/chromium
/third_party/blink/web_tests/external/wpt/import-maps/data-driven/tools/format_json.py
UTF-8
628
2.640625
3
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
import collections import json import sys import traceback """ Simple JSON formatter, to be used for JSON files under resources/. Usage: $ python tools/format_json.py resources/*.json """ def main(): for filename in sys.argv[1:]: print(filename) try: spec = json.load( ...
true
b3aaed4be97a9db3b2d6269c3e5325e0f18ee431
Dharmateja-Palepu/CompetitiveProgramming
/Techgig Patter Problems/Ascending Alphabetical Right Angle Triangle Reverse.py
UTF-8
313
3.609375
4
[ "MIT" ]
permissive
#Ascending Alphabetical Right Angle Triangle Reverse """ A B C D E A B C D A B C A B A """ n=int(input()) for i in range(0,n): for j in range(n-i): if j<n-1-i: print(chr(65+j),end=' ') else: print(chr(65+j),end='') if i<n-1: print()
true
55a0bee04f1bca3204eb8b21e6169cdcc6decdfc
daniels-kb/dining-philosophers-and-others
/minimum_swaps.py
UTF-8
2,105
4.1875
4
[ "MIT" ]
permissive
''' Given an unordered list consisting of consecutive integers [1, 2, 3, ..., n] (where n is the number of elements) without any duplicates, find the minimum amount of swaps necessary to sort the list in ascending order. Only two elements are allowed per swap. ''' #!/bin/python3 import math import os imp...
true
68d81b916f807841eec3d8e224e899cbab4a2790
michaelzh17/6001_Python
/book_computation&programming/c5_tuple_01.py
UTF-8
393
3.375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 2 20:01:31 2017 @author: xinyezhang """ def intersect(t1, t2): """Assumes t1 and t2 are tuples Returns a tuple containing elements that are in both t1 and t2""" result = () for elmt in t1: if elmt in t2: resu...
true
7afca9d8583415c2d1fd940f3cad708b0d1beade
FerryChan666/catch-the-ball
/ball.py
UTF-8
714
3.28125
3
[]
no_license
import pygame from pygame.sprite import Sprite from random import randint class Ball(Sprite): """球类""" def __init__(self, screen, my_settings): super().__init__() self.screen = screen self.my_settings = my_settings #获取图像 self.image = pygame.image.load('images/ball.png') #获取图像,屏幕属性 self.rect = self.imag...
true
0114c3764b471c77a33181fde5872cef4e4440a8
da-ferreira/uri-online-judge
/uri/2397.py
UTF-8
339
3.609375
4
[]
no_license
entrada = list(map(int, input().split())) entrada.sort(reverse=True) a = entrada[0] b = entrada[1] c = entrada[2] if (a < b + c) and (b < a + c) and (c < a + b): if a ** 2 == b ** 2 + c ** 2: print('r') elif a ** 2 < b ** 2 + c ** 2: print('a') else: print('o') else...
true
cf93d3f65c46b791fcb45b4ec9d19336e6383265
TalwalkarLab/leaf
/models/server.py
UTF-8
4,760
2.75
3
[ "BSD-2-Clause" ]
permissive
import numpy as np from baseline_constants import BYTES_WRITTEN_KEY, BYTES_READ_KEY, LOCAL_COMPUTATIONS_KEY class Server: def __init__(self, client_model): self.client_model = client_model self.model = client_model.get_params() self.selected_clients = [] self.updates = [] ...
true
d23065ea8391c1790dfc7fb676a89f108299118c
martyv123/Snarl
/tests/Game/testLevel.py
UTF-8
21,401
3.328125
3
[]
no_license
#!/usr/bin/env python3 import sys import unittest sys.path.append('../../src/Game') from level import * from character import * # Unit Testing for implementation of levels within a Snarl Game # Modules being tested: level.py class TestRoomGeneration(unittest.TestCase): def test_room_borders(self): """Te...
true
94906bc41df26197db5ecbc798156fb82f77f28c
DorivalRamos/exerciosPython
/Aulas/06AulaDeDicionario.py
UTF-8
1,709
3.921875
4
[]
no_license
# () Tuplas, [] lista, {} dicionario # dados = dict( # { # "nome" : " ", # "idade" : " ", # "peso" : " ", # } # ) # if dados.get("nome") == None:# para pegar o dado dentro do disc e não crachar # print('não existe') # dados.setdefault("altura", 1.70) # else: # print(f"{dados.get('nome')}") # v...
true
1154f9e132b864807fbfde5617e4a810d9f3b466
tomhealy1/project
/yasp.py
UTF-8
666
3.203125
3
[]
no_license
#Tom Healy #Verbatim - https://stackoverflow.com/questions/45862223/use-different-colors-in-scatterplot-for-iris-dataset #This is also a good graph to remember, simple and a good way to compare the ratios of observations import matplotlib.pyplot as plt import seaborn as sns iris = sns.load_dataset("iris") iris["ID"] ...
true
a662d0101c1c34e3159571dcfc96454020295e40
JingkaiTang/github-play
/other_thing/group.py
UTF-8
223
2.640625
3
[]
no_license
#! /usr/bin/env python def feel_new_time_for_few_company(str_arg): do_part(str_arg) print('old_eye') def do_part(str_arg): print(str_arg) if __name__ == '__main__': feel_new_time_for_few_company('fact')
true
7290b12c48e22854a4c88fd5fa579ced205a11a7
SandeepPadhi/Algorithmic_Database
/Math/Offset_trick_fancy_sequence.py
UTF-8
1,778
3.890625
4
[]
no_license
""" Date:27/04/2021 1622. Fancy Sequence - Leetcode Hard The following problem is solved using maths logic..+ modular inverse multiplication. The concept used are: 1)modular arithetic assumes normal rules of arithmetic under modular operation,so operations are lossless.. 2)Whenver (N/D)%mod is to performed,then alway...
true
18472f0942ec7ebe001a7c55ff503d9a19429824
bmwant/jaaam
/playground/crack/cracker_v2.py
UTF-8
2,779
3.078125
3
[]
no_license
""" Measure time separately for generation and collection steps. Use process poll executor for comparison. """ import hashlib import time import functools import itertools import string from concurrent import futures from dataclasses import dataclass from crack.data import DATABASE, HASH_FUNCTIONS MAX_WORKERS = 20 ...
true
be9bbf2956990d944c9e990b3ccbaf3b95b1607b
des-learning/distributed-system
/src/04/racecondition.py
UTF-8
772
3.34375
3
[ "CC0-1.0" ]
permissive
""" simulasi race condition race condition dikarenakan beberapa thread mengakses dan mengubah share resource tanpa ada sinkronisasi akses """ import threading, time, random counter = 0 def worker(name): global counter for _ in range(10): c = counter # critical code, possible race cond...
true
e8220bebce09e538c4587e91ce205c18e1c1a920
tiwaripulkit99/pythonpractice
/pythonpractice/dictionary.py
UTF-8
346
3.046875
3
[]
no_license
dict1 = {"name": "pulkit", "sirname": ["tiwari", "sharma"], "category": "general"} print(dict1) del dict1["sirname"] print(str(dict1)) print(type(str(dict1))) print(dict1) d = {4: "HI"} dict1.update(d) print(dict1) dict2 = {} print(dict1.get("category")) print(dict2) dict1["yoyo"]="honey" print(dict1) print(dict1.popi...
true
1c01a404b52b697f309cbb0d757ca025e2fc9b19
amit-iiitm/Eff-bazaar-assignment
/main.py
UTF-8
4,889
3.265625
3
[]
no_license
import csv from pandas import DataFrame, merge, Series #class to represent the products information class Products: #constructor to load csv file into data frame and setup unit costs for products def __init__(self,csv_file): self.df_prod=DataFrame.from_csv("products.csv", index_col=False) #price_per_kg rep...
true
f3bfc2aa6f2d30abe96e34c99e26b31d50d4c246
liangyy/haplotype-po
/scripts/prs/naive_prs.py
UTF-8
5,026
2.53125
3
[ "MIT" ]
permissive
import argparse parser = argparse.ArgumentParser(prog='naive_prs.py', description=''' Given: 1. A list of GWAS summary statistic table; 2. SNP map table (map each ukb_hap variant to GWAS variant); 3. UKB HAP BGEN 4. A list of P-value thresholds. Output: A N x K x P tensor...
true
7ae5b1e0365326ceb8eb5a7fd8495bb627621ccc
kgalaszewski/Python_wzorce
/WzorceProjektowe/Wzorzec2_Fabryka.py
UTF-8
466
3.09375
3
[]
no_license
class TagHtmlowy(object): html = "" def get_html(self): return self.html class Tagzdjecie(TagHtmlowy): html = "<img></img>" class Taginput(TagHtmlowy): html = "<input></input>" class FabrykaTagow(): def create_button(self, typ): targetclass = typ.capitalize() return gl...
true
f21d4863f43896a8f0685a57b0e031d273a07183
PSPC-SPAC-buyandsell/von_anchor
/von_anchor/canon.py
UTF-8
6,212
2.515625
3
[ "Apache-2.0" ]
permissive
""" Copyright 2017-2020 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca 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 ...
true
2c00ac438f7846ae5732a0adbaa43e5f2afd09c7
nanareyes/CicloUno-Python
/FuncionesParaColeccionesDatos/tarea_reto_variasNotas.py
UTF-8
2,015
4.0625
4
[]
no_license
""" Crear un programa en python que muestre en pantalla el desempeño académico de un alumno en cuatro asignaturas (Español, Matemáticas, Sociales y Ciencias Naturales) al finalizar el segundo periodo del año lectivo 2021. Se aprueba la asignatura si se obtiene una calificación mayor o igual a 3. Se debe calcular e impr...
true
94631769d71c8f2305913607f6e305913a17ec1b
PashaEagle/Sharaga
/Sharaga_3kurs/Algos/me/labs/labs/lab04_insertion.py
UTF-8
272
2.765625
3
[]
no_license
from precompile import * print("*************** INSERTION SORT *****************\n\n") n = len(ls) for k in range(1, n): i = k - 1 while (i >= 0) and ls[i+1].mark > ls[i].mark: ls[i+1], ls[i] = ls[i], ls[i+1] i -= 1 showList(ls)
true
3efe0e90b4362592547a9184cb017ba435f8a98d
tails1434/Atcoder
/ABC/004/trend.py
UTF-8
35
2.796875
3
[]
no_license
N = int(input()) print(int(2 * N))
true
4aa6d252c962ef9c657b9e32ad702c1008858d39
neochapay/liteOS
/Tools/EventLoggingTool/analyze.py
UTF-8
2,879
2.609375
3
[]
no_license
import sys import re from struct import * #This function returns the content of a file as a byte array def get_bytes_from_file(filename): return open(filename, 'rb').read() dict = {} if __name__ == "__main__": args = sys.argv[1:] num = 0 if len(args)<1: print "The number of para...
true
153bcd4066e0b27e980b1ac04f3afb374504085f
nayoung0/algorithm
/carpet.py
UTF-8
430
3.140625
3
[]
no_license
def solution(brown, yellow): tiles = brown + yellow number_list = [] for i in range(1, tiles + 1): if tiles % i == 0 and i > 2: size_1 = i size_2 = tiles/i brown_tiles = size_1 * 2 + size_2 * 2 - 4 if brown_tiles == brown: return sorted...
true
7f18371754b83c509fdd3f008bfd7f67e2a7f4b9
andrhua/pixel-battlegrounds
/resources/colors.py
UTF-8
1,046
2.859375
3
[]
no_license
from random import choice def get_closest_game_palette_color_to(query_color): min_dist, closest = 255**2 * 3, Colors.GAME_PALETTE[0] for color in Colors.GAME_PALETTE: dist = sum(map(lambda a, b: (a - b)**2, color, query_color)) if dist < min_dist: min_dist = dist closes...
true
fd73c317e7431ec1dc49939d7e2081ed8df3a230
Jimmy-INL/google-research
/gradient_based_tuning/data_tfds_to_tsv.py
UTF-8
9,837
2.5625
3
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
true
91931fa32ba0ea6d1495145548c6b38a34923dca
stonematt/ida_dec5
/2-Pandas/d9-11-merge DF review.py
UTF-8
586
3.015625
3
[]
no_license
# import codecademylib import pandas as pd visits = pd.read_csv('myfiles/d9-11-visits.csv', parse_dates=[1]) checkouts = pd.read_csv('myfiles/d9-11-checkouts.csv', parse_dates=[1]) print visits.head(2) print checkouts.head(2) v_to_c = visits.merge(checkouts)#.reset_ind...
true
533171d721afe0942cb058ea6a6ddc9fabecb5f0
mateuszmalinowski/easy-admin
/notificationd.py
UTF-8
4,762
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Sends automatically the emails to the users. """ from __future__ import print_function import os, sys, time, csv, datetime, smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from daemon import Daemon class NotificationDaemon(Daemon): # class ...
true
4d7cd3ec5cdfe7e942d2fc9deeb14109e1dade22
emfriis/SDV602-2021-V2
/data_explorer.py
UTF-8
1,177
2.765625
3
[ "MIT" ]
permissive
""" Data Explorer An example module. Read here about Python documentation: https://ecampus.nmit.ac.nz/moodle/mod/page/view.php?id=1140770 Details about this module. This module is actually main app. The main data explorer view is the default View. It uses controllers for code that runs when GUI actions are ha...
true
2e5799add84c74afffbb558068f6f4eb77e54cd6
Coni63/scripts_Python
/Django_projects/gpx_explorer/src/gpx_explorer/script/functions.py
UTF-8
2,274
2.65625
3
[ "MIT" ]
permissive
import gpxpy import gpxpy.gpx import os from django.conf import settings import gmplot from django.conf import settings def analyse_gpx(file, index=-1): gpx = gpxpy.parse(file) data = {} data["length2D"] = gpx.length_2d() data["length3D"] = gpx.length_3d() c = gpx.get_uphill_downhill() data["p...
true
83ad5c46cc91e16e1f3045721834fd79bc7eeeff
byronduenas/cpen442
/assignment2/question1/question1.py
UTF-8
3,019
3.359375
3
[]
no_license
from operator import itemgetter import sys if __name__ == "__main__": text = "LIRUMMIMMIVDMIXZIFFZIDMAZIFLDFLDVXUCIFULPCOUSBDBIMDBUXUCCDHLISLIMFPOOOPGIVPSFLIOPBLFDZPSBUQBUOVFLDFCDVIPFMHIDZIZPSGPMPEOIVUFPFHDMFLIUSIFLPSBLIOUGIVXUCCDLPMRZIXPUAMXUCCDDSVLIFDOKIVFUPFXUCCDIGISHLISPFHDMSUFHPFLLPCVUFQUZLIKIRFPFLPVVISMDQIPS...
true
ba6bceb671c7ff679b9420e2f650c16a23c0db71
nayoon-kim/Algorithm
/4179.py
UTF-8
1,833
3.109375
3
[]
no_license
import sys from collections import deque input = sys.stdin.readline r, c = map(int, input().split()) table = [list(input().rstrip()) for _ in range(r)] visited = [[False] * c for _ in range(r)] dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] jx, jy= 0, 0 # J는 입력에서 하나만 주어진다. fire = [] # def bfs(): qq = deque() # ...
true
2b6476c00101e61c52c20a9aaed37512d5e1884f
hannah-rose/348_Projects
/Assignment4/bayes_template.py
UTF-8
10,032
3.078125
3
[]
no_license
# Bayes_Classifier # Author(s) names AND netid's: # Hannah Arntson hra069 # Katie George kmg381 # Peter Haddad pbh423 # Date: 2nd May, 2015 import math, os, pickle, re class Bayes_Classifier: goodDict=dict() badDict=dict() def __init__(self, train=0): """This method initializes and tra...
true
7cc1521cd87892d092892d16d6d1e54549689b37
vaginessa/fakeFTP
/fakeFTP.py
UTF-8
861
2.78125
3
[]
no_license
import socket bind_ip = "0.0.0.0" #change as needed bind_port = 21 #change as needed server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip,bind_port)) server.listen(10) print("[*] Listening on " + bind_ip + ":" + str(bind_port)) def handle_client(client_socket): client_socket.send(b"22...
true
413375100589e25454905f89e98e10c9fa19bb44
CVanchieri/DS-Unit3-Sprint1-SoftwareEngineering
/module2-oop-code-style-and-reviews/2.Assignment/lambdata_CVanchieri/class_func.py
UTF-8
510
4.03125
4
[ "MIT" ]
permissive
""" Helpers - A bit of helper code for a class function. """ # create a description title. title = "A bit of helper code for a class function" class Person: def __init__(self, first_name, last_name, age): self.first_name = first_name self.last_name = last_name self.age = age def myfu...
true
f61cae850a4cee19d2ddd86b99fa9572785ec654
madebydavid/wizzie-ctf
/lesson-14/get-flag.py
UTF-8
281
3.09375
3
[]
no_license
#!/usr/bin/env ./../bin/python3 import zipfile password = input('Please enter the password: ') try: flag_zip = zipfile.ZipFile('flag.zip', 'r') flag_zip.extractall(pwd=bytes(password, 'utf8')) print('Zip extracted successfully') except: print('Invalid password')
true
e74c8e97f83a5c23d1ac808e379fde7b889cf9b0
alan-ra/computer-science
/Projeto de Desenvolvimento de Algoritmos/Trabalho 2/TSP/TSP.py
UTF-8
1,976
3.40625
3
[ "MIT" ]
permissive
from itertools import combinations import math def dynamic_tsp(G): """Resolve TSP no grafo G e retorna uma tupla com distância e vértices do percurso.""" C = {} # Sub-problemas sequence = [0] # Ordem do percurso size = len(G[0]) # Tamanho do grafo C[(frozenset([0]), 0)] = 0 # Distância para C(...
true