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
08f09888b09c8806f947643e0bb76fdc674cc7ef
samahDD/MITx6.00.1x_IntroToCS
/oddTuples.py
UTF-8
459
3.765625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 24 14:36:29 2019 @author: peter """ def oddTuples(aTup): ''' aTup: a tuple returns: tuple, every other element of aTup. ''' # Your Code Here newTup=() for i in range(len(aTup)): if i%2==0: newTup=newT...
true
b173afffac83844cb873ca48da0c68d719a66948
camillestomer/thinkful
/NYCFLIGHTS13.py
UTF-8
1,889
2.609375
3
[]
no_license
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import pandas as pd >>> def main(): flights_dataframe = pd.read_csv('C:\\Users\\Camil\\OneDrive\\Desktop\\flights.csv') airline_data...
true
5aec4c8aca437569bafdc857a000c0d956c736b6
calebj/python-sortedcontainers
/tests/benchmark_plot.py
UTF-8
2,922
2.8125
3
[ "Apache-2.0" ]
permissive
""" # Plotting Benchmark Results ## Usage usage: benchmark_plot.py [-h] [--test TEST] [--kind KIND] [--show] [--save] filename name Plotting positional arguments: filename path to file with benchmark data name type name optional arguments: ...
true
25304a1a39a7626c7e49872da9fd808c68a78a5a
yoyo60214/wang-1Pygame
/class 6.py
UTF-8
1,830
3.53125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Apr 24 13:36:00 2021 @author: EDISON """ class Car(): def __init__(self,speed,position,color): self.speed=speed self.position=position self.color=color def run(self): self.position=self.position+self.speed def getPosi...
true
4170b3c6fc5d6e5245d68a56d7ef4ee0944bc0d5
HuXiaoling/imageSeg-2.5D_topo
/model.py
UTF-8
3,947
2.78125
3
[ "MIT" ]
permissive
import torch import torch.nn as nn def double_conv(in_channels, out_channels): return nn.Sequential( nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1, stride=1), nn.ReLU(inplace=True), nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1, stride=1), nn.ReLU(...
true
e96633fb719dbe9c8a29d184a7fbd30e6f66cd02
iossifovlab/gpf
/dae/dae/pheno/common.py
UTF-8
2,850
2.734375
3
[ "MIT" ]
permissive
import enum from pprint import pprint from box import Box class MeasureType(enum.Enum): """Definition of measure types.""" # pylint: disable=invalid-name continuous = 1 ordinal = 2 categorical = 3 text = 4 raw = 5 other = 100 skipped = 1000 @staticmethod def from_str(mea...
true
557c5cf144b42e163b7267b424ee65a9dcfc9285
alveraboquet/blockbot-api
/trading_scripts/jobs/update_user_strategy_pair_balances.py
UTF-8
2,074
2.515625
3
[]
no_license
from bb.models import User_Strategy_Pair, User_Strategy_Pair_Daily_Balance, User_Exchange_Account, Exchange, User import ccxt def main(): print("Running Update Strategy Pairs Job") try: for user_pair in User_Strategy_Pair.objects.filter(is_active=True): user = User.objects.get(user_id=user_...
true
6015fa0dbc49d3ac9ee34a85910862e5dbf41cc7
Mohdyusuf786/split-merge-resize-add-addWeight-ROI
/split,merge,resize,add,addweight,roi.py
UTF-8
1,007
3.3125
3
[]
no_license
import cv2 as cv import numpy img=cv.imread('village.png') img2=cv.imread('turgut.png') img=cv.resize(img,(600,600)) img2=cv.resize(img2,(600,600))#both the image must have same size #lets try split method b,g,r=cv2.split(img)#so this split the image in BGR channels #lets try merge method img=cv2.merge((b,g,r))#so t...
true
3b6f947c8a1e5b5e2cbbae21cd1fb8fb862ba53c
Sabrinawang06/DATA515-Brain-Scan-Classification
/tests/test_upload_form.py
UTF-8
575
2.609375
3
[ "MIT" ]
permissive
import unittest from brain_scan import app class TestUploadForm(unittest.TestCase): def setUp(self): ''' Flask testing is confusing, but I'm 99% sure it is necessary to init a test client to check for template rendering ''' self.app = app.app.test_client() def test_upl...
true
25db1edfaff417b22745355c0ce8740353fac901
wangyaobsz/OpenRAM
/compiler/base/geometry.py
UTF-8
20,349
2.671875
3
[ "BSD-3-Clause" ]
permissive
# See LICENSE for licensing information. # # Copyright (c) 2016-2021 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State University) # All rights reserved. # """ This provides a set of useful generic types ...
true
de7a65fc9af68e8b64c0c63f88292cd386a3ec95
tpt5cu/python-tutorial
/language/python_27/built_in_types/sequence_/tuple_/methods.py
UTF-8
628
4.65625
5
[]
no_license
def get_element(): """Tuples are accessed with brackets []. Using parentheses is always a function call and is thus incorrect.""" t = ("Some", 4, True) print(t[1]) # 4 def slice_tuple(): """ A tuple is a sequence type, and so has access to that methods defined for sequences. Slicing appears to alw...
true
e9ddb5d5d9b6e2beedd973df0f8b2adc3cb30aeb
arashrafiey/Approximation_Min_Cost_Homomorphism
/C_Python_Version/src/flat_graph.py
UTF-8
995
3.328125
3
[]
no_license
# Author: Thiago Santos # program to flat a graph. Then, we aren't gonna care for partitions anymore # This is to help the lp, make it faster # the idea is that we will create a graph with size = size * 2 # if ij is an edge, i is gonna be connected to j' import random import sys import os def flat_graph(graph): ...
true
0d4d29a0039074e75dd07b177d07cb3765ad2832
viniciusperrone/PythonExercises
/Lista_02/exe020.py
UTF-8
292
4.03125
4
[]
no_license
import random nome_01 = str (input('Primeiro nome: ')) nome_02 = str (input('Segundo nome: ')) nome_03 = str (input('Terceiro nome: ')) nome_04 = str (input('Quarto nome: ')) lista = [nome_01, nome_02, nome_03, nome_04] random.shuffle(lista) print('Ordem de apresentação: ') print(lista)
true
1f34c1fb4e7197276b748e44fbbaf51f7b5bf929
nandanabhishek/LeetCode
/problems/2. Add Two Numbers/sol.py
UTF-8
1,331
3.40625
3
[]
no_license
# Approach - 1: Easily Understoodable # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: # base cases if l1==None: ...
true
27e64315c2e0c9b56db9f0b7c1798ee805bce4ca
GINK03/GIZYUTSUSHOTEN-08
/books_codes/003-makeing-kvs/dummy_data_example.py
UTF-8
1,566
3.15625
3
[]
no_license
# ファイルシステムベースのKVSの例 import gzip import pickle from pathlib import Path from collections import namedtuple from itertools import count import requests import random from hashlib import sha224 Path("db").mkdir(exist_ok=True) Datum = namedtuple("Datum", ["depth", "domain", "html", "links"]) def get_digest(url): ret...
true
cf27b55a9b4431f6c3f6ad982ac84f95c8fe7819
DanielMalheiros/geekuniversity_programacao_em_python_essencial
/Exercicios/secao05_estruturas_logicas_e_condicionais/exercicio12.py
UTF-8
330
4.75
5
[]
no_license
"""12- Faça um algoritmo que leia um número inteiro. Se o número for negativo, escreva a mensagem "Número inválido. Se positivo, calcular o logaritmo deste número.""" import math num = int(input("Escolha um número: ")) if num < 0: print("Número inválido.") else: print(f"O log de {num} é {math.log10(num)}.")
true
de42351c8565c70df773f52039b2fde4ecb726cd
optionalg/programming-introduction
/Aula 05/aula5-EXTRA9.py
UTF-8
131
4.15625
4
[]
no_license
num = input("Type a number with 3 digits: ") tens = int(num[1]) print(tens) if tens % 2 == 0: print("Even") else: print("Odd")
true
aef6103e03a44406134c0a06698f88d2b2b924d9
Eger37/algoritmization
/lab_6/lab_6_3.py
UTF-8
927
3.46875
3
[]
no_license
# 3. Значення змінної x, що позначає деяку суму грошей в валюті p, замінити величиною # цієї ж суми в гривнях. # Сугак Даниїл Васильович 1 курс група 122Б from enum import Enum class Month(Enum): January = 1 February = 2 March = 3 April = 4 May = 5 June = 6 July = 7 August = 8 Sept...
true
c9fa4751a3cf0ba8f2c7c86f8eb0485ca3ee65e7
tonyvu2014/hivery-backend-challenge
/app.py
UTF-8
4,810
2.734375
3
[]
no_license
from flask import Flask, request, jsonify from pymongo import MongoClient import json FRUIT_LIST = ['banana', 'apple', 'orange', 'strawberry'] VEGETABLE_LIST = ['cucumber', 'beetroot', 'carrot', 'celery'] app = Flask(__name__) app.config.from_object('config.DevelopmentConfig') def get_db(): client = MongoClient(...
true
79f6a57beeb100cc38d9f9bb0290dcebb86eabdb
iamaureen/Dynamic-Web-Parsing-Selenium-Demo
/seleniumDemo_KA.py
UTF-8
3,777
2.78125
3
[]
no_license
from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException import time driverPath = '/Users/ish...
true
ff350491f5d20a4ec408988569be379f77181887
taigw/itk_vtk
/vtk/ImageSlicingQt.py
UTF-8
6,639
2.625
3
[]
no_license
#!/usr/bin/env python import sys import vtk from PyQt4 import QtGui from PyQt4.QtCore import * from PyQt4.QtGui import * from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor def load_vtk_data(imgName): if(imgName.endswith('nii')): reader=vtk.vtkNIFTIImageReader() elif(imgName.end...
true
6bf2c147f10f2dee647ebdce10975cfb0abc74c6
victordomene/cs181-practicals
/practical2/features/extract_likely_tags.py
UTF-8
2,645
2.640625
3
[]
no_license
import os import cPickle as pickle import random try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET import numpy as np from scipy import sparse import util def shuffle(x): x = list(x) random.shuffle(x) return x counter = 0 TRAIN_DIR = "../data/train/" T...
true
a9df49df962a61774ae35cb0fa2383dfcbc3990a
Kshitij0312/AI-Bots
/utility.py
UTF-8
1,136
3.84375
4
[]
no_license
""" This module contains general-use functions. """ import numpy as np def seq_is_equal(a, b): """ Helper function that checks if two sequences are equal (assuming they have the same length). """ for i in range(len(a)): if a[i] != b[i]: return False return True def angle_i...
true
602aab2da0e4902eab5cba935c87a45e48f76c20
gustavosabin/boltzmann
/PerceptronClass.py
UTF-8
3,794
2.90625
3
[]
no_license
import math import numpy as np class PerceptronClass(): # Perceptron Class def __init__(self, x, w, txAprendizagem): self.x = x self.w = w self.txAprendizagem = txAprendizagem self.alfa = np.array([]) # fase positiva self.Uv = np.array([]) ...
true
40011ab995b9ee4fb99baf4578a08ba21bbb4a9d
gammapy/gamma-cat
/gammacat/tests/test_input.py
UTF-8
1,454
2.625
3
[]
permissive
# Licensed under a 3-clause BSD style license - see LICENSE.rst import gammacat.input def test_basic_source_info(): info = gammacat.input.BasicSourceInfo.read('input/sources/tev-000083.yaml') assert info.data['source_id'] == 83 assert repr(info) == "BasicSourceInfo(source_id=83)" def test_basic_source_l...
true
a0cd9c5c65bc489018b27e514c0c79abcf6450f4
prajaktaray/Design-1
/splStack.py
UTF-8
730
4.28125
4
[]
no_license
#Time complexity = O(1) #Code ran on leetcode with Runtime error class MinStack: def __init__(self): self.stack = [] #rtype : None def push(self, x): self.stack.append(x) #rtype : None def pop(self): self.stack.pop() #rtype : int def top(self): return self.stack.pop(...
true
adab975fa4fa29f55943ef8e5ed15c0148fb7607
liz1527/variability
/xrayluminosity.py
UTF-8
2,692
2.65625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 11 10:10:23 2018 Investigate properties of the variable sources @author: ppxee """ ### Import required libraries ### import matplotlib.pyplot as plt #for plotting from astropy.io import fits #for handling fits from astropy.table import Table #for ...
true
f0a244033b80b7c137d7149fec3adc40e9cd90b2
rdgoite/hca-ingest-client
/ingest/template/spreadsheet_builder.py
UTF-8
10,241
2.65625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python """ Given a tabs template and list of schema URLs, will output a spreadsheet in Xls format """ import urllib from argparse import ArgumentParser __author__ = "jupp" __license__ = "Apache 2.0" __date__ = "08/05/2018" from ingest.template import schema_template, tabs from ingest.template.tabs impo...
true
267167e0625f9265d9ee1d626cab0376e532cbf9
bsolino/2017-MAIR-word-segmentation
/bigram_segmentation/file_utils.py
UTF-8
1,447
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 18 12:38:02 2017 @author: Breixo """ import random from collections import deque def load_file(route): with open(route) as f: text = [] for line in f: text.append(line) return text # Divides the data evenly in parts. # data: List of ...
true
70e4f330dff339164be5096cffac622e873c6c27
moreati/Arpeggio
/examples/json/json.py
UTF-8
2,932
2.96875
3
[ "MIT" ]
permissive
############################################################################## # Name: json.py # Purpose: Implementation of a simple JSON parser in arpeggio. # Author: Igor R. Dejanovic <igor DOT dejanovic AT gmail DOT com> # Copyright: (c) 2009-2014 Igor R. Dejanovic <igor DOT dejanovic AT gmail DOT com> # Licens...
true
1ba2802b1a65a0d55d7b965ff8c337a2fdf02cc4
hackwithcameron/tower_defense
/Enemies/enemy.py
UTF-8
2,962
3.25
3
[]
no_license
import pygame import os from levels import LEVEL_PATH class Enemy: def __init__(self, health=100, speed=1): self.width, self.height = 75, 75 self.max_health = health self.health = health self.animation_count = 0 self.path = LEVEL_PATH self.x, self.y = self.path[0] ...
true
d9cef7320ce46787f41db6ec181c7284b27a276d
CherleX/leetcode
/372-Super-Pow/solution.py
UTF-8
443
2.671875
3
[]
no_license
class Solution(object): def superPow(self, a, b): """ :type a: int :type b: List[int] :rtype: int """ mod1 = mod = a % 1337 period = 0 while True: mod = mod * mod1 % 1337 period += 1 if mod == mod1: ...
true
d7bf6880dfd18cd73ca5db65499e8390a63142cd
murugesh03/full_stack_classroom_july_2019
/day_09/code_snippets/01_input_data_structures_simple_algos/03.py
UTF-8
410
4.09375
4
[]
no_license
# print a list of students which contains even more lists inside it # nested for loops rows_of_students = [ ['alan', 'joshiba', 'ramya', 'sangeetha'], ['kishore', 'arivuselvan', 'jegan', 'syed', 'anand', 'ashwin', 'sachin', 'edwin'], ['sumaya', 'likitha', 'meena', 'abirami', 'kokila'] ] for row in...
true
26392309c6efb3f97706e716450d4358848e2e1f
aangang/book-sworm
/selenium-panjs-bak2.py
UTF-8
7,877
3.3125
3
[]
no_license
from selenium import webdriver from urllib import request import os import random import time # 要想调用键盘按键操作需要引入keys包 from selenium.webdriver.common.keys import Keys # 查找一个页面中的元素: #find_element_by_id #find_element_by_name #find_element_by_xpath #find_element_by_link_text #find_element_by_partial_link_text #find_e...
true
200add7f65573b99e1280d96bc3137c1b9ddde8e
jasont5566/simple-RPG
/blabla.py
UTF-8
1,143
3.984375
4
[]
no_license
print ("hello player") name = input("what is your name?") #int means converting anything typed into integer for python age = int(input ( "what is your age?")) health=100 if age >= 18: print ('Welcome',name,'to the new world') else: print ('sorry',name,'you are not qualified to enter.') #.lowe...
true
402e69f040eae0fea3de725ed3068fd352a7547c
rudolphosu/prep
/ctci/graph.py
UTF-8
1,032
3.65625
4
[]
no_license
class Graph: def __init__(self, vertices = None, directed = True): self.vertices = {v:[] for v in vertices} if directed: self.directed = True else: self.directed = False def getVertices(self): return self.vertices def getEdges(self,v): return...
true
e01bcc9de3f3776a96749e1db640f05283974950
NoFakMiha/pong_game
/player_one.py
UTF-8
918
3.296875
3
[]
no_license
from turtle import Turtle #Player one settings PO_SHAPE = "square" PO_COLOR = "white" PO_SIZE_WIDTH = 8 PO_SIZE_LENGTH = 1 PO_SIZE_OUTLINE = 0 PO_START_X = -720 PO_START_Y = 0 PO_SPEED = 0 class PlayerOne: def __init__(self): self.player_one = Turtle(PO_SHAPE) self.player_one.color(PO_COLOR) ...
true
d1b57db232cd5845738b77f6c132fed9599c65f6
OfficialRuby/file-locker
/tools/util.py
UTF-8
2,251
2.9375
3
[ "MIT" ]
permissive
import random, string, os, sys class Tool: def generatePassword(): return "".join(random.choices(string.ascii_letters + string.digits, k=15)) def multiple(folder): global empty try: value =input("How many copies of this file do you need: ") value = int(value) ...
true
48dfbfa14541dbcb632909e9bd2dea38cbf25750
conan2014/stores-rest-api
/models/user.py
UTF-8
1,047
3.046875
3
[]
no_license
from db import db class UserModel(db.Model): # get UserModel to extend db.Model # tell SQLAlchemy to create the mapping between database and UserModel object __tablename__ = "users" # Tell SQLAlchemy which table UserModel is going to be stored at id = db.Column(db.Integer, primary...
true
3bb9151d1111416ff3b0f6af5ca25f464f6cbaf7
rem657/MTGCardPricer
/MTGCardPricer.py
UTF-8
5,163
3.734375
4
[]
no_license
from Card import Card, time from typing import List import pandas as pd def make_card(card_name: str, card_set: str, is_foil: bool, quantity: int): try: new_card = Card(card_name, card_set, is_foil, quantity) except: print('an error occurred trying again soon') time.sleep(2) ne...
true
a7b347c1e009ea9a7833446a9b459b9143fd44b2
TheodorUngureanu/Advent-of-Code
/2019/day08/day8.py
UTF-8
1,469
3.375
3
[]
no_license
# day 8 # run using python 3 import sys LINE = 6 COLUMN = 25 if __name__ == "__main__": with open("input", 'r') as input: lines = input.read().splitlines() # all numbers numbers = list(lines[0]) layers = {} # for all layers size = int(len(numbers) / LINE / COLUMN) for i in range(size): layers[i] = number...
true
87637d026f502aeb9712dc3796ea805591c3132a
Aasthaengg/IBMdataset
/Python_codes/p03730/s212533013.py
UTF-8
135
3.0625
3
[]
no_license
a,b,c = map(int, input().split()) for i in range(a, 100000000, a): if i % b == c: print("YES") exit() print("NO")
true
9cfbc9228d7f7087803380a4f4a0debc50bc3484
bartman/adventofcode
/2015/7/7-1.py
UTF-8
2,015
3.28125
3
[]
no_license
#!/usr/bin/python3 from collections import namedtuple import re import sys filename = 'input.txt' if len(sys.argv) > 1: filename = sys.argv[1] with open(filename, 'r') as f: lines = f.readlines() gates = {} class Input: def __init__(self, in1): if in1 and in1.isnumeric(): self.in1 =...
true
6415499e5a18381646de5086a1e065e222337e09
DrStriky/Snake
/pytorch_player.py
UTF-8
8,855
3.046875
3
[]
no_license
import random from collections import deque from typing import Tuple, List import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import torch.nn as nn import torch.optim as optim from network import Linear_QNet2 from player import Player class PyTorchPlayer(Player): def __init__(se...
true
42ca4d7c1bbea613158ed7810a9505192b1da4d5
CristinaStaicu/AstroPlant-Simulation
/astroplant_simulation/environment.py
UTF-8
4,766
3.421875
3
[ "BSD-2-Clause" ]
permissive
""" Temperature is in degrees celsius. Pressure is in hPa. Specific humidity is kg moisture per kg air. Relative humidity is a fraction of total possible humidity. """ import threading import time import datetime import math SECONDS_PER_HOUR = 60 * 60 KIT_VOLUME = 0.5 * 1.0 * 2.0 # m^3 KIT_AIR_MASS = 1.293 * KIT_VO...
true
1797aabf33deacb20c6842e220594acffde59c82
alejandrodebus/SpatioTemporalCNN_lvquan
/SpatioTemporalCNN_lvquan/model_phase_classification.py
UTF-8
625
2.515625
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class PhaseClassification(nn.Module): def __init__(self): super(PhaseClassification, self).__init__() self.conv3d_5 = nn.Conv3d(40, 40, kernel_size = (1,5,5), stride = 1, padding = (0,1,1)) self.batch_norm5 = nn.BatchNorm...
true
87953dc3cb9f1496cf4cc739d8724ee9019df2a1
JinkeCao/web_scraping
/credit_service_stat.py
UTF-8
1,292
2.75
3
[]
no_license
from pandas import read_table, merge, DataFrame def ch2int(x): if '万' in x: x = x.strip('万') if '.' in x: i = x.index('.') x = x.replace('.', '') for n in range(4 - (len(x) -i)): x += '0' else: x += '0000' elif '亿' in x: ...
true
d183ddba8b895c7c1a377c32171b4624330ccf76
yooseungju/TIL
/Startcamp/1220/dictionary/dict_pratice.py
UTF-8
1,425
4.03125
4
[]
no_license
""" 파이썬 dictionary 기초 """ #1. 평균을 구하세요. # score = { "국어": 87, # "영어": 92, # "수학": 40 # } # hab = 0 # avg = 0 # for v in score.values(): # hab += v # avg = hab / len(score) # print("평균값: " , avg) # print(sum(score.values())/len(score)) # 2. 반 평균을 구하시오 # scores = { # "철수...
true
31509cc0c3ec9c20ae09304c68c91fa04e7798a9
Roc-J/Unsupervised_learning
/utilities.py
UTF-8
271
2.703125
3
[]
no_license
# -*- coding:utf-8 -*- # Author: Roc-J import numpy as np def load_data(filename): X = [] with open(filename, 'r') as f: for line in f.readlines(): data = [float(x) for x in line.split(',')] X.append(data) return np.array(X)
true
b940873607661c586c9d218314d9a3dc92b45c68
yueqiusun/DSGA1004-Big-Data
/MRAVF/reduce1.py
UTF-8
585
3.171875
3
[]
no_license
#!/usr/bin/python import sys import string # input comes from STDIN (stream data that goes to the program) current_key = None num = 0.0 index = [] for line in sys.stdin: #Remove leading and trailing whitespace line = line.strip() #Get key/value key, value = line.split('\t',1) value = int(value) if key =...
true
6a54f6be4775771ccd9bf82cfee1e08309482d07
prathameshtibile/Python
/LogicalProgram/CouponNumber.py
UTF-8
1,600
4
4
[]
no_license
""" *Author : Prathamesh Tibile *Date : 29-07-21 *Time : 07-00 PM *Title : a. Desc -> Given N distinct Coupon Numbers, how many random numbers do you need to generate distinct coupon number? This program simulates this random process. b. I/P -> N Distinct Coupon Number c. Logic -> repeatedly choose a random number...
true
5bd47789b509a6e485593d61a04bb0099599725c
sososquirrel/SAM_project
/pySAM/tests/cold_pool/test_potential_energy.py
UTF-8
1,797
3.03125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import pytest data_array = np.zeros((15, 20)) # idealized cold pool data_array[0:5, 10:18] = -1 data_array[6, 12] = -1 z_array = np.linspace(0, 14, 15) depth_shear = "5" x_size = 10 def test_hight_max_index(): cold_pool_hight_max = 1.5 * float( depth_s...
true
264035c7ceac2a874ee5be0e362eee5d63942951
madtyn/progPython
/src/PP4E/Gui/Intro/gui1e.py
UTF-8
137
2.671875
3
[]
no_license
from tkinter import mainloop, Label from tkinter import YES, BOTH Label(text='Hello GUI world!').pack(expand=YES, fill=BOTH) mainloop()
true
300ffdb5c74330eec8c51c209244c7179e7ca289
nsshayan/Python
/Diophantine_reciprocals_2.py
UTF-8
543
2.703125
3
[]
no_license
input = open('C:\Personal\Projects\Python\\testcase1.txt','r') T=int(input.readline()) #T = int(raw_input()) for i in range(0,T): N = int(input.readline()) N = N * N initial_N = N numFactors = 1 last = N/2 + 1 for i in range(1,last): if N % i == 0: numFactors += 1 numfactors += 1 ...
true
ffd9a4b8d57f4f645990f4e3713e2d5cabf3d8b1
bobo213/learn-py
/mymodule.py
UTF-8
196
2.859375
3
[]
no_license
__author__ = 'liubo' def sayhi(): print 'Hi, this is my module.' version = '0.1' '''sssss''' start = 1 end = 5 for i in range(start,end): print i+1 else: print 'The for loop is over'
true
b1b14fb644ea4ce5d877b0db56a1815410e2db95
vishnuap/Algorithms
/The-Basic-13/Print-1-255/Print-1-255.py
UTF-8
138
3.875
4
[]
no_license
# The Basic 13 # Print-1-255 # Print all integers from 1 to 255 def print255(): for i in range(1, 256): print(i) print255()
true
ee4c532cefd39c974a70c01530cdbe11e983f771
ericwangg/hackerrank_problems
/Python/math/math_find_angle_MBC.py
UTF-8
497
3.46875
3
[]
no_license
Sample Input 10 10 Sample Output 45° # Notes: Since splitting ABC into 2 triangles at M produces 2 isosceles triangles, calculating angle MBC = angle MCB # angle MCB can be calculated using cos^-1(BC/Hypotenuse) # Enter your code here. Read input from STDIN. Print output to STDOUT import math if __name__ == "__m...
true
a6eb13e723fbd16726150a3afee77bbc48c27465
GYT0313/Python-DataStructure
/3-sort/sort.py
UTF-8
2,621
3.78125
4
[]
no_license
import random # O(n^2) def selection_sort(lyst): """选择排序""" i = 0 while i < len(lyst) - 1: min_index = i j = i + 1 while j < len(lyst): if lyst[j] < lyst[min_index]: min_index = j j += 1 if i != min_index: lyst[i], lyst[mi...
true
5514289bc91352179a5047134c48ff341b8a4b57
cmcafee1988/drf_shoestore
/shoeapp/models.py
UTF-8
1,638
2.6875
3
[]
no_license
from django.db import models # While growing up on the African Savanah, Joe spent many days running with herds of grazing # antelopes while wearing his favorite violet colored sneakers class Manufacturer(models.Model): name = models.CharField(max_length=200) website = models.URLField() class ShoeType(model...
true
546245d08155e770dd55864e0c1b07ad4dfac733
ICe-and-Pi-C/Bot
/statistics_4.py
UTF-8
1,265
3.421875
3
[]
no_license
# Статистика - statistics def minimum(b): return str(min(b)) def maximum(b): return str(max(b)) def median(b): b.sort() if len(b)%2 == 0: return str((b[len(b)//2] + b[len(b)//2 -1])/2) return str(b[len(b)//2]) def summa(b): return str(sum(b)) def firstmostfrequent(b): d = dict()...
true
4a515d8deb151e784372c153f1c76094ff62b128
jennyChing/onlineJudge
/10801_2.py
UTF-8
2,831
3.359375
3
[]
no_license
''' Shortest Path 找不在樹上、離根最近的點,就直接窮舉 d[] 表格,找出最小的 d[b] 10801 - Lift Hopping You are on floor 0 and would like to get to floor k as quickly as possible. Assume that you do not need to wait to board the first elevator you step into and (for simplicity) the operation of switching an elevator on some floor always takes ...
true
e1fafd0222e2f3a1e73463c491451201c9da15a6
DomiDre/vsm_scripts
/vsm_excess.py
UTF-8
6,276
2.5625
3
[]
no_license
import numpy as np import sys, os.path, lmfit import matplotlib.pyplot as plt from vsm import VSMClass class VSM_Excess(VSMClass): def __init__(self): super().__init__() print("Loading " + self.sample_path) self.load_xye_vsmfile(self.sample_path) self.determine_excess() ...
true
51d4f1e7700f3df8b8851e8754a3e3e2bab0face
AnudeeP-1/Codes
/Python/Sample/encode.py
UTF-8
451
3.15625
3
[]
no_license
def encode(data): encoding = '' prev_char = '' count = 1 if not data: return '' for char in data: if char != prev_char: if prev_char: encoding += str(count) + prev_char count = 1 prev_char = char else: count += ...
true
afa105a62d2eddee063a711dec5519e792bf755f
Hridai/Self-Driving-Pi-Car
/Main.py
UTF-8
1,916
2.8125
3
[]
no_license
if __name__ == '__main__': import cv2 from TCPClient import TCPClient from cmdline import command #cap = cv2.VideoCapture('http://192.168.1.157:8090/?action=stream/frame.mjpg') cap = cv2.VideoCapture(0) ## to use your webcam instead of stream tcp = TCPClient() cmd = command() bC...
true
bd7ca03ee6abf145b65319b304c22a8179b64ed1
gabofer82/taller_programacion_2017
/Documentación/SOURCE/Programa/negocio/api.py
UTF-8
1,947
2.734375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from .manejadoras import ManejadoraPrincipal, ManejadoraPacientes class Acceder(object): """ Clase encargada de nuclear el acceso a cada uno de los objetos de la capa de negocio. Note: Suministra los métodos necesarios para trabajar con la capa como facha...
true
9c569c73848ab8ef0aa9e5a0ed6798029b784900
FlyingSpringrol/Human-memory
/RBM/learning/firstRBM.py
UTF-8
4,594
3.03125
3
[]
no_license
import numpy as np from numpy import random as rand import sys def sigmoid(x): return 1.0/(1+ np.power(np.e, -x)) vec_sig = np.vectorize(sigmoid) def bin(state): if rand.random() < state: return 1.0 else: return 0.0 vec_bin = np.vectorize(bin) class Layer(): """ 2 layer RBM class, Mea...
true
f378cb1ae8ec90dc3c5a117dd3c7818be5f74d70
AmazingPaper/PrjWk2
/Board/PlayerGraphics.py
UTF-8
364
2.875
3
[]
no_license
from Board.GraphicsConstants import * from Board.PlayerTextures import PlayerTextures class PlayerGraphics(): def __init__(self, surface): self.surface = surface def draw(self, player): playerTexture = PlayerTextures[player.playerType] position = (player.tile.posY * TileSize, player.tile.posX * TileSize) ...
true
5f24d0fb054f18646ed6c21a521f7613a5141fcd
tfjgeorge/fuel
/fuel/transformers/video.py
UTF-8
3,111
2.875
3
[ "MIT" ]
permissive
import numpy from PIL import Image from . import ExpectsAxisLabels, Transformer import math class RescaleMinDimension(Transformer, ExpectsAxisLabels): """Resize (lists of) images so that their shortest dimension is of a given size. Parameters ---------- data_stream : instance of :class:`AbstractDataS...
true
4a0da8000a5ff7919707b88935632f2c01485315
wout-junius/AI_Project_Routeplanner
/AI/AI 2.0.py
UTF-8
3,357
3.46875
3
[]
no_license
import queue import requests lijst = [] def printMaze(maze, path=""): for x, pos in enumerate(maze[0]): if pos == "O": start = x i = start j = 0 pos = set() for move in path: if move == "L": i -= 1 elif move == "R": i += 1 elif...
true
56cfcd87fe695dcfa811bc30d5f67ed3832bd863
aio-libs/aiocache
/examples/alt_key_builder.py
UTF-8
10,655
3.375
3
[ "BSD-3-Clause" ]
permissive
"""alt_key_builder.py ``key_builder`` is used in two contexts within ``aiocache``, with different meanings. 1. Custom ``key_builder`` for a cache -- Prepends a namespace to the key 2. Custom ``key_builder`` for a cache decorator -- Creates a cache key from the decorated callable and the callable...
true
7626d830bf28dddc0b21988f29c84e83451c54da
ksamokhin/python
/Lesson1/task2.py
UTF-8
347
3.75
4
[]
no_license
time = int(input('Введите время в секундах (не более 86400): ')) if time <= 86400: sec = time % 60 time = int(time / 60) min = time % 60 time = int(time / 60) print ('Получилось %.2d:%.2d:%.2d' % (time, min, sec)) else: print('Вы ввели слишком большое число')
true
3561a0f533f83520e822d701e5224d646f08f94d
Levi1215/one-workflow
/test.py
UTF-8
2,103
3.484375
3
[]
no_license
# ipo input process(处理) out # 静态语言,解释型语言 # 两种编程方式 # 交互式 # 文件式 # import turtle # turtle.pensize(3) # turtle.circle(10) # turtle.circle(40) # turtle.circle(80) # turtle.circle(160) # from turtle import * # color('blue','red') # begin_fill() # for i in range(5): # fd(200) # rt(144) # end_fill() # done() # tem...
true
9f97739e8c60b4237118763cc6667e9dd48f6b85
lukewang7/bioinfo
/outcome_likelihood.py
UTF-8
1,466
2.515625
3
[]
no_license
""" Solve the Non Branching Paths Construction Problem. """ import bio.io_utils as io import bio.triee import bio.cluster as cl import math def do_work(source): output = source.next() print "output", output io.eat_line(source) external_states = io.read_elements(source) print "external_states", exte...
true
65a52306f36078cbdc7f34676166dd0f381f9630
LanguidCat/BaekJoon
/7510-고급_수학/7510.py
UTF-8
292
3.265625
3
[]
no_license
import sys idx = 0 for i in range(int(sys.stdin.readline())): LST = list(map(int, sys.stdin.readline().split())) LST.sort() idx += 1 if LST[2] ** 2 == LST[1] ** 2 + LST[0] ** 2: print(f"Scenario #{idx}: \nyes") else: print(f"Scenario #{idx}: \nno") print()
true
479e6e534d84f577520d0de932fcf056f9ca3baa
WebSculptor-Govardhan-26/J-R-D_TATA
/W6D2/rec.py
UTF-8
124
2.765625
3
[]
no_license
def anyname(i): if i==1: return print(i) anyname(i-1) #Infinite loop anyname(5) print("end")
true
5566e312d4afbc982157a94cf59ecc2eed6681b7
ai-kmu/etc
/algorithm/Basic_Class/문제풀이코드/05_BruteForce/카펫_jaeseok.py
UTF-8
556
3.078125
3
[]
no_license
def solution(brown, yellow): # brown이 8, yellow가 1이 최소조건인 경우는 width와 height가 모두 3인 경우 width = 3 height = 3 # width에 의해 height가 결정되므로 width를 1씩 더해가면서 yellow와 brown의 개수가 조건과 같을 때까지 계속 width에 1을 더함 # width는 항상 height보다 같거나 커야 함 while True: if (width - 2) * (height - 2) == yellow and width >...
true
8716fab18ab01b4ad20e650d352bebedb4573810
AnthonyDem/MultiThreading
/map.py
UTF-8
911
3.34375
3
[]
no_license
from concurrent import futures def read_ints(path): lst = [] with open(path, 'r') as f: while f: line = f.readline() lst.append(int(line)) return lst def count_three_sum(ints, name): print(f'started counter in thread {name}') n = len(ints) counter = 0 fo...
true
d979a23026aea9d90c256b2da055eb48c77b3660
PaulaGeorgiana/Agenda_Contacte
/teste/ContactDomTest.py
UTF-8
841
2.640625
3
[]
no_license
''' Created on 24 ian. 2015 @author: ToTaL ''' import unittest from domain.ContactDom import Contact class TestCase(unittest.TestCase): def testContact(self): c = Contact("1", "Anca", "123", "job") self.assertEqual(c.getId_contact(), "1") self.assertEqual(c.getNume(), "Anca") ...
true
5e7cb10639d776242cae63f284dbcb552f6df8c0
shayp/NavigationModels
/NeuralNetwork/PlotTuningCurves.py
UTF-8
1,511
2.625
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def PlotTuningCurves(neuronNumber, modelWeights, numOfPositionParams, numOfVelocityParams, numOfHeadDirectionParams, numOfBorderParams): positionTuningCurve = modelWeights[0:numOfPositionParams ] velocityTuningCurve = np.asarray(modelWeights[numOfPositionParams...
true
6c2c33a01f4d3e42da82c4b20e3a9aeb75320a01
CherylYao0/mysite
/apps/news/search_indexes.py
UTF-8
1,171
2.578125
3
[ "AFL-3.0" ]
permissive
#!/usr/bin/env python # -*- coding:utf-8 -*- # author:HuangManyao from haystack import indexes from .models import News class NewsIndex(indexes.SearchIndex, indexes.Indexable): """ 这个模型的作用类似django的模型,它告诉haystack哪些数据会被 放进查询返回的模型对象中,以及通过哪些字段进行索引和查询 """ # 这字段必须这么写,用来告诉haystack和搜索引擎要索引哪...
true
e6ca589e8f9dcc296e7bf816883792ceb5ecb419
rodrigodobre/visualizacao
/loja3.py
UTF-8
1,843
2.828125
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as mpl from colour import Color import datetime as dt mpl.rcParams['axes.spines.left'] = False mpl.rcParams['axes.spines.right'] = False mpl.rcParams['axes.spines.top'] = False mpl.rcParams['axes.spines.bottom'] =...
true
7d184b1849fe70cad5adc905c9f97a0d4faa6a14
aipetre/algorithm-toolbox
/week 3/different_summands.py
UTF-8
1,063
3.890625
4
[]
no_license
# Uses python3 # 5 Problem: Maximizing the Number of Prize Places in a Competition import sys def get_summand(k, l): if (k <= 2 * l): return k return l def optimal_summands2(n): summands = [] index = 1 while n != 0: summand = get_summand(n, index) summands.append(summ...
true
e71271ac45522e7044ef28a6e0e90fe9a7d594f7
Sabarikn/python_project
/py2.5.3.py
UTF-8
138
3
3
[]
no_license
import sys filename=sys.argv[1] string=sys.argv[2] res=(open(filename,'r').readlines()) for x in res: if string in x: print x
true
b999b4090667751d9a7cf8ae0c7b23fe92004d31
P-H-Pancholi/Python_practice_programs
/Hackerrank/findthemedian.py
UTF-8
243
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 14 16:02:28 2019 @author: Phalin Pancholi """ i = int(input()) for j in range(i): l = [int(x) for x in input().split()] l = sorted(l) n = int(len(l)//2) print(str(l[n]))
true
f133b1439f63a5a7e65168749a696210afa0cff1
chandrakanthdiddela/Demo
/Python/FinalGetDirections.py
UTF-8
1,443
2.859375
3
[]
no_license
import json import sys, urllib.request as url from html.parser import HTMLParser #https://www.youtube.com/watch?v=ulzlXMZa8ak #http://stackoverflow.com/questions/753052/strip-html-from-strings-in-python #answer submitted by stackoverflow user eloff class MLStripper(HTMLParser): def __init__(self): self.res...
true
2cc1b81668dd9ab6c64b69f42acbacac27df274f
mlucas-NU/advent_of_code
/2020/day_1/main.py
UTF-8
1,193
3.484375
3
[ "MIT" ]
permissive
import argparse import logging # Helper functions def part2(expenses): for exp1 in expenses: for exp2 in expenses: for exp3 in expenses: if len(set([exp1, exp2, exp3])) < 3: continue if exp1 + exp2 + exp3 == 2020: return...
true
3f6d82e7428cd1efcb42e4249a156db724de97aa
fstakem/pyedj
/test/unit/test_field_factory.py
UTF-8
2,019
2.515625
3
[]
no_license
import pytest from pyedj.compute.fields.field_factory import FieldFactory from pyedj.compute.fields.util import BoundsError # def test_typed_int_field(): # value = 2.0 # schema = { # 'type': 'integer', # 'default_value': value, # 'type_check': True, # 'bounds_check': False, #...
true
80c679e5eac8437a73ae2a451ece282ed8807a0a
Annihilation7/Ds-and-Al
/src/ds/graph_subject/chapter_05/graph_bfs.py
UTF-8
1,027
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- # Email: 763366463@qq.com # Created: 2020-02-15 02:38pm import queue class GraphBfs: def __init__(self, graph): """ 图的广度优先遍历类,和二分搜索树的广度优先遍历差不多,区别就是多个了节点记录功能 :param graph: 传入的图 """ self.graph = graph self.visited = [False] * self.graph.V ...
true
79e6f44518f65c84090648f433bcc430556e128d
Patrick1953/Behavior
/outils/Lire.py
UTF-8
849
2.8125
3
[]
no_license
# coding: utf-8 from lecture_log import lecture_log import os def Lire () : L = lecture_log () debut_message = "" while (True) : message = debut_message + """logs: trace : 1 warning : 2 error : 3 \n FIN : 4 """ rep1 = input(mess...
true
489c4e7ba905d688bbd1890d1a10c432c5713b27
chelseazhao/Leetcode-for-fun
/69-Sqrt(x)/Solution.py
UTF-8
582
3.296875
3
[]
no_license
class Solution(object): def mySqrt(self, x): """ :type x: int :rtype: int """ if x == 1: return 1 left = 0 right = x res = right / 2 while left < right - 1: if res * res < x: left = res re...
true
7d3ca80c2585f43dd05fcf0528ddcf5b68ce1e77
Sh1n/abit
/matrixHelper.py
UTF-8
667
3.375
3
[]
no_license
""" Generic Helper class for matrix management """ import numpy # Creates an NxN zero matrix def zero_matrix (n): return [[0] * n for i in xrange(n)] # Creates a NxN defined matrix def defined_matrix(n, v): return [[v] * n for i in xrange(n)] # creates a diagonal NxN matrix def eye_matrix(n): return [ [0 if (i ...
true
39f6fb7b68e3d658f01e8c81f7956dd3b2e5e741
amitkumarj441/QNET
/src/qnet/algebra/library/circuit_components.py
UTF-8
4,580
3.140625
3
[ "MIT" ]
permissive
"""Collection of essential circuit components""" from functools import partial from sympy import I, cos, exp, pi, sin, symbols from ..core.circuit_algebra import Component, SLH from ..core.matrix_algebra import Matrix from ...utils.properties_for_args import properties_for_args __all__ = ['CoherentDriveCC', 'PhaseCC...
true
57c1c8e2fa320ef17e9a6bded20026dad48bf813
jfongjw/testFolder
/octString.py
UTF-8
141
3.15625
3
[]
no_license
octString = input(str("Enter a number: ")) decNum = 0 for c in octString: decNum = decNum * 8 decNum = decNum + int(c) print(decNum)
true
96e3dcf3dd4aa6223b34343a593846460b61ea04
wildomonges/artificial-intelligence
/cameo_face_tracking_and_image_manipulation/cameo.py
UTF-8
1,402
3.078125
3
[ "MIT" ]
permissive
import cv2 from cameo_face_tracking_and_image_manipulation.managers import WindowManager, CaptureManager class Cameo(object): def __init__(self): self._window_manager = WindowManager('Cameo', self.on_keypress) self._capture_manager = CaptureManager(cv2.VideoCapture(0), self._window_manager, True) ...
true
87a897541d48abd1141480181e376848661af93e
gauravkarkal/Design-and-Analysis-of-Algorithms
/prim.py
UTF-8
830
2.9375
3
[]
no_license
graph={1:[2,4],2:[1,3,4],3:[2,4,6],4:[1,2,3,6],6:[3,4]} edges={(1,2):4,(1,4):8,(2,4):1,(2,3):3,(3,4):7,(3,6):8,(4,6):3} def prim(source): U=[source] V=list(graph.keys()) tree={} while len(U)!=len(V): d={} for u in U: for v in set(V)-set(U): if (u...
true
ad5c2801f7583e2bb5761c93ee7890a485c5b3bc
suryansh3112/React-VQA
/backend/api/util/img_util.py
UTF-8
618
2.515625
3
[]
no_license
from flask import current_app as app, jsonify from werkzeug.utils import secure_filename import os import datetime def allowed_img(filename): data = '.' in filename and filename.rsplit( '.', 1)[1].lower() in ['jpg', 'jpeg', 'png'] return data def validate_img(file): if file and allowed_img(file....
true
1d92ec44ec052fd15305a4e9c89b01a627805c6c
hazelor/tobacco_monitor
/server/model/device.py
UTF-8
3,103
2.515625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from transwarp.db import next_id from transwarp.orm import Model, StringField, BooleanField, FloatField, TextField, IntegerField import time from util import CountDownTimer from util.marcos import DEV_ERROR_COUNT,\ DEV_STATUS_ERROR, DEV_STATUS_GOOD,\ DEV_STATUS_INAC...
true
8f6fc505507160d45e39700336fd37402a155e71
RenanMsV/FGFSTools
/telnetFG.py
UTF-8
1,017
2.5625
3
[]
no_license
'''import os,re,telnetlib host = "127.0.0.1" port = 5401 fg = telnetlib.Telnet() fg.open(host, port) fg.write("\r\n") fg.write("set /controls/flight/elevator 25\r\n") telnet.close()''' #! /usr/bin/python import socket class FlightGearInterface: def __init__(self): self.fgfs_sock = None self.fgfs...
true
cc1f3f18f2baffd67dd6d2fdc142484713a98257
RogerTerrill-Python/personal-projects
/Classes/Cards.py
UTF-8
250
3.625
4
[]
no_license
class Card: def __init__(self, value, face, suit): self.suit = suit self.face = face self.value = value def __str__(self): return f'Suit value of: {self.suit} Face value of {self.face} Value of {self.value}'
true
454543ed474540f2c1767d54ac4b046b0919940a
gghezzo/prettypython
/PythonEveryDay2015/setupRace.py
UTF-8
463
2.640625
3
[]
no_license
# This is the packager for the Race Game # From http://pythonprogramming.net/converting-pygame-executable-cx_freeze/?completed=/pygame-button-function-events/ # Typer: Ginny C Ghezzo # What I learned: This seems stupid to me. I just want an .exe import cx_Freeze executables = [cx_Freeze.Executable("MyGame.py")] cx_...
true