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 |
|---|---|---|---|---|---|---|---|---|---|---|
6a7e062afedbd18891ea1b78e89afc158071f283 | liyong6351/python-Books | /chapter10/pi_digits.py | UTF-8 | 199 | 3.234375 | 3 | [] | no_license | data = ''
birthday='41592'
with open('resource/py_digits.txt') as f:
for line in f:
data+=(line.strip())
print(data)
if birthday in data:
print("in it")
else:
print("not in it") | true |
ef155e5994b15f66412e5217e3987f741661f9ea | lekanakin/restApis | /Resources/user.py | UTF-8 | 1,178 | 2.59375 | 3 | [] | no_license | import sqlite3
from flask_restful import Resource,reqparse
from Models.user import UserModel
#User register resource
class UserRegister(Resource):
parser = reqparse.RequestParser()
parser.add_argument('username',
type=str,
required=True,
h... | true |
040d018e5a5e4a688f4c84d04063d4e6423e6611 | DanielNoord/DuolingoPomodoro | /src/tests/app_functions/menu/test_change_interval.py | UTF-8 | 2,705 | 3.015625 | 3 | [
"MIT"
] | permissive | import pytest
import rumps
from src.app_functions.menu.change_interval import change_interval
@pytest.fixture(name="basic_app")
def create_app_true():
"""Creates a basic app object with some variables to pass to functions
Returns:
rumps.App: Basic app
"""
app = rumps.App("TestApp")
app.se... | true |
e7b73bebbb8d681547d8d961146f6dc8d4ec8770 | jlin180/Phys_Chatbot | /server/circuits.py | UTF-8 | 1,475 | 3.109375 | 3 | [] | no_license | from decimal import *
import math
# V = IR
def seriesCurrent(resistors, voltage):
s = seriesResistance(resistors)
if(s == 0):
return "Cannot divide by 0"
return voltage/s
def seriesResistance(resistors):
s = 0
for i in resistors:
s += i
return s
def parallelCurrent(resistors... | true |
e9911e090be8a486419710894e34151d9b36105c | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc068/A/4118109.py | UTF-8 | 135 | 3.078125 | 3 | [] | no_license | x = int(input())
r = x % 11
if r == 0:
ans = x//11*2
elif r > 6:
ans = x//11*2+2
else:
ans = x//11*2+1
print(ans) | true |
b7eee4fcbb85be430b194ed2756ff545eb60c2cc | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_202/107.py | UTF-8 | 1,956 | 2.515625 | 3 | [] | no_license | import sys
import itertools
sys.setrecursionlimit(10000)
tc = int(sys.stdin.readline().strip())
for tmp_tc in xrange(tc):
[ N, M ] = map(lambda x: int(x), sys.stdin.readline().strip().split(' '))
start_v = M
rows, cols, diags, antidiags = {}, {}, {}, {}
for i in xrange(N):
rows[i] = 0
cols[i] = 0
fo... | true |
b008811f05885ce2e236b6c9964f73e53d92fb07 | wherculano/Curso-em-Video-Python | /Desafio106.py | UTF-8 | 1,574 | 4.125 | 4 | [] | no_license | """
Faca um mini-sistema que utilize o interactive help do Python.
O usuario vai digitar o comando e o manual vai aparecer.
Quando o usuario digitar a palavra FIM, o programa se encerrará.
Obs.: Utilizar cores.
Ex.:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sistema de Ajuda PyHelp
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Func... | true |
a2fe66764cf72124c92147a7fc8d62969726fdbc | Davv7d/project_patterns | /Strategia.py | UTF-8 | 2,174 | 3.59375 | 4 | [] | no_license | class Konfiguracja:
'''klasa decydujaca którą metode do obliczen wykorzystac '''
def __init__(self, parametr):
self.parametr = parametr
def jak_liczyc(self):
if(self.parametr == 1):
return Podatek_Polska()
else:
return Podatek_Niemcy()
class Zamowienie:
'... | true |
9602af17fba8c0088aa23e14183a21c802c9f41e | kisow/cs231n | /assignment1/cs231n/classifiers/softmax.py | UTF-8 | 3,698 | 3.40625 | 3 | [] | no_license | import numpy as np
from random import shuffle
from past.builtins import xrange
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape ... | true |
7b22bba5da50cf55eb506ca08c359a41b888987b | JosuaKugler/random_python | /numbernames.py | UTF-8 | 3,775 | 3.046875 | 3 | [] | no_license | import codecs
import os
def readData():
numberList = []
with codecs.open('numbernames.txt', 'r', encoding='utf-8') as f:
for line in f:
numberList.append(line)
return numberList
numberList = readData()
def get_String(numberString,bigBlock):
'''
get String from an i... | true |
6ccfb54536fe70e23dd5e2aa047259196f4b7769 | rikardbelowaverage/first_IOT_project | /boot.py | UTF-8 | 1,232 | 2.578125 | 3 | [] | no_license | import time
import binascii
import pycom
import socket
from network import LoRa
from keys import APP_KEY, DEV_EUI, APP2_KEY, APP2_EUI
#Function to convert rgb-color to hex
def rgb_to_hex(red, green, blue):
return '%02x%02x%02x' % (red, green, blue)
#Creates LoRa-object, note EU 868 frequency
lora = ... | true |
36315dbcee9f0b5cd44299d2812076753d89bf48 | apirr/python2021 | /task1.py | UTF-8 | 128 | 3.078125 | 3 | [] | no_license | import turtle as tl
from random import *
for i in range(20):
tl.forward(randint(0, 50))
tl.left(randint(0, 360))
| true |
7e9429006e6a3bceed99156e33b8342d3cb0aab7 | Coderx7/pylearn2 | /pylearn2/datasets/adult.py | UTF-8 | 3,271 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Wrapper for the Adult UCI dataset:
http://archive.ics.uci.edu/ml/datasets/Adult
"""
__author__ = "Ian Goodfellow"
import numpy as np
import os
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.format.target_format import convert_to_one_hot
from pylearn2.utils.string_utils import pr... | true |
45c517e6b363510c12225c0c6c84abadbbe47ccf | bcollazo/briscas | /simulate.py | UTF-8 | 463 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import uuid
from briscas.models.core import Game
from briscas.models.players import RandomPlayer
# Ensure data dir exists
DATA_DIR = 'data'
try:
os.mkdir(DATA_DIR)
except Exception as e:
pass
player1 = RandomPlayer('P1')
player2 = RandomPlayer('P2')
i = 0
while i < 100:
game = Game(player1, pl... | true |
7ed32627e1863811ac2c6837251100e94403c00b | friedemann/projecteuler-py | /euler014.py | UTF-8 | 741 | 3.203125 | 3 | [] | no_license |
#import sys
#sys.setrecursionlimit(5000)
def sequence(n, s):
if s == None:
s = []
s.append(n)
if n == 1:
return s
elif n % 2 == 0:
n1 = n // 2
else:
n1 = 3 * n + 1
return sequence(n1, s)
def get_seq_length():
'''speed up: cache known starting id length... | true |
949efc7443cc657c7c198855edfc432b80d2facd | Aasthaengg/IBMdataset | /Python_codes/p02722/s951009043.py | UTF-8 | 446 | 3.484375 | 3 | [] | no_license | def Divisor(n):
res = []
for i in range(1, int(n**0.5)+1):
if n % i != 0: continue
res.append(i)
if i*i != n: res.append(n//i)
return res
n = int(input())
#K is a divisor of N
ans = 0
for x in Divisor(n):
if x == 1: continue
tmp = n
while (tmp % x == 0):
tmp /= x
... | true |
9cd79a9f8f214c0588e3282a1db9bcfa1c74920d | tr2512/IT1110E | /IT1110E_homework/Derivatives.py | UTF-8 | 672 | 3.5625 | 4 | [] | no_license | class FuncWithDerivatives(object):
def __init__(self, h=1.0E-5):
self.h = h # spacing for numerical derivatives
def __call__(self, x):
raise NotImplementedError('__call__ \
missing in class %s' % self.__class__.__name__)
def df(self, x):
"""Return the 1st derivative of ... | true |
371227e03cf2e98fc95409c06359a55ccbba6172 | Devil8899/Python_demo | /Day21/Demo5shelve模块.py | UTF-8 | 613 | 3.234375 | 3 | [] | no_license | #_author: liuz
#date: 2017/12/14
import shelve
#可以实现文件读取和数据的序列化
#shelve模块比pickle模块简单 只有一个open()函数,返回一个类似字典的对象
#可读可写的key必须为字符串,而值可以是python所支持的数据类型
#shelve类似于一个存储持久化对象的持久化字典,即字典文件
#写入open()
f=shelve.open('testntxt') #打开一个文件
#f['info']={'name':'liuz'} #向文件中添加内容,添加方式与给字典添加键值对相同
#读取get()
# data=f.get('info')
# print(data... | true |
d95956ad16f96faf83f88546cdb8c609e32a4a54 | enterlina/NGS | /NGS_HW2_2.py | UTF-8 | 10,271 | 2.71875 | 3 | [] | no_license |
import pysam
import matplotlib.pyplot as plt
# import Bio
from Bio import SeqIO
import numpy as np
import math
import math
import pandas as pd
def count_subst_freqs(filename, dataset):
freqs_matrix = {}
for ref in ('ACTG-'):
for alt in ('ACTG-'):
if alt != ref:
freqs_matr... | true |
b5409347acfe4cc5e50649bddc3943eeaaf97afe | LukasKodym/python_exercises | /part_19/own_func.py | UTF-8 | 1,955 | 3.609375 | 4 | [] | no_license | # %%
##
def maximum(a, b):
if a > b:
return a
else:
return b
# %%
##
def maximum_2(a, b, c):
if a > b and a > c:
return a
elif b > a and b > c:
return b
elif c > a and c > b:
return c
# %%
##
def multi(iter_obj):
val = 1
for i in iter_obj:
... | true |
04cbb1da99a365faf316bbd15d0c6fe2d39d1285 | JizhiziLi/person-detector | /person_detector/module_1/edge.py | UTF-8 | 1,401 | 2.71875 | 3 | [] | no_license | import cv2
from ..config import *
import os
# from matplotlib import pyplot as plt
# Note: if encounter Anaconda Runtime Error:python is not installed as a framework
# Simply use `conda install matplotlib` to fix the problems.
class edge:
# Reason we are not doing cv2.imshow or plt.imshow is because:
# libc++a... | true |
03acc398263b1ff6b48605eaa5993e5d28577b83 | westmary48/capstone-api | /sizeyourdriveapi/views/donationbox.py | UTF-8 | 4,623 | 2.515625 | 3 | [] | no_license | """View module for handling requests about donation boxes"""
from django.http import HttpResponseServerError
from rest_framework.viewsets import ViewSet
from rest_framework.response import Response
from rest_framework import serializers
from rest_framework import status
from sizeyourdriveapi.models import DonationBox, ... | true |
8f6cea9ea72fa5f17d365955ab21c9dc6413472b | KavinLy/BusBot-Chatbot | /Test.py | UTF-8 | 529 | 2.515625 | 3 | [] | no_license | url = "https://nxbus.co.uk/routes/coventry/"
from bs4 import BeautifulSoup
from urllib.request import urlopen
page = urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
routeNumber = soup.find('span', {'class': 'route-number'}).text
routeTo = soup.find('td', {'class': 'main_and_via'})
destination = routeTo.... | true |
b4e171a30ae390df6f88b2df07956c8427bb4c43 | easternpillar/AlgorithmTraining | /Retry/Failed/선수과목 (Prerequisite).py | UTF-8 | 784 | 3.109375 | 3 | [] | no_license | # Problem:
# Reference: https://www.acmicpc.net/problem/14567
# My Solution:
import sys
from collections import deque
def topology():
q = deque([])
answer = [1 for _ in range(N + 1)]
for i in range(N + 1):
if indegrees[i] == 0:
q.append((i, 1))
while q:
num, sem = q.popl... | true |
d78f3c813d4fa05391c541c1ee8c4ee8816695e6 | rookie-YIFAN/AndrewNg-ML | /吴恩达编程作业6_SVM/ex2.py | UTF-8 | 739 | 3.0625 | 3 | [] | no_license | # SVM
# Feb.28th
# 理解了:参数C、gamma的意义
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as scio
import cap
from sklearn import svm
# 导入数据
data = scio.loadmat('ex6data2.mat')['X']
label = scio.loadmat('ex6data2.mat')['y'].reshape(-1)
# SVM
clf = svm.SVC(kernel='rbf', C=1, gamma=50)
clf.fit(data, label)... | true |
f644309e01d53b839572661768acd3498d5504fd | mjmagee991/CSAPNotes | /Labs/02-SunStar/src/sunstar.py | UTF-8 | 4,218 | 4.625 | 5 | [] | no_license | """
CSAP/X Lab
02-Recursion
Sun Star
This program draws a sun star. A sun star is a shape similar to a polygon but
such that each normal side of the polygon is a line with a triangular
outcropping with more triangular outcroppings coming off the first in a
recursive manner.
author: Matthew Magee
"""
import math
impor... | true |
b649591ba727efb52ba2170377efbc7002f482b1 | Aneapiy/OCR-Image-Sort | /qrReader.py | UTF-8 | 1,977 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
QR-Image-Sort
Image Sorting and Classification using QR codes and Google Vision API
Created by Nond and Josh on December 2, 2019
***UNDER DEVELOPMENT***
Note: This feature is under development and NOT ready for production
"""
'''
Read QR Code
Copied from https://www.learnopencv.com/opencv-qr... | true |
de8a41abba46adaa6e4568a24efea7265d68f8c3 | JrtPec/Maxee | /maxee/client.py | UTF-8 | 1,988 | 2.6875 | 3 | [] | no_license | import requests
URL = "https://api.maxee.eu/api"
def request_token(api_key: str) -> str:
auth_url = f'{URL}/Auth/token'
r = requests.post(auth_url, json={"apiKey": api_key})
r.raise_for_status()
token = r.json()['auth_token']
return token
class Client:
"""Simple JSON client that returns raw... | true |
dcaf5113af6b8a4326cc6e8d85b42baa8ca6ae67 | arXiv-research/DevLab-III-1 | /developer/lab/tools/RL Snake/play.py | UTF-8 | 5,000 | 2.8125 | 3 | [
"CAL-1.0-Combined-Work-Exception",
"CAL-1.0",
"MIT",
"CC-BY-SA-4.0",
"LicenseRef-scancode-free-unknown"
] | permissive | import argparse
import sys
import sdl2
import sdl2.ext as lib
import sdl2.sdlgfx as gfx
from rlsnake.game.snake import Snake
parser = argparse.ArgumentParser(description='Simulate a snake match using an agent')
parser.add_argument('--x', type=int, default=4, metavar='X',
help='number of tiles in hori... | true |
748a48b9a84681264490824036392afc72addcea | FrancisGregoryNg/Sensor-Fusion | /Simulation/functional_lookback.py | UTF-8 | 14,873 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import agv_library as agv
def get_state(IEEE_0, IEEE_1, encoder_0, encoder_1):
# Use the empirically-determined factor for the inverse-square law
# signal_strength = factor * (1 / distance ** 2)
# Transmitter 0 is located at (0, 0) or (0, 0)
# Transmit... | true |
dd567b063b7b4f226b6d7c3eb8f95eb389dc2fcd | katsumeshi/leetcode | /01252. Cells with Odd Values in a Matrix/solution.py | UTF-8 | 579 | 2.90625 | 3 | [] | no_license | class Solution(object):
def oddCells(self, n, m, indices):
"""
:type n: int
:type m: int
:type indices: List[List[int]]
:rtype: int
"""
arr = []
for i in range(n):
arr.append([0] * m)
for i, j in indices:
for c ... | true |
e73843d3c874493347bb6291ade7e35ab0135455 | paulcwlin/raspi3-opencv-python-test | /ex8-1.py | UTF-8 | 222 | 2.640625 | 3 | [] | no_license | import cv2
import numpy as np
img = np.zeros([5,5],np.uint8)
img[1:4, 1:4]=1
kernel = np.ones([3,1], np.uint8)
erosion = cv2.erode(img, kernel)
print('omg=\n', img)
print('kernel=\n', kernel)
print('erosion=\n', erosion) | true |
29b7fece5d5760278146bd39ab657dce29e5017c | dwaltrip/project-euler | /solutions/p92b.py | UTF-8 | 1,430 | 2.84375 | 3 | [] | no_license | import collections
import timeit
import cProfile
squared = [ i * i for i in range(0, 10) ]
dsquares = {}
def chain_value(n) :
a = []
while n not in [1, 89] :
if n in dsquares.keys() :
n = dsquares[n]
else :
a.append(n)
n = sum(squared[int(x)] for x in str(n))
for aa in a:
dsquares[aa] = n
return n
... | true |
9b75e264ad2a02d89b4ae5e11a6d150c788f889e | leriomaggio/histolab | /tests/unit/test_scorer.py | UTF-8 | 1,873 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import PIL
from histolab import scorer
from histolab.tile import Tile
from ..base import COMPLEX_MASK
from ..unitutil import PILIMG, function_mock, instance_mock, method_mock, property_mock
class DescribeScorers:
def it_can_construct_randomscorer(self, request):
tile = instance_mock(re... | true |
251cc285964e9696608a78d1a9e8afbc51241853 | francoisfagan/log-tricks | /load_data.py | UTF-8 | 1,650 | 3.078125 | 3 | [] | no_license | """Defines how all data is to be loaded"""
import numpy as np
from sklearn.datasets import load_svmlight_file
import pickle
from scipy.sparse import csr_matrix, csc_matrix, coo_matrix, find
class MNLDataset():
def __init__(self, file_name):
x, y = load_svmlight_file(file_name + '.txt')
self.x_spar... | true |
e887d6ac75b49e181a2043d59b1a96eb71ed3838 | jefio/autoencoder-explore | /fitplot.py | UTF-8 | 8,969 | 2.578125 | 3 | [] | no_license | """
Fit and plot autoencoders
"""
import argparse
import subprocess
import os
from keras.utils import plot_model
from keras.datasets import mnist
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
from models import get_autoencoder_models, get_vae_models
d... | true |
7d9258670c0414b8a831a4f9892aaf930fa30ec1 | jinwei14/Mathematics-for-Machine-Learning | /CW2/1B.py | UTF-8 | 1,816 | 3.0625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from numpy.linalg import inv
N = 25
X = np.reshape(np.linspace(0, 0.9, N), (N, 1))
Y = np.cos(10*X**2) + 0.1 * np.sin(100*X)
# K = 12 # order of the func
listTrainning = []
for i in np.linspace(0, 0.9, N):
listTrainning.append(np.cos(10*i**2) + 0.1 * np.sin(100*i... | true |
79d136af6f55a2ba113628dbcb21552a2f9de55d | zsalec/Python-Full-Stack-Free | /Chapter3/3-8-dict-set.py | UTF-8 | 7,862 | 4.1875 | 4 | [] | no_license | # 关于元组的函数
# - len 获取长度
print('-' * 20)
print('len')
t1 = (1, 2, 3, 4, 5)
print('t1:', t1)
print('len(t1):', len(t1))
'''
--------------------
len
l1: (1, 2, 3, 4, 5)
len(l1): 5
'''
# -- max & min
print('-' * 20)
print('max & min')
print('max(t1): {}, min(t1): {}'.format(max(t1), min(t1)))
'''
--------------------
max ... | true |
9dc16d4bb3f42e375bc4c07d5b9aeedbd15b39ef | jay-joo-code/leetcode | /Array String/[ans] 621. Task Scheduler.py | UTF-8 | 478 | 2.921875 | 3 | [] | no_license |
# solution
def leastInterval(self, tasks: List[str], n: int) -> int:
counter = {}
for task in tasks:
if task in counter:
counter[task] += 1
else:
counter[task] = 1
chars_by_freq = sorted(counter, key=lambda k:counter[k], reverse=True)
highest = counter[chars_by_freq[0]]
idle = (highest - 1) * n
f... | true |
855bf744bf1ad10b2cd99790bb30017ab64ae3b1 | Nadeemk07/Python-Examples | /Arrays/array_rotate.py | UTF-8 | 546 | 4.4375 | 4 | [
"MIT"
] | permissive | # rotating element By d
def rotation(arr, n, d):
for i in range(0, d):
rotate_by_one(arr, n)
# rotating element one by one
def rotate_by_one(arr, n):
temp = arr[0]
for i in range(0, n-1):
arr[i] = arr[i+1]
arr[n-1] = temp
# Printing the rotated array
def rotate... | true |
b9128d32a5a9ed990fe35b3d4e02779312d2116d | hudyu17/modelvideo | /model1/deleted.py | UTF-8 | 3,694 | 2.578125 | 3 | [] | no_license |
elif len(r) == 0 or r is None:
context = {'com': 'No Player Found'}
elif len(r) == 1:
context = {'com': r}
elif r != '' and request.POST.get("number_field") == '':
#name typed in, empty number = more than 1 person for name
context = {'com': 'Name not specific enough'}
else: # r is hella names
if... | true |
0aff92de175173679abce2816eb72ac2d5c32080 | as-iF-30/My-Python | /Minion.py | UTF-8 | 396 | 3.578125 | 4 | [] | no_license | def minion_game(string):
V = ['A', 'E', 'I', 'O', 'U']
c = 0
v = 0
for i in range(len(string)):
if(string[i] not in V):
c+=(len(string)-i)
else:
v+=(len(string)-i)
if(c==v):
print("Draw")
elif(c>v):
print("stuart",c)
else:
pri... | true |
d7d5e6e01e3b4e4f62f191811e1ee3e2cc6a6b2a | eduardodisanti/drl_tennis | /code/train_agent_headless.py | UTF-8 | 4,677 | 3.046875 | 3 | [] | no_license | from unityagents import UnityEnvironment
import numpy as np
from collections import deque
import torch
from code.ddpgagent import Agent
env = UnityEnvironment(file_name='Reacher_multi.app')
# get the default brain
brain_name = env.brain_names[0]
brain = env.brains[brain_name]
# reset the environment
env_info = env.... | true |
4a98a01d97ab2dcd24183b32d316df782cb7d350 | nicohirsau/pv_simulator | /pvsimulator/simulations/configuration.py | UTF-8 | 1,546 | 3.03125 | 3 | [
"MIT"
] | permissive | import configparser
CONFIGURATION = {
'host': 'localhost',
'username': 'guest',
'password': 'guest',
'queue_name': 'pv_simulation'
}
def read_config_file(filepath):
'''
Tries to load a simulation configuration from the filepath.
The values will be applied to the global CONFIGURATION dictio... | true |
93a8e9a9e5a1b1bd463b193b7913a7d72e3150d8 | tonyabracadabra/Frozen-Lake-RL | /main.py | UTF-8 | 539 | 2.5625 | 3 | [] | no_license | import gym
import deeprl_hw1.queue_envs as queue_env
def main():
# create the environment
# env = gym.make('FrozenLake-v0')
env = gym.make('Queue-1-v0')
env.render()
env.step(1)
env.render()
env.step(1)
env.render()
env.step(2)
env.render()
env.step(3)
env.render()
... | true |
ebf93e5a0857a7dcd42275141010da78a552e74c | Luisa-T/helloworld | /forloops.py | UTF-8 | 124 | 3.15625 | 3 | [] | no_license | # Luisa Timothy 24-02-2018
# for loops
words = ['cat', 'window', 'defenestrate']
>>> for w in words:
... print(w, len(w)) | true |
3f9b70134daeb322fa65e0cd225bf1b821c31a07 | surusara/NLB-Python | /Day2/doorbell.py | UTF-8 | 295 | 3.375 | 3 | [] | no_license | import tkinter as tk
def doorbell(event):
print(" You rang the Doorbell !")
window = tk.Tk()
window.title(" Doorbell App")
window.geometry("300x200")
mybutton = tk.Button(window, text = "Doorbell")
mybutton.grid(column=1,row=0)
mybutton.bind("<Button-1>",doorbell)
window.mainloop() | true |
3c10f596b1e6dabad8b1d8932d58a9c1e94cc5ff | MrSparako/CNS210 | /recursive2.py | UTF-8 | 761 | 3.453125 | 3 | [] | no_license | import argparse
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n-1)
Parser=argparse.ArgumentParser(description='Writes Fibonacci squence by the given number to a given file')
Parser.add_argument('--number', dest='number', type=int, required=True, help='Number used to generate... | true |
dac6f3cea798f74212caf30fec3a94f8959ae5ae | AybarsAcar/MLandAI | /clustering/hierarchical/script.py | UTF-8 | 1,186 | 3.078125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.cluster import AgglomerativeClustering
from scipy.cluster import hierarchy as sch
mall_df = pd.read_csv('../../data/Mall_Customers.csv')
X = mall_df.iloc[:, [3, 4]].values
# find the op... | true |
978dc0c5f435ccd22595e0c8f8c9fe4011f014d2 | jaberg/pylearn | /pylearn2/gui/patch_viewer.py | UTF-8 | 5,682 | 2.84375 | 3 | [] | no_license | import numpy as N
from PIL import Image
import os
def make_viewer(mat, grid_shape = None, patch_shape = None):
""" Given filters in rows, guesses dimensions of patchse
and nice dimensions for the PatchViewer and returns a PatchViewer
containing visualizations of the filters"""
if grid_shape is... | true |
d3f27385e46c2a58a26d811be7dd19eebc1b949f | traghuram/Python-Personal | /Python Stuff/Project Euler/MADOE.py | UTF-8 | 843 | 2.515625 | 3 | [] | no_license | #Downloads teacher data for each year and subject for both the district and the state
#url = 'http://profiles.doe.mass.edu/state_report/teacherdata.aspx?fycode=2015&export_excel=yes&subjectCode=42&reportType=SCHOOL'
#file_loc = '/Users/taranraghuram/Documents/Project Euler/MA/Teacher Data' + '/' + str(2015) + '.xlsx'... | true |
038f40455f092820fbaa383683c642f754acf1b1 | macrotrojan/Hinfo | /infogather.py | UTF-8 | 1,371 | 2.9375 | 3 | [] | no_license | import os
print('''
██╗░░██╗░░░██╗███╗░░██╗███████╗░█████╗░░░░░░░░░░░░
██║░░██║░░░██║████╗░██║██╔════╝██╔══██╗░░░░░░░░░░░
███████║░░░██║██╔██╗██║█████╗░░██║░░██║░░░░░░░░░░░
██╔══██║░░░██║██║╚████║██╔══╝░░██║░░██║░░░░░░░░░░░
██║░░██║░░░██║██║░╚███║██║░░░░░╚█████╔╝░░░░░░░░░░░
╚═╝░░╚═╝░░░╚═╝╚═╝░░╚══╝╚═╝░░░░░░╚════╝░░░░░░... | true |
9b219489c739afb69ab2588c1b603006d4857024 | Zyad1999/Problem-Solving | /KnapSack.py | UTF-8 | 622 | 3.09375 | 3 | [] | no_license | def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i - 1] <= w:
K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i ... | true |
12a5699a9750a3c762b9c610d28bd95f313da3d0 | tboonma/ske-comprog1 | /ComProgLab/Week12/new/cell.py | UTF-8 | 925 | 3.609375 | 4 | [] | no_license | class Cell:
def __init__(self, cell_id, move, hold):
self.__id = cell_id
self.__move = move
self.__hold = hold
self.__occupy_list = []
def get_occupy_list_str(self):
output = ""
for i in self.__occupy_list:
output += "{},".format(i.name)
last_... | true |
3b3b0b53df248ebf2fa201d12b028c6ba5546552 | chanhyeoni/CIS700_Project_ODModel | /models/instancebased.py | UTF-8 | 3,627 | 2.546875 | 3 | [] | no_license | from __future__ import division
#!/usr/bin/env python
import numpy as np
import pandas as pd
from sklearn import neighbors
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
from helper.helper import *
class LoF(object):
def __init__(self, params, k):
self.__distMetr... | true |
dc8df809c6f6888f595b9ce09fc4ec2fc5641256 | CodeYellowBV/django-relativedelta | /tests/test_utils.py | UTF-8 | 2,695 | 2.8125 | 3 | [
"MIT"
] | permissive | from datetime import timedelta
from unittest import TestCase
from dateutil.relativedelta import relativedelta
from relativedeltafield.utils import parse_relativedelta, relativedelta_as_csv
class ParseRelativedeltaTest(TestCase):
def assertStrictEqual(self, a, b):
self.assertEqual(a, b)
self.asse... | true |
06dcd07be7f4e6e1fffd9d2e7ad0c0520fac6bc5 | wthered/postFilm | /recommend_svd.py | UTF-8 | 2,229 | 3.1875 | 3 | [] | no_license | # Code pasted from https://alyssaq.github.io/2015/20150426-simple-movie-recommender-using-svd/
# todo: See results from https://antoinevastel.com/machine%20learning/python/2016/02/14/svd-recommender-system.html
import numpy as np
import pandas as pd
data_names = ['user_id', 'movie_id', 'rating', 'time']
data = pd.read... | true |
da655428ecd1c08e899c656f843ca7525e2da7fe | HumamAlwassel/TSP | /extract_features/eval_video_dataset.py | UTF-8 | 7,885 | 2.671875 | 3 | [
"MIT"
] | permissive | from __future__ import division, print_function
import os
import pandas as pd
import numpy as np
import torch
import h5py
import pickle as pkl
from torch.utils.data import Dataset
from torchvision.io import read_video
class EvalVideoDataset(Dataset):
'''
EvalVideoDataset:
This dataset takes in a lis... | true |
90e6b5e8355831f6d30ac7a7b0a6117e3bcab6ca | seongyooncho/RoboND-Perception-Exercises | /Exercise-3/sensor_stick/scripts/svm.py | UTF-8 | 1,177 | 3.078125 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from generate_clusters import cluster_gen
np.random.seed(424)
n_clusters = 3
clusters_x, clusters_y, labels = cluster_gen(n_clusters)
X = np.float32((np.concatenate(clusters_x), np.concatenate(clusters_y))).transpose()
y = np.float32((np.conc... | true |
ab36ba8c6be738ec4232e74468353dfe071be070 | SouravD18/Dropout_vs_Bootstrap | /eval_predictions.py | UTF-8 | 691 | 2.515625 | 3 | [] | no_license | import os
import pickle
import numpy as np
fnames = os.listdir("./predictions")
result = []
hs_acc = []
hs_loss = []
for i in fnames:
prediction = pickle.load(open("./predictions/" + i, "rb"))
result.append(prediction)
history = pickle.load(open("./history/" + i, "rb"))
hs_acc.append(history["val_acc"... | true |
ef4c86fe196823c4483fa0dcfe0bd6608ff4b40a | minsik-um/algorithm_practice | /programmers/algorithm_data_structure/dynamic_programming/정수 삼각형.py | UTF-8 | 1,712 | 3.375 | 3 | [] | no_license | def my_solution(triangle):
'''
제일 위에서부터 차례로 내려오며
각 자리에서 가지는 최대값을 저장해가는 방식
효율성 1번: 50.52ms
if문과 enumerate() 사용 등이 차이가 있기에 이부분이 시간 증가에 영향
'''
answer = 0
max_list = [triangle[0]]
for idx in range(1, len(triangle)):
temp = []
for i, v in enumerate(triangle[idx]):
... | true |
eef8bed67b736f8e32ee266af2500c636d053365 | FDSJK/Classification | /DataSet.py | UTF-8 | 1,679 | 2.875 | 3 | [] | no_license | from torch.utils.data import Dataset, DataLoader
import numpy as np
import os
from skimage import io
import cv2
#https://blog.csdn.net/zhpf225/article/details/103766493
class MNIST_Data(Dataset):
"""
读取数据、初始化数据
"""
def __init__(self, root_dir, mode='train', transform=None):
self.root_dir ... | true |
e3aa960c1788dbbbd06f98d69e50f4ade98225fd | ParkHyunsu1110/Python | /python GUI/WxPython/WxPython Practice 2 - 2.py | UTF-8 | 1,296 | 3.078125 | 3 | [] | no_license | ##wxPython 실습 2 - 2
import wx
app = wx.App()
frame = wx.Frame(None)
panel1 = wx.Panel( frame )
nametxt = wx.TextCtrl( panel1 )
sizer0 = wx.StaticBoxSizer( wx.VERTICAL, panel1, "이름" )
sizer0.Add( nametxt )
panel1.SetSizer( sizer0 )
panel2 = wx.Panel( frame )
manRB = wx.RadioButton( panel2, label = "남자", style = wx.RB_... | true |
63ad2b8e816383d2cba63234a452c3496e5d2cd3 | Bpratiksha/DS | /binary_search.py | UTF-8 | 625 | 4.15625 | 4 | [] | no_license |
def binarySearch(arr,x):
l=0
r=len(arr)
while l<=r:
mid = (l + r )// 2
if arr[mid] == x: # Check if x is present at mid
return mid+1
elif arr[mid] < x: # If x is greater, ignore left half
l = mid + 1
else: # If x is smalle... | true |
c9970c9400c09474caf0c8e84c819a6f8ba9861d | apontejaj/Python-Bootcamp | /Errors.py | UTF-8 | 657 | 4.03125 | 4 | [] | no_license | def ask_int():
a = True
while a:
try: # Here we put the code that can fail
val = int(raw_input("Type in an integer"))
except: # Here we put what to do if the code fails, you can actually specify the type of error
print ("That is not an integer. Try again")
else... | true |
8e2898d2232adc25ea723f611a9ab6b5ed786558 | dkn22/scratch | /ols_regression.py | UTF-8 | 1,557 | 3.171875 | 3 | [] | no_license | '''
email: dat.nguyen at cantab.net
'''
import numpy as np
from utils import *
class LeastSquaresRegression(Preprocess):
'''
OLS Regression. Weights are computed exactly,
without an optimization procedure.
'''
def __init__(self, normalize_features=True):
Preprocess.__init__(self)
... | true |
3d06e9c1bf2502a9dc85ffeabe3b3bacd7ec729a | zfanli/jachecker | /parser/java_parser/tests/test_operation.py | UTF-8 | 5,382 | 2.875 | 3 | [] | no_license | '''
Unit Test.
Target: Operation
'''
import unittest
import json
from pypeg2 import *
# Test target
from parser.java_parser.operation import Operation, Operations, OperationAssignment, OperationReturn
class TestAssignment(unittest.TestCase):
def test_case_ass1(self):
'''Assignment'''
expecte... | true |
3b3b2f618803ebf9894486e5571bd12a4febefea | eugene-prout/Project-Euler | /p26_n.py | UTF-8 | 455 | 3.0625 | 3 | [] | no_license | length = 0
for i in range(1000,1,-1):
if length >= i:
break
foundRemain = [None] * i
value = 1
position = 0
while(foundRemain[value] == 0 and value != 0):
foundRemain[value] = position
value *= 10
value = value % i
position += 1
try:
if posit... | true |
1cb22c8b8f9fb4bea4de4e21a280dd84a400386f | sangeetjena/datascience-python | /Dtastructure&Algo/DynamicProgramming/The_coin_change_problem.py | UTF-8 | 242 | 3.390625 | 3 | [] | no_license | #Count of different ways to express N as the sum of 1, 3 and 4
#For example, if you have 4 types of coins, and the value of each type is given
# as {8,3,1,2} respectively, you can make change for 3 units in three ways: {1,1,1},{1,2} , and .{} | true |
e0acc1e7d6ec3ada410ccd8e83aefbf52c205579 | BehroozMansouri/TangentCFT | /DataReader/wiki_data_reader.py | UTF-8 | 3,175 | 2.609375 | 3 | [] | no_license | import os
import unicodedata
from abc import ABC
from DataReader.abstract_data_reader import AbstractDataReader
from TangentS.math_tan.math_document import MathDocument
from TangentS.math_tan.math_extractor import MathExtractor
class WikiDataReader(AbstractDataReader, ABC):
def __init__(self, collection_file_pat... | true |
4a46cd3fbc51d382ee0c294be0c8761da89dc882 | lemon-l/Online-Judge | /算法训练/简单加法.py | UTF-8 | 1,143 | 4.3125 | 4 | [] | no_license | '''
Description
首先给出简单加法算式的定义:
如果有一个算式(i)+(i+1)+(i+2),(i>=0),在计算的过程中,没有任何一个数位出现了进位,则称其为简单的加法算式。
例如:i=3时,3+4+5=12,有一个进位,因此3+4+5不是一个简单的加法算式;又如i=112时,112+113+114=339,没有在任意数位上产生进位,故112+113+114是一个简单的加法算式。
问题:给定一个正整数n,问当i大于等于0且小于n时,有多少个算式(i)+(i+1)+(i+2)是简单加法算式。其中n<10000。
Input
输入描述:
一个整数,表示n
输入样例:
... | true |
c7dec4d794bdd8dd4c53f00d9d171f1b6c136391 | efaber314/DATA690_WANG | /Assignments/Faber_Assignment2.py | UTF-8 | 554 | 3.59375 | 4 | [] | no_license | '''
DS690, Spring2020
Assignment 2 Emily Faber
'''
import random
print("*******************************************************")
for i in range(10): #10 rows
#prints at the start of every row
#end = "" does NOT end with a newline
print("* ", end = "")
for i in range(10): #10 columns
... | true |
2f19474043145d94313b3ce5d8a4fca99943ba05 | IronLemon/pyroville | /tests/test_pyroville.py | UTF-8 | 2,505 | 2.625 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pyroville
----------------------------------
Tests for `pyroville` module.
"""
import unittest
import json
from mock import patch, Mock
from pyroville import Pyroville, PlayerResource
class TestPyroville(unittest.TestCase):
api_key = 'key'
site_id = '... | true |
94d047a2bd378d960df0a180807c3d143e5d9517 | westgate458/LeetCode | /P0123.py | UTF-8 | 3,834 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 12:51:08 2019
@author: Tianqi Guo
"""
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
# Solution 1: only one traverse
# initialize tracking quantitie... | true |
4c15f2e0022a52e3edd604e5810fc02ef609426b | jamesliu1/ib_tools | /indicators.py | UTF-8 | 5,694 | 3.234375 | 3 | [] | no_license | from functools import partial
from typing import List, Dict, Callable, Tuple
import pandas as pd
import numpy as np
import sys
def atr(data: pd.DataFrame, periods: int, exp: bool = True) -> pd.Series:
"""
Return Series with ATRs.
Args:
---------
data: must have columns: 'high', 'low', 'close'
... | true |
afdd51182e4070e23808672300c78761dc27d75e | hangxuu/Notes-and-Blog | /codes/effective_python/item37/item37.py | UTF-8 | 1,338 | 3.734375 | 4 | [] | no_license | from collections import namedtuple, defaultdict
Grade = namedtuple('Grade', ('score', 'weight'))
class Subject:
def __init__(self):
self._grade = []
def report_grade(self, score, weight):
self._grade.append(Grade(score, weight))
def average_grade(self):
total, total_weight = 0, ... | true |
3e625e21a2acb9331d719126902eaaac95e69fbe | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_34/668.py | UTF-8 | 2,932 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
import sys
def getDictList(f, D, L) :
dictList=[]
for i in range(0, D):
str = f.readline()
dictList.append(str[:L])
return dictList
def getList (L, str):
withinParan=0
outsideParan=1
tmpList = []
ML = []
for i in range(0, L):
ML.append(tmpList[:])
m... | true |
8be4d0cad95af3972c2e971d088f872566b53c93 | SuyuMichaelYang/linefinder-interface | /init.py | UTF-8 | 2,773 | 2.96875 | 3 | [] | no_license | ##This file populates a SQLite database with information about various lines
#Authors: Vincent He, Larry Donahue
def main():
from app import db, Line
import numpy as np
import os
db.drop_all()
db.create_all()
run = 'O2'
#IMPORTANT: Put 'rootdir' as the data folder within this program, or e... | true |
252d5f2e97ccc56b46d6387d6d5afce7f151355e | zuoxinxue/untitled1 | /read_data.py | UTF-8 | 5,972 | 2.671875 | 3 | [] | no_license | from icalendar import Calendar
import csv
from mysql_tool import Mysql_tool
import requests
from bs4 import BeautifulSoup
import re
import datetime
mysql_tool = Mysql_tool()
s = mysql_tool.connect()
"""
1 读取ATM
2 读取来自谷歌日历的ics
3 将duration处理成hour
"""
#正则处理部分
#匹配数字
def re_num(self,re_content_num):
regex_num =... | true |
802a39e95c96f55b0db24e2260f54adfbce42772 | softking/cnn_learn | /dqn_game/car_conv/auto.py | UTF-8 | 3,588 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import random
from collections import deque
import gym
import time
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev = 0.01)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.01, shape = ... | true |
00c09962ffa095f7f2da21cf36f76b22a30056b2 | praveenkumarjc/tarzanskills | /exercise.py | UTF-8 | 216 | 3.75 | 4 | [] | no_license | a='abc'
b='ing'
print(a+b)
str1="this is python programming"
str2=str1.split(' ')
print(str2)
MyString = "abcdef"
z=MyString[:3]
y=MyString[3:]
x=MyString[0:5:2]
t=MyString[:4]
print(z)
print(y)
print(x)
print(t)
| true |
3abc1324d824398f9d02f4e1339b8ab2b4218cca | JBorrow/lagrangian-transfer | /tests/test_particle_distances.py | UTF-8 | 4,066 | 2.921875 | 3 | [] | no_license | """
This unit test looks at some specific particles within the simulation and
by hand checks that they really do end up at the distance to their nearest
neighbour as we say they do.
This is because of the currently very dubious claim presented in the
histogram plot produced by plot.find_distances_to_nearest_neighbours... | true |
455e46125ed8b87bb3dd379fc61b57e76c0ba209 | BingqiangZhou/LearningOpenCV | /Python/day126.py | UTF-8 | 3,363 | 2.875 | 3 | [] | no_license | '''
Author : Bingqiang Zhou
Date : 2021-09-03 12:10:02
LastEditors : Bingqiang Zhou
LastEditTime : 2021-09-03 12:34:09
Description : OpenCV DNN 基于残差网络的人脸检测
OpenCV在DNN模块中提供了基于残差SSD网络训练的人脸检测模型,该模型分别提供了tensorflow版本,caffe版本,torch版本模型文件,
其中tensorflow版本的模型做了更加进一步的压缩优化,大小只有2MB左右,非常适合移植到移动端使用,实现人脸检测功能,
... | true |
c23875743b3e2c2511a175b21ba83cefe87b7915 | MatthiasWiller/moving-particles | /python/plots/53_plot_breitung_sus_samples.py | UTF-8 | 3,143 | 2.625 | 3 | [] | no_license | """
# ---------------------------------------------------------------------------
# File to produce plots for example 3
# ---------------------------------------------------------------------------
# Created by:
# Matthias Willer (matthias.willer@tum.de)
# Engineering Risk Analysis Group
# Technische Universitat Munche... | true |
8072040c312aea7b426dadfcd1b4fb9587cbc17b | Mussk/sklearn-neural-network-example | /Script.py | UTF-8 | 3,887 | 3.59375 | 4 | [] | no_license | import itertools
from sklearn.datasets import load_iris
import random
import numpy as np
from sklearn.linear_model import Perceptron
import matplotlib.pyplot as plt
'''
IRIS DATASET
features:
1. sepal length in cm
2. sepal width in cm
3. petal length in cm
4. petal width in cm
5. class:
-- Iris Setosa
-- Iris Versicol... | true |
8ba9c967826da04b87d2d4443c5f4466a99ccd1b | markomarkusi/Consolidated-Firmware-1 | /scripts/environment_setup/install_cube.py | UTF-8 | 3,622 | 2.71875 | 3 | [] | no_license | """
Install STM32CubeMX to the specified directory.
"""
import sys
import os
import argparse
import subprocess
CUBE_AUTO_INSTALL_XML = '''\
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AutomatedInstallation langpack="eng">
<com.st.microxplorer.install.MXHTMLHelloPanel id="readme"/>
<com.st.microxplo... | true |
299e24b7eca37c15a3bc92d55c0f1dcb3d4e6e1a | qwe06277/WebCrawling | /mix_master.py | UTF-8 | 982 | 2.640625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
#login
ID = '아이디'
PW = '비밀번호'
driver = webdriver.Chrome()
driver.get('http://www.mixmaster.co.kr/')
driver.find_element_by_xpath('//*[@id="AuroraPopupLayer_Set01"]/span[3]').click()
d... | true |
475f55199d65022eb86d8238dd03b8a425853dfd | alexandermeek/visual-nlp | /scripts/add.py | UTF-8 | 72 | 2.890625 | 3 | [] | no_license | #Params: x=float, y=float
#Return: float
def add(x, y):
return x + y | true |
1fd5a16d3eb64eb62298158367eefaf889ba8d47 | CogitoNTNU/gce-setup | /mail.py | UTF-8 | 2,254 | 2.671875 | 3 | [
"MIT"
] | permissive | import smtplib
import os
def get_users():
USERS_PATH = 'users.txt'
try:
with open(USERS_PATH, 'r') as f:
return [a.strip() for a in f.read().strip().split('\n')]
except FileNotFoundError:
return []
def send_login():
if not 'groups' in os.listdir('.'):
return print... | true |
d1346e2d8f2cf6d31580db7208f5e002e32a1b58 | daniel-reich/ubiquitous-fiesta | /TZXG9RfcZ7T3o43QF_0.py | UTF-8 | 122 | 2.78125 | 3 | [] | no_license |
import re
def same_length(txt):
return [len(i) for i in re.findall('1+',txt)]==[len(i) for i in re.findall('0+',txt)]
| true |
a08459138e8d06c87d726789e40d4c5a71434b28 | anirudh200015/wikipedia-using-python | /wiki.py | UTF-8 | 562 | 3.125 | 3 | [] | no_license | import wikipedia
from wikipedia import summary
#query=input("what is it that you are searching: ")
#text=wikipedia.search(query,results=10,suggestion=False) # suggestion= false will give a list of result
# suggestion =true will give a tuple
query=input("whic... | true |
d88a490cf7881b4c41c4b8d8fa2487d803d6944c | a-abir/Retrove | /music.py | UTF-8 | 1,768 | 2.5625 | 3 | [] | no_license | import os
import sys
import pygame
import random
pygame.init()
pygame.mixer.init()
executing_wd = os.path.dirname(os.path.realpath(sys.argv[0]))
current_wd = os.path.join(executing_wd, "assets")
music_wd = os.path.join(current_wd, "music")
sounds = []
ALL_SOUNDS = []
# music_wd = variables.music_wd
list(map(lambda ... | true |
7b55eb59a188a595524e7f35870c85fa3ad38b75 | Bor-G/Diving_into_Python-Coursera | /Week_3/work/assert.py | WINDOWS-1251 | 235 | 2.875 | 3 | [] | no_license | # -*- coding: cp1251 -*-
def get_user_by_id(id):
assert isinstance(id, int), "id "
print(" ")
if __name__ == "__main__":
get_user_by_id("foo") | true |
1a67fa42f633c37f905b712b77acb7723100ee1b | ESSS/barril | /src/barril/basic/fraction/_tests/test_fraction.py | UTF-8 | 2,300 | 3.5 | 4 | [
"MIT"
] | permissive | import copy
from barril.basic.fraction import Fraction
def testBasicUsage() -> None:
f = Fraction(5, 3)
assert tuple(f) == (5, 3)
assert len(f) == 2
assert f[0] == 5
assert f[1] == 3
assert f.numerator == 5
assert f.denominator == 3
f.numerator = 10
assert tuple(f) == (10, 3)
... | true |
aa0c0d4fd6229086f7b20e0e1c11c0ab574dd23a | mike-chesnokov/leetcode | /tree/medium/0654_max_binary_tree.py | UTF-8 | 2,255 | 4.34375 | 4 | [] | no_license | """
654. Maximum Binary Tree
You are given an integer array nums with no duplicates.
A maximum binary tree can be built recursively from nums using the following algorithm:
Create a root node whose value is the maximum value in nums.
Recursively build the left subtree on the subarray prefix to the left of the ... | true |
a063faabb060ba3fb87e9785481e0056efe3f958 | tangethan79/chess-AI | /chess!/chessGame.py | UTF-8 | 2,427 | 3.4375 | 3 | [] | no_license | from chess import GetPieceLegalMoves, IsPositionUnderThreat, printPos, GetMove, GetPlayerPositions
from AI import AI, TreeNode, evalBoard
# first digit represents piece (1: pawn, 2: knight, 3: bishop, 5: rook, 9: queen, 8: king)
# second digit represents color (1: white, 0: black)
# a 2 means the space is blank
... | true |
98f96cceae95ac535a300d3346c4fa1981bd9251 | MikeNordMan/TDNikel | /mainWindow.py | UTF-8 | 2,719 | 2.953125 | 3 | [] | no_license | import PySimpleGUI as sg
import datetime
from addWindow import AddWindow
from reworkWindow import ReworkWindow
from realWindow import RealWindow
now = datetime.datetime.now() # Получаем текущую дату
now = now.strftime('%d.%m.%Y')
def prepareOpenWidow(activate, window):
activate = True
window.Hide()
'''Функц... | true |
a687062822b2bc5d59a7496ab27f7dc621c63249 | leduytung/django_course | /meetups/views.py | UTF-8 | 714 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render
# Create your views here.
def index(request):
meetups = [
{'title': 'First meetup!', 'location': 'Ha Noi', 'slug': 'hanoi'},
{'title': 'Second meetup!', 'location': 'Ho Chi Minh', 'slug': 'hochiminh'}
]
return render(request, 'meetups/index.html', {
... | true |
4252d6d3725b62815f9316253cebecefd781bd68 | kateno4eg/OOP | /testRectangle.py | UTF-8 | 443 | 3.34375 | 3 | [] | no_license | from rectangle import Rectangle
r1 = Rectangle(10, 5)
print("r1.width =", r1.width)
print("r1.height =", r1.height)
print("r1.get_width =", r1.get_width())
print("r1.get_height =", r1.get_height())
print("r1.get_area =", r1.get_area())
r2 = Rectangle(7, 3)
print("r2.width =", r2.width)
print("r2.height =", r2.heigh... | true |
6191f608521c67b671f493e68f1595ebf96fc5af | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/3396/codes/1642_869.py | UTF-8 | 266 | 3.53125 | 4 | [] | no_license | # Teste seu código aos poucos.
# Não teste tudo no final, pois fica mais difícil de identificar erros.
# Use as mensagens de erro para corrigir seu código.
cp= float(input("digite preco:"))
pmp= 200.0
if(cp>=pmp):
print(round(cp-(cp*5//100), 2)
else:
print(cp) | true |