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
b808aec90ccf8269fbcd482763629a8b3e0360c7
nimishamanjali/thesis-detection-of-synthetic-faults-in-self-driving-cars
/analysis-udacity/udacity/train_self_driving_car.py
UTF-8
9,451
2.53125
3
[]
no_license
import argparse import os import numpy as np import pandas as pd import tensorflow from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.layers import Lambda, Conv2D, Dropout, Dense, Flatten, Convolution2D, MaxPooling2D from tensorflow.keras.models import Sequential from tensorflow.kera...
true
2f71823fbb7e5a0dab3e68d65cef4836492b177b
emersonvictor/projeto3-algoritmos
/q1-contasomas/conta_somas.py
UTF-8
1,911
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- ''' Universidade Federal de Pernambuco (UFPE) (http://www.ufpe.br) Centro de Informática (CIn) (http://www.cin.ufpe.br) Graduando em Sistemas de Informação IF969 - Algoritmos e estrutura de dados Autor: Emerson Victor Ferreira da Luz (evfl) Email: evfl@cin.ufpe.br Data: 2017-10-22 Copyrigh...
true
fb3abeafd05fa9f733668aed3059e7dbc925851e
apoorvaagrawal86/PythonLetsKodeIt
/PythonLetsKodeIt/Basic Syntax/string_methods_2.py
UTF-8
651
4.25
4
[]
no_license
""" Examples to show available string methods in python """ # Replace Method a = "1abc2abc3abc4abc" print(a.replace('abc', 'ABC', 1)) print(a.replace('abc', 'ABC', 2)) # Sub-Strings # starting index is inclusive # Ending index is exclusive b = a[1] print(b) c = a[1:6] print(c) d = a[1:6:2] print(d) e = 'This is a st...
true
492a7c2febd899a39fbd9f34b70f0a9ebd201ebc
melizeche/bootcamp_material
/clases/persona.py
UTF-8
2,543
4.25
4
[ "Apache-2.0" ]
permissive
#Crear una carpeta que se llame clases y adentro poner los$ # archivos dino.py persona.py # Crear una clase Persona() que tenga como atributos nombre, edad # y profesion. Al instanciar la clase tiene que saludar igual que el # dino diciendo sus atributos # Agregar un metodo a la clase persona, que se llame cumpleanh...
true
916412ba1f3247c2be02ef041f9ef3af36535a11
xsteadfastx/DoTheBackup
/src/dothebackup/plugs/tar.py
UTF-8
1,127
2.65625
3
[]
no_license
"Tar." import logging import os from dothebackup import plugins from dothebackup.types import COMMANDLISTTYPE, CONFIGTYPE from dothebackup.utils import absolutenormpath LOG = logging.getLogger(__name__) @plugins.required_executables(['tar']) @plugins.required_keys(['source', 'destination']) def main(config: CONFIG...
true
22d2abef8d0644185e075513c4c59e3f29fe8dfd
SundarGopal/FacialRecognitionUsingGoldenRatio
/Face2WidthRatio.py
UTF-8
3,568
3.09375
3
[ "Unlicense" ]
permissive
import math from matplotlib.pyplot import imshow from PIL import Image, ImageDraw import face_recognition from cv2 import cv2 import matplotlib.pyplot as plt def load_image(path): return face_recognition.load_image_file(path) def get_FacePoints(points, method='average'): width_left, width_right...
true
10a5826e0d62d9c4ec1bec814333101862682bc6
igaichenkov/CodingProblems
/HackerEarth/Graphs/hamiltonian-path.py
UTF-8
1,308
3.703125
4
[]
no_license
class Graph: def __init__(self, verticesCount): self.__edges = [[] for i in range(verticesCount)] self.__verticesCount = verticesCount self.__time = 0 def addEdge(self, fromVertex, toVertex): self.__edges[fromVertex].append(toVertex) def __dfs(self, at, inStack, inStackCoun...
true
81192432dff5f349fbe1f2af8568255679fb5829
olegpidsadnyi/argo
/argo/schema.py
UTF-8
9,015
3.140625
3
[ "MIT" ]
permissive
"""Argo schema primitives.""" import sys import inspect from . import types from . import exceptions PY2 = sys.version_info[0] == 2 if not PY2: string_types = (str,) else: string_types = (str, unicode) def _get_context(func, kwargs): """Prepare a context for the serialization. :param func: Functi...
true
13e04830b6bb5a52019a58ebc7c247e6c0507fe1
MyChoYS/K_TIL
/python/PYTHONexam/day6_dic_set/exercise6_dic_list_set/listLab6.py
UTF-8
609
3.5
4
[]
no_license
list1 = [[10,12,14,16], [18,20,22,24], [26,28,30,32], [34,36,38,40]] list2 = [] list3 = [] print("1행 1열의 데이터 :",list1[0][0]) print("3행 4열의 데이터 :",list1[2][3]) print("행의 갯수 :",len(list1)) print("열의 갯수 :",len(list1[0]))#?? print("3행의 데이터들 :",list1[2]) print("2열의 데이터들 :",list1[1][1]) for i in r...
true
d82e14aa26a40adcedd7bc35aed4411bcc2bdbd8
itsolutionscorp/AutoStyle-Clustering
/all_data/cs61a/untarred2/181.py
UTF-8
8,654
4.125
4
[]
no_license
# CS 61A Spring 2014 # Name: # Login: from ucb import main letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] bad_num_letters = "Wrong number of letters." not_a_word = "Not a valid word." win_message = "Congratulations! You win!...
true
b2be890ba9d6909cc975c63682ed8cd747aa3b4c
Jellby/NECI_STABLE
/utils/send_softexit.py
UTF-8
3,017
2.9375
3
[]
no_license
#!/usr/bin/python # # Usage: # send_softexit.py [options] walltime & # # This is a version of watchdog which will work on computers without a # queueing system or using a queueing system other than Torque. # # send_softexit must run in the same working directory as the NECI calculation. # # Care must be taken that th...
true
8bb96472f8f97425b7e4fd1eb08663dfb905ad6d
zzchua/whichisbetter
/twitterSearch.py
UTF-8
3,965
2.8125
3
[]
no_license
from secrets import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET import json import urllib, urllib2 from locale import getlocale import tweepy import urllib3.contrib.pyopenssl urllib3.contrib.pyopenssl.inject_into_urllib3() auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_t...
true
487099eb2c7667f5d7cf98ee97d24928285e5672
henryzt/raspberry-pi-car-fpv-remote
/car.py
UTF-8
2,517
2.75
3
[]
no_license
import threading import motor import ranging import servo import autopilot from connect import socket_emit us_avoid = True ir_avoid = False # ------- motor ------- def move_motor(direction, speed=30): thread = threading.Thread(target=move_motor_thread, args=(direction, int(speed))) thread.start() def mo...
true
def3ef4c57d0a117a25a8f451d43fcb452c4b80b
end2you/end2you
/end2you/add_parsers.py
UTF-8
6,279
2.5625
3
[ "BSD-3-Clause" ]
permissive
import argparse def add_eval_args(parser): parser.add_argument('--valid_num_workers', type=int, default=1, help='Number of workers to use (default `1`).') parser.add_argument('--valid_dataset_path', type=str, required=True, help='The directory of the .hdf5 files...
true
1dae9bff583bed23de35992ae21d584377759877
VioletaSeo/earthquake_detection_EB_et_al_2019
/automatic_detection/common.py
UTF-8
1,287
2.671875
3
[]
no_license
import numpy as np import datetime as dt from .config import cfg def to_samples(value, sampling_rate=None): if sampling_rate is None: sampling_rate = cfg.sampling_rate value = np.asarray(np.around(value * sampling_rate), dtype=np.int32) return value def to_seconds(value, sampling_rate=None): ...
true
cc96ccea6d74184c1cc84b22bcb10cc3a04d375c
LKaMe/Machine_Learning
/code/深度学习优化算法/梯度下降算法/小批量梯度下降算法.py
UTF-8
2,308
2.984375
3
[]
no_license
#!/usr/bin/python #coding=utf-8 import numpy as np from scipy import stats import matplotlib.pyplot as plt # 构造训练数据 x = np.arange(0.,10.,0.2) m = len(x) # 训练数据点数目 print (m) x0 = np.full(m, 1.0) input_data = np.vstack([x0, x]).T # 将偏置b作为权向量的第一个分量 target_data = 2 *x + 5 +np.random.randn(m) # 两种终止条件 loop_max = 10000 ...
true
e5e203f2940cafc23b15872809bde3d2a56a0613
neoashraf/awesome-python
/examples/codewars_examples/morse_code_1.py
UTF-8
239
2.578125
3
[ "MIT" ]
permissive
MORSE_CODE = {} CHAR_SEP = ' ' WORD_SEP = ' ' * 3 def decode_morse(morse_code): return ' '.join([''.join(['A' for i in m.split(CHAR_SEP)])for m in (morse_code.strip()).split(WORD_SEP)]) decode_morse('.... . -.-- .--- ..- -.. .')
true
88d4efcb0a27c8babe683a66a4678f3d4439c5bb
marcinho21/repozyt
/kalkulator.py
UTF-8
221
3.375
3
[]
no_license
def get_info(): print ("To jest prosty kalkulator") def dodawanie(a, b): return a + b get_info() l1 = int(input("Wprowadz pierwsza liczbe: ")) l2 = int(input("Wprowadz druga liczbe: ")) print(dodawanie(l1,l2))
true
e62e12b618dadddf1fa281791ca424eb51bdacd8
LilyYC/legendary-train
/Python/Algorithm/5.Tree.py
UTF-8
7,600
4.53125
5
[ "MIT" ]
permissive
"""Tree Practice === Module description === - Task 1, which contains one Tree method to implement. - Task 2, which asks you to implement two operations that allow you to convert between trees and nested lists. - Task 3, which asks you to learn about and use a more restricted form of trees known as *binary t...
true
7abc3a8ffec6bfc9659630ae8e101d1ec5169983
harshalhv/Multiclass-classification-with-word-bags-and-word-strings
/plotConfusionMatrix.py
UTF-8
2,126
2.921875
3
[]
no_license
import matplotlib.pyplot as plt import json import itertools import numpy as np def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues, filename='cf-matrix'): """ This function prints and plots the confusion matrix. Normalization can be applied by setting `norma...
true
567f1549667a58efcdd15ca5570894f9691c0d4f
marirsg2/KerasLearning
/KerasTest.py
UTF-8
2,113
2.671875
3
[]
no_license
import numpy as np import keras from keras.models import Sequential from keras.layers import Dense,Dropout,Activation,Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.utils import np_utils from keras.datasets import mnist from matplotlib import pyplot as plt # print keras.__version__ np.random...
true
bd2781f883d4d236501993b81191582a9ba1b87c
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/102_10.py
UTF-8
1,888
4.21875
4
[]
no_license
Python program for addition and subtraction of complex numbers Given two complex numbers z1 and z2. The task is to add and subtract the given complex numbers. **Addition of complex number:** In Python, complex numbers can be added using + operator. **Examples:** **Input:** 2+3i, 4+...
true
f25fb52617ae75d3fa594eaf376cce2b2d9e6aac
StaticDDQ/AI-Assignment
/parta.py
UTF-8
10,425
3.671875
4
[]
no_license
import math from queue import PriorityQueue MAX_VAL = 100 # ---SUB FUNCTIONS START HERE--- # calcMoves takes the board and coordinates as input # and returns the number of moves possible from that coordinate def calcMoves(board, row, col): moves = 0 for pos in range(0,4): # Cycle through directions based on ro...
true
4b06a261825ad8d3b2768ed9988e1101b4a92027
skshihab069/Data-Structure
/graphs.py
UTF-8
617
3.34375
3
[]
no_license
class Graph: def __init__(self, edges): self.edges = edges self.edges_dict = {} for start, end in self.edges: if start in self.edges_dict: self.edges_dict[start].append(end) else: self.edges_dict[start] = [end] print("Edge dict ...
true
7e7c60fbbb5a063f0ea39d8a4bf5e65ca8f4b52d
johanlundahl/home_monitor
/home_monitor/handlers.py
UTF-8
1,639
2.8125
3
[]
no_license
import abc import logging from pytils import http, slack class Handler(metaclass=abc.ABCMeta): def __init__(self, next_command=None): self._next = next_command def handle(self, sensor): self.process(sensor) if self.proceed: self._next.handle(sensor) @property def...
true
790dcf709af51183696c785f08aa488867c48d80
jnash67/eulerpython
/euler113pt2.py
UTF-8
3,055
3.328125
3
[]
no_license
import math import sortedcontainers as sc def is_increasing(n): str_n = str(n) for i in range(0, len(str_n) - 1): d1 = int(str_n[i]) d2 = int(str_n[i + 1]) if d2 < d1: return False return True def is_decreasing(n): str_n = str(n) for i in range(0, len(str_n) -...
true
a4f7c8f41885237a64cff8456ff6f81986847c8c
SaiSree-0517/pythonlab
/basicprograms.py
UTF-8
777
4.21875
4
[]
no_license
#1.1) Running instructions in Interactive interpreter and a Python Script #Interactive interpreter >>> a=10 >>> print(a) 10 >>> type(a) <class 'int'> >>> a=15 >>> b=24 >>> c=a+b >>> print(c) 39 >>> s='hello' >>> type(s) <class 'str'> >>> len(s) 5 >>> #python script to reverse a given number n=int(input('enter the numb...
true
ef1f06733724a41ad1ffb251a62d2ec01387562c
Kadxs/kalman-filter-in-single-object-tracking
/draw box location.py
UTF-8
2,125
2.546875
3
[]
no_license
import os import cv2 import numpy as np from utils import plot_one_box, cal_iou, updata_trace_list, draw_trace "使用最大IOU作为判别条件" initial_target_box = [729, 238, 764, 339] # 目标初始bouding box if __name__ == "__main__": # 读取视频与标签 video_path = "./data/testvideo1.mp4" label_path = "./data/labels" ...
true
bb7bbe0db47b23c949ccdae8eab53903e7ade8dc
tanaylab/metacells
/metacells/utilities/typing.py
UTF-8
31,693
2.796875
3
[ "MIT" ]
permissive
""" Typing ------ The code has to deal with many different alternative data types for what is essentially two basic data types: 2D matrices and 1D vectors. Specifically, we have pandas data frames and series, Scipy sparse matrices, and numpy multi-dimensional arrays (not to mention the deprecated numpy matrix type). ...
true
0dc035a1abdc1f447d06510fb75787329e0e7ed4
KanoYugoro/python-pr-notifier
/main.py
UTF-8
2,068
2.6875
3
[ "MIT" ]
permissive
import argparse import datetime import os.path import json from pyprnotifier import github_retrieval from pyprnotifier import custom_email_format from pyprnotifier import emailing parser = argparse.ArgumentParser(description='This script retrieves recent Pull Requests from a publicly available git repository, ...
true
c216bd14a094e471f0ad7fef40271bb90b3a358c
sharathjith7/angle-finder
/Angle Finder.py
UTF-8
4,856
3.34375
3
[]
no_license
import pygame import sys import math from PIL import ImageGrab ####################### SETTINGS ########################### pygame.init() WIDTH = 555 HEIGHT = 578 BLACK = (0, 0, 0) RED = (225, 0, 0) GREEN = (0, 225, 0) BLUE = (0, 0, 255) GREY = (107, 107, 107) YELLOW = (255, 255, 0) WHITE = (255, 255, 255) FPS = ...
true
fd98c3ab2736aecd837ab2d1ee1c4a9f3e85648e
mfbx9da4/neuron-astrocyte-networks
/backup/mypybrain/misc/modify_structure.py
UTF-8
3,970
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Feb 14 17:48:37 2013 @author: david """ from pybrain.structure.modules.neuronlayer import NeuronLayer class QuadraticPolynomialLayer(NeuronLayer): def _forwardImplementation(self, inbuf, outbuf): outbuf[:] = inbuf*1 # print 'here is the output of this layer'...
true
2eb9f990888ccc8a823a60ab022009cdc1c2f1e4
kevingtzz/ST0245-033
/laboratorios/lab03/ejercicioEnLinea/Online.py
UTF-8
829
4.0625
4
[]
no_license
#!/usr/bin/python def start_end(str): """ This function reorders the string, correcting the errors caused by the expressions '[' and ']' that symbolize the "start" and "end" keys on a conventional keyboard. Args: str (str): any text to reorder returns: nstr (str): The text reor...
true
09090e2a73d80925ff71399d3e0017a17775dcb4
acamilass/learning-python
/parte1/ex-14/ex-14.py
UTF-8
188
3.890625
4
[]
no_license
# valores vazios ou zero retornam false # valores maiores que zer retornam true lista = [] if lista: # if true: print("Lista tem valores") else: # else false print("Lista vazia")
true
892cf6a1dfa6860f3a144913153b8d4ee9ba20ef
toebgen/cyberfoosball
/webserver/app/models.py
UTF-8
1,484
2.578125
3
[]
no_license
from app import db # http://flask-sqlalchemy.pocoo.org/2.1/models/ # Many-to-Many Relationships for user and games games = db.Table('games', db.Column('game_id', db.Integer, db.ForeignKey('game.id')), db.Column('user_id', db.Integer, db.ForeignKey('user.id')) ) clas...
true
230b2270f849be961c0ce87074861142ee817b82
qwa310/Algorithms
/Greedy/03_problem.py
UTF-8
466
3.1875
3
[]
no_license
# 그리디 - 숫자 카드 게임 n, m = map(int, input().split()) result = 0 for i in range(n): data = list(map(int, input().split())) minvalue = min(data) result = max(result, minvalue) print(result) ''' n, m = map(int, input().split()) result = 0 for i in range(n): data = list(map(int, input().split())) ...
true
378f4c859163986c265f09e3cb953b470ca09f6a
pombreda/reval
/src/st2canon.py
UTF-8
8,170
2.515625
3
[ "ISC" ]
permissive
#!/usr/bin/env python ''' Convert "standard" BioNLP Shared Task stand-off annotations into canonical non-textbound annotations. Author: Pontus Stenetorp <pontus stenetorp se> Version: 2012-03-30 ''' from argparse import ArgumentParser, FileType from itertools import combinations from re import compile as r...
true
70aead8290273da2d33e1abb7c7ab1661a0c177c
geon-jeong/Language-Examples
/lang-FileRead-Text/python/FileRead.py
UTF-8
1,769
3.4375
3
[]
no_license
import os filename = os.path.abspath('.') + r"\..\DataFiles\data.csv" #- open a file and read #- open a file and readlines #- open a file using with ~ as #- open text files under a directory and make it one # open a file and read def func_file_read(_filename): f = open( _filename, 'r') read_data = f.read() ...
true
3111fb89529f00979b8303fd748a7f2bcf4e4193
wmboult94/NLP
/Workshops/Topic 0/solutions/prime_ministers.py
UTF-8
593
3.234375
3
[]
no_license
# coding: utf-8 address_book = {"Harold Wilson" : (1974,1976,"Labour"), "James Callaghan" : (1976,1979,"Labour"), "Margaret Thatcher" : (1979,1990,"Conservative"), "John Major" : (1990,1997,"Conservative"), "Tony Blair" : (1997,2007,"Labour"), ...
true
a9faadb13af78b76dabd0fcb27340072da16256a
tanaka0325/atcoder
/abc117/B/main.py
UTF-8
105
2.921875
3
[]
no_license
N = int(input()) L = list(map(int, input().split())) m = max(L) print('Yes' if m < sum(L) - m else 'No')
true
688525623abd130b9a130f986844745968c1e15f
smartspot2/advent-of-code
/2020/day1.py
UTF-8
944
2.765625
3
[]
no_license
import numpy as np from collections import * from itertools import * from common.session import AdventSession session = AdventSession(day=1, year=2020) data = session.data.strip() # data = data data = list(map(int, data.split())) def part1(): out = 0 for i, val in enumerate(data): for val2 in data[i...
true
c16feb8bf91df7a1584293a6f5b517d2f47611a1
JohnnyRyan1/clouds
/03_machine_learning_process/03_Stack_Regrid_to_ISMIP_SW.py
UTF-8
11,694
2.6875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ DESCRIPTION Regrid and stack radiative flux data to ISMIP grid. """ # Import modules import pandas as pd import numpy as np import glob import os import netCDF4 import pyresample # Define years years = np.arange(2003, 2021, 1) for year in years: # Define f...
true
93341503c3f1b40d2cf521ff768569f5ae4e13d2
Andrey5597/elementary_task
/Task3/Triangles.py
UTF-8
2,543
4.59375
5
[]
no_license
#!usr/bin/env python3 import math help_message = '''Here is a console program that performs the output of triangles in descending order by their square. After adding each new triangle, the program asks if you want to you add another one. If you answer “y” or “yes”, the program will ask you to enter data for one mor...
true
c49eec13c96bd04700ba07f1712a638c94c1c2ad
alex233376/Project
/proj/glava6/upr6.4.py
UTF-8
504
2.984375
3
[]
no_license
termin = { 'кортеж': 'неизменяемый список', 'словари': 'неупорядоченные коллекции произвольных объектов ', 'списки': 'упорядоченные изменяемые коллекции объектов ', 'множество': 'это неупорядоченная коллекция без дублирующихся элементов.' } for key, value in termin.items(): print(f'{key.title()} {value.title()}\n'...
true
63c56e631d1469563df5ccfdcea6eadb256c1933
irvingmanaog/CS7641HW3
/code/wdbc/rp.py
UTF-8
1,501
2.71875
3
[]
no_license
import numpy as np from sklearn.decomposition import PCA from sklearn.random_projection import GaussianRandomProjection from sklearn.random_projection import SparseRandomProjection import pandas as pd from numpy.testing import assert_array_almost_equal from sklearn import utils original = pd.read_csv("wdbc.csv") df = ...
true
7063f0c663090b569540e3d09d8d6323ebc7e56f
MishaelChL/gestordecontrasenas
/usuario.py
UTF-8
1,529
3.203125
3
[]
no_license
import hashlib from conexion import * def comprobar_usuario(): conexion = conectar() cursor = conexion.cursor() sentencia_sql = 'SELECT * FROM usuario' cursor.execute(sentencia_sql) usuario_encontrado = cursor.fetchall() conexion.close() return usuario_encontrado def registrar(nombre, apel...
true
6585cbc07fa5fefde38b2fc397f084ada7d56e0a
gitshangxy/tutorial
/L2基础类型控制语句/4 if 语句.py
UTF-8
2,024
4.1875
4
[]
no_license
# 主题: 控制语句之if # 多行注释 ctel+/ 或 shift+冒号 # age = 10 # if age > 18: # print('年龄大于18是成人') # else: # print('未成年') # # score = 'hello' # if score < 0 or score > 100: # print('分数不合法') # elif score < 60: # print ('不及格') # elif 60 <score > 70: # print('及格') # elif 70 <= score and score < 90: # prin...
true
3988bb97ad1a668fc107afa76b9d6e2488454d43
solisrex/hangman-for-python
/Hangman.py
UTF-8
7,736
3.15625
3
[]
no_license
import pygame, sys, math, ctypes, string, random from pygame.locals import * pygame.init() length = 750 DISPLAYSURF = pygame.display.set_mode((length,length)) pygame.display.set_caption("Hangman") WHITE = (255,255,255) LITEGREY = (200, 200, 200) GREY = (130, 130, 130) BLACK = ( 0, 0, 0) DISPLAYSURF.fill(...
true
2f6eb590c98037993fe7045906b2af99077a16ba
uscheller/aws-lambda-runtime-pypy
/pypy3-v6.0.0-linux64/lib_pypy/identity_dict.py
UTF-8
1,502
2.8125
3
[ "Apache-2.0", "LicenseRef-scancode-unicode", "GPL-1.0-or-later", "OpenSSL", "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain" ]
permissive
try: from __pypy__ import identity_dict as idict except ImportError: idict = None from UserDict import DictMixin class IdentityDictPurePython(object, DictMixin): __slots__ = "_dict _keys".split() def __init__(self): self._dict = {} self._keys = {} # id(obj) -> obj def __getitem_...
true
83e95479509c7ff0e08105ba5353743ae71ff8b6
GillesBonne/multi_object_tracking
/multi-object tracker/model_extension.py
UTF-8
1,939
2.828125
3
[ "MIT" ]
permissive
"""Multi-object tracker as extension for the single object tracker.""" import numpy as np from utils import resize_bb from yolo.config import ConfigParser class MultiTrackNet(): """Extension for the TrackNet identification network. Creating an end-to-end tracking network with pretrained YOLO-v3 as detection...
true
fd3ff335bc0f69b9ce23d73a1e12a9dee40675ff
Aaeller/Vuln_classify_Malware_detection
/vulndb/vul_machine_learning.py
UTF-8
4,484
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- import pickle from data_preprocessing import word_split,word_lemmatizer,stopwords_filter,words2vec,words2vec_label #导入自定义数据预处理函数 from tf_idf import feature_select #导入tf-idf词频选择函数 import time import info_gain from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classificat...
true
c379dfa4158b00e174f2fa236d468e92c74a72f6
amari-at4/Duplicate-File-Handler
/Topics/Default arguments/Markdown heading/main.py
UTF-8
150
3.75
4
[]
no_license
def heading(title, level=1): if level < 1: level = 1 elif level > 6: level = 6 return '{} {}'.format('#' * level, title)
true
12d24291231abbf786624ac2c6b98618c112c105
shmurygin-roman/geekbrains_lessons
/course_client_server/Урок 5. Коды примеров/log_config_7.py
UTF-8
1,315
3.0625
3
[]
no_license
""" Простейшее логгирование """ import logging # Создаём объект-логгер с именем app.main LOG = logging.getLogger('app.main') # Создаём объект форматирования: FORMATTER = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s ") # Создаём файловый обработчик логгирования (можно задать кодировку): ...
true
471143c1d2200e39ba8263aa63fe4a15d9a0241b
weiqi88/python
/liao/function.py
UTF-8
1,473
4.375
4
[]
no_license
#coding=utf-8 #比较函数cmp(x, y)就需要两个参数,如果x<y,返回-1,如果x==y,返回0,如果x>y,返回1 import math print cmp(1,2) print cmp(2,1) print cmp(2,2) print unicode(100) #定义一个函数要使用def语句,依次写出函数名、括号、括号中的参数和冒号: def abs(x): if x>=0: return x else: return -x a = abs(-3) print a #如果想定义一个什么事也不做的空函数,可以用pass语句 #实际上pass可以用...
true
7c7786c5424338fdc2845c296095c4022bcf2ba6
Sewmini-18/python-programs
/min_max.py
UTF-8
557
3.8125
4
[]
no_license
# find the minimum and maximum number seq = [] # number inputs n = int(input("Enter number of inputs : ")) for i in range(0, n): nlist = int(input()) seq.append(nlist) # adding the inputs to the list max = seq[0] min = seq[0] for i in range(1, n): if max < seq[i]: max =...
true
a68f2975eaec133aec962b1cdaa24d695e2fb0db
tabuadaefren/The-Stiffness-Matrix-Method-V2.0
/deflection111.py
UTF-8
889
2.734375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # insert dri ang beam parameters or iimport #length, height, width, point where load begins, gravity, rho, E, I, w l=200 #mm, lenght h=100 #mm, height b=10 #mm, width a=0 #mm, point where load begins g=9810 ...
true
0d0978ceff3f5df1bb10724ecfbf9e7f013f827c
riadnassiffe/Simulator
/src/tools/ecos/cvxpy/cvxpy/atoms/affine/add_expr.py
UTF-8
2,594
2.578125
3
[ "MIT", "GPL-3.0-only", "GPL-3.0-or-later" ]
permissive
""" Copyright 2013 Steven Diamond This file is part of CVXPY. CVXPY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. CVXPY is distributed i...
true
fb226cfa4b0a206988f9755e17c596d5299b8b22
gtarciso/Estudos-Maratona
/URI/Strings/2137.py
UTF-8
223
3.6875
4
[]
no_license
while True: try: n = int(input()) books = [] for i in range(n): x = input() books.append(x) s_books = sorted(books) for obj in s_books: print(obj) except EOFError: break
true
28ac6552d9de525d86abaf5cdd606cf862bb00aa
whaleygeek/pyws
/code/twurtle/src/Proxy.py
UTF-8
2,112
3.828125
4
[]
no_license
# GenericDynamicProxy.py (c) 2013 @whaleygeek # A generic function call proxy for groups of classes # # Create an instance of this class that wraps multiple similar class instances. # Then call any method on this proxy class, with any parameters, and it # will dispatch in turn to each instance. # # This makes it possi...
true
48bbee29cc65657dbd0ad35fdeac1d7ed73c3abf
jzaia18/AntiviralVoyager
/antiviralvoyager/utils/geocoder.py
UTF-8
638
2.953125
3
[ "MIT" ]
permissive
import requests,json import os url = "https://maps.googleapis.com/maps/api/geocode/json" DIR = os.path.dirname(__file__) or '.' KEY = json.loads(open(DIR + "/../secrets.json").read())['google'] headers = { "key": KEY } def get_coords(place_name): data = { "key": KEY, "address": place_name ...
true
2737fc331e128f2ec4a701aab0e804e8ac167a76
Aaron-Nazareth/ChocolateMinds-Python-beginner-course
/Return functions.py
UTF-8
735
4.5625
5
[]
no_license
# Write a function that calculates and returns the area of a rectangle - given length and width # Call it with length of 12 and width of 13 # def rectangle_area(length, width): # area = length * width # return area # # print(rectangle_area(12, 13)) # Write a function for a square of a number and call...
true
8c308dc562bea72391826760022011268db5e8f3
finaldie/final_test
/todo/todo_show.py
UTF-8
2,943
2.84375
3
[]
no_license
#!/usr/bin/env python3 import sys import os import getopt import string import pprint import yaml import subprocess import re import collections import datetime def processTodo(filename): try: f = open(filename, "r") today, older, later = getValidData(f) res = show(today, older, later) ...
true
c17fb8393be275ac79b12f0789feb4b1388ac653
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_55/471.py
UTF-8
619
3.015625
3
[]
no_license
fin = open('in.txt') fout = open('out.txt','w') t = int(fin.readline()) for w in range(1,t+1): r,k,n = map(int,fin.readline().split()) n -= 1 groups = list(map(int,fin.readline().split())) i = 0 tally = 0 tsum = 0 j = 0 while r > 0: tally += groups[i] #prin...
true
45770f5c0d22044603319d712a243554b0d71019
EamonnR96/SquatFormTracker-FYP
/FormDetector/classifier.py
UTF-8
1,600
3.21875
3
[]
no_license
import pandas from sklearn.tree import DecisionTreeClassifier class Classifier(object): def __init__(self): self.trainingFile = "training.csv" self.headers = [] self.dataSet = None self.CARTClassifier = None def createDecisionTreeClassifier(self): self.seperateCSVFile()...
true
491fe84f70944da5953335d7ebe5e49a74870733
shiziwen/leetcode-python
/78-Subsets/solution.py
UTF-8
438
2.71875
3
[]
no_license
class Solution(object): def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ def dfs(depth, start, vlist): res.append(vlist) if depth == len(nums): return for i in range(start, len(nums)): ...
true
971c00db53c1d1d1a73f010a91700384fad78440
momentum-cohort-2019-02/w3d3-oo-pig-ChristianLMedlin
/new_pig.py
UTF-8
2,329
3.765625
4
[]
no_license
class Human(): """This controls and tracks all of the information associated with the human.""" def __init__(self, round_score=0, total_score=0, roll_again=True): self.round_score = round_score self.total_score = total_score self.roll_again = roll_again def is_user_input_valid(self...
true
0e27f4c8c150822ab3160c32020c74d5a3aead7b
Dormitabnia/KenCode
/python/38.外观数列.py
UTF-8
803
3.296875
3
[]
no_license
# # @lc app=leetcode.cn id=38 lang=python3 # # [38] 外观数列 # # @lc code=start class Solution: # runtime beats 7.29 % (64 ms) # memory usage beats 29.56 % (15.1 MB) def countAndSay(self, n: int) -> str: num_str = '1' for _ in range(n - 1): num_str = self.describe_num(num_str) ...
true
2fea075d03d0e5e7e307672393366a727a7c81c4
Sami-AlEsh/Intelligent-Content-Management-System
/icms-server/keyphrases_extraction/embed_rank.py
UTF-8
5,773
2.578125
3
[ "MIT" ]
permissive
from keyphrases_extraction.clean_text import clean from keyphrases_extraction.utils import timeit import numpy as np from sklearn.metrics.pairwise import cosine_similarity import itertools from .bert_embedding import embed_text_bert from .doc2vec_embedding import embed_text_doc2vec from .extract_ner_candidate import ge...
true
5f7bb248393f7b2cf31e5da539d99517a97a4bdf
h-wei/AdventOfCode2020
/day16.py
UTF-8
3,299
3.4375
3
[]
no_license
class Day16: def __init__(self, content): self.rules = [] self.your = [] self.near = [] count = 0 for line in content.split("\n"): if len(line) == 0: count += 1 elif count == 0: key, value = line.split(": ") ...
true
cf0e653f52fa23029a50538b73a67c394fcb896c
isohels/AutomateTinder
/tinder_click.py
UTF-8
183
2.640625
3
[]
no_license
import os import pyautogui import time #pyautogui.position(773,902) #x=773,y=902 i=0 while i<10: pyautogui.click(773,902) time.sleep(0.2) i+=1 print("Happy HumpDay")
true
00543c3187131be2f8b36036497d78fcfe76a238
anujkr2210/LearnToCode
/Python_Gen/build/lib/number_generator/Number_validator.py
UTF-8
464
3.296875
3
[ "MIT" ]
permissive
def validate(n): try: if n.isdigit(): return True else: return "Please enter integer number greater than 0" except Exception as e: return str(e) def ackvalidate(fnum1,fnum2): try: if fnum1.isdigit() & fnum2.isdigit(): return True ...
true
62a04aaed56e2c0d882d74c4e12935ad9f0df775
KforG/halving-discord-bot
/halving.py
UTF-8
2,424
2.640625
3
[]
no_license
import discord import requests from datetime import datetime Token = "" client = discord.Client() BlockHalving = 1680000 BrHalving = 12.5 BrNow = BrHalving * 2 GetBlockURL = "https://ocm-backend.blkidx.org/info" def getTime(): now = datetime.now() current_time = now.strftime("%H:%M:%S") return current_ti...
true
8e52c3f69cdb8277805b250746f23cf9a672bf27
s20033/ComputerVision
/Coin_detection.py
UTF-8
3,189
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Apr 17 17:14:56 2021 A certain number of 5 zł coins and a certain 5 gr. coins are given.The coins can be located in or out of the tray. Write a program thatwill determine the number and type of coins in and out of the tray. Test the program on pictures. Tune the system ...
true
2c2a6434f144330e5906c2debf7f3f7e9005c53f
shiunyi71/nge_2_re
/tools/text.py
UTF-8
10,875
2.859375
3
[]
no_license
#!/usr/bin/env python2.7 import os import struct import json import common import re class TextArchive(object): def __init__(self): self.entries = [] self.strings = [] self.warnings = [] self.header_padding = 0 self.entry_padding = 0 def warn(self, message): ...
true
9e56556504a491eec28d331f6cc3c7c9ffa0ab2d
Aasthaengg/IBMdataset
/Python_codes/p02612/s067041033.py
UTF-8
84
3.5625
4
[]
no_license
money = int(input()) if money%1000==0: print(0) else: print(1000-(money % 1000))
true
417fd3a55799f55a7b7aab288008c473ede5fa1d
knoxxknox/Codenation-challenges-Python00
/desafioCodenation.py
UTF-8
4,221
3.15625
3
[]
no_license
''' Objetivo ...: Desafio Codenation Autor ......: Jose Carlos Data .......: abril/20 ''' import requests import json import hashlib # -------------------------------------------------------------------- # Faz requisição com token e gerar arquivo json e extrai o texto cifrado # -----------------------------------...
true
05d25841c83e54d0c3e5bb90d722f0bc14082c7c
gabriellaec/desoft-analise-exercicios
/backup/user_167/ch18_2019_08_30_17_19_17_707216.py
UTF-8
72
3.109375
3
[]
no_license
def encontra_cateto(a,b): y= [(a)**2-(b)**2]**(1/2) return y
true
de769adfdaf728d03d8c77ef611a9ef8a5584b1b
yusan123/scrapy-douban
/old_learn_py/chuanzhi/file.py
UTF-8
1,190
2.875
3
[]
no_license
#coding=utf-8 import os #dirPath = r'C:\Users\yousan\Desktop\new' def getNewName(name='新建文件'): name = input('请输入文件的新名字(默认为*新建文件*):') return name def getNum(num=20): num = int(input('请输入目录下新建文件的数量(默认为20个):')) return num def getPath(): try: path = input('请输入文件目录所在的路径(默认D:\\new盘根目录):') os.chdir(path) except: ...
true
b2cb4c2d8d442014d0a2af0441bc66bdf0167bf5
purnesh42H/Algorithm-Problems
/Stack n Queue/queue.py
UTF-8
1,310
4.15625
4
[]
no_license
# Key Points: ''' 1. Maintain both head and tail(insert from tail and remove from head) 2. Check if queue is empty 3. Maintain some threshold here(stop the push after that) ''' #Algorithm: ''' 1. Four methods, insert, delete, peek, isEmpty(tail is empty?) 2. Insert, create a node, make it tail. 3. Delete, remove head ...
true
6a85bd4559634a219d9adad6deb6d6d142ba55bb
elektxo/weas-programadas
/python/bloc-notas-plus/bloc-de-notas-plus-v2.py
UTF-8
1,070
3.046875
3
[]
no_license
import tkinter as tk from tkinter.filedialog import askopenfile import os root = tk.Tk() root.title("Bloc de Notas Plus") root.geometry("1280x720") #menu superior def fileBtn(): print("hola mundo") fileText = tk.StringVar() fileButton = tk.Button(root, textvariable=fileText, command=lambda:fileBtn(), height=1, w...
true
4766b05be006f0715fa8c6d6b2e53a397b8649c4
pysal/tobler
/tobler/tests/test_area_join.py
UTF-8
2,835
2.703125
3
[ "BSD-3-Clause" ]
permissive
import geopandas as gpd import numpy as np from shapely.geometry import Point import pytest from tobler.area_weighted import area_join class TestAreaJoin: def setup_method(self): self.grid = gpd.points_from_xy( np.repeat(np.linspace(1, 10, 10), 10), np.tile(np.linspace(1, 10, 10), 10) ...
true
2c92f6ff91455246f8418d9c4dca62a86149bb60
adamguos/surp-2019
/nfft-hermite/adc/tree.py
UTF-8
217
2.75
3
[]
no_license
''' Defines a basic binary tree class for use in adc.py ''' class Tree: "Simple binary tree." def __init__(self, data = None, left = None, right = None): self.data = data self.left = left self.right = right
true
0e745bd42082589398be53be6059360a65712e89
WardMaes/aoc-2020
/day_08/day_08.py
UTF-8
1,379
3.578125
4
[]
no_license
def flip_op(val): return 'jmp' if val == 'nop' else 'nop' def run(program): ip = 0 acc = 0 executed = [] while (ip not in executed and ip >= 0): if (ip > len(program) - 1): break executed.append(ip) instruction = program[ip] if (instruction['op'] == 'nop'): ip += 1 cont...
true
86b6ff23871f73ed87a1600b77868f35fbb3682b
dean-shaff/flask_citation_manager
/app.py
UTF-8
5,517
2.984375
3
[]
no_license
from flask import Flask, render_template, jsonify, request import json from cred import cloudant_api_key as api_key from cred import cloudant_pass as api_pass import requests import time from bs4 import BeautifulSoup import json app = Flask(__name__) def gen_soup(url): """ Given some url, generate a soup obj...
true
bf13a70a42c22c48bf1474916f1746034f116960
caiyunbin/knn
/machainlearningKNN.py
UTF-8
2,511
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jul 10 16:13:31 2019 @author: Caiyunbin """ import pandas as pd import numpy as np data = pd.DataFrame({ 'id':np.array(range(1,8),dtype='int32'), '名称':pd.Series(['魂断蓝桥','泰坦尼克号','触不可及','尖峰时刻','新警察故事','少林寺','咏春']), '打斗镜头':np.array([1,5...
true
859dabcf7b1d5d402c0311719ef0105c85ec9a1a
dvirsky/badger
/src/utils.py
UTF-8
1,003
3.1875
3
[]
no_license
import logging, ConfigParser, ast def readConfig(settings, section, fileName): """ Read the local config file and replace any setting Settings with the one from this file """ #Create case sensitive config parser config = ConfigParser.ConfigParser() config.optionxform = str try: #rea...
true
ba2f3d6e90f4f90b54316910aa42c3825fe9b279
eduard-netsajev/Personal-Practice
/Python/Games/TextDungeon.py
UTF-8
2,988
3.625
4
[]
no_license
__author__ = 'Netšajev' import os clear = lambda: os.system('cls' if os.name == 'nt' else 'clear') # http://programarcadegames.com/labs/adventure/castle_map_02.png room_list = [] # room = [THIS, N, E, S, W,] #from 0 to 6 room = ['You are in a Bedroom 2.\nThere are rooms to the north and east.', 3, 1, None, None]...
true
c6b0178e52b05eb75ca08dbaabf54046ca0d5349
jizhi/jizhipy
/Math/RMS.py
UTF-8
250
3.3125
3
[]
no_license
def RMS( cls, a, axis=None ) : ''' Root Mean Square a is array, this function return the rms of a ''' import numpy as np a = np.array(a) if (axis is None) : rms = ((a**2).mean())**0.5 else : rms = ((a**2).mean(axis))**0.5 return rms
true
6ca5feaa212af929b0b925a5837d87c7bed19762
vlad-zankevich/LearningPython
/users.py
UTF-8
1,382
3.8125
4
[]
no_license
class User(): # Основные атрибуты пользователей def __init__(self, first_name, last_name, male, age, nationality): self.first_name = first_name self.last_name = last_name self.male = male self.age = age self.nationality = nationality self.login_attempts = 0 ...
true
7f66b46566c4c3a115cd6b35ad1fc62509c01d81
giserh/com.sma
/src/main/python/alg/bulls_and_cows_test.py
UTF-8
367
2.96875
3
[]
no_license
from unittest import TestCase from alg.bulls_and_cows import BullsAndCows class TestBullsAndCows(TestCase): def test_getHint(self): ins = BullsAndCows() cases = { ('11', '10'): '1A0B', ('11', '01'): '1A0B', ('1234', '0111'): '0A1B' } for case, ans in cases.iteritems(): self.a...
true
df82d96910634361f29bfbfba3e08bb15b8c0711
devDroidhang/mongodb_consistent_backup
/MongoBackup/Oplog/Info.py
UTF-8
1,313
2.65625
3
[ "Apache-2.0" ]
permissive
import os import logging from gzip import GzipFile from bson import decode_file_iter class OplogInfo: def __init__(self, oplog_file, dump_gzip=False): self.oplog_file = oplog_file self.dump_gzip = dump_gzip self._count = 0 self._first_ts = None self._last_ts = None ...
true
0745c2cb0f8f124d1fb164469df77edb6b104a69
bentonstark/hash-sigs
/lms_type.py
UTF-8
1,464
2.828125
3
[]
no_license
from enum import Enum class LmsType(Enum): """ Leighton-Micali Signature (LMS) Algorithm Type Enumeration """ def __new__(cls, *args, **kwds): value = len(cls.__members__) + 1 obj = object.__new__(cls) obj._value_ = value return obj def __init__(self, m, h, len_i,...
true
8e610d6ea16a7fc301e706099306dbabf7608238
meloLeeAnthony/PythonLearn
/comprehensions/set_test01.py
UTF-8
54
2.671875
3
[]
no_license
a = {x for x in range(1, 100) if x % 9 == 0} print(a)
true
8417052067b909137226a068771052256e9c3990
kkrawczyk5/Module-10---Final-Game
/Cave Adventure FINAL VERSION.py
UTF-8
8,497
3.890625
4
[]
no_license
#Name: Kamil Krawczyk #University: National-Louis University #Contact: kkrawczyk@my.nl.edu #Course: CSS 225 Winter semester #Language: Python3 #Name of game: Cave Adventure #Version: Final version of game #Type of game: Text based import random def intro_screen(main): print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
true
d4068ef5bac58b98a77ce3f0e61b8bf667ec2835
jzm101010/black-jack
/black jack.py
UTF-8
6,213
3.1875
3
[]
no_license
#A game named black jack import simplegui import random #加载扑克牌 CARD_SIZE = (73, 98) CARD_CENTER = (36.5, 49) card_images = simplegui.load_image('https://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png') CARD_BACK_SIZE = (71, 96) CARD_BACK_CENTER = (35.5, 48) card_back = simplegui.load_image('htt...
true
d12e1cc0f9378b304531f295502ddd84aef4e99a
alb7979s/datastructuresAndAlgorithms
/kakaoProblems/2018 KAKAO BLIND RECRUITMENT/06프렌즈4블록.py
UTF-8
1,041
3
3
[]
no_license
# https://programmers.co.kr/learn/courses/30/lessons/17679?language=python3 def gravity(n, m, board): for y in range(m): temp = [] for x in range(n): if board[x][y] != ' ': temp.append(board[x][y]) board[x][y] = ' ' for x in range(len(temp)): ...
true
d47e565db4a2bcb16a6b54183680b39d19c0d6c6
annkon22/chapter5
/ex12.py
UTF-8
1,040
3.8125
4
[]
no_license
#Perform a benchmark analysis for a shell sort, using different increment sets on the same list. import time, random def shell_sort(a_list): sublist_count = len(a_list) // 3 while sublist_count > 0: for start_position in range(sublist_count): gap_insertion_sort(a_list, start_position, ...
true
cb812ce222a86acd339ff39dd1334e943b293e36
venkatachiranjeevi/algorithms
/interview_bit/two_pointers/three_pointers.py
UTF-8
873
3.1875
3
[]
no_license
import sys class Solution: # @param A : tuple of integers # @param B : tuple of integers # @param C : tuple of integers # @return an integer def minimize(self, A, B, C): i = j = k =0 len1 = len(A) len2 = len(B) len3 = len(C) diff = sys.maxint while ...
true
32ec9c300bcb1063bb8fe60726a9bc88c466c4e1
rednir/robo
/src/help_module/help_functions.py
UTF-8
3,976
3.0625
3
[]
no_license
import discord import text_module.embeds async def help_message_handler(message, COMMAND_PREFIX): try: second_parameter = message.content.split(" ")[2] except IndexError: await default_help_message(message, COMMAND_PREFIX) return except: await message.channel.send(embed=te...
true
66c6de34ff976c6f9aa84a294e262b69456e2468
MichaelMcFarland98/Stickman-Z
/stickmanZ/game/input_service.py
UTF-8
2,965
3.125
3
[ "MIT" ]
permissive
import arcade import math import random class Input_service: def __init__(self): pass def on_release(self, key, modifiers, player_sprites): player_sprite = player_sprites["player"][0][0] if key == arcade.key.UP or key == arcade.key.W: player_sprite.change_y = 0 ...
true