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
2883e775ef3cf2f4b6e718b5d946eb8c1f5390fc
HackerspaceTrento/100100-hackathon
/gloves/send-buttons.py
UTF-8
576
2.609375
3
[]
no_license
#!/usr/bin/env python import urllib.request import sys import serial import time ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1) cmds = ['left', 'right', 'forward'] start_time = 0 read_time = 0 while True: try: code = int(ser.readline().strip().decode('utf-8')) read_time = time.time() ...
true
c8b97222b01bf1af806011289556803e23b0da99
dankoga/URIOnlineJudge--Python-3.9
/URI_3217.py
UTF-8
629
3.125
3
[]
no_license
from math import sqrt height_leak, rate_leak, rain_duration, observation_time, height_observed = map(float, input().split()) if height_observed < height_leak: print('{0:.9f} {0:.9f}'.format(height_observed)) else: a = rain_duration b = height_observed + rate_leak * (observation_time + rain_duration) c...
true
55d29674a65d2f129e2e1bae506157afaf7d06f7
Micranthum/programacion_python
/Laboratorio_3/E1.py
UTF-8
597
4.28125
4
[]
no_license
print "Este programa le ayudara a encontrar la distancia (km) entre dos puntos del planeta, dados por su latitud y longitud, por favor ingrese:" import math as m a=int(input("Latitud del punto inicial: ")) b=int(input("Longitud del punto inicial: ")) c=int(input("Latitud del punto final: ")) d=int(input("Longitud del p...
true
4e7681bb5932e2c9f8724dd6fa0be5f5769b1d1a
chlien/MFIR-AP
/MFIRAP/d04_modelling/losses.py
UTF-8
4,079
2.515625
3
[ "MIT" ]
permissive
import numpy as np import glob import os import tensorflow as tf import random import MFIRAP.d00_utils.project as project from tensorflow.keras import backend as K POS_LOSS_WEIGHT = 0.5 class Losses_Keras: def __init__(self, frames, frame_shift): self.frames = frames self.frame_shfit = frame_shift...
true
e877fc1e8e8af368d3ba5199698340bb1c232fd7
Jun-Yang-1007/Fushan-master
/lstm_forecast_manual.py
UTF-8
4,162
2.671875
3
[]
no_license
#!/sur/bin/env python #-*- coding: utf-8 -*- import datetime import pandas as pd from database.base_env_repository import getFactors,getSites from database.dts_env_repository import getSiteData,save_daily_forecast_data from utils import dateshift from model import arma,lstm import warnings warnings.filterwarnings("i...
true
d7cb125ccd2be74b561194028eff3fed0ffe16ba
pabou061/ShapeDetection
/ShapeDetection-Lines.py
UTF-8
641
2.890625
3
[]
no_license
import cv2 import numpy as np img = cv2.imread('images/lines_target.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) blur = cv2.medianBlur(gray,21) edges = cv2.Canny(blur,200,400) lines = cv2.HoughLines(edges,1,np.pi/180,63) for x in range(0, len(lines)): for rho,theta in lines[x]: ...
true
e1bfda027cdf277395e9f26a83847d1c8c435c35
TheDarthMole/ProtonChat
/Testing/SQLClass.py
UTF-8
11,509
3.015625
3
[]
no_license
import sqlite3 import time class SQLDatabase: def __init__(self, DBFileName): self.dbfile = DBFileName open(DBFileName,"a") # Creates the file if not already made def CommandDB(self, code, *args): # Semi-universal SQL command executor, however allows SQL injection when variable entered ...
true
8f0a5afcf5348525b135919f3b039ce9b49c3296
bitranox/fingerprint
/fingerprint/lib_diff_registry.py
UTF-8
7,934
2.71875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import csv from lib_data_structures import * from lib_fp_registry import FingerPrintRegistry class RegistryDiff(object): def __init__(self, fingerprint_name_1:str, fingerprint_name_2:str, fingerprint_result_dir:str, field_length_limit:int=32767, ...
true
08a012b98676e0e291d78e2741b3dcd399984b8b
CarbonHeartDev/Meteotrentino_Bot
/modules/prepare_json.py
UTF-8
146
2.578125
3
[]
no_license
import json def prepare_json_file(url): with open(url, 'r', encoding='utf-8') as file: raw = file.read() return json.loads(raw)
true
40d83f2e1c46b2922998c4106e0d99f26cb072cf
jermwatt/computational_maths
/compmaths_libraries/basics_library/image_function_plotter.py
UTF-8
7,473
2.703125
3
[]
no_license
# import custom JS animator from compmaths_libraries.JSAnimation_slider_only import IPython_display_slider_only import numpy as np import time # import standard plotting and animation import matplotlib.pyplot as plt import matplotlib.animation as animation from mpl_toolkits.mplot3d import Axes3D from matplotlib import...
true
ab6bc012d383cf71421b18b836eb2936d6afde80
congsonag/udacity-data-structures-algorithms-python
/sorting and searching/find_closest_number.py
UTF-8
1,995
4.71875
5
[]
no_license
def find_closest_number(input_array, target): ''' Description of find_closest_number function taken from YouTube tutorial: https://www.youtube.com/watch?v=0gkWZNE1H4Y. We will be given a sorted array and a target number. Our goal is to find a number in the array that is closest to the target number...
true
0a45ba1fe9545f291480f1739c78dff7eeaa25e0
Zandros229/PythonKonwoj
/dfs.py
UTF-8
595
3.359375
3
[]
no_license
def road_dfs(number_of_points): tabel = [None] * (number_of_points) for i in range(number_of_points): tabel[i] = i used = [] road = [] i = 1 used.append(0) while len(used) < number_of_points: if tabel[i] not in used: road.append(tabel[i]) used.append(t...
true
06b9a22e08b39750d539d2d154387d5825d25bd7
nehalgupta8501/LeetCode-
/AverageSalary.py
UTF-8
257
3.546875
4
[]
no_license
class Solution: def average(self, salary: List[int]) -> float: maxi=max(salary) mini=min(salary) sum=0 for i in salary: if not (i==maxi or i==mini): sum=sum+i return sum/(len(salary)-2)
true
770ce3866a857d7bf2bdc36dd0a8c4317c631fa8
penlow99/surfs_up
/app.py
UTF-8
2,933
2.640625
3
[]
no_license
from flask import Flask, jsonify import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func # initialize flask app app = Flask(__name__) # # create flask route # @app....
true
3b07e25125c8e313096442a69a8dc2df950ea975
crunchyroll/ef-open
/efopen/ef_password.py
UTF-8
10,434
2.765625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # coding: utf-8 from __future__ import print_function from collections import OrderedDict import argparse import json import os import string import sys from ef_config import EFConfig from ef_context import EFContext import ef_utils class EFPWContext(EFContext): def __init__(self): super...
true
6250328026bec0f7d470033c43801fc4057f25e3
ArtemZaZ/OldAllPython-projects
/Projects/BadProjects/ALL/test3.py
UTF-8
372
2.625
3
[]
no_license
import VRangle import time angle=[] def handler(ang): global angle angle=ang print(angle) def handler1(): print("\nI stoped\n") def handler2(): print("\nI started\n") VR_TH=VRangle.VR_thread("/dev/ttyUSB0") VR_TH.start() VR_TH.connect("START", handler2) VR_TH.connect("STOP", handler1) VR_TH.co...
true
45f83eb628f5f92b1258e16149fdfa55426d8a4b
truongcongthanh2000/Cryptography-and-Network-Security-Assignment
/code/rail_fenceCipher.py
UTF-8
1,566
3.109375
3
[]
no_license
class Rail_fence: def __init__(self, key): assert type(key) == int, "key must be at integer" self.setKey(key) def setKey(self, key): self.key = key def encrypt(self, plaintext): fence = [[] for i in range(self.key)] rail = 0 step = 1 ...
true
72c95a8a8e31093857ee8cf60b8d086340ebc014
annaymj/LeetCode
/MergeSort.py
UTF-8
844
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Aug 8 18:05:41 2019 @author: annameng """ def mergeSort(l): if len(l) > 1: firstHalf = l[0:len(l)//2] secondHalf = l[len(l)//2:] mergeSort(firstHalf) mergeSort(secondHalf) merge(firstHalf, secondhalf, temp) ...
true
3369cf0fcf6ef854404e4ce8622b7502dd41179b
Evgengrmit/TSiSA_labs
/STaSA-lab-5/source/pareto.py
UTF-8
773
3.015625
3
[ "MIT", "Apache-2.0" ]
permissive
import criteria as cr import numpy as np if __name__ == '__main__': names = np.array(list('ABCD')) criteria_matrix = np.array([[3, 9, 1, 8], [5, 6, 3, 9], [7, 4, 4, 4], [9, 0, 1, 1]]) dist = cr.pareto_set(crite...
true
aeea26514b99513c76fedf7e3b40a38174626cd6
pnbeldor/CalculDeStructure
/ChargeConcentree.py
UTF-8
4,131
2.890625
3
[]
no_license
__author__ = 'Pierre Beldor' from Chargement import Chargement class ChargeConcentree(Chargement): def __init__(self, charge, dist_from_a): self.__dist_from_a = dist_from_a Chargement.__init__(self, charge) def set_dist_from_a(self, dist): self.__dist_from_a = dist def get_dist_...
true
1e601e1b3fae6a8781214c2136c1144818729a42
gmayock/blog_msco_ch02_holt_winters_model
/MSCO_Chapter_2_Instruction_part_7_3.py
UTF-8
11,212
2.90625
3
[]
no_license
import pandas as pd # This starts a timer import time start = time.time() # This ingests just the period and demand data, for the 13 periods df = pd.read_excel('filepath/chapter_2_instruction.xlsx', sheet_name='holt_winters', header=4, index_col=None, nrows=8, usecols=[0,1]) # This renames the columns using...
true
24ebd754460e630bc65f9736ec9a4ac71df4f085
acalzadaa/python_bootcamp
/week09 Complexity/insertsort_test.py
UTF-8
194
2.796875
3
[]
no_license
import unittest from week09.insertsort import insert_sort class TestInsertSort(unittest.TestCase): def test_insertsort(self): self.assertEqual(insert_sort([4,3,2,1]),[1,2,3,4])
true
16dfc02adb7cbc3fcf0ab0fad9e2b7ce725d9a98
Namirabboud/encrypt_decrypt
/aes_encryption_gui.py
UTF-8
6,916
3.140625
3
[]
no_license
'''encrypt a file with AES''' import os import sys import random import struct import hashlib from tkinter import * from tkinter import ttk from tkinter import filedialog from tkinter import messagebox from Crypto.Cipher import AES # PyCrypto block-level encryption API is very low-level # it expects your key to be e...
true
4bf746ad5b36c64bb965638de43d9ff932d4f8a8
jerin17/PythonProgrammingMasterclass
/8.2.BinaryOctHex.py
UTF-8
567
3.6875
4
[]
no_license
# print("Decimal | Binary | Hex") # print("-" * 25) # # # for i in range(18): # print("{0:>7} | {0:>08b} | {0:02x}".format(i)) # # x = 0x20 # y = 0x0a # print("x :", x) # print("y :", y) # print("x * y :", x * y) # print(0b0010100) # print(0b10100) powers = [] for i in range(15, -1, -1): powers.append(2 ** i...
true
70e6a89d48c8ec18080ef99f9c45b1dc0c958e32
gst-take1/BasicPython
/arrays.py
UTF-8
428
3.859375
4
[]
no_license
arr = [1,2,4,5,6,7,8] for i in arr: print i; for idx,val in enumerate(arr): print 'In enumerate idx :' + `idx` + ' Value: ' + `val` if len(arr) > 6: print("Array %s is a big array of %d" % ('arr', len(arr))); if len(arr) > 6 and len(arr) <= 10: print('Array %(array)s is a medium sized ..array of leng...
true
4119d6adab6b5d55c982083aa396a79483118022
Drew-Turner-cpp/python-refresher
/Main.py
UTF-8
1,455
3.140625
3
[]
no_license
import random as rnd # Constant lists PREF = ['Captain', 'Sir', 'Madame', 'The', 'Sinister'] POWR = ['fire', 'water', 'earth', 'air'] DESC = ['summon', 'create', 'manipulate', 'throw'] # Constant Dictionaries NAME = {'fire': rnd.choice(['Blaze', 'Inferno']), 'water': rnd.choice(['Tsunami', 'Tide']), 'air': ...
true
aea660ba8c1e1d4d20e004d464c20bd2ee1e2a88
mjbyrnes/yale-class-recs
/yale_class_recs/forms.py
UTF-8
3,566
3
3
[]
no_license
from django.db import models from django.forms import ModelForm from django import forms from .models import Student, CourseProfile #Form to get user login data class UserForm(forms.Form): username = forms.CharField(label="Username", help_text="30 characters or fewer. Letters, digits and @/./+/-/_ only.") pas...
true
e8aa5949fcfca1a08b03ac130dfcd7e460a56f97
kentxun/PythonBase
/leetcode/22_generateParenthesis.py
UTF-8
866
3.875
4
[]
no_license
''' 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] ''' # dfs加剪支 class Solution: def generateParenthesis(self, n: int): if n == 0: return [] res= [] def dfs(start , tmp, index): if start...
true
2ea599ed854af6457fa4de842a31e9ce68935cce
harleyng/nguyenlethanhha-labs-c4e24
/lab3/homework/turtle3.py
UTF-8
141
3.34375
3
[]
no_license
from turtle import * def draw_square(length, colour): color(colour) for _ in range(4): forward(length) left(90)
true
4244d0fff49a2df25cf5d50a95ad0771159b6327
iamuhammadkhan/SSUET-Python-Practice
/Chapter 4/Exercise 4-1.py
UTF-8
397
3.640625
4
[]
no_license
fav_dish = ['Pizza', 'Zinger', 'Chinese'] for i in fav_dish: print(i) for a in fav_dish: print('My favourite dish is ' + a) print('I really love Pizza, I really love Pizza, I really love Pizza, I really love Pizza, I really love Pizza, I really love Pizza, \nI really love Pizza, I really love Pizza, I really...
true
ad430a13a17a9f498beb9b90b99abc4cb7b39355
walkerzjs/CatOrBird
/application.py
UTF-8
674
2.578125
3
[]
no_license
from flask import Flask, request import json # from catOrBird import start_predict from catOrBird import processing_image from flask_cors import CORS # EB looks for an 'application' callable by default. application = Flask(__name__) CORS(application) @application.route('/catOrBird',methods=['POST']) def hello_world()...
true
c9c1c1ef5bd74aa4a43545a52451386c436ea524
vianna274/neural-network
/new_world/printtofile.py
UTF-8
790
2.84375
3
[]
no_license
class PrintToFile: @staticmethod def print_accuracy(accuracy_list): cross_validation_iteration = 0 file = open("acc.txt", "a") file.write("iteration_index acc\n") for accuracy in accuracy_list: file.write(str(cross_validation_iteration) + " " + str(accuracy) + "\n") cross_validation_it...
true
441c8438dfe8a9a1c7c1407a8858427bed617516
uiandwe/TIL
/algorithm/LC/112.py
UTF-8
819
3.21875
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right from collections import deque class Solution: def hasPathSum(self, root: TreeNode, sum: int) -> bool: d =...
true
49cec615b47557eb4cb8416460ee78aaaf553c2a
davout1806/Hexcrawler
/src/gamemap/hexgrid.py
UTF-8
3,074
3.0625
3
[ "MIT" ]
permissive
''' Created on Jul 9, 2012 @author: Chris ''' from util.tools import Loc import math WEST = 0 NORTHWEST = 1 NORTHEAST = 2 EAST = 3 SOUTHEAST = 4 SOUTHWEST = 5 #neighbors = [(-1, -1), (0, -1), (1, 0), (1, 1), (0, 1), (-1, 0)] neighbor_deltas = [(-1, 0), (-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1) ] midpt_deltas = [(-1...
true
943c96d56083d9416987d8a60996414da9c63470
Aden-Q/LeetCode
/code/reverse_to_make_equal.py
UTF-8
1,438
3.71875
4
[ "MIT" ]
permissive
import math # Add any extra import statements you may need here # Add any helper functions you may need here def are_they_equal(array_a, array_b): # Write your code here dict_a = {} dict_b = {} for c in array_a: if c not in dict_a.keys(): dict_a[c] = 1 else: dict_a[c] += 1 for c in arr...
true
e148edde627f33e3a7de4e25c460188f4f20caa7
agilecelox/ccfraud
/data_reader/text_reader.py
UTF-8
359
3.515625
4
[]
no_license
# This is a file reader that knows how to parse CSV files # and turn them into useful data structures. from numpy import genfromtxt def read_to_numpy_array(file_path): ''' Reads a file and transforms it into a numpy array. :param file_path: The path of the file :return: A numpy array ''' retur...
true
7ea9f4eae646a451f0c0bf5f6f726c7cf1c14b99
dz4va/clc-vtable
/clc_vtable.py
UTF-8
4,313
3.21875
3
[ "MIT" ]
permissive
""" # CLC variants table formatter contains main that should be run. # Inludes two modes. Formatting for single file and formatting on a directory. # Help: python3 clc_vtable.py -h # Author: George Dzavashvili # Email: dzavashviligeorge@gmail.com # Twitter: @redpix_ # How it works: TODO: Explain """ # Add openpyxl ...
true
5c9c1899f7098c68c9fb34a3caa80d189a1ce51f
andylopezr/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/0-square_matrix_simple.py
UTF-8
137
3.015625
3
[]
no_license
#!/usr/bin/python3 def square_matrix_simple(matrix=[]): if matrix: return [list(map((lambda x: x ** 2), i)) for i in matrix]
true
e83362add44516f791f6218d14aabfc8c8e334a9
syn1992/OpenStreetMap-Data-Case-Study
/audit.py
UTF-8
2,102
3.09375
3
[]
no_license
# coding: utf-8 # In[6]: import xml.etree.cElementTree as ET from collections import defaultdict import re import pprint # In[7]: mapping_direction = {'NE': 'Northeast', 'SE': 'Southeast', 'NW': 'Northwest', 'SW': 'Southwest', 'N': 'North', 'W': 'West', 'S': 'South', 'E': 'East'} mapping_way = {'A...
true
445a88733da1f471921f40e00782547641311123
sqvarfort/bad-boids
/boids/command_line.py
UTF-8
1,935
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
from argparse import ArgumentParser import numpy as np from boids import Boids import matplotlib.pyplot as plt from matplotlib import animation import os import yaml def process(): parser = ArgumentParser(description = 'Simulate boids') parser.add_argument('boid_no', type = int, help = 'Number of boids') p...
true
284f00c58e68961dff8d6834966e93428868ee7e
usernamenumber/Karaoke
/pylib/pycdg.py
UTF-8
24,620
2.65625
3
[]
no_license
#!/usr/bin/env python # pycdg - CDG/MP3+G Karaoke Player # Copyright (C) 2007 Kelvin Lawson (kelvinl@users.sourceforge.net) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # v...
true
6e306ae7dd27e46330699c63c777f56c6d7c820a
Thedonutz/CS490-LABS
/Lab3/WorldCup.py
UTF-8
2,180
3
3
[]
no_license
from pyspark import * from pyspark.sql import * import pyspark.sql.functions as f from pyspark import SparkContext from pyspark.sql.functions import col import os os.environ["SPARK_HOME"] = "/Users/jm051781/Documents/spark-2.3.1-bin-hadoop2.7/" spark = SparkSession \ .builder \ .getOrCreate() ##Lab 3 Part A....
true
5390fb978eff054213fb19b475f9732b59b44848
m-sousa/curso-em-video-python
/Exercicios/MOD01/ex009.py
UTF-8
303
4.46875
4
[]
no_license
# Exercício Python 009: Faça um programa que leia um número Inteiro qualquer e # mostre na tela a sua tabuada. n = int(input('Digite um número para ver sua tabuada: ')) print('-' * 12) for i in range(1, 11): print('{} X {:2} = {:2}'.format(n, i, n * i)) print('-' * 12)
true
5168c319053a616118330bda6e9fa1b3a852d583
MrGecko/pyguane
/game.py
UTF-8
2,806
2.609375
3
[]
no_license
# encoding: utf-8 """ game.py Created by Julien Pilla on 2010-05-20. """ from pyguane.core.window import Window from pyguane.core.egg import Egg from pyguane.physics.world import PhysicWorld from pyguane.sprites.factory import SpriteFactory from pyguane.core.librarian import Librarian from pyguane.core.gamestate im...
true
82b6cbe76ea9f190defba2b352e52743013743e6
bzylich/wordEmbeddings
/basicRNN.py
UTF-8
11,889
2.78125
3
[]
no_license
import tensorflow as tf import numpy as np import collections import os import datetime as dt import nltk # code based on: https://github.com/adventuresinML/adventures-in-ml-code/blob/master/lstm_tutorial.py # followed tutorial found here: http://adventuresinmachinelearning.com/recurrent-neural-networks-lstm-tutorial-...
true
251abc71b31da49b385ea95992242713c5c3a924
daniel-reich/turbo-robot
/dSrisJKHB78aj2d7L_10.py
UTF-8
1,015
4.125
4
[]
no_license
""" Given the perimeter and the area of a triangle, devise a function that returns the length of the sides of all triangles that fit those specifications. The length of the sides must be integers. Sort results in ascending order. triangle(perimeter, area) ➞ [[s1, s2, s3]] ### Examples triangle(12, 6) ➞ [[...
true
68e575afb352d3d07b724c784b1e835293c7e025
chapinb/chickadee
/libchickadee/parsers/evtx.py
UTF-8
1,311
2.859375
3
[ "MIT" ]
permissive
"""Extract IP addresses from EVTX files.""" import Evtx.Evtx from libchickadee.parsers import ParserBase, run_parser_from_cli class EVTXParser(ParserBase): """Class to expose EVTX record contents for IP address extraction""" def parse_file(self, file_entry, is_stream=False): """Parse EVTX contents....
true
537fe9360a976a2a25e51e3614e1bf20c60a9055
moshekagan/Computational_Thinking_Programming
/homeworks/check_homeworks/extractor.py
UTF-8
3,679
2.734375
3
[]
no_license
import os import zipfile from homeworks.check_homeworks.comments import * from homeworks.check_homeworks.config import NUMBER_OF_ASSIGNMENT from homeworks.check_homeworks.students import add_comment_to_student, set_zip_file_name, user_have_zip_file def remove_zip_extention(zip_file_name): return zip_file_name.sp...
true
df1f7b40038723cfd98a0bb7939009ede92a6e10
ry3s/atcoder
/abc170/b.py
UTF-8
209
3.078125
3
[]
no_license
x, y = map(int, input().split()) ok = False for a in range(0, x + 1): b = x - a if b < 0: continue if 2 * a + 4 * b == y: ok = True if ok: print("Yes") else: print("No")
true
457a904c2a53f253c24d5390751afbeb062efa19
vrash/Code-jam-and-Hacker-Cup-code
/Evernote CodeSprint/3.py
UTF-8
846
2.703125
3
[]
no_license
from string import punctuation from operator import itemgetter import sys from collections import Counter N = 0 words = {} #inp = open ("C:\Users\Vrashabh\Desktop\\abc.txt","r") check=0 inputlist =[] i=0 inc = {} for line in sys.stdin: #for line in inp.readlines(): for i in line.split(): i...
true
e75c475b67300793ab5f284bd8f4cac7c868184a
chjdev/euler
/python/problem37.py
UTF-8
1,473
3.859375
4
[ "BSD-2-Clause" ]
permissive
# Truncatable primes # Problem 37 # The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from # left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, # 379, 37, and 3. # # Find the sum of the only ele...
true
68e598928b448237fc9c41927283b37afd06d184
darrickyee/zyrig
/rig/builders/base.py
UTF-8
1,878
2.765625
3
[]
no_license
from functools import wraps import pymel.core as pm from ..utils import isTransform def builder(min_xforms=1, max_xforms=10, output_keys=('name', 'unit_type', 'root', 'controls', 'drivers', 'targets')): """Decorator for validation of builder input and output. 1. Checks that input xforms satisfy mins and ma...
true
a85774598d01c678cd5ec2511cd3625f3745cffc
SatoKeiju/AtCoder-Python3
/ABC157/b.py
UTF-8
595
2.984375
3
[]
no_license
def main(): import numpy as np card = np.array([list(map(int, input().split())) for _ in range(3)]) n = int(input()) for _ in range(n): b = int(input()) card = np.where(card == b, 0, card) is_bingo = False is_row_bingo = np.sum(card, axis=0).min() == 0 is_column_bingo = np....
true
61555300a880cd362a1f077b4dc5883b283d32c8
c940606/leetcode
/Ugly Number.py
UTF-8
655
3.765625
4
[]
no_license
class Solution(object): def isUgly(self, num): """ 编写一个程序判断给定的数是否为丑数。 丑数就是只包含质因数 2, 3, 5 的正整数。 --- 输入: 6 输出: true 解释: 6 = 2 × 3 --- 输入: 8 输出: true 解释: 8 = 2 × 2 × 2 --- 输入: 14 输出: false 解释: 14 不是丑数,因为它包含了另外一个质因数 7。 --- :type num: int :rtype: bool """ if num == 0: return False...
true
aebefaf5fd7d465fb9c55cf50767233c038cc0e0
tomiambro/phys2020Classifier
/app_af.py
UTF-8
7,572
2.625
3
[ "BSD-2-Clause" ]
permissive
import sys from xverse.transformer import WOE from aux_funcs import * from pandas_summary import DataFrameSummary import numpy as np import scipy import matplotlib.pyplot as plt from scipy.cluster import hierarchy as hc from sklearn import metrics from sklearn.metrics import f1_score, fbeta_score, make_scorer from skle...
true
3642388011cc2e37b648304fa3396a32b4fe0b93
zzarbttoo/TMT
/CH/20200717_4_2.py
UTF-8
415
2.9375
3
[]
no_license
from collections import deque as dq def solution(num, target): answer = 0 stack=dq([(0,0)]) temp=0 ind=0 while stack : temp,ind = stack.popleft() if ind ==len(num) and temp==target : answer+=1 elif ind !=len(num) : number=num[ind] stac...
true
9b3f943f214d47b539890f6667f70678caf8c305
Gabeesh/MITx.6.00.1x-IntroToC.SandProgramming
/Problem Sets (Coding)/Set 1 - Sol/1.3.3.py
UTF-8
1,265
3.78125
4
[]
no_license
from itertools import groupby def find_long_cons_sub(s): class Key(object): ''' The Key function returns 1: For Increasing Sequence 0: For Decreasing Sequence ''' def __init__(self): self.last_char = None def __call__(self, char): ...
true
9bf380f05d2c7050ae46b5e0ed57ee3094166f92
jiluhu/dirtysalt.github.io
/codes/contest/leetcode/convex-polygon.py
UTF-8
1,402
3.34375
3
[]
no_license
#!/usr/bin/env python # coding:utf-8 # Copyright (C) dirlt class Solution: """ @param point: a list of two-tuples @return: a boolean, denote whether the polygon is convex """ def isConvex(self, point): # write your code here def cross_product(v0, v1): # print(v0, v1) ...
true
6a8479218ffc3121585cf2b3a72776e933c06657
achupanikath/Search-and-sort
/SongLibrary.py
UTF-8
9,650
3.765625
4
[]
no_license
""" UMass ECE 241 - Advanced Programming Project #1 Fall 2018 SongLibrary.py - SongLibrary class """ from Song import Song import random import time #class TreeNode creates nodes for BST class TreeNode: def __init__(self, key, val, left=None, right=None, parent=None): self.key = key ...
true
5f875f167e58543f5ba83e9445f57396a0aaf6e3
descartez/microkey
/code.py
UTF-8
612
2.859375
3
[]
no_license
import board import time import busio as io i2c = io.I2C(board.SCL, board.SDA) import adafruit_ssd1306 oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) for i in range(0,3,1): oled.text("Starting.",0,0) oled.show() time.sleep(1) oled.text("Starting..",0,0) oled.show() time.sleep(1) oled.t...
true
21ffb85391335bbd702f34e7950a2035f6c02f0b
tesh11/backbonetest
/cities/import.py
UTF-8
993
2.875
3
[]
no_license
# import the set of cities and states from cities.models import State, City def _tofloat(s, n): return float("%s.%s" % (s[0:n], s[(n+1):])) f = open('latlng.txt', 'r') states = {} cities = [] linenum = -1 for line in f: linenum += 1 # skip the first 4 lines as they're header information if linenum ...
true
950f1828d401f3c812ec15d33a4033990da32758
ioverho/meta-learning-emotion-detection
/baseline/modules/mlp_clf.py
UTF-8
1,012
2.84375
3
[ "Apache-2.0" ]
permissive
import torch import torch.nn as nn import torch.functional as F class MLP(nn.Module): def __init__(self, encoder_output_size, hidden_dims, act_fn=nn.ReLU): """MLP module. Args: encoder_output_size (int): output size of encoder. Input should be tensor of size [batch_size, encoder_outpu...
true
917a95e1c93373797c2bd24f09001ab2a5ebd556
enigmata/h8s-clp
/services/serial/commands/devices_v1.py
UTF-8
1,325
2.578125
3
[ "MIT" ]
permissive
import os import serial.tools from command import Command, CommandInterface if os.name == 'posix': from serial.tools.list_ports_posix import comports else: raise ImportError(f'ERROR: platform ("{os.name}") not supported') class Devices(Command): def __init__(self, owning_service, version): self....
true
f45d509229c9d92c9e3c78d46a033911835b76a8
virtualjoker/jankenpony
/myapp/models/alone.py
UTF-8
886
2.640625
3
[]
no_license
# myapp.models.alone # # model: Alone from google.appengine.ext import db from player import Player from status import Status from game import Game class Alone(db.Model): """ Alone Model This model will store the player who can't play the actual match, cause it has a odd playing players and he ca...
true
d4c7cf086128bd8e993c6f495c454332842ca883
Vaa3D/vaa3d_tools
/hackathon/LLF/VirtualTree/branch_code_data.py
UTF-8
5,214
2.890625
3
[ "MIT" ]
permissive
import os import numpy as np from sklearn.utils import shuffle from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler import pickle STEM_SAMPLE_POINT_NUM = 40 ''' Load branch codes from .bcd file. For branch generator training. ''' class BranchCodeLoader(): ...
true
b0ac6d71d936e1132f22cfd14c6c6c0efd69e6f6
lashid/shid
/Algorithm Practice/SW Expert Academy/SWEA 1206.py
UTF-8
439
2.78125
3
[]
no_license
for repeat in range(10): answer=0 n = int(input()) data = list(map(int, input().rstrip().split(' '))) a,b,c,d,e=0,0,data[2],data[3],data[4] index=4 while index!=n: e=data[index] max_num=max([a, b, c, d, e]) max_others=max([a,b,d,e]) if max_num==c: ...
true
d34a0c78311e304fc6ce4314bd7eb854adeab43b
AtufaShireen/Scraping-Projects
/Text-Based Browser/task/browser/browser.py
UTF-8
2,812
2.796875
3
[]
no_license
from collections import deque from bs4 import BeautifulSoup # write your code here import requests import sys import os from colorama import Fore,Style if __name__ == '__main__': downloads_folder = sys.argv[1] try: os.mkdir(downloads_folder) except FileExistsError: pass tabs_list = deque...
true
fc49587e4bc64d33559d7cf69dc90f32616b7090
anttiruonakoski/python-practice
/sarja_2.py
UTF-8
389
3.6875
4
[]
no_license
from random import shuffle last_number = int(input('Anna suurin luku: ')) sort_order = int(input('Anna järjestys: \n1 nouseva \n2 laskeva \n3 satunnainen ')) number_list = list(range(1, last_number + 1)) if sort_order == 1: pass elif sort_order == 2: number_list.reverse() elif sort_order == 3: shuffle(number_lis...
true
c36e939feb71374d2ff4c8ae88d582c20c2d8eba
G-Node/python-odml
/odml/format.py
UTF-8
5,249
3.015625
3
[ "BSD-2-Clause" ]
permissive
""" The module provides general format information and mappings of XML and RDF attributes to their Python class equivalents. """ from rdflib import Namespace import odml class Format(object): """ Base format class for all odML object formats. The formats are required when the corresponding odML objects ...
true
5d6e11ddc1eb49de409bcb90b37221b5df8bce8d
adityasingh108/python-Practice
/Oops/math.py
UTF-8
343
4
4
[]
no_license
class math: def __init__(self, x, y): self.x = x self.y = y def addition(self): return f"the firist number is {self.x} the second numbr is {self.y} the addition is {self.x+self.y} " add = math("x", "y") x= input("enter the firisyt number : ") y= input("Enter the second number : ")...
true
27da1140eb457cae2ece1dc9a8433c2f154d8017
andlgr/python-tutorial
/src/cpp-module/module.py
UTF-8
917
3.359375
3
[ "MIT" ]
permissive
# Learning Python 101 import build.module # Our C++ shared library is located at ./build/module.so def main(): printer = build.module.MyPrinter() cpp_obj = build.module.MyModule() cpp_obj.PrintFromCppModule(80) cpp_obj.PrintFromOtherObject(printer) # 'printer' is being passed as pointer print(...
true
ddb738b0702d26c5181b4665b2b11dd41741a3c8
devConrado/curso_python
/Aula_02/script5.py
UTF-8
921
3.390625
3
[]
no_license
#!/usr/bin/python3 with open('arquivo.txt','a') as arquivo: arquivo.write('estou escrevendo o arquivo one more time') exit() ############################################################# with open('arquivo.txt','w') as arquivo: arquivo.write('estou escrevendo no arquivo') exit() ###################################...
true
02809c76a755081d6d8ca4cb99d99ae38edaf37d
zooniverse/serengeti-analysis-scripts
/get-summary.py
UTF-8
2,673
2.828125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python __author__ = 'alex' import pymongo import csv import pickle from bson.objectid import ObjectId from collections import OrderedDict import sys def create_csv(csv_filename): wrfile = open("csvs/output/season-summary/summaries.csv", 'w') writer = csv.writer(wrfile, delimiter=',', quoting=csv.QUO...
true
a0402fa7eafa8638c07611e7fae81f4aaeee2102
LizaKoliechkina/text-formatting-app
/db/query.py
UTF-8
1,644
2.671875
3
[]
no_license
from sqlalchemy import exc, orm, update import db.schemas as sch def save_element(text: str, db: orm.Session): try: db_obj = sch.FormatText( text=text, done=False, ) db.add(db_obj) db.commit() except exc.SQLAlchemyError as ex: db.rollback() ...
true
48673bb5cab332934c09e1b4019c68ee8a316c55
manavmradul11/Computer-Networks
/project-1/run.py
UTF-8
5,227
2.90625
3
[]
no_license
import sys, operator, socket, ssl from HTMLParser import HTMLParser from urllib import urlopen from urlparse import urlparse # We are going to create a class called LinkParser that inherits some # methods from HTMLParser which is why it is passed into the definition class LinkParser(HTMLParser): # This is a funct...
true
05c25e3f195873a1df9a6b2925669e736f68968a
vendyv/A2OJ-Ladders
/A2OJ-11/022_A_Way_Too_Long_Words.py
UTF-8
246
3.90625
4
[ "MIT" ]
permissive
""" 22 Way Too Long Words - https://codeforces.com/problemset/problem/71/A """ for _ in range(int(input())): word = input() l = len(word) if l > 10: print(word[0] + str(l-2) + word[-1]) else: print(word)
true
3913b7296c94977f106d97a5dbd8b2d6cbadf6f4
victor-luu191/hacker_rank_train
/medium/misc/time_delta.py
UTF-8
6,766
3.53125
4
[]
no_license
# !/bin/python3 import calendar import os from calendar import monthrange from collections import namedtuple from datetime import datetime as dt # Logic: the difference has the following components: # i) day difference # ii) time difference: have to include time zone offsets from UTC # When we compute time differen...
true
234347a1aa75bc00f17236ca5fd0191abba135d6
IsThatYou/Competitive-Programming
/Codeforces/367d2B.py
UTF-8
755
2.953125
3
[]
no_license
n = int(input()) s = input() a = 0 c = 0 g = 0 t = 0 question = 0 for i in range(len(s)): cha = s[i] if cha == "A": a +=1 elif cha == "C": c +=1 elif cha == "G": g +=1 elif cha == "T": t +=1 elif chat == "?": question += 0 maximum = max(a,c,g,t) needl = maximum*4 - (a+c+g+t) if needl < question: print(...
true
0c7d6a8855b6ae2c3f60ffa1d2f16cfd09ba858c
srcecde/aws-tutorial-code
/lambda/lambda_transcribe_speaker_seperation.py
UTF-8
2,355
2.734375
3
[ "MIT" ]
permissive
""" -*- coding: utf-8 -*- ======================== AWS Lambda ======================== Contributor: Chirag Rathod (Srce Cde) ======================== """ import json import boto3 def lambda_handler(event, context): if event: s3 = boto3.client("s3") s3_object = event["Records"][0]["s3"] bu...
true
a300f0f3963df69c0aece3a1f9151053de25bd20
DeepakLabh/projects_all
/python_tutorials/iterators/problem3.py
UTF-8
493
3.484375
3
[]
no_license
'''Problem 3: Write a function "findfiles" that recursively descends the directory tree for the specified directory and generates paths of all the files in the tree.''' import os def findfiles(path): for i in os.listdir(path): #print i f_path = os.path.join(path, i) if not os.path.isdir(f_path): yield f_p...
true
4f6b1dd25cce3cbfb99cd699318510fd6eaeb3fd
bjherger/data-structures-in-python
/interfaces/MinHeap.py
UTF-8
1,010
3.890625
4
[]
no_license
import logging from functools import total_ordering class MinHeap(object): """ A min heap implementation, with the following attributes - Complete tree - Root is minimum of all values """ def __init__(self): pass def add(self, element): """ Add the element to ...
true
d074f9c20e8f908d9312f934f88937031c60cd2a
Taher5253/Disease_Diagnosis_Chatbot
/Disease_Chatbot3.py
UTF-8
6,345
2.859375
3
[]
no_license
import mysql.connector import xlrd import itertools from collections import Counter mydb = mysql.connector.connect( host="localhost", user="root", passwd="mynewpassword", database="Disease.db" ) mycursor = mydb.cursor(buffered=True) list1=['Blurred vision'] list_disease = [] list_age = [] def Eyes(): #...
true
6e7d258b3760926db70a0849320b4ebb9855092d
Nao-Y1996/LearningPython
/ICPC/2018/ansA.py
UTF-8
226
3.125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input()) a_list = list(map(int, input().split(' '))) ave = sum(a_list)/int(n) ans_list = [] for i in a_list: if ave >= i: ans_list.append(i) print(len(ans_list))
true
551d4f59342e7242c730768a333fad6e046a91c4
chris-xliu/bubbles-p1
/bubbles.py
UTF-8
2,402
3.34375
3
[]
no_license
import string import math #Google p1 = {} f1 = open('google.txt', 'r') for line in f1: List = line.split() for word in List: fixed_word = word.translate(None, string.punctuation).lower() if len(fixed_word) > 0: if p1.has_key(fixed_word): p1[fixed_word] += 1 else: p1[fixed_word] = 1 print(p1["googl...
true
6eca2752b37263b82142203e2244c40dd84dbf64
Junyang-chen/PythonLearning
/Testing/PythonTesting.py
UTF-8
1,912
3.375
3
[]
no_license
""" Illustration of testing in python """ """ Mock testing """ import datetime from unittest.mock import Mock # Save a couple of test days tuesday = datetime.datetime(year=2019, month=1, day=1) saturday = datetime.datetime(year=2019, month=1, day=5) # Mock datetime to control today's date datetime = Mock() def is_w...
true
ec39afb06fd80c8c9cad2115f55af43d7f7bfe29
sumitjain0695/Data-Structures-and-Algorithms
/Searching/pivot of sorted and rotated array.py
UTF-8
411
3.109375
3
[]
no_license
n=int(input()) l = [] for i in range(n): m=int(input()) l.append(m) st = 0 en = n - 1 while st < en : mid = (st + en)//2 if l[mid] > l[mid + 1] : ans = mid break elif l[mid] < l[mid - 1] : ans = mid - 1 break elif l[mid] > l[0] : st = mi...
true
2a58abf407ff4d1f65d5335940e1413540ddfaae
software-engineering-amsterdam/many-ql
/TeamAwesome/ql/ql/gui/Widgets.py
UTF-8
4,925
2.75
3
[]
no_license
import tkinter as tk class Widget: def _gridIfVisible(self, questionModel): if questionModel.isVisible: self.grid() else: self.grid_remove() class Dropdown(tk.OptionMenu, Widget): def __init__(self, master, questionModel, callback): self._value = tk.StringVa...
true
ae153d9966ac7a2be1b9d39bbe652e2866174f55
makcakaya/learn-python
/chapter3/seeing_the_world.py
UTF-8
294
3.125
3
[]
no_license
places = ['thailand', 'japan', 'syberia', 'egypt', 'cuba'] print(places) print(sorted(places)) print(places) print(sorted(places, reverse=True)) print(places) places.reverse() print(places) places.reverse() print(places) places.sort() print(places) places.sort(reverse=True) print(places)
true
72de50618b68c3cc3a5a63d4cd889a7573145681
jayrav13/jr-hackerrank
/contests/projecteuler/6.py
UTF-8
224
3.046875
3
[]
no_license
n = int(raw_input().strip()) arr = [] for i in range(0, n): arr.append(int(raw_input().strip())) for elem in arr: su = long(((elem + 1) * elem / 2)**2) sq = long(sum([x**2 for x in range(1, elem + 1)])) print su - sq
true
6777d84ad8988dfb0fc4f96f5da48f52755ff391
kyle-sammons/PingGraph
/src/IPC.py
UTF-8
831
3.078125
3
[]
no_license
import queue class IPC(): clients = {} def add(client): if(client not in IPC.clients): IPC.clients[client] = queue.Queue() return True else: return False def getMessages(client): if(client in IPC.clients): item = IPC.clients[client]...
true
0c235d7caa4a52ee530e6550813322e9f59cb05f
jmiel/Labo2
/Exo1.py
UTF-8
732
3.140625
3
[]
no_license
import re '''phonenumber=input('Write a phonenumber with the form +xx xxx xx xx xx : \n') pattern=r'\+\d{2} \d{3} \d{2} \d{2} \d{2}' p=re.compile(pattern) print(p.match(phonenumber))''' '''number=input ('Write a positive or negative number without any spaces : \n') pattern1=r'-?[1-9][0-9]*' #pattern2=r'\-\d*' p1=re....
true
3162529ed7bb8d0e48bb9e3ffe762a62ec29e843
ruizj3/facebook_message_parser
/facebook.py
UTF-8
2,001
3.09375
3
[ "MIT" ]
permissive
import sys import os import codecs import fb_parser import fb_analysis # Nasty hack to force utf-8 encoding by default: reload(sys) sys.setdefaultencoding('utf8') # Change stdout to allow printing of unicode characters: streamWriter = codecs.lookup('utf-8')[-1] sys.stdout = streamWriter(sys.stdout) if __name__ ==...
true
4fb93b898b77cd6859e8635aea80d5b8a89cddf5
MDufant/Custom-Mask-R-CNN-for-kidney-s-cell-recognition
/datasetTools/ASAPAdapter.py
UTF-8
4,508
2.640625
3
[ "MIT" ]
permissive
import math import xml.etree.ElementTree as et from datasetTools.AnnotationAdapter import XMLAdapter class ASAPAdapter(XMLAdapter): """ Exports predictions to ASAP annotation format """ ''' <?xml version="1.0"?> <ASAP_Annotations> <Annotations> <Annotation N...
true
011a5702ae68ea472bc97d5646fde31cfa11e4b4
kantharajucn/time_series_analysis
/lib/exceptions.py
UTF-8
312
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- class DownloadDataException(Exception): def __init__(self, data_url): self.message = "Could not download the data from the provided '%s'" % data_url class DataPreparationException(Exception): def __init__(self): self.message = "Could not prepare the dataset"
true
345eac1fb7ec8420effe33e19156d979b9f3f519
gitgitest1234/bokeh_create_chart
/myApp.py
UTF-8
1,319
2.6875
3
[]
no_license
import numpy as np import pandas as pd from random import random from bokeh.layouts import column,layout from bokeh.models import ColumnDataSource,Select from bokeh.plotting import figure,show from bokeh.io import curdoc dat_names = ['times','data1','data2','data3','data4','data5'] dat = pd.DataFrame(np.random.randn(1...
true
a5a7e6a203d9a768ac3a1e1aa2e60ee404ab4f8c
minkue777/Algorithm
/Programmers/lv1/실패율.py
UTF-8
595
3.109375
3
[]
no_license
from collections import Counter def FailureRatio(N, stages): count = Counter(stages) answer = [] for i in range(1, N+1): try: a = count[i] b = sum([v for k, v in count.items() if k >= i]) answer.append(a/b) except: answer.append(0) return ...
true
b3cfcd2938161f0f1bed69f498c2561f6c405b5f
ruizhang84/Algorithms-Design-and-Analysis
/cal_clustering2.py
UTF-8
3,512
2.921875
3
[]
no_license
class TXT_Extract: def __init__(self,job_file): f=open(job_file,'r') self.lists=[] for line in open(job_file): line=f.readline() line=line.strip() line=line.split(' ') line=[int (x) for x in line] #int self.lists.append(li...
true
11975c4bd04954b3176adf8f4f9a5a298c79cde8
ahammer3/DataquestProjects-DataAnalysis
/8.1 - Transforming Data with Python (Hacker News from Command Line)/submissions.py
UTF-8
1,333
3.15625
3
[]
no_license
# correlate submission time to upvotes import read import pandas as pd import dateutil as dt def months(timestamp): time = dt.parser.parse(timestamp) return time.month def hours(timestamp): time = dt.parser.parse(timestamp) return time.hour hn = read.load_data() hn["month"] = hn["submission_time"]....
true
11397cd62463573409fbf29d2203e86719231557
alibezz/PODS
/metrics.py
UTF-8
1,953
2.84375
3
[]
no_license
import numpy as np from scipy.stats import ttest_ind, t, sem from constants import * def compute_adjusted_rsquared(number_of_antecedents, rsquared, number_of_points): num = (1.0 - rsquared) * (number_of_points - 1.0) den = number_of_points - number_of_antecedents - 1.0 return 1.0 - (num/den) def compute_rsquare...
true
51b169607d1516b8d4a8479731fc6503dc739b10
aryanxk02/HackerRank-Solutions
/Problem Solving/Almond 2.py
UTF-8
685
3.046875
3
[]
no_license
n = int(input()) count = 0 if n % 2 == 0: dum = True while dum: n = int(n/2) count += 1 if n % 2 == 1: count += 1 print(count) dum = False elif n % elif n % 2 == 1: while True: n = int(n/2) count += 1 ...
true