blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c95e101ed312b876e75266180fed61a03a68bc5e | Python | okin/argparse-lightning_talk | /3.py | UTF-8 | 345 | 2.96875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | import argparse
parser = argparse.ArgumentParser(prog="program name",
description="Doing amazing things!",
epilog="Still amazing after the help.",
prefix_chars='*')
parser.add_argument('**thingy')
args = parser.parse_arg... | true |
c6c2be2201fa2434f3aac8a206e77017cc7ac138 | Python | JcesarIA/learning-python | /EXCursoEmVideo/ex055.py | UTF-8 | 344 | 3.984375 | 4 | [] | no_license | maior = 0
menor = 0
for c in range(1, 6):
peso = float(input(f'Digite o {c}° peso: '))
if c == 1:
maior = peso
menor = peso
else:
if peso > maior:
maior = peso
if menor > peso:
menor = peso
print(f'O maior peso inserido foi o {maior} e o menor peso col... | true |
76d64d44ae8dc145b8aa2a06e1457db78cf4aecb | Python | alebovic/fakeessaytyper | /wikiwriter.py | UTF-8 | 475 | 3.125 | 3 | [] | no_license | def wikiGet(topic):
import requests
from bs4 import BeautifulSoup
import re
url = "https://en.wikipedia.org/wiki/" + topic
print(url)
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
ps = soup.findAll('p')
ps = [i.getText() for i in ps]
ps = [re.sub(... | true |
c80f44ea09dca66fa71688b4de3333642a063bd0 | Python | adrianna/DSandA | /Project/P0/Task0.py | UTF-8 | 1,504 | 4.15625 | 4 | [] | no_license | """
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
def firstRecord( record_list ):
return (... | true |
6176a8b028734f213c8aa875734095d3642379af | Python | rolfsimoes/Simple-ClusterPy | /programa.py | UTF-8 | 246 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
xmin, xmax = sys.argv[1].split('-')
xmin, xmax = int(xmin), int(xmax)
xsum = 0
x = xmin
while x <= xmax:
xsum += x
x += 1
print "Somatório (%d...%d) = %d" % (xmin, xmax, xsum)
| true |
aabcff905ef36a730215e843133436e84d30305d | Python | CFN-softbio/SciStreams | /SciStreams/data/tests/test_Obstructions.py | UTF-8 | 798 | 2.6875 | 3 | [] | no_license | from SciStreams.data.Obstructions import Obstruction
import numpy as np
from numpy.testing import assert_array_almost_equal
def test_obstruction():
mask = np.ones((10, 10))
mask[4:5, 6:9] = 0
# invert
image = (mask == 0).astype(int)
origin = 4, 5
obs = Obstruction(image, origin)
# this sho... | true |
d71dbb42524d261718431af6e6339a75277129a9 | Python | mhigson/Example-Projects | /Exercise 22 - Read from File.py | UTF-8 | 1,347 | 4.375 | 4 | [] | no_license | # Lists the characters in King Lear and how many times each character speaks.
# Empty list to fill with character names.
character_list = []
# Open and read file line by line.
file = open("King_Lear.txt", "r").readlines()
# Iterate through the text, finding character names with the following logic:
# (1) Incl... | true |
45332639b49aa115bc771b1466a456677bf63ea5 | Python | IshMehta/DSViz | /build/lib/DSViz/ArrayListV.py | UTF-8 | 2,397 | 3.3125 | 3 | [
"MIT"
] | permissive |
from DSViz.NoneError import NoneError
import tkinter as tk
from tkinter.constants import BOTTOM, HORIZONTAL
class ArrayListV:
list = []
@property
def show(self):
window = tk.Tk()
window.geometry("1000x800")
window.title("Array List Visualiser")
main_frame = tk.Frame... | true |
3a5210a716cc2b4db593c000d7b89ba6d7b93612 | Python | Teerapat1234/dockerProject | /pyFiles/finance.py | UTF-8 | 154 | 3.34375 | 3 | [] | no_license | def getPositionSize(Capital, Risk, Entry, Stop):
DistanceToStop = 100 * (abs(Stop - Entry)) / Stop
return (Capital * (Risk / 100))/DistanceToStop
| true |
21b5868354f13ad07b548baeaf5c2e2290ef79ca | Python | whyadiwhy/Awesome_Python_Scripts | /BasicPythonScripts/Integer To Roman Numeral/integer _to_roman_numeral.py | UTF-8 | 818 | 4.34375 | 4 | [
"MIT"
] | permissive | def roman_number(num):
if num > 3999:
print("enter number less than 3999")
return
#take 2 list symbol and value symbol having roman of each integer in list value
value = [1000,900,500,400,100,90,50,40,10,9,5,4,1]
symbol = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]
ro... | true |
648ec20881e6205706e9004b58be17d71026e232 | Python | sk8erwitskil/citrinechallenge | /src/citrinedemo/units/hour.py | UTF-8 | 208 | 2.609375 | 3 | [] | no_license | from base import TimeUnit
class Hour(TimeUnit):
@property
def name(self):
return 'hour'
@property
def symbol(self):
return 'h'
@property
def si_unit_conversion(self):
return 3600
| true |
dae1a513b1098af1e6e860ed6671e582919242dd | Python | xchekh/Game_on_python | /ball.py | UTF-8 | 4,853 | 2.828125 | 3 | [] | no_license | import pygame as pg
import sys
import random
pg.init()
screen = pg.display.set_mode((1024, 580))
walkRight = [pg.image.load('right_1.png'), pg.image.load('right_2.png'), pg.image.load('right_3.png'),
pg.image.load('right_4.png'), pg.image.load('right_5.png'),
pg.image.load('right_6.png')] #... | true |
a462dfc555408210b0345157d1598d32db1f80e6 | Python | akhil12028/Theory-of-Computation | /ANN-using-backpropagation/TOC_Assn3.py | UTF-8 | 3,372 | 2.96875 | 3 | [] | no_license | #A02231889
#Akhil Gudavalli
#TOC Assignment 3
#Change the input which is the parameter passed to the fit method in the last line of the program
import numpy as np
import pickle
class ANN:
def __init__(self,a_input,a_hidden,a_output):
self.a_input = a_input
self.a_hidden = a_h... | true |
394d84b04edda630988816e951227154c33a9092 | Python | RaghavJindal2000/Python | /basics/Python/PYTHON --------/Exception Handling/value_error.py | UTF-8 | 298 | 2.609375 | 3 | [] | no_license | with open("intro.txt",'r') as names_file:
with open("temp.txt",'r') as body_file:
body = body_file.read()
for name in names_file:
nam=names_file.read()
print(name)
print(body)
mail = nam+body
with open("hello.txt",'w+') as mail_file:
mail_file.write(mail)
#print(mail_file.read())
| true |
725e22dcfa9cf639d21d505a3fc61f1501425b90 | Python | parkseungjae/Python_Basic | /ex19.py | UTF-8 | 278 | 3.40625 | 3 | [] | no_license | import datetime
now = datetime.datetime.now()
if now.hour < 12:
print("현재 시간은 {}시 {} 분으로 오전입니다!".format(now.hour, now.minute))
if now.hour >= 12:
print("현재 시간은 {}시 {} 분으로 오후입니다!".format(now.hour, now.minute))
| true |
a923adae2e5b9997eb94a97d2ecbdaaa9125d2fd | Python | neethupauly/Luminarmaybatch | /oops/Inheritance.py | UTF-8 | 1,392 | 4.125 | 4 | [] | no_license | # inheritance
# single inheritance - only one class is inherited
# 1st program -single inheritance
class Person: #parent class/base class/super class
def pdetails(self,name,age,address):
self.name=name
self.age=age
self.add=address
print(self.name,self.age,self.add... | true |
4a68a7f0becda4e9b59f62a6934bae55e84d47df | Python | ColinClark/IntroToHadoopAndMapReduce | /studygroupsmapper.py | UTF-8 | 514 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import sys
import csv
reader = csv.reader(sys.stdin, delimiter='\t')
# Skip header.
reader.next()
writer = csv.writer(sys.stdout, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
for line in reader:
if len(line) == 19:
the_id = line[0]
node_type = line[5]
author_id ... | true |
e0effbe095f8340cf50e961dfe30c7c772d16b65 | Python | JHLee1995/Bioinformatic-OMICS | /All_scripts/summary_scripts/count_seq_len.py | UTF-8 | 858 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python3
import Bio.SeqIO
import csv
def count_seq(input_file):
protein = {}
try:
for record in Bio.SeqIO.parse(input_file , "fasta"):
protein[record.id] = len(record.seq)
except IOError:
print("IO error")
#print(protein)
seq_file = csv.writer(open("... | true |
b0de82fef5ec155ee817f6ac0827058be42b0768 | Python | JesusGonzalezA/Distributed-Calculator | /python/server.py | UTF-8 | 1,325 | 2.546875 | 3 | [] | no_license | import glob
import sys
from calculator import Calculator
from calculator import ttypes
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
import logging
logging.basicConfig(level=logging.DEBUG)
class Calculador... | true |
85244339b4d15fdc9d3eb7330dbd9d27e05fb7dd | Python | TheRiseOfDavid/NTUTcs_media | /hw03/hw3_2.py | UTF-8 | 1,681 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 10:07:19 2021
@author: kuotzulin
"""
import cv2
import numpy as np
# hw3_2: 利用霍夫線標磁磚邊緣
img_floor = cv2.imread("./pic/floor.jpg")
w = int(img_floor.shape[1]*0.2)
h = int(img_floor.shape[0]*0.2)
kernel = np.ones((2,2), np.uint8)
# 調整大小
resize_f ... | true |
840fe8727384cd98be611097cc79ae3df980c015 | Python | Mehal001/Key-Frame-Extraction | /RRPN/lib/pynuscenes/utils/nuscenes_utils.py | UTF-8 | 10,420 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
################################################################################
## Date Created : Fri Jun 14 2019 ##
## Authors : Landon Harris, Ramin Nabati ##
## Last Modified : September 2nd, 2019 ... | true |
8c7118b6cda01e0f3f876d48cf67c2752dc4c01e | Python | MonicaAlvear/ProyectoTitulacion | /Servicio Rest/VecinosMasCercanos.py | UTF-8 | 1,402 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 31 22:23:20 2019
@author: Bryan
"""
# Import the needed libraries
import numpy as np
import pandas as pd
import tensorflow as tf
import urllib.request as request
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.lin... | true |
146149baf6d4fc6699cde22984827407ce4bd5d7 | Python | Bloodhard/Repl.it | /Exercicio7.py | UTF-8 | 987 | 4.3125 | 4 | [] | no_license | x = float(input('Digite o valor de "X": '))
y = float(input('Digite o valor de "Y": '))
print(f'X: {x}, Y: {y}')
if x != 0 and y != 0:
if x > 0 and y > 0:
print('Ponto ({x},{y}) esta no 1 quadrante')
if x > 0 and y < 0:
print('Ponto ({x},{y}) esta no 4 quadrante')
if x < 0 and y > 0:
... | true |
0549dc624177190c9720c17ca247f53657a10770 | Python | GladsonRe/pattern-recognition | /Classification_WineDate_dist_norm.py | UTF-8 | 1,776 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import pandas as pd
import numpy as np
import random
from sklearn.utils import shuffle
# In[ ]:
#Importa o arquivo com os dados como um dataset
arquivo = pd.read_csv('winedados.csv')
# In[ ]:
#Normalização estatistica dos dados: (X - Xmédia)/Xdesvio_padrão
def... | true |
6afd5be387e260ffb9be2ca196968cfe954d63a7 | Python | gwerum/DataStructuresND-BasicAlgorithms | /01_SquareRoot/square_root.py | UTF-8 | 2,217 | 4.125 | 4 | [] | no_license | import unittest
import math
import random
import time
def sqrt(number):
"""
Calculate the floored square root of a number
Args:
number(int): Number to find the floored squared root
Returns:
int: Floored Square Root
"""
return sqrt_floor(int(number), 0, int(number))
def sqrt_flo... | true |
49d605f39043f83b05a9fa57f91a3a9d41610d10 | Python | Cc618/Q-Board | /src/solvers.py | UTF-8 | 3,624 | 3.140625 | 3 | [
"MIT"
] | permissive | # Gathers AIs for environments
import envs
import agents
import dqn
from log import Logger
from mem import LinearMemory
from utils import f_one_hot_state, play, train, test, random_act, user_act
def tic_tac_toe(path='data/tic_tac_toe', seed=161831415):
# TODO : Complete
env = envs.TicTacToe()
rand_epoch... | true |
38bab603a4383dafb725dcdd8f50e167f21aa8f8 | Python | galileoguzman/bedu-data-04-20210306 | /03_list.py | UTF-8 | 181 | 2.796875 | 3 | [] | no_license | def aplicar_iva(precio):
return precio * 1.16
lista_precios = [
200,
100,
50
]
lista_precios_iva = list(map(aplicar_iva, lista_precios))
print(lista_precios_iva)
| true |
750ecc3a29a04bf561eae687de4549a3a36b2526 | Python | shishirjindal/cryptopals | /set2/ch15.py | UTF-8 | 225 | 2.8125 | 3 | [] | no_license | def validate_pkcs7(paddedtext):
lastbyte = paddedtext[-1]
for i in range(1,ord(lastbyte)+1):
if paddedtext[-i] != lastbyte:
return "padding error"
return paddedtext[:-ord(lastbyte)]
print validate_pkcs7(raw_input())
| true |
cb0fca6dd916a9e5ad5b6f3c050703b5e7793372 | Python | franjagon/CarreraInPyGame | /move.py | UTF-8 | 4,571 | 3.171875 | 3 | [] | no_license | '''Importamos las librerías -random-, para poder invocar valores aleatorios, -sys-, para poder invocar la salida de la interfaz y -pygame-.'''
'''Importamos la librería de variables locales de PYGAME, para poder invocar sus códigos de identificación para las teclas, el ratón, etc...'''
'''Importamos nuestro programa ma... | true |
2ac6b6f8ce4bd1dc0dba0953f0b0defdd9a28847 | Python | shubhamoli/solutions | /leetcode/medium/117-Populate_next_right_II.py | UTF-8 | 1,628 | 3.78125 | 4 | [
"MIT"
] | permissive | """
Leetcode #117
"""
# Definition for a Node.
class Node:
def __init__(self, val, left=None, right=None, next=None):
self.val = val
self.left = left
self.right = right
self.next = next
class Solution:
# Skipping queue based level-order traversal
# as it is not in co... | true |
2e36647dc445ca385f02d637b2be8338a7905965 | Python | hemmerling/python-coursera2012 | /src/week8/week8.py | UTF-8 | 1,070 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# @package coursera2012
# @author Rolf Hemmerling <hemmerling@gmx.net>
# @version 1.00
# @date 2015-01-01
# @copyright Apache License, Version 2.0
#
# Implementation of the game
# "Asteroids"
# for the Coursera course
# "An Introductio... | true |
e7f8f7679dca0e61ba8e5146876dc8cea8d7914e | Python | GeeeHesso/EV_sim | /python/4_speed.py | UTF-8 | 2,069 | 3.375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import random
import math
def create_profile_simple(point,slope_in,slope_out,max_speed,length):
#Simplified with simple slopes
#Initialization
slope_1=np.zeros(length)
slope_2=np.zeros(length)
slope_3=max_speed*np.ones(length)
profile = np.zeros(length)
#Crea... | true |
bae6481cb8ae6df5c495981b77dc9376859fd500 | Python | sebascarra/utower-minimal | /water_pump_app.py | UTF-8 | 848 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
"""Conatins a sample that tests the EC and PH probes."""
from __future__ import print_function
import sys
from time import sleep
import device_manager as DeviceManager
def main(argv):
"""Makes the water pump turn on and off."""
# First initialize the device manager. This is mandatory to... | true |
2e5610e73b4e48be33841bf4d5e721fccc8990c3 | Python | Yhkjoker/YYW | /travel/apps/utils/mixin_utils.py | UTF-8 | 667 | 2.703125 | 3 | [] | no_license | from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
"""类的方法和独立的函数不完全相同,所以你不可以直接将函数装饰器运用到方法上
—— 你首先需要将它转换成一个方法装饰器。
"""
class LoginRequiredMixin(object):
"""
add by wth:
视图类继承此混合类即可拥有login_required功能(使用时一定要将此混合类放在mro第一顺位)
"""
@method_decorat... | true |
6d5d0ef235219ddf67d8a1f08f72ee58001fb646 | Python | amaozhao/Python-Real-World-Machine-Learning | /Module 1/Chapter 3/svm.py | UTF-8 | 1,886 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import classification_report
import utilities
# Load input data
input_file = 'data_multivar.txt'
X, y = utilities.load_data(input_file)
############################... | true |
4e6d4c353bef8698f64805139fce4b0653fde678 | Python | TophTab/Learning_python_firsttime | /basic_knowledge/10_2_1.py | UTF-8 | 147 | 3.015625 | 3 | [] | no_license | with open('programming.txt','w') as file_object:
file_object.write('I love programming\n')
file_object.write('I love creating new games\n') | true |
e3b715ffcb8cdc0f31d0eb3b8e925954fe1f36f9 | Python | balemessenger/bale-bot-python | /balebot/models/messages/contact_message.py | UTF-8 | 1,999 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import json as json_handler
from balebot.models.base_models.raw_json import RawJson
from balebot.models.messages.base_message import BaseMessage
from balebot.models.constants.errors import Error
from balebot.models.constants.raw_json_type import RawJsonType
from balebot.models.constants.message_type import MessageType... | true |
d0fc9fae2e2e39f3c9b667590cb82f9a789cc460 | Python | Nyapy/TIL | /04_algorithm/hyundaecard/B.py | UTF-8 | 1,767 | 2.53125 | 3 | [] | no_license | from itertools import combinations
ips = ["5.5.5.5", "155.123.124.111", "10.16.125.0", "155.123.124.111", "5.5.5.5", "155.123.124.111", "10.16.125.0", "10.16.125.0"]
langs = ["Java", "C++", "Python3", "C#", "Java", "C", "Python3", "JavaScript"]
scores = [294, 197, 373, 45, 294, 62, 373, 373]
num = len(ips)
cheat = [... | true |
73ec96c03059276c9a347bab2e187e2b0cb06309 | Python | Karo340/iotsim | /iotsim/tests/test_behaviors.py | UTF-8 | 4,195 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
from iotsim.behaviors import FlatlineBehavior, LinearBehavior
from iotsim.core import AssemblyContext
class TestFlatlineBehavior:
def test_flatline_bhv_name(self):
with pytest.raises(ValueError):
bhv = FlatlineBehavior(name=None)
with pytest.raises(ValueError):
... | true |
6d3e67dc38a4972513625e841066a0284a0de053 | Python | 740i/Tools- | /smtp_rst.py | UTF-8 | 1,108 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
import socket
import sys
if len(sys.argv) != 4:
print "Enumerates email accounts by initiating an email and resetting before being sent \r\n"
print "Usage:smtp_rst <serverIP> <userlist.txt> ,outputfile.txt>"
sys.exit(0)
# Define input variables
server=sys.argv[1]
userfile=sys.argv[2]
outputfile=... | true |
08ec55887314f610495c88e9ab2872d1cb781252 | Python | Pan-Pam/AID_2010 | /write_db2.py | UTF-8 | 760 | 3 | 3 | [] | no_license | import pymysql
args={
"host":"localhost",
"port":3306,
"user":"root",
"password":"123456",
"database":"c_j",
"charset":"utf8"
}
#连接数据库
db=pymysql.connect(**args)
#创建游标 游标对象:执行sql得到执行结果的对象
cur=db.cursor()
#数据批量写操作 insert delete update
stu_list=[
("张三",23,'m',99),
("李四",21,'w',90),
... | true |
92664e89336dcb7ea4c159c4c9e105543ad08ae1 | Python | deepcoder42/mongo-dump | /test/unit/mongo_db_dump/mongo_dump.py | UTF-8 | 3,744 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Classification (U)
"""Program: mongo_dump.py
Description: Unit testing of mongo_dump in mongo_db_dump.py.
Usage:
test/unit/mongo_db_dump/mongo_dump.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
impor... | true |
a96f504291b75c91750e0f9305fd70637a0579ab | Python | cloud4rpi/cloud4rpi-esp8266-micropython | /main-gpio.py | UTF-8 | 3,728 | 2.609375 | 3 | [
"MIT"
] | permissive | from time import time, sleep
from machine import Pin, reset
from network import WLAN, STA_IF
from onewire import OneWire
from ds18x20 import DS18X20
import cloud4rpi
# Enter the name of your Wi-Fi and its password here.
# If you have an open Wi-Fi, simply remove the second item.
WIFI_SSID_PASSWORD = '__SSID__', '__PW... | true |
449e3984f1b2f897abeec0791752531ebb4993a8 | Python | SabaOrk/amazon-spider | /bs4amazon.py | UTF-8 | 2,025 | 2.6875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import json
import sys
import tkinter as tk
import time
from tkinter import filedialog,Text
url_arg = sys.argv[1:]
url1 = 'https://www.amazon.com/Panasonic-Headphones-RP-HJE120-K-Ergonomic-Comfort-Fit/dp/B003EM8008/ref=sr_1_3?crid=G28TBIQR3E2S&keywords=earbud+head... | true |
93dbc8d54446cc4e39b02be7be524330bddb9286 | Python | LampCat/Lokaverkefni_Bilaleiga | /ui/CustMenu/LookupCustomerMenu/LookupCustomerMenu.py | UTF-8 | 2,714 | 2.9375 | 3 | [] | no_license | import os
def customerMenuSelection(self, check_if_admin, customer):
selection = ""
os.system('cls')
while (selection !="9"):
print(customer)
print("1. Update information ")
print("2. Customer Order History")
if check_if_admin:
pri... | true |
c64b073edd69d21fabf40d9a9483b6a9f385c95b | Python | sid10on10/GUVI_codekata | /Stack/eval_postfix_or_-1.py | UTF-8 | 1,463 | 3.75 | 4 | [] | no_license | class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def top(self):
return self.items[-1]
def size(self):
return len(se... | true |
462cdeb12ae14539609e1a47554fdcb1a49a3a6d | Python | IsFlwrs/Batch1_backendplus | /python/web.py | UTF-8 | 2,102 | 2.953125 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import my_exceptions
import json
import logger
import sys, os
class WebService:
'''Es la clase para pedir solicitudes
Attributes:
url -- Necesita una url para funcionar
'''
__log = logger.Log()
__data = {}
__headers = {}
__file = os.p... | true |
c074289edae4c17e3a07c0efaff710802b62de74 | Python | TheGreatCookieMachine/Dictu | /tests/benchmarks/string-methods/endsWith.py | UTF-8 | 144 | 2.90625 | 3 | [
"MIT"
] | permissive | import time
start = time.perf_counter()
for _ in range(10000):
x = "Dictu is great!".endswith("great!")
print(time.perf_counter() - start) | true |
0dcdfabc84068979ef3ea7456048a95628fb97fb | Python | LonelyHunter7/Quantitative_Model | /Quantitave_Trading/TradeData_Analysis.py | UTF-8 | 10,283 | 3.265625 | 3 | [] | no_license | # encoding: UTF-8
#引入系统模块
import csv
#引入第三方模块
import pandas as pd
from pandas import Series,DataFrame
from numpy import cumsum
import matplotlib.pyplot as plt
from datetime import datetime,time
class TradeData_Analysis():
"""成交记录的数据处理包含三个部分:
1.数据的预处理,将数据存放在dataframe中
2.利用dataframe格式的便利,对成交记录进行数理统计分析... | true |
10ed653170d4fc311b8da0b6061c88e73418b742 | Python | XinliYu/utix | /_util/_examples/dict_ext/hdict.py | UTF-8 | 178 | 2.65625 | 3 | [] | no_license | from utix.dict_ext import hdict
d = hdict(a=1, b=2, c=3)
print(d['a'])
print(d['b'])
print(d['c'])
del d['a']
print(d)
d['d'] = 4
print(d)
del d['d']
print(d)
| true |
06891e6199355221de7317451b47e7567e922979 | Python | oisinhenry/CA117-2018 | /lab1.2/plural_012.py | UTF-8 | 654 | 3.15625 | 3 | [] | no_license | import sys
def plural(s):
if s.endswith("ch") or s.endswith("sh") or s.endswith("x") or s.endswith("s") or s.endswith("z"):
return s + "es"
elif s.endswith("y") and s[len(s)-2] != "a" and s[len(s)-2] != "e" and s[len(s)-2] != "i" and s[len(s)-2] != "o" and s[len(s)-2] != "u":
return s[:len(s)-1]... | true |
dd020507a07b99ad9543d5c1fdf29ec548bf11a4 | Python | sgmoorthy/PS3RasPiRobot | /Ps3RaspiRobot.py | UTF-8 | 5,046 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: Latin-1
# Load library functions we want
import time
import pygame
import RPi.GPIO as GPIO
import turtle # to draw the drawing along with Robot
from turtle import *
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set which GPIO pins the drive outputs are connected to
DRIVE_1 = 17
DRI... | true |
1165ef9a6a0cddb75ee3d07d123e5ef0aaf55403 | Python | HyegeunCho/TIL | /DeepLearning/Deep learning from scratch/4_2_4.py | UTF-8 | 2,772 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 4.2.4 (배치용) 교차 엔트로피 오차 구현하기
import sys, os
import numpy as np
from dataset.mnist import load_mnist
def cross_entropy_error(y, t):
# y가 1차원이라면, 즉 데이터 하나당 교차 엔트로피 오차를 구하는 경우는 reshape 함수로 데이터의 형상을 바꿔준다.
if y.ndim == 1:
t = t.reshape(1, t.size)
y = y.reshape(1, y.size)
... | true |
205e7ecc5d2bdfdd802824dcc9b4408e8d06e1b7 | Python | mjso7660/Chatting-Application | /login.py | UTF-8 | 1,059 | 2.578125 | 3 | [] | no_license | import sys
import time
import pymongo
from passlib.context import CryptContext
pwd_context = CryptContext(
schemes=["pbkdf2_sha256"],
default="pbkdf2_sha256",
pbkdf2_sha256__default_rounds=30
)
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase... | true |
a0b0f81eec76373807885b4fba17509714b8989e | Python | f4str/numerical-methods-toolkit | /numerical_methods_toolkit/roots.py | UTF-8 | 736 | 4.09375 | 4 | [
"MIT"
] | permissive | def bisection_method(f, a, b, epsilon=1e-5):
if a > b or f(a) * f(b) > 0:
raise ValueError('bisection method: invalid a and b values')
while abs(b - a) >= epsilon:
x = (a + b) / 2
if abs(f(x)) <= epsilon:
return x
if f(a) * f(b) >= 0:
a = x
else:
... | true |
748a15f27c804a88b1116e1d33f9639c995d1b98 | Python | InterestingBrainPoops/aoc2020python | /intcode.py | UTF-8 | 396 | 2.640625 | 3 | [] | no_license | def evalintcode(line):
x=0
temp = line
for x in range(0,len(temp),4):
#print(temp[x])
if(temp[x] == 1):
temp[temp[x+3]] = temp[temp[x+1]] + temp[temp[x+2]]
elif(temp[x] == 2):
temp[temp[x+3]] = temp[temp[x+1]] * temp[temp[x+2]]
elif(temp[x] == 99):
... | true |
ed9792c8df9e71cc51323930792cbfc70a441c74 | Python | gunjan1991/Telstra-Kaggle | /gene_clf.py | UTF-8 | 1,697 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 9 09:36:23 2016
@author: GunjanPandya
"""
import numpy as np
from sklearn.metrics import log_loss
from sklearn.cross_validation import KFold
class my_classifier(object):
'''Class: my_classifier'''
# init
def __init__(self, number_class, number_fold, nu... | true |
4da3e44c8e1bb1e47acc4907055de22b0c14a23a | Python | yijiantao/WorkSpace | /LeetCode Algorithms/code/40.组合总和-ii.py | UTF-8 | 1,063 | 3.171875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=40 lang=python3
#
# [40] 组合总和 II
#
# @lc code=start
class Solution:
# def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
@classmethod
def combinationSum2(self, candidates, target):
res = []
if not candidates: return res
cand... | true |
a7530df33012a75450a565188f5be52cd4107af1 | Python | Hieunt27/GoogleKickStart_Solutions | /2020_RoundH/retype.py | UTF-8 | 234 | 2.796875 | 3 | [] | no_license | from collections import defaultdict
T=int(raw_input())
for tt in range(1,T+1):
N,K,S=[int(t) for t in raw_input().split()]
result=K-1
result+=min(1+N, K-S+N-S+1)
print "Case #"+str(tt)+": "+str(result)
| true |
c498966adebf109cbb6e4676df89bc1b911a5f10 | Python | brunatotti/Python | /Abraji/p08.py | UTF-8 | 330 | 2.96875 | 3 | [] | no_license | import urllib.request
pagina = urllib.request.urlopen(
'http://beans.itcarlow.ie/prices-loyalty.html')
texto = pagina.read().decode('utf8')
onde = texto.find('>$')
início = onde + 2
fim = início + 4
preço = texto[início:fim]
if preço < 4.74:
print ('Comprar pois está barato:', preço)
else:
print ('Esperar... | true |
ea949cfc994d244096d039645f26385472edf723 | Python | rocking5566/deep-learning-docker | /example/toy/opencv/webcam_face.py | UTF-8 | 1,672 | 3.078125 | 3 | [] | no_license | import sys
import cv2
def get_faces(frm):
# Gray scale image for the face detector, shrink it to make it faster
gray = cv2.cvtColor(frm, cv2.COLOR_BGR2GRAY)
image_scale = 3
scl = 1.0 / image_scale
smallgray = cv2.resize(gray, (0, 0), fx=scl, fy=scl)
faces = faceCascade.detectMultiScale(
... | true |
66e16ebfbc133d41b2ed1fff94ef20c1e5e8e83f | Python | Mahsa13473/Machine-Learning-Course | /Assignment1/polynomial_regression_1d.py | UTF-8 | 1,434 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
import assignment1 as a1
import numpy as np
import matplotlib.pyplot as plt
(countries, features, values) = a1.load_unicef_data()
targets = values[:,1]
x = values[:,7:]
#x = a1.normalize_data(x)
N_TRAIN = 100;
x_train = x[0:N_TRAIN,:]
x_test = x[N_TRAIN:,:]
t_train = targets[0:N... | true |
32c2b98a0fd59ac02469df78941132aa42617cc9 | Python | saketks2694/MetaAdaptRank | /metaranker/networks/.ipynb_checkpoints/magic_module-checkpoint.py | UTF-8 | 7,223 | 2.546875 | 3 | [
"MIT"
] | permissive | import copy
import torch
import operator
import torch.nn as nn
from torch import Tensor, device, dtype
from typing import Callable, Dict, List, Optional, Tuple
import torch.nn.functional as F
from ..transformers import ModuleUtilsMixin, BertPreTrainedModel
# ------------------------------------------------------------... | true |
542d9db5674252094591dbab81cf7250068b18ab | Python | nchong/pairgenv2 | /constant.py | UTF-8 | 873 | 2.625 | 3 | [] | no_license | class Constant:
def __init__(self, name=None, description=None, type='double', dim=1):
if not name:
raise Exception, "New Constant requires name"
self.__name = name
self.description = description
self.type = type
self.dim = dim
def __repr__(self):
return self.__name
def name(self, ... | true |
b4fc5087b3eb0e656639e1c315c1cb65430dfa3f | Python | karyam/halite_deep_rl_bot | /trainer/league.py | UTF-8 | 5,040 | 2.515625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from agent import *
class Player(object):
def get_match(self):
pass
def ready_to_checkpoint(self):
return False
def _create_checkpoint(self):
return Historical(self, self.payoff)
@property
def payoff(self):
return self._payoff
@property
de... | true |
6d7963922e630bb3883d397e2d503ab6316ce751 | Python | Ad7siem/Projekt | /Metody klasy.py | UTF-8 | 2,737 | 3.46875 | 3 | [] | no_license | class Car:
def __init__(self, brand, model, isAirBagOK, isPaintingOK, isMechanicOK):
self.brand = brand
self.model = model
self.isAirBagOK = isAirBagOK
self.isPaintingOK = isPaintingOK
self.isMechanicOK = isMechanicOK
def IsDamaged(self):
return not (self.isAirBa... | true |
d4b40d37f70e6c3dee4bbdfbdc54c89f89d84d2b | Python | HeartCrystal/Weekend0625 | /twoDay/JavaScriptDemo.py | UTF-8 | 1,551 | 3.25 | 3 | [] | no_license | from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://localhost/")
# driver.execute_script('document.getElementsByClassName("site-nav-right fr")[0].childNodes[1].removeAttribute("target")')
# driver.find_element_by_link_text("登录").click()
# 对同一个元素,分别采用javaScript的方式和Selenium的方式定位了两次
# 其中selenium... | true |
e2c471901d928b9b70692b9d4bbe90e16c1eebf3 | Python | lnishan/Pacman-Mirror | /generateTournamentLayouts.py | UTF-8 | 1,393 | 2.578125 | 3 | [
"MIT"
] | permissive | # generateTournamentLayouts.py
# ----------------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, includi... | true |
80de19d76ab1dc976926515560a008e0599ed3bc | Python | ralig/AdventOfCode2020 | /Day 11/Python/Part 1/solve.py | UTF-8 | 1,789 | 3.15625 | 3 | [] | no_license | from pathlib import Path
path = Path(__file__).parent / "../../input.txt"
rows = []
with path.open("rt") as f:
rows = f.readlines()
for x in range(0,len(rows)):
rows[x] = rows[x].strip()
newRows = rows.copy()
def countSeatsAdjacent(seatX,seatY, typeToCount):
countEmpty = 0
countOcc = 0
for y in ... | true |
7218eb52d37b8a0b2441d32da4b7821fad7bccae | Python | deify/py_advent_of_code_2020 | /day_01/puzzle.py | UTF-8 | 927 | 3.234375 | 3 | [] | no_license | from typing import Any
import itertools
import numpy as np
class puzzle:
puzzle_data: str = ""
parse_data: Any = None
part1_result: Any = None
part2_result: Any = None
def __init__(self, data_path):
super().__init__()
with open(data_path, "r") as file:
self.puzzle_data... | true |
f73675e432c4169adc44b2ed7cc50399c0c188a7 | Python | irl/bushel | /bushel/document.py | UTF-8 | 227 | 2.921875 | 3 | [
"MIT"
] | permissive |
class BaseDocument:
def __init__(self, raw_content):
self.raw_content = raw_content
def get_bytes(self):
return self.raw_content
def __str__(self):
return self.raw_content.decode('utf-8')
| true |
767d92c62a829a3a2943d20fad89f3665cddb6db | Python | SeifJelidi/holberton-system_engineering-devops | /0x16-api_advanced/0-subs.py | UTF-8 | 652 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
'''0. How many subs?'''
import requests
def number_of_subscribers(subreddit):
'''queries the Reddit API and returns the number of subscribers
(not active users, total subscribers) for a given subreddit'''
url = 'https://www.reddit.com/r/{}/about.json'.format(subreddit)
user_agent = ... | true |
aef27d0c291e413c8e9b104633e7570e04cdd8ee | Python | LiliaG-hiramatsu/POO | /Ejercicio 2/main.py | UTF-8 | 9,719 | 3.796875 | 4 | [] | no_license | # El programa debe crear 1 móvil (manual) dentro de una grilla plana.
# El móvil posee un nombre único y conoce su posición actual, la
# secuencia de órdenes recibidas y la distancia total recorrida.
# Las dimensiones del plano y las órdenes de movimiento son dadas
# por el operador (para moverse puede usar el código e... | true |
c8da971761b43a9c6552b4504cc9b7f350678ba8 | Python | github076986099/sonata-plugins | /plugin_class.py | UTF-8 | 5,690 | 2.9375 | 3 | [] | no_license | """Object based plugin framework extension for sonata
See Plugin class documentation, from which you have to inherit if you want to
use this module.
"""
import sys
import traceback
import logging
import weakref
class meta(type):
"""A metaclass is needed to create adhoc class (not instance) members as wrappers"""... | true |
6ffb805de72680ff43f82dbd9ee5b74526b7576b | Python | Rozhin-sharifi/Assignment2 | /1.py | UTF-8 | 342 | 3.234375 | 3 | [] | no_license | from random import randint
value = randint(0, 10)
inputN=-1
counter=0
while inputN!=value:
inputN=int(input("Adad ra hads bezanid:\n"))
counter+=1
if inputN==value:
print("you did it!")
print(counter)
break
if inputN>value:
print ("go down")
else:
... | true |
291ac8f23997788d948150cd1eb1a35e9e692f7b | Python | iskislamov/kyapr | /linq/linq.py | UTF-8 | 1,697 | 3.796875 | 4 | [] | no_license | def generateFibonacci():
first = 1
second = 1
while True:
second += first
first = second - first
yield second
class Range:
def __init__(self, provider):
self.provider = provider
def Select(self, foo):
return Range([foo(x) for x in self.provider()])
def ... | true |
227ec0978e669e1f461e87189a3629f6b6bbe908 | Python | Aasthaengg/IBMdataset | /Python_codes/p02393/s859112079.py | UTF-8 | 263 | 3.34375 | 3 | [] | no_license | a = raw_input()
for i, b in enumerate(a.split()):
if i==0:
x=int(b)
elif i==1:
y=int(b)
else:
z=int(b)
if x<=y<=z:
print x,y,z
elif x<=z<=y:
print x,z,y
elif y<=x<=z:
print y,x,z
elif y<=z<=x:
print y,z,x
elif z<=x<=y:
print z,x,y
else:
print z,y,x | true |
2313e5c79b54d5170cfbdb477a0dceb59a5b7af7 | Python | omsktransmash/ScientificPythonTutorial | /network_python/dict2_v01.py | UTF-8 | 705 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | from xlrd import open_workbook, cellname, XL_CELL_TEXT #importing open_workbook in xlrd
book = open_workbook('C:\\Users\\Administrator\\Desktop\\ScientificPythonTutorial\\network_python\\a.xlsx') #identify location of data file and define book
dict2 = {} #create dictionary2
for s in book.sheets(): #for sheets ... | true |
971283f4774d92db9c3f80acf9403cfeb6eb8cfb | Python | daviddexter/wrangle-mirror | /wrangle/utils/datetime_handler.py | UTF-8 | 2,589 | 3.34375 | 3 | [
"MIT"
] | permissive | import datetime
import pandas as pd
from .column_handler import column_mover
def datetime_detector(data, datetime_mode='retain'):
'''Datetime Handling
WHAT: Detects a datetime column and sends it to the
datetime_handler for processing based on the
datetime_mode setting.
OPTIONS: 'pass', drop',... | true |
3c7f95add7dd56d80d449019558580c918c3c359 | Python | Luriii/programming_practice_2020 | /week 8/task 3.py | UTF-8 | 82 | 2.765625 | 3 | [] | no_license | import numpy as np
b = np.array([2, 3, 4])
a = np.arange(9)
print(np.delete(a, b)) | true |
e4751139a023b93556aba96a02f04178721d8991 | Python | leogiraldimg/DP1 | /Lista05/j.py | UTF-8 | 410 | 3.390625 | 3 | [] | no_license | entrada = input().split()
n = int(entrada[0])
k = int(entrada[1])
s = input()
esquerda = 0
tamanho = 0
ct = [0] * 2
for direita in range(0, n):
ct[ord(s[direita]) - ord("a")] += 1
if (ct[0] <= k or ct[1] <= k):
temp = direita - esquerda + 1
tamanho = tamanho if (tamanho > temp) else temp
... | true |
d50a4fd0fe3358e118089865b0ede05caa8851c3 | Python | mmcenta/jax-baselines | /jax_baselines/common/scheduler.py | UTF-8 | 547 | 3.296875 | 3 | [
"MIT"
] | permissive |
class LinearDecay:
def __init__(self, initial_value, final_value, final_step):
self.initial_value = initial_value
self.final_value = final_value
self.final_step = final_step
self.coef = (final_value - initial_value) / float(final_step)
def __call__(self, t):
return sel... | true |
0695873158ffd365326b5cdfd80795584ddd72bb | Python | BrauCamacho/Mis_Trabajos_python | /ejemplo.py | UTF-8 | 102 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
def saludar():
print("hola mundo")
if __name__ == "__main__":
saludar() | true |
d087c86955e6c4e85e7da85bcd8a8e8429224dc0 | Python | quhuohuo/python | /filedir/seek.py | UTF-8 | 163 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
import sys
f = open('test.txt','r+')
str = f.write("hello")
print str
print f.tell()
f.seek(5,1)
str = f.read(5)
print str
print f.tell()
| true |
5a03cee8ae84aaaa69a34c85cf4446934c485826 | Python | pemo11/pykurs | /Abend4/tkInterBeispiel1.py | UTF-8 | 196 | 2.84375 | 3 | [] | no_license | # GUIs mit tkInter - Beispiel Nr. 1 - Anzeigen eines leeren Fensters
# Alle Beispiele ohne Klasse, da das Thema erst am Abend 5 an die Reihe kommt
import tkinter
tk = tkinter.Tk()
tk.mainloop() | true |
3840103f08cef32a2282800f405b56ed7170d4f4 | Python | a-m-frantz/sudoku-solver | /extra_algorithms.py | UTF-8 | 12,173 | 3.21875 | 3 | [
"MIT"
] | permissive | import itertools
import algorithms as alg
def find_preemptive_sets(puzzle, n):
"""Find preemptive sets and remove them from the candidate lists of other cells in the unit.
A preemptive set is a set of values, size 'n', that are the only possible values for a set of cells, size 'n',
within the same unit.... | true |
d714f1b9f4c09e6a095cd973d4b21ebf80b31948 | Python | AttackCondor/epaper-slow-movie | /2001-space-player/main.py | UTF-8 | 758 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
import epd7in5
import datetime
import time
from PIL import Image,ImageDraw,ImageFont
import traceback
import os
try:
print("Start playing movie: 2001 A Space Odyssey")
epd = epd7in5.EPD()
epd.init()
print("Clear")
epd.Clear(0xFF)
while os.path.exis... | true |
b95f13c7e932aa0e5fdb645a62a6076c78b2666d | Python | CSeven19/PythonLevelUp | /pythonLevel4/redisrpc/server.py | UTF-8 | 982 | 3 | 3 | [] | no_license | import redis
import msgpack
class Fibonacci:
def fib(self,n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return self.fib(n-1) + self.fib(n-2)
class RedisRpcServer:
def __init__(self, redis_url, list_name, klass):
self.client = redis.from_url(redis_url)
self.list_name =... | true |
af0ebe9b481c3791efd860ee7dd16a1297f26911 | Python | gokul180288/instacart-basket-prediction-1 | /nonrecurrent/plot_model.py | UTF-8 | 1,575 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import xgboost as xgb
import argparse
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from baskets import common
from dataset import Dataset
import hypers
parser = argparse.ArgumentParser()
parser.add_argument('tag')
args = parser.pa... | true |
8c738a819e143970d5402002d67e183201ea28b5 | Python | flintlouis/tictactoeminimax | /minmax.py | UTF-8 | 1,410 | 3.171875 | 3 | [] | no_license | import math
from os import stat
from random import randint
states = 0
def get_states():
print(states)
def random_move(game):
while True:
row, col = randint(0,2), randint(0,2)
if game[row, col] == 0:
return row, col
def minmax(game, depth, alpha, beta, maximizing_player, player):
global states
score = gam... | true |
f12af0179dfa64be502a911c80711bdac29cf59a | Python | jleldridge/Knight | /src/Main.py | UTF-8 | 10,479 | 2.75 | 3 | [] | no_license | import pygame, sys, math
from pygame.locals import *
flags = DOUBLEBUF
X_RESOLUTION = 1280
Y_RESOLUTION = 700
MAP_TILE_SIZE = 32
# set up the game
pygame.init()
main_clock = pygame.time.Clock()
# create the game window
screen = pygame.display.set_mode((X_RESOLUTION, Y_RESOLUTION), flags, 32)
screen.set_alpha(None)
... | true |
de630ad6db3acb2056a4491bc0ea350327c5da7c | Python | jglomsk/PyGit | /Project/myfile.py | UTF-8 | 305 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
# Please use fp = open('Project/yourfile.*') when opening YOUR files
# to not lose YOUR file in the jumble of OTHER files.
# Also, do NOT delete the very first comment line.
# 'logs.txt' is your friend for your error logs.
print("Hello")
def hello(world):
print(world)
hello("Jake")
| true |
1e70df44038fbc2f08391ce508d4d4ccfbc7bd8a | Python | 18-500-b9/integration | /pool/tests/pool/pool_ball_test.py | UTF-8 | 654 | 2.828125 | 3 | [] | no_license | import unittest
import sys
sys.path.append('../../src')
from pool.pool_ball import PoolBall
from physics.coordinates import Coordinates
from physics.vector import Vector
class PoolBallTest(unittest.TestCase):
def test_init(self):
name = '1'
pos = Coordinates(0, 0)
mass = 1.0
rad... | true |
28eb96664901368b1595e76207ccc57f26ba2d70 | Python | sanggil1107/Coding_Test | /백준/그리디 알고리즘/2875번 대회 or 인턴.py | UTF-8 | 132 | 2.90625 | 3 | [] | no_license | n, m, k = map(int, input().split())
team = 0
while n >= 2 and m >= 1 and n + m - k >= 3:
n -= 2
m -= 1
team += 1
print(team) | true |
04b4e7a874605cf883ad6fe283ca562a7be79a40 | Python | kipoi/kipoi | /example/models/pyt/dataloader.py | UTF-8 | 2,234 | 2.703125 | 3 | [
"MIT"
] | permissive | """DeepSEA dataloader
"""
import numpy as np
import pandas as pd
import pybedtools
from pybedtools import BedTool
from kipoi.data import Dataset
from kipoi.metadata import GenomicRanges
from kipoiseq.extractors import FastaStringExtractor
import linecache
from kipoiseq.transforms.functional import one_hot_dna
# ------... | true |
7793e1bdde4bf60d3c98e950e0e2ea9826b1f360 | Python | Orionsilver/RNG-Python-Scripts | /mt_chimney_hiker_predictor.py | UTF-8 | 815 | 3.40625 | 3 | [] | no_license | # Script for predicting the Mt. Chimney Hiker in RSE
from LCRNG import PokeRNG
initial_seed = int(input("Initial Seed: 0x"),16)
starting_advances = int(input("Starting Advance: "))
max_advances = int(input("Max Advances: "))
delay = int(input("Delay (mine was 96): "))
rng = PokeRNG(initial_seed)
rng.advance(starting_a... | true |
556d0af3086f6da701ddfa4b59248ca98924743e | Python | danilat/water_zgz | /scraper.py | UTF-8 | 1,444 | 2.71875 | 3 | [] | no_license | import urllib2
import mechanize
import json
from bs4 import BeautifulSoup
import utm
browser = mechanize.Browser()
def parse(link):
resp = browser.open(link)
soup = BeautifulSoup(resp.read())
title = soup.find('h2').text
ele = soup.find('div', class_='elementos')
divs = ele.find_all('div')
for div in divs:
pas... | true |
e1b1f232acf6e11112d67ef78e60f653e2b74895 | Python | ohyeahjoe/apcompsciproject | /tests/unit/test_entities_souffler.py | UTF-8 | 4,222 | 2.9375 | 3 | [] | no_license | """Unit test module for playlist_souffle.entities.souffler."""
import pytest
from playlist_souffle.definitions import Track
from playlist_souffle.entities.souffler_util import (
generate_souffle_name,
souffle_tracks
)
class TestSouffleTracks:
"""Tests for playlist_souffle.entities.souffler.souffle_tracks"... | true |
be8d6470cd60c57cc3a33385ba5269c06da64f9f | Python | Kosisochi/Text_Classification | /Text_Classification_BiLSTM.py | UTF-8 | 6,749 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
#import gensim
import time
import tensorflow as tf
import random as rn
# np.random.seed(12)
# rn.seed(12)
# tf.random.set_seed(12)
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selecti... | true |
4b5d63fb85b9f7c4a986f61e2be0c09500ba3fbf | Python | Pragya2393-mishra/Identifying-Russell-Conjugations | /Project Execution/Models/Approach1/Pipeline/Versions of code/pipeline_data19v3_test18_datav27v3.py | UTF-8 | 6,830 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 17 18:19:34 2019
@author: pragy
"""
import gensim
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm
import nltk
from gensim.models.word2vec import Word2Vec
from gensim.models import KeyedVectors
from sklearn.metrics import accu... | true |