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
324dc707f1970b0c7bf1195f1fc6fc6660d10755
ethyl2/Data-Structures
/queue_and_stack/dll_queue.py
UTF-8
841
3.71875
4
[]
no_license
# import sys # sys.path.append('../doubly_linked_list') from doubly_linked_list import DoublyLinkedList # FIFO (first in, first out) class Queue: def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # Pretty straight-forward to add to head & tail, and r...
true
d87d65474ed79f535787d8472e1a797c39b35b6f
def-mycroft/curly-guacamole
/create_dataframe.py
UTF-8
2,764
3.515625
4
[]
no_license
"""Create dataframe with zipcode, GPS coords. and city name""" import pandas as pd import pickle_funcs as pk import zipcode from pyzipcode import ZipCodeDatabase from geopy.geocoders import Nominatim def get_city_data_geopy(zipc): """Given a zip code, return latlon and city name""" geolocator = Nominatim() ...
true
57fccb835b9c1256b9d8cac489e6446165f23189
brucewoodward/chase
/DataSet.py
UTF-8
2,699
2.90625
3
[]
no_license
#!/usr/bin/env python # chase # Copyright (C) 2003 Bruce Woodward # chase 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 2 of the License, or # (at your option) any later ve...
true
6d60b6539b0c2a65b1a3b11bf7dc4bd2c8e6893d
buxx/synergine
/synergine/core/simulation/EventManager.py
UTF-8
2,406
2.53125
3
[ "Apache-2.0" ]
permissive
from synergine.core.ActionManager import ActionManager from synergine.synergy.collection.SynergyCollection import SynergyCollection class EventManager(): """ Manager of collection events. """ def __init__(self, synergy_manager): self._synergy_manager = synergy_manager self._collection...
true
e0243335e95ebe98376a7f885a0bb703c4ba38af
tyutltf/Leecode
/1-100/39-组合总和.py
UTF-8
1,710
3.6875
4
[]
no_license
# -*- encoding: utf-8 -*- """ @File : 39-组合总和.py @Time : 2023/06/09 20:11:02 @Author : TYUT ltf @Version : v1.0 @Contact : 18235121656@163.com @License : (C)Copyright 2020-2030, GNU General Public License """ """ 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates ...
true
0cb74369b0d0ffb44efa7e75c0446fadc42de420
startsUp/Algorithms-Practice
/arrays/max-profit-cooldown/max-profit-cooldown.py
UTF-8
1,020
3.109375
3
[]
no_license
class Solution: def maxProfit(self, prices) -> int: if not prices: return 0 profit = 0 buyAt = [prices[0], 0] sellAt = [prices[0], 0] prices[0] = 0 maxProfit = 0 for i in range(1, len(prices)): cur = prices[i] print(buyAt, ...
true
a3fc9dfaac9312b621069529f2499b46da8bf0a9
yk-m/Clousel
/clousel/clothing/models.py
UTF-8
3,960
2.625
3
[]
no_license
import os from uuid import uuid4 from django.core.exceptions import ValidationError from django.core.files.storage import FileSystemStorage from django.db import models from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ from mptt.models import MPTTModel, TreeFor...
true
2ba52f470957d0c416b2de0e824167e1c04883ce
friendsbt/FetchCourse
/pku_school_course.py
UTF-8
1,440
2.53125
3
[]
no_license
# coding: utf-8 from pprint import pprint as print import urllib.parse as up from lxml import html import requests class PKUSchoolCourse: """ fetch courses of each school """ form_data = { 'zy': '%', 'xn': '14-15', 'xq': ['1', '2'], 'xs': None, 'nj': '%', ...
true
a47ad3a4125620e114c92f497ab35a5b518db09d
luasaul/primera_entrega
/version_1.py
UTF-8
2,595
3.046875
3
[]
no_license
from funciones_excepciones import excepciones_float import libreria_operaciones_tuplas def distancia(posicion_1, posicion_2): valor = restar_tuplas(posicion_2, posicion_1) return valor def fuerza(CONSTANTE_GRAVITATION_UNIVERSAL, masa_1, masa_2, distancia): magnitud = CONSTANTE_GRAVITATION_UNIVERSAL * ((ma...
true
b480d9f4854216a00bc4cc19365b293374e2d18c
andreshugueth/holberton-system_engineering-devops
/0x15-api/3-dictionary_of_list_of_dictionaries.py
UTF-8
900
3.03125
3
[]
no_license
#!/usr/bin/python3 """Dictionary of list of dictionaries""" import json import requests if __name__ == "__main__": url = "https://jsonplaceholder.typicode.com/" counter = len(requests.get(url + "users").json()) data = {} full_data = {} for i in range(0, counter): user = requests.get(url + ...
true
654ce7b27ec3d26df8ccd9b7b8ecf0eceea8448e
JoachimIsaac/Interview-Preparation
/HashTableProblems/longestConsecutiveSequence.py
UTF-8
2,952
4.25
4
[]
no_license
""" 128. Longest Consecutive Sequence (leetCode) Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. T...
true
5dd7f4305523d54d7a25be642d0537808026411f
MangoTux/Jukebox
/jukebox.py
UTF-8
13,438
2.65625
3
[]
no_license
#!/usr/bin/python ''' Script to control playback of music (Using PyGame mixer) and DotStar LED strip ''' import os import time import linecache import colorsys import colour from bisect import bisect import RPi.GPIO as GPIO from random import random,randint,choice,uniform,shuffle from pygame import mixer from dotstar...
true
ba0cfde84cf03e788649f09305183d84267e4c4a
OZ-T/Bilgisayar-Bilimi-Python-Dersleri
/dersler_14_oop/alem.py
UTF-8
261
2.875
3
[]
no_license
from siyam import * from kedi import * mavis = kedi() print("mavişin ayak sayısı :",mavis.ayak) serafettin = kedi() print("şerafettin ayak sayısı :", serafettin.ayak) prenses = siyam() print("prenses ayak sayısı :", prenses.ayak) print(prenses.tuy)
true
24e85199d0eb5f105ef811841a0a6efa02d5f9f3
zengxyu/Reinforcement_Learning
/RL_Exercise4_TD/GridWorld.py
UTF-8
2,468
2.90625
3
[]
no_license
import numpy as np grid_world_config = "config/gridworld.txt" H_grid = 5 # height W_grid = 7 # width grid_world = [] # actions A = [0, 1, 2, 3, 4, 5, 6, 7] # [NW, N, NE, E, SE, S, SW, W] # states S = [(i, j) for i in range(H_grid) for j in range(W_grid)] # 35 x 2 # reward distribution R_distributes = np.zeros((H_...
true
b01b99513f104a2bbee9c7e301f5b930ca19dd1d
HuangCongQing/Python
/python3_tutorials_菜鸟教程/03函数.py
UTF-8
2,154
4.3125
4
[]
no_license
''' Created on 2017年8月12日 @author: Chongqing ''' # def 函数名(参数列表): # 函数体 # 函数调用 #定义函数 def printme(str): "打印任意字符串:" print(str); return; # 调用函数 print(printme("我要调用函数")) # 参数传递 # 在 python 中,类型属于对象,变量是没有类型的: # 可更改(mutable)与不可更改(immutable)对象 # 传不可变对象实例 def ChangeInt( a )...
true
7b38c50ad48cd4c5438e84aafbcbd9ce228f7301
iamqk/wwdc-downloader
/downloader.py
UTF-8
2,283
2.734375
3
[]
no_license
import sys import os import urllib import urllib2 from bs4 import BeautifulSoup import subprocess def report(count, block_size, total_size): """Report save progression.""" progress_size = int(count * block_size) / (1024 * 1024) percent = int(count * block_size * 100 / total_size) sys.stdout.write("\r ...
true
f1e012a29354d520bb9ce160f549ffae93b04e4f
MWers/advent-of-code
/2020/11/main.py
UTF-8
3,183
3.515625
4
[ "MIT" ]
permissive
import argparse import copy from typing import List parser = argparse.ArgumentParser(description='Run an Advent of Code program') parser.add_argument( 'input_file', type=str, help='the file containing input data' ) args = parser.parse_args() input_data: List = [] with open(args.input_file) as f: input_data = ...
true
6090231035ce5299f5486f9a9848e6eb5b871d63
JeromeLefebvre/ProjectEuler
/Python/Problem016.py
UTF-8
355
3.125
3
[]
no_license
#!/usr/local/bin/python3.3 ''' Problem 16 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2**1000? ''' from pe.digits import applyToDigits def problem16(): return applyToDigits(2**1000) from cProfile import run if __name__ == "__main__": print(problem1...
true
6bae536b9a0a2a7a31c6b732ede76ae80df21e0a
mochen1228/Course
/10-601/HW4/decisionTree.py
UTF-8
5,158
2.890625
3
[]
no_license
import sys,csv,math class DecisionNode(object): def __init__(self,entropy): self.entropy = entropy self.left = None self.right = None self.y = 0 self.n = 0 self.attr = 0 self.next_attr = 0 self.label = 0 #for checking def __str__(self): return "attribute: %s, entropy: %d"%(self.attr,self.entrop...
true
988f43c476d8fb9587174763d0cac9e128b0453f
aanavas/mtproject
/src/oov.py
UTF-8
6,411
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import sys import redis import simplejson as json from collections import defaultdict import codecs SUFFIX = { 'FPS': '1ps', 'SPST': '2ps', 'SPSV': '2ps', 'SPSU': '2ps', 'TPS': '3ps', 'FPP': '1pp', 'SPPV': '2pp', 'SPPU': '2pp', 'TPP': '3pp' } ES_ACCENT_D...
true
bbfd62ca086756dd74c000e10e7fb958a36c5ef1
tnakaicode/jburkardt-python
/matrix_exp/r8mat_is_anticirculant.py
UTF-8
2,321
2.9375
3
[]
no_license
#! /usr/bin/env python # def r8mat_is_anticirculant ( m, n, a ): #*****************************************************************************80 # ## R8MAT_IS_ANTICIRCULANT checks whether A is an anticirculant matrix. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 14...
true
1be0fea6954f8cedfdceece98f8b88124cdb0104
muyuanzhao/IntroductionToComputerScienceAndProgramming
/Lec18.py
UTF-8
530
3.296875
3
[]
no_license
from pylab import * import random ##plot([1,2,3,4]) ##plot([5,6,7,8]) ##plot([1,2,3,4],[1,4,9,16]) ##figure() ##plot([1,2,3,4],[1,4,9,16],'ro') ##axis([0,6,0,20]) ##title('Earnings') ##xlabel('Days') ##ylabel('Dollars') ##figure() ##xAxis=array([1,2,3,4]) ##print xAxis ##test=arange(1,5) ##print test ##print test==xAx...
true
a19d35f3502beee1d04881634edd9f5c09b24591
david2999999/Python
/Archive/PDF/Sequences/Referencing-Last-Element.py
UTF-8
1,183
4.34375
4
[]
no_license
def main(): # All of the sequence types provide you with some shortcuts to make their use more convenient. You often # need to know the contents of the final element of a sequence, and you can get that information in two # ways. One way is to get the number of elements in the list and then use that number t...
true
78464ac1eb9ab1c70af4716b298f6c364d8b473d
AdamZhouSE/pythonHomework
/Code/CodeRecords/2130/60666/246387.py
UTF-8
205
2.6875
3
[]
no_license
n=int(input()) num=0 i=1 while(n>num+i*9*10**(i-1)): num+=i*9*10**(i-1) i+=1 a=10 **(i-1)-1+(n-num)//i b=(n-num)%i if b==0: result=a%10 else: a+=1 result=(a//10**(i-b))%10 print(result)
true
2feae90478b679ef034352a362fa58de3958818e
DanielY1783/te_ml
/bin/2018_07_09_shuffle_ml/ml_test.py
UTF-8
5,970
3.4375
3
[]
no_license
# coding: utf-8 # Module version of train/test split, cross validation, and predictions with a scikit learn machine learning model. # # This version can also be used as as standalone script on the features matrix at: # /dors/capra_lab/users/yand1/te_ml/data/2018_07_06_genome_shuffle/all_pairs_feature_matrix.tsv # I...
true
50ba83ff81f824f99e66638fd42fd6d0d547cb60
lisboa-prog/Ocean_Exercicio_11_2020
/Exercicio25.py
UTF-8
1,466
3.40625
3
[]
no_license
""" Exercício 25 Nome: Cadastro de Pessoas Objetivo: Criar uma aplicação que cadastre, liste, consulte e remova pessoas utilizando um dicionário. Dificuldade: Avançado 1 - Crie uma aplicação que rode infinitamente. 2 - A aplicação deverá perguntar ao usuário se deseja realizar uma das seguintes ações (independente se d...
true
3c8e95585295dc326cdc0333621fa453497a9791
FesianXu/NemoFishPixelSegmentation
/codes_in_py/task_2.py
UTF-8
2,455
2.65625
3
[]
no_license
''' @author: Fesian Xu @date: 2018/9/20 @decription: Color Image segment task. @note: Originally using jupyter notebook as developing environment, in order to make this program more universal, i transfer it into a standard python script file without any jupyter'scipy magic command. ''' import cv2 import numpy as np imp...
true
f3896830afa0c3bed6aec41852ad41d30d1fe3ec
ShaileshDhama/Hemostasis
/database.py
UTF-8
737
2.765625
3
[]
no_license
import sqlite3 conn = sqlite3.connect('stopthebleed.db') c = conn.cursor() # Create table in the database def users(): c.execute('CREATE TABLE IF NOT EXISTS users(userid TEXT, name TEXT, password TEXT, country TEXT, phone INTEGER, location TEXT, certified TEXT, PRIMARY KEY (userid))') # creates a sample records ...
true
7486125a1da7e7db00b53d97b38a1d469e48df0f
regran/maoai
/AI.py
UTF-8
4,424
3.125
3
[]
no_license
"""AI class for Mao card game""" import sklearn.tree as sk import sklearn.preprocessing as pre import numpy as np class AI: """AI superclass for hands and card selection of all AIs""" def __init__(self, h): self.hand = h def card_select(self, topcard): """Play an appropriate card, if there...
true
d02527861fb1e5c00b58969cc23cabd11da88ab0
meowgil/my-travel-plans
/test_terminal.py
UTF-8
274
3.375
3
[]
no_license
name = input("What's your name?") print("Hello,",name,"!") print("Nice to meet you!") def more(): 2 + 2 print(more()) import antigravity def print_all(strings): for string in strings: print(string) print_all(["one","two"]) import turtle print(turtle)
true
0bf25d1b319417d21c8348866a1e49aa69c03be6
evatr0n/CS122-Edu-Project
/fws.py
UTF-8
2,502
3.328125
3
[ "MIT" ]
permissive
''' Possible forward selection for linear regression ''' import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.feature_selection import SequentialFeatureSelector from sklearn.metrics import r2_score def forward_selection(dat, dependent): """ Outputs labels of ind...
true
ced11f599f5861dd49cf65690a5d480eaa8dca4f
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/1297.py
UTF-8
402
3.046875
3
[]
no_license
for t in range(int(input())): l = list(map(float,input().split(" "))) c = l[0]; f = l[1]; x = l[2] tot = 0 r = 2 time = 0 if(x<=c): time = x/r; else : while(True) : t1 = x/r; t2 = c/r; if(t1>(t2+x/(r+f))): tot = 0 r = r+f time+=t2 else :...
true
d063a5b2d5f6a5fae01f0411b64feab5e745a2dc
enkun-li/pythonlib
/tools/qgaus.py
UTF-8
3,395
2.8125
3
[]
no_license
#!/usr/bin/env python #-*- coding: utf-8 -*- #================================== # File Name: qgaus.py # Author: ekli # Mail: ekli_091@mail.dlut.edu.cn # Created Time: 2019-05-17 15:16:33 #================================== import numpy as np import sys from scipy.integrate import quad, dblquad import time from in...
true
1cc690298f088b461e3ee74783fcf5d47c25dcc2
rmazzine/ml-explain
/mlexplain/counterfactuals/bruteforce_counterfactual.py
UTF-8
3,586
2.984375
3
[]
no_license
import torch import numpy as np from itertools import combinations import torchvision import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Softmax class BruteforceCounterfactual: def __init__(self, model, fill_func='mean'): self.model = model self.fill_func = s...
true
02bca85741b24ffb7db710b25f3eb4fe0dcfa40d
tinkalpatel09/Python-Classrooms
/listcomparision.py
UTF-8
91
3.375
3
[]
no_license
lst=[] for x in range(1,11): if (x%2==1): lst.append(x**2) print(lst)
true
c1fea74836df4be5ae77ea46bd3102850cc3abf9
jbrummal/pythonclass
/Alta3DropBox/csvgraphin.py
UTF-8
1,262
3.515625
4
[]
no_license
#!/usr/bin/python3 """learning how to manipulate csv data""" # download from https://tinyurl.com/y3mpflqy import csv import matplotlib.pyplot as plt def main(): """runtime code""" xaxislist = [] yaxislist = [] totalrow = 0 # this is the total value of a single line (row) totaldict...
true
b251304db25f80b3668df46cde301358f31c8136
hfhsieh/sphynx_vis
/sphynx/lib_BV.py
UTF-8
10,705
2.671875
3
[]
no_license
#! /usr/bin/env python # # -*- coding: utf-8 -*- # # Purpose: # The class `BV_frequency` that compute the Brunt-Vaisala frequency # # Adopted from Kuo-Chuan's code `get_bv_frequency.py`, with modification for SPHYNX's results # # Reference: # See Eqs. (12) and (13) in Pan+, 2016, ApJ, 817, 72. # # Note th...
true
4f71b08997a4618582201745405f7c27493d17c3
AugustLONG/Code
/CC150Python/challenges-masterCC50-Python-good/two-dimensional-array-number-exist.py
UTF-8
844
4.3125
4
[]
no_license
''' Question: Given a two dimensional matrix where rows and columns are sorted in increasing order. Design an efficient algorithm that decides whether a number X appears in A. ''' rows = 5 cols = 5 count = 0 #Initialize matrix with increasing values def init(): global count count += 1 return count def S...
true
808da96bf74c3ebd3df0af05a42d28cc26eb49c9
evmarecki/nante
/flask-nante/AccraTempFile.py
UTF-8
2,436
3.03125
3
[]
no_license
# coding: utf-8 # In[33]: from bs4 import BeautifulSoup from requests import get from requests.exceptions import RequestException from contextlib import closing import psycopg2 # def getHTML(url): ##get html with closing(get("https://silverbirdcinemas.com/cinema/accra/", stream=True)) as webResponse: #https://sil...
true
19c28adfac098978b30a622f44d3d282dd486b91
GlobalVent/prototypes
/pyJamVentSim/GasSim/Lungs.py
UTF-8
4,398
2.765625
3
[]
no_license
# # simulaton model for lungs, variable volume container, with a # load of some sort. # This model of the Lung will have an inhale connection and # and an exhale connection to keep things simple # rather than to trace down the connections to see # which part of a pipe is open. # import math from .SimNode import Sim...
true
94f43737695342419f6fa87be05ea92f15e38832
billy-mosse/nlp-inference
/train_supervised.py
UTF-8
380
2.671875
3
[]
no_license
import math import numpy as np #Entrena el modelo pero tambien lo testea con dev.txt def main(): import fasttext model = None try: model = fasttext.load_model('supervised_model.bin') print("El modelo ya está cargado!") except ValueError: model = fasttext.train_supervised('train.txt') model.save_model('sup...
true
f2144ba954217d4f7507346afa1bea519a288444
SilinAlexander/Shop2
/web/order/services.py
UTF-8
1,480
2.53125
3
[]
no_license
from django.contrib.auth.models import AnonymousUser from .models import OrderItem, Order from cart.cart import SessionCart from .models import User from product.models import Product class OrderService: def __init__(self, request): self.cart = SessionCart(request) print(self.cart) print...
true
1c215f7095ea50d82ab9fca79da52cccaa35003c
Limmen/Distributed_ML
/lab2/fashon_mnist_tf/task4/task4.py
UTF-8
9,927
3.296875
3
[]
no_license
# Task 4 - Convolutional Layer with 3 Conv layers + 1 FCC/RELU + Softmax # 1. See results in stats.txt # Results indicate that adam was better than GD, and that adam with decay peformed best, # once again we actually got a bit worse accuracy when adding dropout regularization (pre-tuning), # but not as much this time, ...
true
811cd2c7a1608c3f2c457b2c3a5f0d8452ee0ce3
Gretuwtf/Tomas_Alfonso_Test
/Test/punto_8.py
UTF-8
159
2.65625
3
[]
no_license
# Inicio del modulo modulo_a.py def hola(): print("Hello world!!!") def chau(): print("chau!!!") chau() if __name__ == "__main__": hola()
true
bcbb9a2bee9ea358183bca774dbaf42647de61e2
NHERI-SimCenter/SURF
/examples/demo-NN.py
UTF-8
2,693
2.859375
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ /*------------------------------------------------------* | Spatial Uncertainty Research Framework | | | | Author: Charles Wang, UC Berkeley, c_w@berkeley.edu | | | | ...
true
cafa9dc6e8df135b1cb26861f1cd0b838d6a291f
mortier/SoftDes
/day03/functions1.py
UTF-8
316
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jan 30 16:25:46 2014 @author: dmichael """ def hypotenuse(a,b): from math import * c=sqrt(a**2+b**2) print c def right_justify(x): y=len(x) print (70-y)*" "+x def do_twice(f,arg): f(arg) f(arg) def mmmspam(): print "I love SPAM"
true
6765716b1de21d7b6fb2f99e03094e46a8b283e9
abhirathmahipal/Practice
/Python/lists.py
UTF-8
850
4.3125
4
[]
no_license
# creating a list numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # list splicing print("Numbers[:]", numbers[:]) print("Numers[0:5]", numbers[0:5]) print("Numbers[-5:-1]", numbers[-5:-1]) print("Numbers[-1:-5]", numbers[-1:-5]) print("Number[:3]", numbers[:3]) print("Numbers[-2:]", numbers[-2:]) # multiplying and join...
true
cb2f069dbd35f386a8dab35131fe08651d4841c6
2row-unb/2re-electronic
/tempo.py
UTF-8
114
2.765625
3
[]
no_license
import time def procedure(): time.sleep(3.12) tx= time.time() procedure() ty = time.time() - tx print ty
true
e8fa6658bef78bf23caf3abf759ee73788800529
NikoWar/Scuola
/python/moduloTurtle/garaTurtle.py
UTF-8
286
3.09375
3
[]
no_license
#Nicolò Guerra 4AROB import random import turtle as t nTurtle=0 lTurtle=[] height=800 weight=800 nTurtle=int(input("Quante turtle partecipano alla Turtle Race?")) for i in range(0, nTurtle): lTurtle.append(t.Turtle()) height=height//nTurtle t.setup(weight, height)
true
8e350748515552f38c57e3fe99fce4443ebe944d
Rou-Yi/Covid-Game-Design-0812
/menu/page_controller.py
UTF-8
1,561
2.734375
3
[]
no_license
from menu.menu import Menu, Introduction_Menu from game.game import Game class Page_controller: """ Used in start_menu.py to control the current menu or enter a level. """ def __init__(self): self.level_state = [1, 0, 0, 0, 0] self.introduction_menu = Introduction_Menu() ...
true
c4f2813c90c909f4ea9da769482af4b3d39908a4
satyadeb2000/HackerRankPython
/StringValidators.py
UTF-8
419
2.796875
3
[]
no_license
if __name__ == '__main__': s = input() #print(any(str(x).isalnum() for x in s )) #print(any(str(x).isalpha() for x in s )) #print(any(str(x).isdigit() for x in s )) #print(any(str(x).islower() for x in s )) #print(any(str(x).isupper() for x in s )) for cmd in ["isalnum", "isalph...
true
e1817d7e5a4cdc4bac01fda37e6d9664edd0b485
patfennemore/python_fundamentals-master
/07_classes_objects_methods/07_05_freeform_inheritance.py
UTF-8
1,642
3.796875
4
[]
no_license
''' Build on your previous freeform exercise. Create subclasses of two of the existing classes. Create a subclass of one of those so that the hierarchy is at least three levels. Build these classes out like we did in the previous exercises. If you cannot think of a way to build on your freeform exercise, you can sta...
true
010677d482c3a6badb62fa37acefd049568337d0
batukochan/VSCode-Python-Egitim
/05_fonskiyonlar/math_modul.py
UTF-8
508
3.828125
4
[]
no_license
import math """ print(math) """ # <module 'math' (built-in)> """ print(math.sqrt(16)) """ # karakök işlemidir. sonuç = 4.0 # region örnek 1 '''Yarıçapı 4 olan çemberin çevresini hesaplayalım''' """ r = 4 cevre = 2*math.pi*r print(round(cevre, 2)) """ # endregion # region örnek 2 """ derece = 30 radyan = math.radians...
true
927c40f5cb2703554f58e86b8022565e4f12b79e
thisismonica/funCoding
/dijkistra/dijkistra.py
UTF-8
1,901
3.265625
3
[]
no_license
__author__ = 'monica_wang' import heapq import copy UNFOUND = 1000000 class Vertex: def __init__(self): self.label = 0 self.score = UNFOUND self.edges = [] def setVertex(self, label, score, edges): self.label = label self.score = score self.edges = edges ...
true
ef5bbe6d1e07a1b9d90bfe4293d09fe43c8df518
afeborgeaud/pytomo
/pytomo/work/ca/dist.py
UTF-8
777
3.359375
3
[ "MIT" ]
permissive
import numpy as np import seaborn as sns import matplotlib.pyplot as plt def bi_triangle_cfd_inv(x, a, b): assert (x >= 0) and (x <= 1) aa = np.abs(a) h = 2. / (aa + b) if x < h*aa/4.: y = np.sqrt(x*aa/h) - aa elif x < h*aa/2.: y = -np.sqrt(aa*aa/2. - x*aa/h) elif x < (h*aa/2. +...
true
9be44c1c341128c81d81f2178ef1ecaf88d2bb4a
cornkle/proj_CEH
/surface_wavelet/MCS_stats.py
UTF-8
896
2.5625
3
[]
no_license
import numpy as np import xarray as xr from utils import constants import matplotlib.pyplot as plt import pdb MCSdom = xr.open_dataarray(constants.MCS_POINTS_DOM) MCSdom = MCSdom.sel(lat=slice(10,18), lon=slice(-10,10)) # f = plt.figure() # plt.hist(MCSdom.values[np.isfinite(MCSdom.values)]) plt.title('MCS dominant ...
true
b7a49ac9d72aa95a44aee771015146e5af2962be
mul14/perundangan
/analyze_html.py
UTF-8
5,444
2.6875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from os import rename, listdir from os.path import isfile, isdir, join from sys import argv import re from lxml import html, etree def clean1(filename, content): test = """ <table align="left" border="0" cellspacing="0"> <tbody> <tr> <td wid...
true
503a315c227bab8718e659083cf7a918375ae500
mosho-p/advent_of_code2020
/day14.py
UTF-8
1,179
2.765625
3
[]
no_license
from itertools import product with open('inputs/day14_input.txt') as f: s = f.read().strip() rules = s.split('\n') mem = {} mask = '' for rule in rules: if rule[:3] == 'mas': mask = rule.split(' = ')[1] continue a, b, c = rule.partition(' = ') c = str(bin(int(c)))[2:].zfill(36) c ...
true
33e52249637432a3871cffced1e89718f8e09feb
swq-1993/ocr_record
/pdf/request/util.py
UTF-8
1,152
2.6875
3
[]
no_license
################################################################################ # # Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved # ################################################################################ """ This module provide configure file management service in i18n environment. Authors: wanglong...
true
199982f10f9e813433316a7833f5a3c5f92560de
NightKirie/NCKU_NLP_2018_industry3
/Packages/matplotlib-2.2.2/examples/api/agg_oo_sgskip.py
UTF-8
619
3.109375
3
[ "MIT" ]
permissive
""" ============================= The object-oriented interface ============================= A pure OO (look Ma, no pyplot!) example using the agg backend. """ from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure fig = Figure() # A canvas must be manually ...
true
b732ea63c4a06c60779f1d08cce3cca7ed7b0676
2vitalik/wiktionary
/libs/utils/timing.py
UTF-8
464
2.578125
3
[]
no_license
from datetime import datetime import functools def timing(func=None, *, desc=None): # info: measure time of function work if func is None: return lambda f: timing(f, desc=desc) @functools.wraps(func) def wrapper(*args, **kwargs): started_at = datetime.now() result = func(*args, ...
true
f95216b906075226df5ee5150c5785f9c72e2300
CEngelbrecht/SchoolCode
/Math693a/Final_Project/CHOLSOLVE.py
UTF-8
245
2.765625
3
[]
no_license
def CHOLSOLVE(n,g_c,L_c): '''Solve (L * LT)s = -g for s''' from LSOLVE import LSOLVE from LTSOLVE import LTSOLVE s = LSOLVE(n,g_c,L_c) s = LTSOLVE(n,s,L_c) s = -1.0*s #print("s as returned by CHOLSOLVE: {}".format(s)) return s
true
87ce28a34a0b3edd73a0bd2e5c99f5a4cee7f6a4
ZLBer/tensorflowAndML
/scikit_learn/scikit_learn _svm1.py
UTF-8
427
3.265625
3
[]
no_license
from sklearn import svm #训练样本 x = [[2,0], [1,1], [2,3]] #label y = [0,0,1] clf = svm.SVC(kernel = 'linear') clf.fit(x, y) #打印出参数设置情况,只设置了 kernel,其他都是默认 print(clf) #支持向量 print(clf.support_vectors_) #支持向量的index print(clf.support_) #对于每个类别,分别有几个支持向量 print(clf.n_support_) #对新数据进行预测 print(clf.predict([[2,0]]))
true
e232a9d7d0f8bc72930e38a38dddb108e12c44b1
Marcedes-Antoniya/Majors
/check_major.py
UTF-8
253
2.546875
3
[]
no_license
from major import * from req import * # sample test #a student has taken these six classes and wants to know how close they are to each major within 7 classes for i in major_list: i.satisfied(["cs1", "cs10", "cs30", "cs31", "math22", "cs86"], 7)
true
f30b9274ead20c690813a8347c0e7ddcfd09ccd9
tjdgus3160/algorithm
/BOJ/Silver5/체스판 다시 칠하기.py
UTF-8
641
3.140625
3
[]
no_license
# 1018번 import sys input=sys.stdin.readline def diff(s1,s2): res=0 for i in range(8): if s1[i]!=s2[i]: res+=1 return res arr=[] n,m=map(int,input().split()) for _ in range(n): arr.append(input()[:-1]) res=100 a="WBWBWBWB" b="BWBWBWBW" for i in range(n-7): for j in range(m-7): ...
true
4bfde48e60640d2903360ccad0eb0c226ec5302e
Attila94/refinenet-keras
/scripts/training.py
UTF-8
2,875
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np from keras.callbacks import LearningRateScheduler from keras.losses import categorical_crossentropy import tensorflow as tf from keras.callbacks import TensorBoard def step_decay_schedule(initial_lr=1e-5, decay_factor=0.1, step_size=30): """ Define custom learning ra...
true
daf0eb50902eb9a85182168175934e48062b180e
mrphys/tensorflow-mri
/tensorflow_mri/python/metrics/confusion_metrics.py
UTF-8
24,842
2.53125
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 University College London. All Rights Reserved. # Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # 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://w...
true
fb32d62afc7cd4e29b3c4c5ecebaaa8ac24bd52e
Aanand98/Python---CodeKata
/palindrome.py
UTF-8
174
3.5
4
[]
no_license
number = int(input()) num = 0 n = number while n != 0: num = (num * 10) + (n % 10) n = n / 10 n = int(n) if number == num: print("yes") else: print("no")
true
2c39f8b0bf3e890662d5ce39d4c4d78f55759127
tjczec01/butcher
/butchertableau.py
UTF-8
36,195
3.09375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Feb 3 23:21:54 2020 @author: tjcze01@gmail.com """ import numpy as np import scipy as sc import sympy as sp from sympy import I from scipy.interpolate import CubicSpline class butcher: def __init__(self, order, decs): ...
true
d44595efbd7d21ac19fe81c5d55a272ffa78b855
carloshsjbv/automatingboringstuffwithpython
/section-2_flow_control/if-example.py
UTF-8
158
3.875
4
[]
no_license
print('What is your name?') name = input() if name: print('Congrats you\' ve entered a name') else: print('You did not entered a name') print('Done')
true
f2c0fd295d6e27207d2712dd1d7ff65641b4d4ff
satishsolanki1990/Leetcode
/169_MajorityElement.py
UTF-8
967
3.875
4
[]
no_license
""" Given an array nums of size n, return the majority element. The majority element is the element that appears more than n / 2 """ class Solution: def majorityElement(self, nums): ''' logic: keep track of numbers in hashmap(dict) with track of maxterm and maxcount if count of any term is...
true
d57c69aa459c52c3eb578ace97b827becbec8645
kalmalang/BMES-T580-2019
/Module06/wizard_battle.py
UTF-8
2,556
3.9375
4
[ "MIT" ]
permissive
import wizard_code as wc from random import choice if __name__ == '__main__': #creature = wc.Creature('small animal', 1) creatures_to_fight = [wc.Creature('bear', 5), wc.Creature('bird', 3), wc.Creature('wolf', 8), wc.Wizard('Evil Gu...
true
7096d9987e86cdc601fa4d2fbb6f748b69a4eb00
Youngjun-Kim-02/ICS3U-Assignment2-python
/volume_of_cone.py
UTF-8
726
4.15625
4
[]
no_license
#!/usr/bin/env python3 # Created by: Youngjun Kim # Created on: April 2021 # This program calculates the volume of a cone # with radius and height inputted from the user import math def main(): # this function calculates the volume of a cone # main function print("We will be calculating the area of ...
true
379dfb1aff6851cf58ee900a918209381ce766cc
KavyaSnigdha/Codevita_Previous_Problems
/number_game.py
UTF-8
509
3.09375
3
[]
no_license
def prime(n): i = 2 factors = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(i) if n > 1: factors.append(n) return factors n=int(input()) l=[] l=list(map(int,input().split(" "))) d=[0]*len(l) for j i...
true
275e240dceeccef457395f2d83f2cfbad5f31475
php4all/backcookie
/backcookie.py
UTF-8
5,612
2.609375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # # Copyright 2013 - 2014 @jofpin <jofpin@gmail.com> # # ############################################### import os # import sys # import urllib # impor...
true
63437a16d7eb5cc0a9b863a676c19e03ceab96b1
hzqmwne/asymsched_demo
/asymsched/models.py
UTF-8
2,465
3.015625
3
[]
no_license
""" 本文件定义了一些数据模型类 """ class Cluster: """ 一个cluster同一个app之中访问相同的内存的线程集合 """ def __init__(self): self.rbw = 0 # 访问远程节点的带宽 self.weight = 0 # cluster的权重,通常为log(rbw) self.memories = [] # cluster中每个节点使用的内存大小 self.origin_nodes = [] # cluster上一次分配的节点 self.current_nodes = [] # 当...
true
8375cad026063c7acd20d6628fc9fbb82b61dbd3
bigeyesung/scrabbleSolver
/scrabble.py
UTF-8
11,096
2.703125
3
[]
no_license
from utils import Utils from common import Coord, Move, Dirs import collections import copy import sys import time class Scrabble(): def __init__(self): self.words=set() self.wordGrid=[] self.wordDict={} self.scoreTable={} self.wordsMaxScore=collections.defaultdict(list) ...
true
3bd4d8b71c04fb745fd2a0779e9a960a61898ebd
josh-uksbs/python-packet
/connection/listener/ConnectionListener.py
UTF-8
540
2.796875
3
[]
no_license
from threading import Thread class ConnectionListener(Thread): def __init__(self, connection_registry, connection): Thread.__init__(self) self.__connection_registry = connection_registry self.__connection = connection def run(self): while True: self.__co...
true
b4ae293817157b58296bcceb077bb63e19bb1afa
TStalnaker44/interface_creator
/polybius/graphics/components/checkbox.py
UTF-8
2,695
3.4375
3
[]
no_license
""" Author: Trevor Stalnaker, Justin Pusztay File: checkbox.py A class that creates and manages a check box object """ import pygame from polybius.graphics.utils.textgraphic import TextGraphic from .multilinetextbox import MultiLineTextBox from polybius.utils import EventWrapper, Font class Checkbox(TextGraphic): ...
true
056df04804fd534fc60b027eecceeab555c6e695
jedwardsjunior/Project-Euler
/Sum3And5.py
UTF-8
569
3.46875
3
[]
no_license
""" Sum3And5.py Author: Julia Edwards Date: August 2017 Github: jedwardsjunior """ def findSumOfMultiple(multiple, target, discount): sum = 0 count = multiple while count < target: if (not discount.get(str(count))): sum += count discount[str(count)] = True count += ...
true
6f0bac433750d9b9692b8e75128bb213a3cbbb2f
yotamlevit/Holydays_Project
/tests_do_not_enter/test.py
UTF-8
145
2.6875
3
[]
no_license
import ast def main(): dot = "[100,200,300,400,500]" lis = ast.literal_eval(dot) print lis if __name__ == '__main__': main()
true
68f69269f6830788b20eb8390bef596c1d7e0058
RaelViana/Python_3
/ex029.py
UTF-8
374
3.921875
4
[]
no_license
""" Programa lê o nome de uma pessoa e verifica se ela tem 'Silva' no nome """ nome = str(input('Qual é o seu nome completo: ')) print('Seu nome é {}'.format(nome)) print('tem silva ? : {}'.format('silva' in nome.lower())) # verifiva a existencia de 'silva' dentro de nome #--------------------------------...
true
5367c60f5153a23cd2844f339e3a674b71fcec6f
fhuzero/assistive-mouse-capstone
/gesture_learning/template.py
UTF-8
2,686
3.03125
3
[]
no_license
#!/usr/bin/env python3 """ Description: Template for gesture recognition via machine learning Author: Ayusman Saha (aysaha@berkeley.edu) """ import sys import numpy as np import matplotlib.pyplot as plt import keypoints as kp # ----------------------------------------------------------------------------------------...
true
c288d2492759592f41e99446a85404f62eac4430
BackbenchCoder-py/Python-user-defined-methods
/USER DEFINED METHODS/ARMSTRONG NUMBER/IsArm3.py
UTF-8
843
4.71875
5
[]
no_license
#Program to check whether a number is Armstrong or not #With argument but without a return value. (3rd Method) def IsArm(x): #Function Declaration | suppose, x = 153 #Function Definition [Starts] arm=0 temp=x #Storing the original input value to keep it safe while x!=0: #153!=0 {T} | 15!=0 {T} | 1!=0 ...
true
abe009f70ae4cc0d4ac48cfd378780fde0de1cec
open2c/polychrom
/tests/demo_test_pymol_show.py
UTF-8
762
2.84375
3
[ "MIT" ]
permissive
import numpy as np from openmmlib import pymol_show rw = 0.4 * np.cumsum(np.random.random((1000, 3)) - 0.5, axis=0) def example_pymol(): # Creating a random walk # Highlighting first 100 monomers and then 200-400 regions = [(000, 100), (100, 200)] # Coloring them red and blue colors = ["red", "...
true
b684f1e8e2031c05826ddaf1e67e1dd5ddce3b6e
mozdas/EFUS
/spikeSortingUtils/spike_analysis_utils.py
UTF-8
6,584
3.15625
3
[]
no_license
""" Created on Friday, Oct 6th, 2017 author: Tansel Baran Yasar Contains the functions for analyzing spike trains. """ import numpy as np from matplotlib.pyplot import * from LFPutils.read_evoked_lfp import * def firing_histogram(bin_size, spike_times, sample_rate, end_inds): """ This function generates a h...
true
e4ab761c5d8db57f65c896fd1405ed9b871d2bab
krivolapov/Python_tips
/python_exel.py
UTF-8
908
3.1875
3
[ "MIT" ]
permissive
# Section 1 import pandas as pd files = ['https://github.com/datagy/mediumdata/raw/master/january.xlsx', 'https://github.com/datagy/mediumdata/raw/master/february.xlsx', 'https://github.com/datagy/mediumdata/raw/master/march.xlsx'] combined = pd.DataFrame() # Section 2 for file in files: df = pd.read_excel(file, ski...
true
c7af9a14f9d7317283a40e53b4148d0baf7ed09e
rafael-vvianaa/CYK_LFA
/Regras.py
UTF-8
823
2.953125
3
[]
no_license
def verificacao(t, gramatica): varP = '' if (type(t) is list): for s in t: varP += verificacao(s, gramatica) else: for chave, x in gramatica.items(): if t in x: varP += chave return varP def geracao(t, lin): passo = lin + 1 var_comb = []...
true
efac8bd2c0a59f5347175261d4489865c67a42bc
Aasthaengg/IBMdataset
/Python_codes/p02577/s088119478.py
UTF-8
136
3.359375
3
[]
no_license
n = list(input()) n1 = [int(i) for i in n] sum = 0 for i in n1: sum += i if sum % 9 == 0: print('Yes') else: print('No')
true
bd837197305acfefba6ab471cdfddd10e3cd9620
Okocha76/cs-module-project-recursive-sorting
/src/recursive_sorting/recursive_sorting.py
UTF-8
2,194
4.28125
4
[]
no_license
# TO-DO: complete the helper function below to merge 2 sorted arrays def merge(arrA, arrB): elements = len(arrA) + len(arrB) merged_arr = [0] * elements i = 0 j = 0 while i < len(arrA) and j < len(arrB): if arrA[i] < arrB[j]: merged_arr[i+j] = arrA[i] i += 1 ...
true
499ec68155103a2c25fd474d786b1fa6794a070b
mauricioZelaya/QETraining_BDT_python
/PabloZubieta/PZProy09_replaceString.py
UTF-8
534
3.9375
4
[]
no_license
def replaceString_easy(strTest, strOld, strNew): #Replace an old string piece with a new in the given string strTest. print (strTest.replace(strOld, strNew)) def replaceString_hard(strTest, strOld, strNew): index = 0 for ch in strTest: index = strTest.index(strOld) strTest.join(strNew) ...
true
b31115e272ac9672d7da0f5ef4e0e4ffefcc9840
NicolasBroute/Projet_Tableau_de_Bord
/Projet_Catastrophes_Naturelles/Code/Insertion_bd/insertion_bd_words.py
UTF-8
1,198
2.5625
3
[]
no_license
import pyodbc import csv # Connexion à la base de données sur SQL Server host = "DESKTOP-QEBO46O\SQLSERV" db = "master" user = "" pwd = "" conn = pyodbc.connect("DRIVER={SQL Server}; SERVER=" + host + ";DATABASE=" + db + ";UID=" + user + ";PWD=" + pwd) # Création du curseur cursor = conn.cursor...
true
795a026c34fadd4cae69930c10038b7b5201257a
luobgith/py_stockanaly
/utils.py
UTF-8
8,879
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import os, threading, time, pdb from tkinter import * from datetime import datetime from matplotlib.pylab import date2num import matplotlib.pyplot as plt import matplotlib.mpl_finance as mpf import stock, config #类的字段名 objAttrTuple = config.objAttrTuple #kdj的两个条件 minKdjCon = 5 maxKdjCon = 10 #量...
true
fe55e4d684ed51164bc5c3e6efda6c33354d188f
ariwbolton/game-solvers
/Risk/RiskRunner.py
UTF-8
410
3.140625
3
[]
no_license
import Table def runner(): print "Welcome to the Risk Probability Calculator!" s = raw_input("Enter attacking and defending: ").split() choices = [int(v) for v in s] while choices[0] >= 1: t = Table.MemTable(choices[0], choices[1]) t.runner() print "Welcome to the Risk Probability Calculator!" s = raw_i...
true
81ebf049485f0ad3c7ad193607e6538ec49e67d2
takin6/algorithm-practice
/at_coder/e869120/18_math/disco_2020_d.py
UTF-8
931
2.875
3
[]
no_license
# from collections import deque # M = int(input()) # deq = deque() # for _ in range(M): # d,c = map(int,input().split()) # for _ in range(c): # deq.append(d) # def is_handred(): # if deq[0]==1 and deq[1]==0 and deq[2]==0: # return True # return False # times = 0 # while len(deq) > 1: ...
true
35a758e4189b4bf09c873e0e433d139b979b8ff3
DayGitH/Python-Challenges
/DailyProgrammer/DP20121103C.py
UTF-8
2,268
4.15625
4
[ "MIT" ]
permissive
""" [11/3/2012] Challenge #110 [Difficult] You can't handle the truth! https://www.reddit.com/r/dailyprogrammer/comments/12k3xw/1132012_challenge_110_difficult_you_cant_handle/ **Description:** [Truth Tables](http://en.wikipedia.org/wiki/Truth_table) are a simple table that demonstrates all possible results given a B...
true
cb445ec3647246decb34aeb72eaa5eabf9a1a6a9
thehalovex/PythonCBT
/primetest.py
UTF-8
299
4.28125
4
[]
no_license
num = input('Test a number: ') prime = True for test in range(2,1000): if int(num) % test == 0 and int(num) != test: print(int(num), 'equals', test, '*', int(num)/test) prime = False if prime: print(int(num), 'is a prime number!') else: print(int(num), 'is not a prime number')
true
d170f9202bb02671c0c6b09d5bc363058bfab868
CarolMLGO/deeplearning_keras
/data_processing_panda.py
UTF-8
1,149
2.9375
3
[]
no_license
import os import pandas as pd import numpy as np # print(pd.__version__) pd.set_option('display.expand_frame_repr', False) path='./data/' filepath_read=os.path.join(path,'auto-mpg.csv') filepath_write=os.path.join(path,'write-out.csv') df=pd.read_csv(filepath_read) # df.to_csv(filepath_write,index=True) # print(df.hea...
true
25d3d1b130c6bb166691d8d975d49cc6ba87f5cc
Jennyliu0623/Python_Selenium
/com/imooc/test_select.py
UTF-8
502
2.59375
3
[]
no_license
# -*- coding:UTF-8 -*- ''' Created on 2018��11��28�� @author: samsung ''' import pymysql from _sqlite3 import Cursor conn = pymysql.connect( host = 'localhost', port = 3306, user = 'root', passwd = '123456aaa', db = 'imooc', charset = 'utf8' ) cursor =conn.cursor() sq...
true
906e332ea3fd9b285e42d7bd3a760e7e2393c735
epic342/Assignment-3
/src/strategy/bar_graph.py
UTF-8
2,156
2.828125
3
[]
no_license
import plotly from src.database import sql from src.database.class_data import ClassData from src.strategy.graph_strategy import AbstractGraphBuilder class BarGraphCreator(AbstractGraphBuilder): def __init__(self, db_name): self.db = sql.database(db_name) def initialize(self): self.db.query(...
true