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
0987712e2b1ac25e8bab5d50a40d0219000a2e54
aniruddhamurali/Project-Euler
/src/Python/Problem01.py
UTF-8
332
3.9375
4
[]
no_license
def sum_multiples(n): '''Finds the sum of all the multiples of 3 or 5 below n.''' total = 0 for count in range(1,n): if (count % 3 == 0) or (count % 5 == 0): total = total + count print('The sum of all multiples of 3 or 5 below ' + str(n) + ' is ' + str(total)) # The answe...
true
b7a90b0ea102d826b194548ac6e6f6427bc92448
pshappyyou/CodingDojang
/main.py
UTF-8
1,607
4
4
[]
no_license
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. # def print_hi(name): # # Use a breakpoint in the code line below to debug your script. # print(f'Hi, {name}') # P...
true
5b12a9974f1f6c550e2c24f5aa0a6647f8b3b611
RaiLinKey/EREMEEV-BSBO-08-17-LAB-PYTHON
/laba1/t3.2.py
UTF-8
595
3.40625
3
[]
no_license
print('\nCalculator Very Lite v0.0.1 pre-pre-alpha\n') n1 = float(input('Введите значение 1: ')) n2 = float(input('Введите значение 2: ')) act = input('Введите действие: ') scope = ['+', '-', '*', '/'] if act in scope: if act == '+': print('Ответ: ', n1 + n2) elif act == '-': print('Ответ: ', n...
true
f8870ca24bccad516624a90263821e53f5a270b0
strombom/Puffin-Pilot-Qualification
/simulator/gate_detector/ellipsoid/main.py
UTF-8
33,737
2.703125
3
[]
no_license
import copy import math import skimage import skimage.morphology import numpy as np import cv2 from scipy import stats from numba import jit, njit, jitclass, int32, float32, float64 ellipse_fitting_threshold = 3.0 def read_image(filename): image = skimage.io.imread(filename) #thresh = skimage.filters.thre...
true
28fc0aaed014db32e374de4d4c70eb75c2c3e88f
swacad/deep-learning-with-python-notebooks
/3.4-movie-review.py
UTF-8
2,843
3.1875
3
[ "MIT" ]
permissive
from keras.datasets import imdb from keras import models, layers import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt def vectorize_sequences(sequences, dimension=10000): """ Convert list of sequences to one-hot vectors that encode a one for every integer in the sequenc...
true
1595e5563d982508776b18a315b15966a0033299
Pav246/SeleniumScripts
/searchGoogle.py
UTF-8
558
2.796875
3
[]
no_license
import time from selenium import webdriver class ChromeDriverWindows(): def searchGoogle(self): driver = webdriver.Chrome(executable_path='D://chromedriver//chromedriver_win32//chromedriver.exe') driver.get("https://google.com") element=driver.find_element_by_id('L2AGLb') ...
true
2f93ea7b58d89fc2b07b80bf3ef09a8fd5db5dfb
AssemSadek/Search-Engine
/Crawler/robots.py
UTF-8
1,387
2.625
3
[]
no_license
''' Created on Mar 19, 2017 @author: Lana Shafik ''' #from urllib.parse import urljoin import robotexclusionrulesparser from urllib.parse import urlparse class robots(): def __init__(self, url): #self.baseUrl = baseUrl self.url = url self.agent = "*" def Is_Allowable(...
true
5253f76a26cd3e8b4729a0b91e0b7890d193b837
liviubrinza/alice
/source_code/FileHandler.py
UTF-8
5,048
3.28125
3
[]
no_license
import pickle from pathlib import Path class FileHandler: # input file containing the training corpus input_training_corpus = "persistent/trainingCorpus.txt" # file containing the stemmed training corpus refined_training_corpus = "persistent/refinedTrainingCorpus.txt" # contains the used lexicon ...
true
a3e616eec0b4c9f34e3256ee59ddc160f51dd7e4
CalebKnight10/CS_260_5
/Binary_Search.py
UTF-8
1,324
4.34375
4
[]
no_license
def binarySearch(alist, item): # From Book if len(alist) == 0: return False else: midpoint = len(alist) // 2 if alist[midpoint] == item: return True else: if item < alist[midpoint]: return binarySearch(alist[:midpoint], item) e...
true
f7ec8a5b4716acbc99bb5d1cdda0b4bab9cc2f51
stasvorosh/pythonintask
/INBa/2015/ORSHONOVA_E_G/task_5_17.py
UTF-8
689
3.71875
4
[ "Apache-2.0" ]
permissive
#Задача 5 Вариант 17. #Напишите программу, которая бы при запуске случайным образом отображала название одной из трех стран, входящих в военно-политический блок "Тройственный союз". #Orshonova. E. G. #23.05.2016 print("Программа выводит на экран одну из трех стран, входящих в военно-политический блок 'Тройственный сою...
true
04da5ad433e706a100e4e45cbc39f173b3e5e686
gerrycfchang/leetcode-python
/tree/level/populate_next_right_in_each_node.py
UTF-8
1,863
4.28125
4
[]
no_license
# 116. Populating Next Right Pointers in Each Node # # Populate each next pointer to point to its next right node. # If there is no next right node, the next pointer should be set to NULL. # # Initially, all next pointers are set to NULL. # # Note: # # You may only use constant extra space. # Recursive approach is...
true
fd770585c16f486a3fe25ba81ab06aa3a2dbca0d
publichamlet/Loan-Calculator
/loan_calculator.py
UTF-8
2,805
3.3125
3
[]
no_license
import argparse import sys from math import ceil from math import floor from math import log def error(count_None, count_neg): if l_p == None: count_None += 1 elif l_p < 0: count_neg += 1 if b.type == None: count_None += 1 if m_p == None: count_None += 1 elif m_p < 0: count_neg += 1 if l_i == N...
true
e6e37de76f868b1f494784800099de0483fc6caa
Top-Q/jsystem-system-objects
/misc/process-montior/process-monitor-so/src/main/resources/scripts/monitor.py
UTF-8
2,479
2.78125
3
[]
no_license
import sys import wmi from optparse import OptionParser from win32api import GetFileVersionInfo, LOWORD, HIWORD if __name__ == '__main__': usageText = "cpu.py [options]\n" + \ "example: python cpu.py -p notepad.exe" parser = OptionParser(usage = usageText) parser.add_option( "-p", ...
true
74babafa77c2ba55705faf3cc04e98bf8b9cba70
vleseg/udacity_webdev_final
/tests/history_tests.py
UTF-8
16,649
2.9375
3
[]
no_license
# coding=utf-8 from datetime import datetime # Internal project imports from base import BaseTestCase class BasicHistoryPageTest(BaseTestCase): def test_there_is_a_history_page_for_every_article(self): # Bob opens MyWiki's homepage. There is a link to the edit history page. homepage = self.testapp...
true
5c64459fa916160ca2977a4c5e352dbc9314a6fd
ilaoda/python
/08_异常/08_4_抛出异常-assert语句.py
UTF-8
396
3.078125
3
[]
no_license
""" assert语句 当用户定义的约束条件不满足的时候,就会出发 AssertionError 异常 assert 是用来手机用户定义的约束条件,而不是捕获内在的程序错误 格式: assert 逻辑表达式, data(可选) 以上格式等同于: if not 逻辑表达式: raise AssertionError(data) """ # a = 0 assert a != 0, "a的值不能为0"
true
92795742c96869cf57f1182f34ddb3faeec825b0
RishitAghera/internship
/python/kindergarten-garden/kindergarten_garden.py
UTF-8
539
3.046875
3
[]
no_license
stud = ["Alice", "Bob", "Charlie", "David", "Eve", "Fred", "Ginny", "Harriet", "Ileana", "Joseph", "Kincaid", "Larry"] plants = {"R": "Radishes", "C" : "Clover", "G" : "Grass", "V" : "Violets"} class Garden: def __init__(self, diagram, students=stud): self.students=sorted(students) self.diagram=dia...
true
412b6c91a654d742649f1efff89fa54cd6f8a576
onnx/onnx
/onnx/reference/reference_evaluator.py
UTF-8
22,092
2.59375
3
[ "Apache-2.0" ]
permissive
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 # pylint: disable=C3001,C0415,R0902,R0912,R0913,R0914,R0915 from io import BytesIO from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np from onnx import load from onnx.defs import onnx_opset_version from onnx.on...
true
74d5affbc3996fd1119d0c0fd891e4547135d4b0
sebaxtian/twitter-data-collection
/src/colombia_covid_19_pipe.py
UTF-8
17,304
2.53125
3
[ "MIT" ]
permissive
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load i...
true
077f897c9f6c06ac6acbf650ad9924ec33400ccb
mxbi/mlcrate
/mlcrate/xgb.py
UTF-8
6,859
3.015625
3
[ "MIT" ]
permissive
import os from .time import Timer def get_importances(model, features): """Get XGBoost feature importances from an xgboost model and list of features. Keyword arguments: model -- a trained xgboost.Booster object features -- a list of feature names corresponding to the features the model was trained on...
true
760c8a7bcf06764fc20a3b81b81e054cfccae325
pker98/HappyWheels
/Services/car_men_valid.py
UTF-8
1,903
3.859375
4
[]
no_license
import os def check_type_option(choice): if choice in ["a", "b", "c"]: return choice else: return "" def check_car_option(car_input,stage): if car_input in ["1","2","3","a","b","c"]: stage = 1 return car_input, stage else: stage = 0 return "", stage ...
true
2a61004f5d3980599cbf5826c42436a3d1c5b0c9
manoharp/algo
/merge_interval.py
UTF-8
930
3.109375
3
[ "Apache-2.0" ]
permissive
from collections import namedtuple Point = namedtuple('Point', ['start', 'end', 'contains']) class Stack(list): def peek(self): return list.__getitem__(self, -1) a = [(1,4), (5,9), (2,4), (7,10), (6,80)] a = sorted(a, key=lambda x:x[0]) results = [] s = Stack() # Initalize the stack with the first element _start...
true
528fc958f4b31d732008ea03fcd3fb413c10b229
rxqx/my_fmriworkshop
/prepro.py
UTF-8
1,589
2.828125
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Dec 12 10:54:15 2017 @author: rx """ import glob import os #import shutil import pdb #Set the path to the data def prepro(basedir): for item in glob.glob(os.path.join(basedir,'sub-*','func','sub-*_task-bart_bold.nii.gz')): input=item ...
true
5cbad9f8c9946e6ca48505a3ef2eab69333bc371
Kroonjay/Dealify
/core/utils/location_utils.py
UTF-8
2,043
2.796875
3
[]
no_license
import logging import re from pydantic import BaseModel, ValidationError from geopy.geocoders import Nominatim from core.configs.config import DEALIFY_NOMINATIM_USER_AGENT def parse_price(source_price): if not source_price: return None out_price = ''.join(i for i in source_price if i.isalnum()) ...
true
983d3c29a036891f74b16e5f97f2fc8c5ca61919
zacharydewittafs/SARF-Population
/sarf_automator.py
UTF-8
12,298
3.03125
3
[]
no_license
from pdf_filler import PdfFileFiller import pandas as pd import os import shutil import sys def main(): print('Starting process...') #Local directory the SARF template is located sarf_template_path = 'SARF_Template/' #Local directory the completed P&P file(s) is located user_data_path = 'P&P_File...
true
32f52f426a7321b0dec096419b50f0b843cd2066
edsonlage/meuteste
/cadastro.py
UTF-8
642
3.015625
3
[]
no_license
from PySimpleGUI import PySimpleGUI as sg # Layout sg.theme('Reddit') Layout = [ [sg. Text('usuario'),sg.Input(key='usuario',size=(20,1))], [sg.Text('Senha'),sg.Input(key='senha',password_char='*',size=(20,1))], [sg.Checkbox('salvar o login?')], [sg.Button('ENTRAR')] ] # Janela janela = sg....
true
04a8cb6ee08324208e4747bcd6955d9d0aaef21d
ckqqqq/my-python-scripts
/img2txt.py
UTF-8
1,357
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- from PIL import Image CHAR_PIX_LIST = ['M', '&', 'D', 'n', '1', '+', ',', ' '] GAP = 256 / len(CHAR_PIX_LIST) class Img2txt: def __init__(self, src, resize=0.7): self.src = src img = Image.open(src) if img.mode == 'P' or img.mode == 'RGBA': im = Image.n...
true
18a7e75d5f4978a9ea4571fa157a7c3c382942bf
TylerSandman/mopy
/mopy/impl/dvonn/action.py
UTF-8
1,340
3.328125
3
[ "MIT" ]
permissive
"""This module contains a representation of an action in the game Dvonn.""" from mopy.action import Action from enum import Enum class DvonnAction(Action): class Type(Enum): PLACE = 1 MOVE = 2 def __init__(self, type_, end, start=None): """ Create an action rep...
true
fa2552a92fa2b7487fc97dc5e535e4672560411c
susan101566/algorithms
/advent_of_code_2020/7/day7.py
UTF-8
915
3.125
3
[]
no_license
# https://adventofcode.com/2020/day/7 # each bag contains many other bags. How many bags will you end up with starting from 'gold bag' import parse from collections import defaultdict # f = open('input.txt', 'r') f = open('input.txt', 'r') d = defaultdict(list) for parent, children in map(lambda x: x.replace("bags", ...
true
a6014f2f04a64dcd3511f49331af9d9dcacefbfc
srinaveendesu/Programs
/amazon_sdet.py
UTF-8
2,528
3.5
4
[]
no_license
## AMAZON SDET INTERVIEW ROUND 1 ## //Given an analouge clock time, Can you find the bigger angle? ## //Example time : 03:00, Bigger angle is 270 Deg ## ##min hand = 360 - (6 * min) ##hrs hand = 360 - (30 * hrs) ## ## ##H = 360 - (3 * 30) = 270 ##M = 360 - (6 * 0) = 36360 ## ##H - M = (360 - 36270) ## ##res ...
true
7f75dfda40630fa4458be6e2ee161de003f5d9b2
cash2one/xai
/xai/brain/wordbase/nouns/_timber.py
UTF-8
457
2.5625
3
[ "MIT" ]
permissive
#calss header class _TIMBER(): def __init__(self,): self.name = "TIMBER" self.definitions = [u'trees that are grown so that the wood from them can be used for building: ', u'wood used for building: ', u'a long piece of wood used for building, especially houses and ships: '] self.parents = [] self.childen =...
true
5ee521a4ed993a7f74b4ad13fc4c95d40e8b1e21
EhODavi/curso-python
/exercicios-secao07-parte2/exercicio01.py
UTF-8
442
4.0625
4
[ "MIT" ]
permissive
matriz = [] quantidade_maior = 0 for i in range(4): matriz.append([]) for j in range(4): numero = int(input('Informe um número: ')) matriz[i].append(numero) if numero > 10: quantidade_maior = quantidade_maior + 1 print('\nMatriz:\n') for i in range(4): for j in range...
true
150056bf37b91ae1c8564b297790eb859201628c
liyunrui/data_science_micro_service
/src/utils.py
UTF-8
796
3.34375
3
[]
no_license
def remove_delimiter(text): text = text.replace('\n', '') return text def remove_separator(text): text = text.replace('\r', '') return text def remove_empty(text): text = text.strip() return text def remove_two_spaces(text): text = text.replace(" ", " ") return text def remove_three...
true
1bf442c3b9b38e4cce2ea6eb8d8366255eb8b6d6
Aasthaengg/IBMdataset
/Python_codes/p03244/s085016826.py
UTF-8
466
2.734375
3
[]
no_license
import collections N=int(input()) V=list(map(int,input().split())) l=N//2 V_odd=[] V_eve=[] for i in range(N): if i%2==0: V_odd.append(V[i]) else: V_eve.append(V[i]) p_odd = list(collections.Counter(V_odd).most_common()) p_eve = list(collections.Counter(V_eve).most_common()) p_odd.append([0,0]) p_eve.appen...
true
dc262d47b926a344526fe7220edf20ad56efe932
imaopaopao/wordcloud
/stone.py
UTF-8
1,309
2.859375
3
[]
no_license
## English wordcloud import os currentpath= os.getcwd() filename= "China.txt" mytext=open(filename).read() from wordcloud import WordCloud wordcloud=WordCloud().generate(mytext) import matplotlib.pyplot as plt plt.imshow(wordcloud,interpolation='bilinear') plt.axis ("off") #Chinese wordcloud import os ...
true
6f87c72976ebb576c64a1d1956135f3dbfaceb8e
rmatsum836/gmso
/gmso/core/forcefield.py
UTF-8
6,702
2.734375
3
[ "MIT" ]
permissive
from lxml import etree from gmso.utils.ff_utils import (validate, parse_ff_metadata, parse_ff_atomtypes, parse_ff_connection_types) class ForceField(object): """A generic implementation of the forcefield class. ...
true
675a9ec957c2dace83511a3ca286d3000e17a515
juanma-rm/CamPong
/GUI_Bat.py
UTF-8
5,390
3.046875
3
[]
no_license
# ------------------------------------------ # DESCRIPTION OF MODULE # ------------------------------------------ """ Bat class Inherits from Mobile_Object - The image is a rectangle - Init, update and detect_other_obj_hit methods are overriden Bats can only move in vertical Y axis Collisions: - Top or b...
true
7a3e6957504233de10ea7bf5af784150e19ecfc5
msternke/UEFA-Euro-2021-sim
/Group.py
UTF-8
1,957
3.484375
3
[]
no_license
from itertools import combinations from Match import Match class Group(object): def __init__(self, name, teams): self.name = name self.teams = teams def play_group(self): ''' Runs the simluations for all games in the group ''' #Instantiate all games in the...
true
8c5cbbb20741c88847a016724c1240484910de09
pivovard/ZCU
/IR/lang-detect/lang_detector.py
UTF-8
10,251
2.84375
3
[]
no_license
import os import pickle import numpy as np import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix from sklearn.metrics import precision_s...
true
5c72935f22425246feaa503af5491804f4d8cb93
robertorenesc/promidat_ml
/docs/module_3/week_4/homework/src/svm/CustomSVM.py
UTF-8
2,389
3.03125
3
[]
no_license
import ipyvolume as ipv import pandas as pd import numpy as np from sklearn.svm import SVC class CustomSVM: def __init__(self, data:pd.DataFrame): self.__data = data self.__X = None self.__Y = None self.__clf = None def build_model(self): variable_predict = "color" ...
true
51e31db569419b1c67a39c8bb69ca3b91f466bdf
pykwok/Pytorch_CV_Models_from_Scratsh
/YOLOv3_from_Scratch/loss.py
UTF-8
4,622
3.015625
3
[]
no_license
import torch import torch.nn as nn from utils import intersection_over_union ''' 在YOLOv3中,Loss分为三个部分: 1. `lbox`:[回归] - **bounding box regression**损失。 回归loss会乘以一个`(2 - w x h)`的比例系数,用来加大对小box的损失 - loss_x = **self.mse_loss**(x[obj_mask], tx[obj_mask]) - loss_y = **self.mse_loss**(y[obj_mask], ty[obj_mask]) ...
true
f867d842993fb6eb76cd945404ba92e90f010540
alexpron/article_central_sulcus_connectivity
/scripts/pipeline/e_drawing_landmarks/c_gyri/a_clean_gyral_crests.py
UTF-8
2,499
2.609375
3
[]
no_license
import numpy as np from soma import aims from libs.lines import clean_line, normalized_curv_parametrisation from libs.tools.aims.meshes.processing import vertices_to_2d_line from configuration.configuration import ( SUBJ_LIST, SIDES, GYRI, MESHES, GYRAL_CRESTS, GYRAL_PARAMETRISATIONS, ) if __na...
true
19156d9fff3f178084d8f7fccf6f7a3991b99f7e
mircum/machine_learning
/linear_regression/test.py
UTF-8
529
3.40625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # load data filename = "data_1d.csv" raw_data = open(filename, 'rt') data = np.loadtxt(raw_data, delimiter=",") # get the X and Y array X, Y = np.split(data, [-1], axis=1) X = np.asarray(X).reshape(-1) Y = np.asarray(Y).reshape(-1) # calculate linear regressions d...
true
6dde19f0b8aa396005945ae212da918f436214e0
cgebbe/kaggle_predict_future_sales
/data.py
UTF-8
11,818
3.0625
3
[]
no_license
""" Defines train and valid dataset. Computes all features. """ import logging import pandas as pd import tqdm import numpy as np import utils import pickle logger = logging.getLogger(__name__) def generate(sparsify_by=1, use_cache=False): """ Generates the train, valid and test data including features ...
true
47d3a808f04542cf6aaee24cc75b6ddd3ac78927
tsuday/GAN
/Predictor.py
UTF-8
1,993
2.71875
3
[ "MIT" ]
permissive
### Predictor %matplotlib inline import matplotlib.pyplot as plt print("Predictor Start") # function to draw image def draw_image(image_list, caption_list, batch_size, width, height): num_image = len(image_list) for i in range(num_image): image_list[i] = image_list[i].reshape((batch_size, width, heig...
true
35bf063422e6fa4bb969b55bcde0db9f4cbc5dc2
Stanleygoo/pyneng-examples-exercises
/exercises/19_ssh_telnet/task_19_2c.py
UTF-8
1,132
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Задание 19.2c Переделать функцию send_config_commands из задания 19.2b Если при выполнении команды возникла ошибка, спросить пользователя надо ли выполнять остальные команды. Варианты ответа [y]/n: * y - выполнять остальные команды (значение по умолчанию) * n - не выполнять остальные ком...
true
4f9bcf607c60a7382af2faa597bcbb46d1ebbe90
feltnerm/Schoolwork
/set_theory/cs363/assignments/assignment2.py
UTF-8
1,166
2.796875
3
[]
no_license
#!/usr/bin/env python from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, ForeignKey, DateTime, String engine = create_engine('sqlite:///:memory:', echo=True) Base = declarative_base() class Hotel(Base): __tablename__ = 'hotel'...
true
a5f895706db95d0c86ac20fa16da8ce408ae7a43
thealtruisticphilosopher/edX-Python
/final_exam.py
UTF-8
10,978
4.03125
4
[]
no_license
#Problem 3 - Convert number to mandarin def convert_to_mandarin(us_num): ''' us_num, a string representing a US number 0 to 99 returns the string mandarin representation of us_num For numbers 11-19, the number is pronounced as "ten digit", so for example, 16 would be pronounced (using Mandarin)...
true
c239c6deb0e7613c97d7963d168892b0a93f3409
lufercadic/Tests
/Hanne/Main.py
UTF-8
422
3.0625
3
[]
no_license
# coding: utf8 import sys # Procedimiento principal, punto de inicio de la aplicacion def Main(args): print("Hola") print("") print("Ejecutar el archivo 'Servidor.py'") print(" - Inicia el serividor. solo una vez") print("") print("Ejecutar el archivo 'Cliente.py'") print(" - Conecta un cli...
true
c470c9a912875a1e76246c478c1d91ca9b64048e
xzeck/CodeRepo
/pickle_ex.py
UTF-8
1,065
3.421875
3
[]
no_license
import pickle import os path = os.path.dirname(os.path.abspath(__file__)) class Student: def __init__(self,id, name, division, department): self.id = id self.name = name self.division = division self.department = department def display(self): print("\nID : {}\...
true
2ff6a041d2d9a528d3fc2b57ef9208a6547408b9
febacc103/febacc103
/oop/inheritance/inheritance.py
UTF-8
886
3.953125
4
[]
no_license
#single inheritance #------------------- # class Parent: #base class # parent_name="Arun" # def m1(self,age): # self.age=age # print("my name is",Parent.parent_name) # print(self.age) # # class child(Parent) : #derived class is child class # def m2(self,cage): ...
true
e620c09b37b12ef7cd37cf7473a1dc7a95ad4901
Penk13/Tkinter-project
/NumberGuessing.py
UTF-8
934
3.875
4
[]
no_license
from tkinter import * import random root = Tk() root.title("Number Guessing") root.geometry("500x500") key = random.randint(0,100) #Function def submit(): try: int(guess.get()) if guess.get() == key: print("You Win!") elif guess.get() < key: print("It is higher th...
true
235c52d147bc349ecc3d6e09100a01fc174f1097
ryanc414/euler
/src/py_utils/iterable_nums.py
UTF-8
1,157
4.25
4
[]
no_license
#!/usr/bin/env python3 """ Provides a class that allows iteration through digits in a number. """ class IterableInt(object): """ Provide iteration through an integer's digits, as well as direct access via the .digits property. Arithmetic functions which return integers remain iterable. """ def...
true
ef621a834a6a1fd6c3846c30ee536d691276abda
toofar/pmail
/pmail
UTF-8
24,697
2.609375
3
[ "Zlib" ]
permissive
#!/usr/bin/env python from __future__ import with_statement """ pmail -- command line SMTP interface. You can feed pmail a pre-constructed email message on stdin. You can also specify any relevant header values on the command line. Anything on the command line takes precedence over values in pmailrc (or on stdin in t...
true
6a03ee105000cc2f29eccfc7dab32fe208677a18
quaterneon/practice
/8_4.py
UTF-8
1,112
3.96875
4
[]
no_license
""" 8.4 Power Set """ test_cases = [{'a', 'b'}, {'a', 'b', 'c'}, {'a', 'b', 'c', 'd'}] def build_sets(case): """ O(n*2^n). For each item iter over sets we've built so far. :param case: :return: """ sets = [set()] for item in case: new_sets = [] for ps in sets: ...
true
2adac809d16da082362148b3c24d5675dd3d0df0
piotti/robot-control
/ble/gui.py
UTF-8
7,405
2.796875
3
[]
no_license
from Tkinter import * import tkMessageBox as messagebox import client DEFAULT_PORT = 'COM19' class CharacteristicDisplay: def __init__(self, master, char, idx, reactor_display): self.master = master self.char = char self.idx = idx self.reactor_display = reactor_display def ...
true
366c885f0a4bcf1be17e2860d6aa6e3946a39335
p-schlickmann/word-finder
/main.py
UTF-8
1,474
3.546875
4
[]
no_license
cross_words = [ ['A', 'V', 'E', 'T', 'O'], ['A', 'B', 'C', 'D', 'E'], ['C', 'B', 'C', 'D', 'E'], ['O', 'B', 'C', 'D', 'E'], ['R', 'B', 'C', 'D', 'E'], ['N', 'B', 'C', 'D', 'E'], ['O', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D', ...
true
7791460b9ebbae18194dcd4226a91a61fbb862c2
nidi3/project-euler
/project-euler/cont_frac.py
UTF-8
667
2.875
3
[]
no_license
def eval_cont_frac(n, coeff): a = 1 b = coeff(n) for x in xrange(n - 1, 0, -1): a, b = b, a + coeff(x) * b return [a + coeff(0) * b, b] def cont_frac_of_root(q): from math import floor, sqrt s = set() r = sqrt(q) a = 1 b = floor(r) l = [int(b)] if b != r: w...
true
83ce8d2bed56170f9f1f552f8a96573c7d9b5ad1
yxfcodeup/PloyoAlgorithm
/python/search/binarySearch.py
UTF-8
1,235
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- """ Name: Version: Author: Ployo Wiself Language: Python 3.6.0 Start time: 2017-10-10 11:00 Description: Input: a sequence of n numbers {a1 , a2 , a3 , ... , an}. Output: a permutation(reordering) {b1 , b2 , b3 , ... , bn} of the input sequence such that b1 <= b2 <=...
true
26c8e707aec89b54a38dd6803ef394cbb708c164
peterchen94/healthcare_ds_challenge
/utils.py
UTF-8
5,704
3.03125
3
[]
no_license
import pandas as pd import numpy as np import os import matplotlib.pyplot as plt from sklearn.model_selection import learning_curve def extract_unique_time_params(file_list, file_dir, params_col, non_time_params): ''' get list of unique parameters that represents the union of parameters from all patients measu...
true
218b4bc76c733af29a3b0d7ff5cc3007f35d5789
Gawmoon/Programowanie-w-jezyku-Python-i-Bash
/Ex_1_c.py
UTF-8
213
3.59375
4
[]
no_license
#!/usr/bin/env python set_password = input('Set your password') read_password = input('Tell the password you set') if(set_password != read_password): print('Wrong password') else: print('Accept')
true
2a1eed3f1945f7405d5efae4815b91a541a986cc
zinsmatt/Programming
/CodeForces/1201B-Zero_Array.py
UTF-8
162
2.890625
3
[]
no_license
n = int(input()) a = sorted(list(map(int, input().split()))) maxi = max(a) s = sum(a) if s % 2 == 0 and maxi <= s - maxi: print("YES") else: print("NO")
true
c65e87cda8beb88054da7104be59bc9f201d604f
isheerin/GelberQuantInterview
/test_minimax.py
UTF-8
1,794
3.390625
3
[]
no_license
# Iain Sheerin # 1/21/19 # CS76 HW3 import chess from RandomAI import RandomAI from HumanPlayer import HumanPlayer from MinimaxAI import MinimaxAI # from AlphaBetaAI import AlphaBetaAI from ChessGame import ChessGame player1 = MinimaxAI(4, True, True) player2 = HumanPlayer() # Example 1, AI has mate in one as white g...
true
f6b2d66a8824343d6bc83c34318f437424958290
zcnewt/common
/monkeygen.py
UTF-8
1,016
2.9375
3
[]
no_license
#!/usr/bin/python import random import datetime import time def numToChar(x): return { 1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v'...
true
a824f422d561d43f80a61996b0cf872b8e8427f7
angelamin/Machine-Learning
/algorithm-realization/DCT/DCT.py
UTF-8
4,925
2.71875
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 import os import math import sys tmp = [ [17,18,24,47,99,99,99,99], [18,21,26,66,99,99,99,99], [24,26,56,99,99,99,99,99], [47,66,99,99,99,99,99,99], [99,99,99,99,99,99,99,99], [99,99,99,99,99,99,99,99], [99,99,99,99,99,99,99,99], [99,99,99,99,99,99,...
true
0fb01dcca2a5ff7f52d3d7b2d5ecda12fee3e73c
AK-1121/code_extraction
/python/python_2807.py
UTF-8
109
3.34375
3
[]
no_license
# python - list operations &gt;&gt;&gt; l = [4, 5, 12, 0, 3, 7] &gt;&gt;&gt; min(x for x in l if x &gt; 5) 7
true
d51b682c23983e61d5fd2c8a74ac0692d0ffe408
ShangQingTu/SQuAD_Bert_QA
/evaluate.py
UTF-8
2,261
2.78125
3
[]
no_license
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction from train import get_processed_features import os from tqdm import tqdm import argparse import json def get_bleu_score(src, tgt): smooth = SmoothingFunction() # default setting is BLEU-4 score score = sentence_bleu([src], tgt, smoothi...
true
73ebb3b5b6edc7e13a2c6e981587c06c6f6844db
github-solar/pyworks-eduwill
/ch01/py01-07char.py
UTF-8
702
4.3125
4
[]
no_license
#다양한 문자 표현 이스케이프문자.... print("이름\t나이\t지역") print("이순신\t40\t전남") #문자열 안에 인용부호(작은, 큰 따옴표) 포함할 때 sentence = "'힘내세요!' 라고 말했습니다." print(sentence) say = '"Python is very easy." He says.' print(say) print("'배가 고프다' 라고 생각했습니다.") print("\'배가 고프다\' 라고 생각했습니다.") #여러줄로 문자열 출력하기 song1 =''' 동해물과 백두산이 마르고 닳도록 하는님이 보우하사 우리나라 만세 '...
true
fce32e3a6c06c5cdd01be9d8fd1b7129fe988b18
parra320/Python
/TareaTony.py
UTF-8
4,797
3.578125
4
[]
no_license
#Programa que permita calcular la presencia en las redes AbrirArchivo= open("presenciaderedes.csv", "r") Contenido= AbrirArchivo.readlines() AbrirArchivo.close() valor=[] valor.append(Contenido[3]) print(type(valor)) print("\n\t¿Que operación quiere realizar?: ") print("1)Calcular diferencia de cierto aspecto comp...
true
8573ef0e3e49278d12a4fef2d3c9fa016f8005de
robertjankowski/stochastic-predator-prey
/plot_results.py
UTF-8
7,953
2.734375
3
[]
no_license
import argparse import glob import matplotlib.pyplot as plt import numpy as np import pandas as pd from matplotlib import animation, rcParams, cycler cmap = plt.cm.jet def get_files_from(folder: str): files = glob.glob(folder + "/*.csv") if not files: print(f"Cannot load files from: [{folder}]. Folde...
true
938fa8172baf01709a2c2e7314fc576019740d3c
Aasthaengg/IBMdataset
/Python_codes/p02831/s100674767.py
UTF-8
78
3.03125
3
[]
no_license
A,B=map(int,input().split()) import math a=math.gcd(A,B) ans=A*B//a print(ans)
true
415c4029958d2e0a32df3e98e79849aa9348ae6d
AdnanMahida/FlaskWebService
/main.py
UTF-8
2,580
2.5625
3
[]
no_license
#created by AdnanMahida import pymysql #for mysql client from app import app #init from db_config import mysql #config details from flask import jsonify #restful module from flask import flash, request #resquest module from flask_restful import reqparse @app.route('/') def index(): return jsonify( {'isworking':'t...
true
180aa4359a296fd5fe99f46533b4bb3f037a94cc
vald3nir/Python-Flask-Demo
/src/db/entities.py
UTF-8
1,094
2.59375
3
[]
no_license
# -------------------------------------------------------------------------- class ObjectDTO: def __init__(self, created_at=None) -> None: self.created_at = created_at def to_json(self): return {"created_at": self.created_at} def __str__(self) -> str: return str(self.to_json()) ...
true
8dc7ba77794277234a45d2257394b0a009890412
DiCarloLab-Delft/PycQED_py3
/pycqed/instrument_drivers/virtual_instruments/instrument_monitor.py
UTF-8
2,384
2.515625
3
[ "MIT" ]
permissive
import time import PyQt5 import pyqtgraph as pg import pyqtgraph.multiprocess as pgmp from qcodes.instrument.base import Instrument from qcodes.utils import validators as vals from qcodes.instrument.parameter import ManualParameter class InstrumentMonitor(Instrument): """ Creates a pyqtgraph widget that disp...
true
1b3df3ac892db46a8b7884573295245ce165f279
seceast/PyProjects
/zhijieketang/chapter8/ch8.2.1.py
UTF-8
156
3.1875
3
[]
no_license
# coding=utf-8 # 代码文件:chapter8/ch8.2.1.py i = 0 while i * i < 100_000: i += 1 print("i = {0}".format(i)) print("i * i = {0}".format(i * i))
true
c1c482f541593940e4bd16863310da79f8f81781
dosatos/LeetCode
/Medium/ll_add_two_numbers.py
UTF-8
1,226
3.984375
4
[]
no_license
""" Percentile: We are given with two linked lists, each node of which represents a digit of a number the digits are represented in the reverse order problem: to add the two numbers (consisting of the digits) Clarification questions: - How big is N (number)? - A value of a node is 0-9? - How important is it to take c...
true
523e36518f59b4dc349eb239d30932815c25e3d1
mrpolyonymous/adventofcode2020
/day9.py
UTF-8
2,407
4.09375
4
[ "Apache-2.0" ]
permissive
def read_input(): xmas_code = [] with open('day9_input.txt') as input_file: for line in input_file: line = line.strip() xmas_code.append( int(line) ) return xmas_code # find the first number in the list (after the preamble) which is not # the sum of two of the 25 numbers b...
true
2302227aa95d762d137d56a01702b992df6bccc4
thundertonic/Will-of-the-Alpha-Python
/wotapy/objects/signal.py
UTF-8
1,323
3.234375
3
[ "Apache-2.0" ]
permissive
from abc import ABC, abstractmethod class Signal(ABC): """ An abstract game object that is broadcasted by properties within and across Actors. It is listened for by properties. It can contain required fields to carry additional data, such as how much damage is dealt, etc. Constructor: ``` def ...
true
52e34a1a12021516cc82984faa7aca927a5902f5
owlish123/Python
/Class1/python_note.py
UTF-8
17,121
4.0625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jan 03 16:15:04 2020 @author: 86152 """ ##加速度的程序 #v0 = input('The starting velocity is:' ) #v1 = input('The ending velocity is:' ) #t = input('The time span is:' ) #formula = (v1-v0)/t #print 'The average velocity is: ', formula ##加速度程序的优化版本 #def acceleration(v0, v1,...
true
2d23df307a19d267c266b19101415cf2566003bb
EthanShapiro/PythonForDataScience
/Pandas/DataFramesPart1.py
UTF-8
591
3.625
4
[]
no_license
import numpy as np import pandas as pd from numpy.random import randn np.random.seed(101) # To get the same random numbers df = pd.DataFrame(randn(5,4), ['A', 'B', 'C', 'D', 'E'], ['W', 'X', 'Y', 'Z']) print(df) print(df['W']) print(df.W) # Don't use this print(df[['W', 'Y']]) df['new'] = df['W'] + df['Y'] print(...
true
5551e1bc7a253796745de420eff87dee31a12e48
isabella0428/Leetcode
/python/66.py
UTF-8
533
2.828125
3
[]
no_license
class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ count = 0 for i in range(len(digits) - 1, -1, -1): if i == len(digits) - 1: digits[i] += 1 count, digits[i] = divmod(digits[i] + count,...
true
09b4f4e5e385979b9d1a6dab85168ed4b8cec025
cschu/stag
/bin/check_create_db_input_files.py
UTF-8
21,018
2.921875
3
[]
no_license
""" Scripts that checks the input files for the database """ import sys import os import subprocess import tempfile import shlex # there are two input files to check: # - the taxonomy file # - the fasta file class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[9...
true
c0da645307f0f939cddd4667d3be88dd8de03d6f
Tech-closet/user_id_generator
/app.py
UTF-8
2,108
2.6875
3
[]
no_license
## This program generates a random user id and sends it in json format ## for it to be saved in Firebase in the document of the user. import mongo_read from flask import Flask, request, redirect, jsonify import random import os from flask_pymongo import pymongo # import html_gen import datetime, time try: ...
true
31586faf52f48af5b13ee62a67a77daa562623a5
TERADA-DANTE/algorithm
/python/codeup/solved/_1029.py
UTF-8
39
2.59375
3
[]
no_license
a = input() print('%.11f' % float(a))
true
63b3f530bafae48bc1662d7a8b17dd6f166ab18b
paintception/ZeroAccuracySystems
/preprocess_otsu.py
UTF-8
509
2.625
3
[]
no_license
import cv2 from PIL import Image import time import os def otsufy_pillow_image(image): file_path = "tmp" + str(int(time.time()*1000000)) + ".png" image.save(file_path) otsufy_file(file_path) image = Image.open(file_path) image.load() os.remove(file_path) return image def otsufy_file(file_p...
true
04cd0127beaa033855a15b8f4dc4c29d4a209865
Ian19420/reviews_analytics
/read.py
UTF-8
751
3.625
4
[]
no_license
data = [] count = 0 with open('reviews.txt') as f: for line in f: data.append(line) count += 1 if count % 1000 == 0: print(len(data)) print(f'檔案讀取完了,總共有{len(data)}筆資料') sum_len = 0 for d in data: sum_len += len(d) print(f'留言平均長度為:{sum_len/len(data)}') new = [] for d in data: if len(d) < 100: new.append...
true
aeaa11b78df826a2060efebeaf549da50ff3bdc0
ghomsy/makani
/analysis/util/simdata_analysis/simdata.py
UTF-8
12,968
2.625
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
true
7308efd0bf3aad6ee21843623ab41d65cee5db2f
17021084/Data-visualization-Kaggle
/data_visualization/ass2.py
UTF-8
925
3.4375
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns dt = pd.read_csv("pokemon_ass.csv") print ( dt.head(10)) # # value_counts số lần xuất hiện của các giá trị trong 1 cột # print ( " value_counts trả về số lần xuất hiện của các giá tri\n" , dt.Total.value_counts().head(10)) # print ( " des...
true
3f8c4282187c86dbaa65c831d2ea10bb082ddfc5
sevenqwl/PythonProjects
/Learning/Python12期/day10/redis_cli.py
UTF-8
3,393
2.953125
3
[]
no_license
import redis ''' r = redis.Redis(host='127.0.0.1') # print(r.keys()) # all_keys = r.keys() # for k in all_keys: # print(k, r.get(k.decode())) r.set("Name", "ChunYun", ex=3) # 3秒过期 print(r.get("Name")) ''' # 连接池 pool = redis.ConnectionPool(host="127.0.0.1") r = redis.Redis(connection_pool=pool) # print(r.keys(...
true
453b9c15ccff7ac903fcfdd5ba51cdcde0944c49
itgoyo/Learn
/python/老男孩笔记/Python全栈/大作业/计算器.py
UTF-8
1,597
3.9375
4
[]
no_license
import re # '3+4' '5*6' '2-5' '5/2' # 写函数 计算小字符串的结果 def atom_cal(exp): # 原子 if '*' in exp: a,b = exp.split('*') return str(float(a) * float(b)) elif "/" in exp: a,b = exp.split('/') return str(float(a) / float(b)) # 格式化输出 def format_exp(exp): exp = exp.replace('--','+') e...
true
6eb3a077f4335058fd3b350c84766657c3b0afaf
syedalihashmi/Web-Mobile-App-Development
/Full-Stack-Developement/todoapp_fetch/app.py
UTF-8
2,885
2.578125
3
[]
no_license
from flask import Flask,render_template, request, redirect, url_for, jsonify,abort from flask_sqlalchemy import SQLAlchemy import sys from flask_migrate import Migrate app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:12345678@127.0.0.1:5432/todoapp' app.config['SQLALCHEMY_TRACK_MODI...
true
08487ed1763c2c4795488c7961f93be136f96dfb
dorukan06/OkulOdevleri
/Python/İnsertionSort.py
UTF-8
423
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- import time n = int(input("how many numbers to enter?")) array = [] a = time.time() for x in range (n): array.append(int(input())) for i in range(len(array)): temp = array[i] j = i-1 while j >=0 and temp < array[j] : array[j+1] = array[j] j = j ...
true
1b4ff501a08d04f66bdaa8fc7943dbf6065ac146
guofei9987/leetcode_python
/solved/[171][Excel Sheet Column Number][Easy].py
UTF-8
257
3.0625
3
[]
no_license
# https://leetcode.com/problems/excel-sheet-column-number class Solution: def titleToNumber(self, s): """ :type s: str :rtype: int """ num = 0 for i in s: num = num * 26 + (ord(i) - 64) return num
true
20756d210928c6424c3d6f939dc054f8660360e8
Vasili1990/Rock_Paper_Scissors
/task_management/main.py
UTF-8
176
3.078125
3
[]
no_license
# x = input("add task Name: ") # y = input("add deadline date (Day/Month/Year): ") # tasks = {} import datetime print(datetime.date(2020, 11, 5)) # print(tasks) # print(y)
true
ae0eb629a5db5a25aff989b913b3eabf64f4fba7
Aswin1210/Simple-Server-Client-UDP-protocol-
/MANICKAM_PROJECTPHASE_UDP/AswinManickam_SourceCode_PROJECTphase3/Send_Receive.py
UTF-8
6,145
3
3
[]
no_license
from Globals import * import Functions '''This function is the basically the client's RDT function to send the file.''' def RdtSendPkt(udp_sock,addr,seq_nmbr,data,E_Prob=0): send_successful = 0 #send_sucessful is set to '0' initially packet = Functions.MakeP...
true
85cc8d8dd681fde27ad14e1e7d997e0479ccd6d7
sainihimanshu1999/Arrays-LeetCode
/DuplicateNumber.py
UTF-8
191
2.890625
3
[]
no_license
def findDuplicate(self, nums): dic = {} for num in nums: dic[num] = dic.get(num,0)+1 for key,value in dic.items(): if value>1: return key
true
dca51a4425d91cfd8f11aa6cbd7e6957780ea972
lakshay451/Deep-Neural-Networks-with-PyTorch
/Week 5/Dropout in Regression.py
UTF-8
5,268
3.359375
3
[]
no_license
""" Comparing Neural Network Dropout vs Non in Regression """ # In[1] Imports import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset # In[2] Creating Data class Data(Dataset): # Constructor def __init__(self, ...
true
14e8a6d96e215a19be2b63166447bc3dd15b7b98
shaynababe/gpfit
/gpfit/tests/test_print_fit.py
UTF-8
2,259
3.015625
3
[ "MIT" ]
permissive
"""unit tests for printing functionality""" import unittest import numpy as np from gpfit.fit import MaxAffine, SoftmaxAffine, ImplicitSoftmaxAffine A = np.array([2, 3, 4, 6, 7, 8, 10, 11, 12]) B = np.array([1, 5, 9]) ALPHA = np.array([1/13, 1/14, 1/15]) DIM = 3 K = 3 class TestPrintFit(unittest.TestCase): "Unit...
true
08cb1370930a767f3fe9e062d6697115e8498bd5
XpFlyAK/PythonTest
/作业1-昕昕网络教程【www.xinxin2018.com】.py
UTF-8
4,171
3.359375
3
[]
no_license
# coding: utf-8 import socket import ssl """ 2017/02/16 作业 1 资料: 在 Python3 中,bytes 和 str 的互相转换方式是 str.encode('utf-8') bytes.decode('utf-8') send 函数的参数和 recv 函数的返回值都是 bytes 类型 其他请参考上课内容, 不懂在群里发问, 不要憋着 """ # 1 # 补全函数 def protocol_of_url(url): protocol = 'http' if url[:7] == 'http://': protocol = 'h...
true
3893a06dc590cd4c86e969265e34126ceacde305
gitddabong/Algorithm_python
/chap4_implementation/time.py
UTF-8
716
3.4375
3
[]
no_license
n = int(input()) cnt = 0 list_for =[] for i in range(n+1): for j in range(60): for k in range(60): if '3' in str(i) + str(j) + str(k): cnt += 1 list_for.append([i, j, k]) print(cnt) list_while = [] hour = 0 min = 0 sec = 0 cnt = 0 while True: if n == hou...
true
0f47d7d958b27e16c3629ff57fa165a4cde96b12
bgenchel/MIDI-Autoencoder
/autoencoder/src/dataloaders.py
UTF-8
1,150
3.078125
3
[]
no_license
import numpy as np from torch.utils.data import DataLoader class MHDataLoader(DataLoader): """ DataLoader class for raw audio music performance assessment data """ def __init__(self, dataset, num_data_points=None,): """ Initializes the class, defines the number of batches and other pa...
true