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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8c1cf791e79842e43470ba37c34c1d7c8ae0be84 | Python | EveryoneHappyAI/ComputerVision_Learning | /OpenCV3_Py_Examples/ConvolveTest.py | UTF-8 | 1,690 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
OpenCV 3 学习示例
卷积特性试验
Created on Fri Jul 21 12:49:40 2017
@author: yf
"""
import cv2
import time
#help(cv2.namedWindow)
import numpy as np
from skimage import io
from scipy import ndimage
kernel_3x3 = np.array([[-1, -1, -1],
[-1, 8, -1],
[... | true |
9007ecbd795e61d5837d31586b04f178d2c4c33b | Python | TimoKubera/instagram_monitor | /instagram/testing/test.py | UTF-8 | 1,642 | 2.578125 | 3 | [] | no_license | from urllib.parse import urljoin
from selenium import webdriver
from selenium.webdriver import ActionChains
from bs4 import BeautifulSoup
url = "https://www.instagram.com/jimmyfallon/"
base_url = "https://www.instagram.com/"
geckodriver = "/Users/timo/node_modules/geckodriver/geckodriver"
driver = webdriver.Firefox(e... | true |
40e50b8da09610b3245692f42b87fa7360d2282e | Python | mumtazcem/Amazon-meta-graph | /main.py | UTF-8 | 12,470 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import networkx as nx
import plot_creator as pv
import networkx.algorithms.community as nx_comm
import random
import time
# Seed value for betweenness centrality and for random choices
seed = 900
# Most Crowded Modules would be saved to..
g1_modules_file = "most_crowded_modules/... | true |
0c1724d19fc377d20511d6f3292fa96459cdb276 | Python | haha1808656980/study_data | /python基础用法/dir方法和getattr.py | UTF-8 | 221 | 3.703125 | 4 | [] | no_license | '''
dir方法和getattr的使用
'''
from datetime import datetime
print(dir(datetime)) #把对象的方法和属性全部打印出来
print('*'*50)
print(getattr(datetime,'ctime')) #获取对象的属性
| true |
9d0bc48947a332e9ef38fdbac4c527b1a30c03c3 | Python | vipulshah31120/PythonDataStructures | /OccurInSortedArray.py | UTF-8 | 326 | 3.765625 | 4 | [] | no_license | def occurrence(arr, n, x) :
res = 0
for i in range(n) : # Returns number of times x
if x == arr[i] : # occurs in arr[0..n-1]
res += 1
return res
arr = [1, 2, 2, 2, 2, 3, 4, 2 ,8 ,8]
n = len(arr)
x = 2
print(occurrence(arr, n... | true |
9a8169deca1cd26e5d116f0f5b50568a68546c2f | Python | shahrukh00789/PythonBasics | /tryExceptionalHandling.py | UTF-8 | 215 | 3.96875 | 4 | [] | no_license | print("Enter Number 1")
num1 = input()
print("Enter Number 2")
num2 = input()
try:
print("The sum of two numbers are ",int(num1)+int(num2))
except Exception as e:
print(e)
print("This is Important number")
| true |
26b62c68807a86477ed286c4edf97129ab1ee10f | Python | JoDongHyuen/AI-Study | /정보전산원 수업/Sklearn/Reg/boston_linear.py | UTF-8 | 1,215 | 3.53125 | 4 | [] | no_license | # --------------------------------------
# 보스턴 집값 데이터
# --------------------------------------
# 모듈 로딩 ----------------------------------------------
from sklearn import model_selection
from sklearn.linear_model import LinearRegression
from sklearn import metrics
from sklearn import datasets
import matplotlib.pyplot a... | true |
d57418a4b33fe0c261af4a31dcd70eaa040374f7 | Python | Aasthaengg/IBMdataset | /Python_codes/p03609/s093221150.py | UTF-8 | 79 | 3.28125 | 3 | [] | no_license | a,b=map(int, input().split())
if a < b:
print(0)
if a >= b:
print(a-b) | true |
ca7d66ff83a4d54ff376c625b2e6e1085fc3f1de | Python | trinhgliedt/Algo_Practice | /2020_11_20_parens_valid.py | UTF-8 | 677 | 4.5625 | 5 | [] | no_license | # Page 67 Algo:
# Parens Valid
# Create a function that, given an input string,
# returns a boolean whether parentheses in that
# string are valid. Given input "y(3(p)p(3)r)s" ,
# return true. Given "n(0(p)3" , return false .
# Given "n)0(t(0)k" , return false .
def parensValid(str):
count = 0
for i, v in enume... | true |
dc888975e4227c21f67b4899b0f76e5c228052f3 | Python | guerrerobertrand/python | /tests/searchAndReplaceFiles.py | UTF-8 | 1,069 | 3.140625 | 3 | [] | no_license | '''
Created on 19 mai 2015
@author: Bertrand
'''
import fileinput
import sys, os
if __name__ == '__main__':
print("Search and Replace on multiple files")
# The top argument for walk
topdir = "C:\\Users\\Bertrand\\Desktop\\stage\\"
# The extension to search for
exten = ".txt"
... | true |
2559a736ffab93a4b421a178529d73d54fe1160e | Python | jennifersong/dailyprogrammer | /easy/115-guessthatnumbergame.py | UTF-8 | 988 | 3.96875 | 4 | [] | no_license | #####################################################################
#
# ORIGINAL PROBLEM:
# Write a program that prompts the user to guess a randomly
# chosen integer between 1 and 100, inclusive.
#
# For more information, see the original prompt at
# http://www.reddit.com/r/dailyprogr... | true |
fae5053bf7d98068ce8301b2d55c4053b346f542 | Python | steadily-worked/July | /DataScience/silicon_valley.py | UTF-8 | 420 | 2.75 | 3 | [] | no_license | %matplotlib inline
import pandas as pd
df = pd.read_csv('data/silicon_valley_summary.csv')
boolean1 = df['gender'] == 'Male'
boolean2 = df['job_category'] == 'Managers'
boolean3 = df['race_ethnicity'] != 'All'
df[boolean1 & boolean2 & boolean3].plot(kind='bar', x='race_ethnicity', y='count')
#실리콘 밸리에서 일하는 남자 관리자(Mana... | true |
c43896293aa6adf4ce774bc96e1f209b98972e3d | Python | ZazAndres/Ejercicios_Taller_Lab24 | /punto5.py | UTF-8 | 574 | 3.859375 | 4 | [] | no_license | from typing import Sized
cond="si"
def frecuencia(numero,digito):
cantidad=0
while numero !=0:
ultDigito=numero%10
if ultDigito==digito:
cantidad+=1
numero=numero//10
return cantidad
while cond=="si":
num=int(input("ingrese un numero: "))
un_digito... | true |
754870964b41aa1001bcb37afe6c57fee68d4935 | Python | Fabritsi/Python-labs | /Python-labs/-5/Завдання 3.py | UTF-8 | 432 | 3.78125 | 4 | [] | no_license | x=float(input("Введіть змінну x="))
e=float(input("Введіть точність е="))
import math
d=x
n=2
while math.fabs(1-(x**2/((n-1)**2)*(math.pi**2)))>e:
d*=(1-(x**2/((n-1)**2)*(math.pi**2)))
n+=1
print("Добуток:{0}".format(d))
if math.sin(x)-d<e:
print("Рівність справедлива d=sin(x)")
else:
print... | true |
7b19d18fef02443a6eb5979d62d471f8ca0f06c4 | Python | adi0808/setuproject | /Security/hashing.py | UTF-8 | 443 | 3.34375 | 3 | [] | no_license | import hashlib
# Hashing class and methods
class Hashing:
def hash(self, info, format):
hashing_type = get_hashing_format(format)
return hashing_type(info)
def get_hashing_format(format):
if format == 'sha1':
return _sha1_hashing
else:
return ValueError
... | true |
5d44d7fa7a1064c3613c5ee89665bc915883b329 | Python | psavery/hexrdgui | /hexrd/ui/image_file_manager.py | UTF-8 | 4,789 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import os
import tempfile
import yaml
from PySide2.QtWidgets import QMessageBox
from hexrd import imageseries
from hexrd.ui.hexrd_config import HexrdConfig
from hexrd.ui.load_hdf5_dialog import LoadHDF5Dialog
class Singleton(type):
_instance = None
def __call__(cls, *args, **kwargs):
if cls._inst... | true |
1c3b85d3a6c083520df8c95a3f8e20ca68788354 | Python | kingwersen/CS-178-Project | /Classifiers/AClassifier.py | UTF-8 | 1,749 | 3.546875 | 4 | [] | no_license | import numpy as np
class AClassifier:
"""
Abstract Classifier Type. Supports Training and Predicting.
"""
def __init__(self):
self.alpha = 1
self.classes = np.zeros(0)
def train(self, x: np.array, y: np.array, classes: np.array=None) -> None:
"""
Train the classif... | true |
82e117ae8eb1fb452ddd2091c9b42289d2b9f49f | Python | goodsoulkor/python3_fastcampus | /section04-4.py | UTF-8 | 1,016 | 4.5 | 4 | [] | no_license | # section04-4
# 딕셔너리, 집합 자료형
# 딕셔너리(Dict) : 순서 X, 중복 X, 수정 O, 삭제 O
# Key, Value
# 선언
a = {'name': 'Kim', 'Phone': '010-1111-2222', 'birth': 800612}
b = {0: 'Hello Python', 1: 'Hello Coding'}
c = {'arr': [1, 2, 3, 4, 5]}
print(type(a))
# 출력
print(a['name'])
print(a.get('name1'))
print(c['arr'][1:2])
# 딕셔너리 추가
a['ad... | true |
7d9d66b2c46331d30b45216e1e1c31b45f806cf9 | Python | mrdrozdov/pubmed-demo | /examples/tfidf.py | UTF-8 | 3,736 | 3.0625 | 3 | [] | no_license | """
The scikit-learn tfidf tool removes stop words by default. The list of stop words is here:
https://github.com/scikit-learn/scikit-learn/blob/b194674c42d54b26137a456c510c5fdba1ba23e0/sklearn/feature_extraction/_stop_words.py
"""
import os
import collections
import numpy as np
from sklearn.feature_extraction.text im... | true |
e756034e9b18d2fed3c1ef3da52a222c0d497f72 | Python | Sreelakshmi393/learn.py | /weight_converter.py | UTF-8 | 286 | 4.375 | 4 | [] | no_license | weight = int(input("Enter your weight : "))
unit = input("Unit in which you entered the weight [(L)bs or (K)g ]: ")
if unit.upper() == "L":
converted = weight*0.45
print(f"You are {converted} kilograms")
else:
converted = weight/0.45
print(f"You are {converted} pounds") | true |
3116808fe6a4b2a445f6a9272ab7c7de20f5a34a | Python | grimario-andre/Python | /exercicios/desafio3.py | UTF-8 | 132 | 3.828125 | 4 | [
"MIT"
] | permissive | num1 = int(input('Primeiro número'))
num2 = int(input('segundo número'))
print('A soma dos números é, {}.'.format(num1+num2))
| true |
5c0e91888f0d3ec8266f1866a2a299b19a37a739 | Python | qvpiotr/ASD | /Dynamic and greedy/6_1_oil_station.py | UTF-8 | 1,753 | 3.71875 | 4 | [] | no_license | # Zadanie 1. (problem stacji benzynowych) Pewien podróznik chce przebyc trase z punktu A do punktu
# B. Niestety jego samochód spala dokładnie jeden litr paliwa na jeden kilometr trasy (mozna powiedziec, ze
# jedzie czołgiem... znaczenie punktów A i B w ramach obecnej sytuacji geopolitycznej wybierzcie sobie sami).
# W... | true |
fe319c7d5992dc87c22f27d67648de0f8bed7b6c | Python | sudhamshrama/Adventure-game | /Desktop/adv_game.py | UTF-8 | 2,579 | 4.375 | 4 | [] | no_license | import time
import random
def print_pause(message, wait_time):
print(message)
time.sleep(wait_time)
def start():
print_pause("Help John to reach his home, which is 3 streets away.", 1)
print_pause("Its late night,John should reach his home asap!", 1)
print_pause("John is walking on the road alon... | true |
17338ad80515a4a9d47b8b8dee85223ac624b48a | Python | theoneandnoely/FYP_15144798 | /FYP/PlayerAgent.py | UTF-8 | 13,278 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 23 13:40:31 2020
@author: Noel
"""
from mesa import Agent
import numpy as np
class PlayerAgent(Agent):
def __init__(self, unique_id, model, goalkeeper = False, possession = False):
super().__init__(unique_id, model)
if (unique_id % 2 =... | true |
ab27b6ad8591f4fada51089c11783205c2c60579 | Python | abjose/surfsim3 | /old_tests.py | UTF-8 | 16,711 | 2.875 | 3 | [] | no_license |
from rule import Constraint as C, ExecStep as E
import random
#from node import Node
from context import Context
import matplotlib.pyplot as plt
import numpy as np
""" NOTES
TODO: put useful Es and Cs into a file somewhere
maybe make them into functions so you can modify their insides :O
NOTE: Problem that... | true |
b093df8b8410d21eaae63bb65a6e81b2afcb7e52 | Python | Williamdayu/PythonCodeLibrary | /sort/HeapSort.py | UTF-8 | 1,224 | 3.6875 | 4 | [] | no_license | def swap(nums, i, j):
nums[i], nums[j] = nums[j], nums[i]
def sift_up(nums, i, comp):
# assert nums[1:i] is a heap
while i != 1:
if comp(nums[i], nums[i/2]):
swap(nums, i, i / 2)
i /= 2
else:
break
def sift_down(nums, i, comp):
# assert heap[1:i] i... | true |
4ad7a97226d183511726d45a590113096b6e991a | Python | annagriffin/LEGpOe | /limit_finder_edges.py | UTF-8 | 1,524 | 2.671875 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
def nothing(x):
pass
def main():
cap = cv2.VideoCapture(1)
window_name = 'color range parameter'
cv2.namedWindow(window_name)
cb = cv2.imread('lamb.jpg')
cv2.createTrackbar('min', window_name, 0,500, nothing)
cv2.creat... | true |
32e27e70590c60639e5244a12f84bd8d90035fe6 | Python | dietriro/int_agents_project | /scripts/Test.py | UTF-8 | 1,147 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
from numpy import (array, dot, arccos, clip, pi)
from numpy.linalg import norm
from Transformations import quat_to_euler, tf_world_to_robot
from tf.transformations import euler_from_quaternion
from threading import Thread, Lock
from SimulationEnvironment import SimulationEnvironment
import rospy
... | true |
1ee33629f97b77d69347854d83e7cb3268bfa0e7 | Python | ntomita/superres | /data.py | UTF-8 | 5,995 | 2.59375 | 3 | [] | no_license | import sys
from os.path import join, basename, exists
from os import makedirs, remove
import tarfile
import zipfile
from io import BytesIO
from six.moves.urllib.request import urlopen
from PIL import Image
from utils.utils import is_image, filename_wo_ext
def download_aplus(dest='dataset'):
""" Download BSDS300 a... | true |
775462f13674a4c7ddb388672e9ba3e9f4edd6e8 | Python | joeycarr/misc | /pfft | UTF-8 | 2,583 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import skimage
from scipy.fftpack import fft2, fftn, fftshift
from skimage.io import imread, imsave
from skimage import exposure
def parse_args():
ap = argparse.ArgumentParser(
description=... | true |
3c217567204b855679443e8739da55cea744142e | Python | bitsbuffer/Clustering | /process_santander_data.py | UTF-8 | 2,170 | 2.875 | 3 | [] | no_license | import argparse
import os
import pandas as pd
from sklearn.impute import SimpleImputer
from feature_engine.encoding import RareLabelEncoder, CountFrequencyEncoder
from feature_engine.imputation import CategoricalImputer
from sklearn.preprocessing import MinMaxScaler
from feature_engine.selection import (
DropFeatur... | true |
6386a60636c8cc1c27992eb6df28b795edd2083c | Python | sekei3/MatchingSubtitle | /MatchingSubTitle.py | UTF-8 | 1,593 | 2.921875 | 3 | [] | no_license | import os
from enum import Enum
import tkinter
from tkinter import filedialog
class VideoFileEnds(Enum):
AVI = '.avi'
MKV = '.mvk'
MP4 = '.mp4'
class SubtitleFileEnds(Enum):
SMI = '.smi'
SRT = '.srt'
def isVideoFile(filename):
for vdoEnd in VideoFileEnds:
if( filename.lower().endswith... | true |
da90410829f66f6168589165737cbc1f288b005e | Python | MoyTW/Zappy | /Python_Zappy/entity/tool/ToolHoloprojector.py | UTF-8 | 3,084 | 2.734375 | 3 | [] | no_license | __author__ = 'Travis Moy'
import Tool
import entity.actor.Actor as Actor
import entity.actor.effects.EffectDeath as EffectDeath
import warnings
import level.commands.CompoundCmd as cmpd
from level.commands.command_fragments import LevelPlaceAndAssignEntityID
# How does the holoprojector work?
# We will need to chang... | true |
548b904a5c8ac1f888b9bcb8d908f19a76c99ff4 | Python | saumya470/python_assignments | /.vscode/Polymorphism/Plusoperator.py | UTF-8 | 150 | 4.03125 | 4 | [] | no_license | # + operator is overloaded and polymorphic
x,y = 10,20
print(x+y)
s1='Hello'
s2=' How are you'
print(s1+s2)
l1= [1,2,3,4]
l2 = [4, 5,6,7,8]
print(l1+l2) | true |
3f2765f203341af362fc351af4da4557b5dbb1e6 | Python | engelmi/pyoddgen | /pyoddgen/manager.py | UTF-8 | 1,793 | 2.859375 | 3 | [
"MIT"
] | permissive | from pyoddgen.tools.directory import import_on_runtime
from pyoddgen.config import ProjectConfiguration, GeneratorConfiguration
class GeneratorManager(object):
def __init__(self, project_config):
if not isinstance(project_config, ProjectConfiguration):
raise Exception("Configuration of projec... | true |
395065bc87b67d5da3a225bfff56127d20a94570 | Python | jong1-alt/Lin | /demo76.py | UTF-8 | 584 | 3.21875 | 3 | [] | no_license | def variable_key_value_function(fix, **kwargs):
print(f'fix part={fix}')
for k, v in kwargs.items():
print(f"parameter name={k}, value={v}")
variable_key_value_function("parameter alone")
variable_key_value_function('POOP',name='python programming' )
variable_key_value_function('POOP',name='python pro... | true |
b2b544d19af6125534200095519ed9f3854cfae7 | Python | liggettla/FERMI | /paperGeneration/baseChangeAnalysis | UTF-8 | 17,568 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
def runArgparse():
print('Reading Argparse...')
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--inFiles', '-i', type=str, nargs='*', help='Specifies the input vcf file(s).')
parser.add_argument('--inDir', '-d', type=str, help='Points to the input dire... | true |
24bfbc6a728e1ba65b95535441cca33fe27c9ab9 | Python | rheidenreich139/Heidenreich_Rebecca | /Heidenreich_Rebecca_Question5.py | UTF-8 | 1,268 | 3.09375 | 3 | [] | no_license | #Question 5. Create a geodatabase. Then, using the following list, generate feature classes for each of the
#elements in the list: featureList = [‘CapitalCities’, ‘Landmarks’, ‘HistoricPlaces’, ‘StateNames’, ‘Nationalities’,‘Rivers’]
import arcpy
out_folder_path = r"C:\gisclass\GIS610_Exercise3"
out_name = "exerc... | true |
8b3dcce11560042136265ec8ba6328547352d77e | Python | AleksandrMedvedev9000/pythonForTesters | /tests/test_new_group.py | UTF-8 | 867 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from model.group import Group
def test_new_group(app):
old_groups = app.group.get_group_list()
group = Group(table_name="Preved!", table_header="Bonjour!", table_footer="Zdarova!")
app.group.create_new(group)
new_groups = app.group.get_group_list()
assert len(old_groups) + ... | true |
4a6ac6c5e7c55226e8ff6752c77a0ac5eb42f08f | Python | hyc121110/ucrcs172_ps2 | /main.py | UTF-8 | 609 | 2.96875 | 3 | [] | no_license | # client for user to type query
# requirements: support for complex queries using VSM
import vsm
import create_index
# prompt user for a term
print("Please enter a query: ", end="")
query = input()
new_query = []
# preprocess query
for q in query.split():
q = vsm.word_preprocessing(q)
if q:
new_query.append(... | true |
37f8e2f61427632b95ca551053ecdb612cc9c9c6 | Python | OnewayYoun/studygroup-for-codingTest | /05주차/2번(박유나).py | UTF-8 | 768 | 3.28125 | 3 | [] | no_license | N,e,w,s,n = map(int, input().split()) #이동거리, 동, 서, 남, 북 분리하기
HR=100
ewsn = [e/HR,w/HR,s/HR,n/HR] #각각의 확률을 100으로 나누기
visited = [[0 for i in range(N*2)] for ii in range(N*2)]
dx, dy = [1,-1,0,0], [0,0,-1,1] #상,하,좌,우
def dfs(count, x, y):
if count==N: #N만큼 이동했다면, 그만
return 1
visited[x][y] = 1 #방문 표시하기
... | true |
dde80113ff554941ab5442afb5083108ad2998a9 | Python | mooonpark/code | /python/system-program/thread/06-锁.py | UTF-8 | 473 | 2.859375 | 3 | [] | no_license | import threading
import time
g_num = 0
def work1():
global g_num
mutex.acquire()
for i in range(1000000):
g_num += 1
#mutex.release()
print("work1 g_num:%s" %g_num)
def work2():
global g_num
mutex.acquire()
for i in range(1000000):
g_num += 1
mutex.release()
print("work2 g_num:%s" %g_num)
mutex = thr... | true |
50954e6c404c6e33a27b99ccc379307fddd423e4 | Python | suizo12/hs17-bkuehnis | /source/game_data/dataexport/dataexport.py | UTF-8 | 3,751 | 2.65625 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
import pandas as pd
from game_data.gamescore import basketballgame
from game_data.dataexport.dataframe_helper import remove_temporary_colums, get_results
import glob
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn.ensemble import RandomF... | true |
b0d944e1b0da6fb19dfe9d79b7b548c19292ce90 | Python | CaptainJRoy/Partition-Space-Monitor | /monSpace.py | UTF-8 | 6,579 | 2.71875 | 3 | [] | no_license | import netsnmp, thread, time
import curses
SESSION = 0
hrPartitionLabel = 0
prev_pct = {}
DICT = {}
REFRESH_TIME = 5
EXIT = False
def init_session():
"""
This function initializes the session that will be used to execute snmp
commands and the list from which it start the iteration of every partition,... | true |
7a155be63fe79240baa7e15ca768c6ba1afa9aad | Python | Luiz6ustav0/verlab | /learningResources/computerVision/OpenCvPlaylist/canny_edge_detection.py | UTF-8 | 578 | 3.078125 | 3 | [] | no_license | """
This algorithm can be broken down, basically, in 5 steps:
1. Noise reduction
2. Gradient calculation
3. Non-maximum suppression
4. Double threshold
5. Edge Tracking by Hysteresis
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread("jp.png", 0)
canny = cv2.... | true |
65c38bf6e2819576949c5b79c2ac0ef06546881e | Python | ynonp/python-for-kids | /pong/pong.py | UTF-8 | 626 | 3.296875 | 3 | [] | no_license | from p5 import *
left_bar_y = 0
ball_x = 100
ball_y = 100
ball_dx = 4
ball_dy = 2
def setup():
size(640, 480)
def draw():
global ball_x, ball_y, ball_dx, ball_dy, left_bar_y
background(150, 150, 150)
if ball_x > 640:
ball_dx = -4
if ball_x < 0:
ball_dx = 4
if ball_y > 480:
... | true |
090962fc0275d14c9ee9889eb0bd5f445497c8cb | Python | Gangadharbhuvan/HackerRank-Python-Solutions | /12-Alphabet_Rangoli.py | UTF-8 | 652 | 3 | 3 | [] | no_license | def print_rangoli(size):
# your code goes here
l = "".join(list(map(chr, range(97, 123))) )
k=size-1
for i in range(2*size-1):
if(i<size):
s="-".join(l[k+i:k:-1]+l[k:k+i+1])
print(s.center(4*size-3,'-'))
k=k-1
if(i==size):
j=(2*size-2)%i
... | true |
f9ab5ff15b5a866665d3e8ac069c6384321535f3 | Python | iliasmezzine/QFML | /LSTM | UTF-8 | 6,148 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#Rolling PCA + All preprocessing functions.
import os
import pandas as pd
import numpy as np
from numpy import concatenate
from sklearn.decomposition import PCA
from sklearn.metrics import mean_squared_error
from tensorflow.keras.models import Sequential
from tensorflow.k... | true |
52d16c09e4dd5b154992d226c00577dd7e03c64d | Python | yezhizhen/Python | /Jump2_gr.py | UTF-8 | 581 | 3.34375 | 3 | [] | no_license | class Solution(object):
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# you want to jump now
step,near,far = 0,0,1
# far represents [far-1] elements you can reach
while far < len(nums):
#next_far = max(i+j for i,j in zip(... | true |
3ab9fd25c2269b68e0d9f8e56112189e911ff697 | Python | tregtatyana/Homework-2 | /HW2.py | UTF-8 | 3,102 | 2.765625 | 3 | [] | no_license | import xml.dom.minidom
import sys
import csv
import time
from matrixops import algorithm_Fl_Warh
def resist(inp, outp):
dom = xml.dom.minidom.parse(inp)
dom.normalize()
# перейдем к schematics
node = dom.childNodes[0]
fl = 1
u = v = t = t_inv = n = -7
d = []
k_nonet = 0
for k in nod... | true |
74ecc4f31b6682111906ff76241612e73497437f | Python | prestonmlangford/sheets | /parse.py | UTF-8 | 2,535 | 2.828125 | 3 | [] | no_license | import lex
from error import CompileError, TokenError
import pysound
from pysound import add
import numpy as np
def compile(instrument,sheet):
# defaults
volume = 100
tempo = 120/60 # beats per second
beats_per_whole = 4 # beats in 4/4 time
beats_per_measure = 4 # beats in 4/4 time
octave... | true |
2698972de1aeac8f50f8ecd17cdde5d8e6bfdcea | Python | rohanmittal149/Python_Examples | /Rock_paper_scissors.py | UTF-8 | 1,177 | 3.90625 | 4 | [] | no_license | import random
my_computer = ['rock','paper','scissors']
print("***Rock Paper Scissors***")
i = int(input("Enter number of turns: "))
j = 0
k = 0
while i>0:
computer = random.choice(my_computer)
player = input("Player turn... ").lower()
print("computer selected " + computer)
if computer ... | true |
df008a9f039def15549645c196cba865973cb87d | Python | MohammedSharaki/hackerrank-python-solutions | /08-List-Comprehensions.py | UTF-8 | 276 | 2.90625 | 3 | [] | no_license | if __name__ == '__main__':
X = int (input())
Y = int (input())
Z = int (input())
n = int (input())
X += 1
Y += 1
Z += 1
temp_list = [[x, y, z]for x in range(X) for y in range(Y) for z in range(Z) if z +x +y !=n]
print(temp_list)
| true |
2ea1e482cced47fc3285893e57a5df7359059a06 | Python | Zoli1212/python | /09-turtle.py | UTF-8 | 314 | 3.234375 | 3 | [] | no_license | import turtle
ablak = turtle.Screen()
ablak.title('Teknocok')
Sanyi = turtle.Turtle()
Sanyi.color('blue')
Sanyi.pensize(4)
Sanyi.forward(100)
Sanyi.left(70)
Sanyi.forward(150)
Mari = turtle.Turtle()
Mari.color('pink')
Mari.pensize(2)
Mari.speed(1)
Mari.right(315)
Mari.forward(150*2**0.5)
ablak.mainloop()
| true |
8946934b676a466d613c30ba64e4524930c2fad8 | Python | ayser259/delphi | /leave_one_out.py | UTF-8 | 1,824 | 2.921875 | 3 | [] | no_license | from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score,train_test_split, LeaveOneOut
from sklearn.metrics import accuracy_score
import pandas as pd
import numpy as np
from data_load import get_encoded_data, get_clean_data, get_one_hot_en... | true |
22114ac1efe7b71db8e9ac02169ebc8f19936209 | Python | PratikBali/python-learning | /asgn/a03/a3q1.py | UTF-8 | 315 | 3.625 | 4 | [] | no_license | arr = list()
def fun():
sum1 = 0
n = input('How many Number do you want to enter: ')
for i in range(0,int(n)):
no = input('Num: ')
sum1 = sum1 + no
arr.append(int(no))
return sum1
ret = fun()
print('Your Elements: ', arr)
print('Addition of all your elements are: ', ret) | true |
3dff77906da52fa1ca0065f034e29b23bdd1817f | Python | dereklarson/MontyHall | /montyhall.py | UTF-8 | 8,358 | 3.328125 | 3 | [
"MIT"
] | permissive | import numpy as np
import copy
import pprint
from collections import defaultdict
class Game:
def __init__(self, rng=None, n_doors=3, n_goats=2, max_doors=None, verbose=0):
"""Configure and initialize the game
rng: our random number generator, the numpy default is quite good (PCG64)
n_doors... | true |
a66f1b1ce2de93e288db05f43fb23cdd9623c38f | Python | facebookresearch/DomainBed | /domainbed/lib/misc.py | UTF-8 | 16,138 | 2.65625 | 3 | [
"MIT"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Things that don't belong anywhere else
"""
import math
import hashlib
import sys
from collections import OrderedDict
from numbers import Number
import operator
import numpy as np
import torch
from collections import Counter
from itertools imp... | true |
8d9cfe2aa7c7fe73593322de90fd48d4d9aa86f0 | Python | Fiinall/UdemyPythonCourse | /Embaded Functions/booleanPrime.py | UTF-8 | 336 | 3.515625 | 4 | [] | no_license | from math import floor
def prime(a):
if (a == 0):
raise ValueError("0 is neither prime, nor composite number")
if ( a == 1 or a == 2 or a == 3):
return True
i = 2
while (i<=a**0.5):
if (a%i == 0):
return False
elif (i == floor(a**0.5)):
return True... | true |
293eba3edaf5467da0758bf37b406a6483bf064a | Python | CogComp/nmn-drop | /utils/spacyutils.py | UTF-8 | 6,588 | 2.65625 | 3 | [] | no_license | import json
import spacy
from typing import List, Tuple
from spacy.tokens import Doc, Span, Token
from utils import util
class WhitespaceTokenizer(object):
def __init__(self, vocab):
self.vocab = vocab
def __call__(self, text):
words = text.split(" ")
# All tokens 'own' a subsequent s... | true |
cfb8708973247985bb7f1bfe99a32ca6dea10096 | Python | leti-olabarri/euro-2020 | /front/pages/players.py | UTF-8 | 5,011 | 2.625 | 3 | [] | no_license | import streamlit as st
from api import find_players
def players():
st.title("Players")
st.markdown("Ancelotti, face it. Kylian Mbappé is not coming this year. Modric is the best, but he is 35 years old. Marcelo is not in shape. And Bale... please, don't make me talk about Bale")
st.markdown("Here is a t... | true |
94b91be5908cf008e415214564b2327fc23c7e61 | Python | TheMagicalPlace/Procedural-Generation-and-Pathfinding | /AstarPathfinding.py | UTF-8 | 5,952 | 3.265625 | 3 | [] | no_license |
# from https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2
import matplotlib.pyplot as plt
import numpy as np
import random,copy,time
from itertools import chain
from AnimatedPlotMods import liveplot
class Node():
"""A node class for A* Pathfinding"""
def __init__(self, parent=Non... | true |
2e413e22d36118fdae3b2f538a1691e5e27a9250 | Python | YunyLee/BaekJoon | /그 외/2309_일곱난쟁이.py | UTF-8 | 469 | 3.21875 | 3 | [] | no_license | import sys
sys.stdin = open('input_2309.txt', 'r')
N = []
for i in range(9):
temp = int(input())
N.append(temp)
N = sorted(N) # 정렬하기
total_sum = sum(N)
sumV = 100
goal = total_sum - sumV # 여기서는 40
remove1 = 0
remove2 = 0
for i in range(len(N)):
for j in range(len(N)):
if N[i] + N[j] == goal:
... | true |
28cc62a69dbfa17610aa1e00b878b2e691b1fe4a | Python | funrollloops/halting | /tmoney1.py | UTF-8 | 1,405 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
import random
import sys
from player_common import State, PlayerResponse, run_player
rank_to_distance = {
0: 0,
2: 3,
3: 5,
4: 7,
5: 9,
6: 11,
7: 13,
8: 11,
9: 9,
10: 7,
11: 5,
12: 3,
}
INITIAL_GOAL = sum(rank_to_distance.values())
def goal_remaining(state):
goal = ... | true |
46853322ee080f6199f0ba1d703024b678e83565 | Python | sudhansom/python_sda | /python_fundamentals/11-oop/oop-exercise-01.py | UTF-8 | 918 | 4.03125 | 4 | [] | no_license | class Vehicles:
def __init__(self, name, price, types='ford', color='white'):
self.name = name
self.types = types
self.color = color
self.price = price
def describe(self):
return f"The name of the Vehicle is {self.name}, type is {self.types} of {self.color} and price {s... | true |
7c6c3711c3b533615479d1973e6c6b5e3bf34b11 | Python | hmgoforth/824proj | /inpainting/dataset.py | UTF-8 | 3,021 | 2.515625 | 3 | [] | no_license | import torch
from torch.utils.data import Dataset
from PIL import Image
import numpy as np
from skimage import io
import argparse
import matplotlib.pyplot as plt
import pickle
import time
import h5py
import utils
from pdb import set_trace as st
class DeepfashionInpaintingDataset(Dataset):
''''
Dataset for In... | true |
855202e21213aec3fa3062724b1111bb872445d4 | Python | liuiuge/LeetCodeSummary | /Findthedifference.py | UTF-8 | 274 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
class Solution:
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
ans = 0
for elem in s + t:
ans ^= ord(elem)
return chr(ans)
| true |
b4736d4b4cc4924630500e838fd50134872c3610 | Python | cetoli/kuarup | /poo09/kuarup/tribos/xavante/rede2.py | UTF-8 | 1,740 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
"""
:Author: Andre Abrantes
:Copyright: ©2009, `GPL <http://is.gd/3Udt>`
"""
from visual import *
from peixe_xavante import *
def init_window ():
scene.title = "Rede"
scene.width = 300 + 9
scene.height = 300 + 30
scene.autocenter = 1
scene.autoscale = 1
#s... | true |
bfa447668e33d499712593a506d776c8abecb26a | Python | akshathamanju/Problems | /Trees/Binary tree/6. Two_Binary Trees are identical.py | UTF-8 | 1,570 | 4.34375 | 4 | [] | no_license | class Node:
def __init__(self, d):
self.data = d
self.left = None
self.right = None
# function to convert sorted array to a
# balanced BST
# input : sorted array of integers
# output: root node of balanced BST
def sortedArrayToBST(arr):
if not arr:
return None
... | true |
2066ebd83cd0b580ca5230585418997c10f11f47 | Python | GoldenSimba97/Alignment_in_Chatbots | /Measure_tests/test_formality.py | UTF-8 | 8,560 | 2.5625 | 3 | [] | no_license | # Need to download nltk before pos tagger can be used
# nltk.download()
# nltk.download('punkt')
# nltk.download('averaged_perceptron_tagger')
# nltk.download('maxent_treebank_pos_tagger')
import nltk
import pandas as pd
from heapq import nlargest
from heapq import nsmallest
from sklearn import model_selection
from sk... | true |
722429bb18bd66ff9fa6a9d8931875500a5a19ac | Python | stepansergeevitch/legit_elections | /client.py | UTF-8 | 3,310 | 3.046875 | 3 | [] | no_license | import socket
from cryptosystem.encryption import Encryptor
class Client:
KEY_REQUEST = b"KEY\n"
DATA_REQUEST = b"DATA\n"
NAMES_REQUEST = b"NAMES\n"
SUCCESS = b"SUCCESS\n"
ERROR = b"ERROR\n"
def __init__(self, server_ip="127.0.0.1", server_port=9999):
self.server_ip = server_ip
... | true |
c549bb66a30d2f859e594d39715a3103d959d15f | Python | ronknighton/DoctorApiOrm | /validation_helpers.py | UTF-8 | 3,622 | 2.578125 | 3 | [] | no_license | import re
from validate_email import validate_email
import uuid
import hashlib
def is_npi_good(code):
if code is None:
return False
if len(code) != 10 or not code.isdigit():
return False
else:
return True
def is_postal_code_good(code):
if code is None:
... | true |
3ae6ca6a5ebdd9285d2c66787c74bcfe1c74e35f | Python | hitochan777/kata | /atcoder/abc200/D.py | UTF-8 | 510 | 2.75 | 3 | [] | no_license | from collections import defaultdict
N = int(input())
A = list(int(x) for x in input().split())
n = min(N, 8)
lists = defaultdict(list)
for i in range(1<<n):
total = 0
seq = []
for j in range(n):
if (i >> j) & 1 == 1:
seq.append(j+1)
total += A[j]
total %= 200
if len(lists[total]... | true |
0dde86eddf7483de75595faf107151a0088e68e7 | Python | ThaisGuerini/Python | /Exercícios_aula_18.py | UTF-8 | 3,107 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 12:17:05 2018
@author: thais
"""
class MeuTempo0 :
# Métodos previamente definidos aqui ...
def __init__ ( self , hrs = 0 , mins = 0 , segs = 0 ):
""" Criar um novo objeto MeuTempo inicializado para hrs, min, segs.
Os valor... | true |
7d65924010aaff4843383279b80f4d93f2bf26fd | Python | lht960/segmentation | /submit.py | UTF-8 | 3,863 | 2.59375 | 3 | [] | no_license | import csv
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
# % matplotlib inline
from scipy import ndimage
from skimage import morphology
from skimage.measure import regionprops, label
from inputs import _banish_darkness
def localization(x, y):
"""Simple post-processing and get IVDs pos... | true |
88c8da318dd3cb048d23dfa7ad6c9d9e18ff22bf | Python | marcosdotps/dagda | /dagda/cli/command/monitor_cli_parser.py | UTF-8 | 2,269 | 2.796875 | 3 | [] | no_license | import argparse
import sys
from log.dagda_logger import DagdaLogger
class MonitorCLIParser:
# -- Public methods
# MonitorCLIParser Constructor
def __init__(self):
super(MonitorCLIParser, self).__init__()
self.parser = DagdaMonitorParser(prog='dagda.py monitor', usage=monitor_parser_text)... | true |
80316490b15e60cd36efa363e50949e5fee1f0f8 | Python | ellinx/LC-python | /MinimumAreaRectangle.py | UTF-8 | 1,077 | 3.609375 | 4 | [] | no_license | """
Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points,
with sides parallel to the x and y axes.
If there isn't any rectangle, return 0.
Example 1:
Input: [[1,1],[1,3],[3,1],[3,3],[2,2]]
Output: 4
Example 2:
Input: [[1,1],[1,3],[3,1],[3,3],[4,1],[4,3]]
Output: ... | true |
d66ac2a437033a46ef630a06c4a779d285f33a48 | Python | MilesDavid/OKAS | /fib.py | UTF-8 | 934 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import decimal
import numpy as np
def fib(N):
if N <= 0:
return
elif N <= 2:
return 1
fn = fn1 = 1
for i in range(2, N):
tmp = fn1
fn1 += fn
fn = tmp
return fn1
def fib_matrix(N):
if N <= 0:
retu... | true |
aa09b20d5ee9fe655d45cb278691c31e53e58e9d | Python | rmassoth/pokedex-plus | /tests/test_pokedex.py | UTF-8 | 972 | 3.140625 | 3 | [
"MIT"
] | permissive | from pokedex import pokedex
char = pokedex.get_pokemon('charmander')
bulb = pokedex.get_pokemon('bulbasaur')
squirt = pokedex.get_pokemon('squirtle')
pikachu = pokedex.get_pokemon('pikachu')
snover = pokedex.get_pokemon('snover')
my_pokemon = [char, bulb, squirt, pikachu]
def test_get_best_pokemon_mine_is_stronger():... | true |
8caa395aceb0426dc305c8764936d9d270328232 | Python | john-mpelkas/Simple-Perceptron | /Perceptron.py | UTF-8 | 709 | 3.1875 | 3 | [] | no_license | import numpy as np
import math
#Activation function
def sign(n):
if n >= 0:
return 1
else:
return -1
class Perceptron():
def __init__(self):
seed = [-1, 1]
self.weights = [np.random.choice(seed), np.random.choice(seed)]
self.lr = 0.25
# Perceptron Guess
def gues... | true |
d8224e3a54f9c9bbb4599a04471211e999e17a5e | Python | s-good/AutoQC | /qctests/EN_increasing_depth_check.py | UTF-8 | 3,842 | 2.78125 | 3 | [
"MIT"
] | permissive | """
Implements the EN increasing depth check.
"""
from . import EN_spike_and_step_check
import numpy as np
from collections import Counter
import util.main as main
def test(p, parameters):
"""
Runs the quality control check on profile p and returns a numpy array
of quality control decisions with False whe... | true |
377908bbf9d8fd4685895dc5ad110e04423f707c | Python | jacobaek/whoisjacobaek | /hw1_1.py | UTF-8 | 245 | 3.53125 | 4 | [] | no_license | def if_function(a,b,c):
if(a==True):
return b
else:
return c
print(if_function(True, 2, 3))
print(if_function(False, 2, 3))
print(if_function(3==2, 3+2, 3-2))
print(if_function(3>2, 3+2, 3-2) ) | true |
872e6bf895f539baa15ad850a6c495543498c38f | Python | endy-imam/advent-of-code-2020 | /day01/day01.py | UTF-8 | 898 | 3.203125 | 3 | [] | no_license | import os
from utils import get_data, run, map_list
# INPUT SECTION
DIR_ROOT = os.path.dirname(__file__)
puzzle_input = map_list(int, get_data(DIR_ROOT).split())
# GLOBAL VALUES
SUM_TO_FIND = 2020
# MAIN FUNCTIONS
def part_one():
memo = set()
for num in puzzle_input:
num_to_find = SUM_TO_FIND - n... | true |
e8ebd7ae414f6fbf9325bc48bc5a6e1859c188a1 | Python | jonpemby/jobbr | /src/searcher.py | UTF-8 | 2,583 | 2.609375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import requests
from urllib.parse import quote_plus
from threading import Thread
from src.exceptions import MissingApiKeyError, MissingCxError, NoResultsError, ResponseError
from src.post import Post
class Searcher(Thread):
def __init__(self, query, params={}):
super().__init__()
self.current_que... | true |
acd0859cada3969d18c9c1f1dc20d83bc4fc9c61 | Python | mdmshf/codechef | /python/malvika.py | UTF-8 | 116 | 2.71875 | 3 | [] | no_license | for _ in range(int(input())):
n,m=input().split()
n,m=(int(n),int(m))
s=(n-1)+(m-1)*2
print(s)
| true |
704b730e30a0115ab2e79d74b37a5efe92fc7d7b | Python | johnbrussell/gtfs-traversal | /gtfs_traversal/data_munger.py | UTF-8 | 18,038 | 2.671875 | 3 | [] | no_license | from datetime import datetime, timedelta
class DataMunger:
def __init__(self, end_date, route_types_to_solve, stops_to_solve, data, stop_join_string):
self.data = data
self.stop_join_string = stop_join_string
self._buffered_analysis_end_time = None
self._end_date = end_date
... | true |
8ba1af90b1c4a9f30b947a5ae32948052aec406a | Python | Chaeguevara/21_1-SNU | /ManufactureAI/Hw2/xorEtoE.py | UTF-8 | 1,357 | 3.296875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def sigmoid(x):
return 1/(1+np.exp(-x))
def back_prop_w1(g, y, x1):
return (-2)*(g-y)*y*(1-y)*x1
def back_prop_w2(g, y, x2):
return (-2)*(g-y)*y*(1-y)*x2
def back_prop_theta(g, y):
return 2*(g-y)*y*(1-y)
def feedforward(x1, x2, w1, w2, theta):... | true |
3e1c626fa6e158c5cd0c6272a8126b7e3caa46fd | Python | eartheekapat/UNSW_ALGO_2 | /asst/2/q_4.py | UTF-8 | 117 | 3 | 3 | [] | no_license | A = [14, 1, 1, 1, 1, 1]
n = len(A)
left = n*(n-1)/2
right = sum(A)
print(left <= right)
print(left)
print(right)
| true |
8672894bd19dcc176d26377c2996aa508ee10254 | Python | biolab/baylor_dicty_paper | /PC1vsTime_plots.py | UTF-8 | 30,611 | 2.53125 | 3 | [] | no_license | print('Preparing PC1 vs time plots.')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing as pp
from sklearn.decomposition import PCA
from sklearn.model_selection import LeaveOneOut
import itertools
import matplotlib
from collections import defaultdict
import random... | true |
9ebac17bc5d1bf00bc15c84dea3f07b9b9f37379 | Python | spatankar276/FacebookLogIn | /facebook_auto_login.py | UTF-8 | 363 | 2.671875 | 3 | [] | no_license |
from selenium import webdriver
import time
browser = webdriver.Chrome()
browser.get('https://www.facebook.com/')
emailElem = browser.find_element_by_id('email')
emailElem.send_keys('Enter your email:')
passwordElem = browser.find_element_by_id('pass')
passwordElem.send_keys('Enter your password:')
login = brows... | true |
14281f5f8d1425ad347217d16182c804ffbcf275 | Python | vincentlal/DIMY | /dbf.py | UTF-8 | 5,919 | 2.859375 | 3 | [] | no_license | # Task 6 and 7
from CustomBloomFilter import CustomBloomFilter
from datetime import datetime, timedelta
import time
import threading
from QBF import QBF
from CBF import CBF
import requests
class DBF():
def __init__(self, startTime, endTime):
self._startTime = startTime
self._endTime = endTime
... | true |
bcd2503741b32e25a532fffbe657fc4c3298c043 | Python | anlar/prismriver-lyrics | /prismriver/plugin/alivelyrics.py | UTF-8 | 1,421 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class AliveLyricsPlugin(Plugin):
ID = 'alivelyrics'
def __init__(self, config):
super(AliveLyricsPlugin, self).__init__('AliveLyrics', config)
def search_song(self, artist, title):
to_delete = [' ', '.', ',', ... | true |
f93c4d06f42b13e95145d0bfd2ba81ae6f6d6417 | Python | EricMontague/MailChimp-Newsletter-Project | /server/tests/unit/flask_app/models/test_user.py | UTF-8 | 1,506 | 2.984375 | 3 | [] | no_license | """This module contains unit tests for the user model."""
from pytest import raises
from app.models import User
from unittest.mock import patch
@patch("app.models.user.generate_password_hash")
def test_setting_password(generate_password_mock):
"""Test that when the password is set,
a password hash is genera... | true |
21622897fc03b0a41d3d99c1fdcd7c936c93ac6b | Python | leylagcampos/Python | /Review_III.py | UTF-8 | 1,342 | 3.65625 | 4 | [] | no_license | #Review III
class Persona():
def __init__(self,nombre,pesokg,alturacm,edad,sexo):
self.peso=pesokg
self.altura=alturacm
self.edad=edad
self.__nombre=nombre
self.sexo=sexo
def Reporte(self):
print("hola ",self.__nombre," actualmente tienes ",self.edad ," años,mides ",self.altura," y pesas ",self.peso)
... | true |
6c4e3209622e554f4be2ca3db7ba660daf7bc1ee | Python | billkabb/learn_python | /MIT/w2l4.py | UTF-8 | 123 | 3.125 | 3 | [] | no_license | x=5
p=4
result=1
for turn in range(p):
print('iteration:'+str(turn)+'current result'+str(result))
result=result*x
| true |
05baae3e27c03383e053891bd283b9998b94f4f7 | Python | fidler3/Puzzle-Problems | /CH2 deletemiddle/deletemiddle.py | UTF-8 | 357 | 2.734375 | 3 | [] | no_license |
def deletemiddle(node):
by2 = node
by1 = node
first = True
while by2 != None:
if first:
first = False
by2 = by2.next
if(by2 == None):
by1.next = by1.next.next
else:
by2 = by2.next
else:
by2 = by2.next
if(by2 == None):
by1.next = by1.next.next
else:
by2 = by2.next
by1 =... | true |
922332ca9df6c20f713d016e3708192087983022 | Python | raczandras/szkriptnyelvek | /OM/4/listcomp.py | UTF-8 | 881 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python3
def main():
#1
inp = ['auto', 'villamos', 'metro']
eredmeny = [ s.upper() + '!' for s in inp]
print(eredmeny)
#2
inp = ['aladar', 'bela', 'cecil']
eredmeny = [ s.capitalize() for s in inp]
print(eredmeny)
#3
eredmeny = [ 0 for s in range(10)]
print(... | true |
962a429939bb83352f2e3553a413199749434c35 | Python | yilmazmuhammed/ITU-CE-Courses | /BIL103E - Intr. to Inf. Syst.&Comp. Eng./Course Files/OtherExamples/Bottle Forms/time6.py | UTF-8 | 924 | 2.65625 | 3 | [] | no_license | from bottle import route, run, request, static_file
from datetime import datetime
from pytz import timezone
def htmlify(text,title):
page = """
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>%(title)s</title>
</head>
... | true |
260709005251c8a38b1b634aeb9cf7a6529c7de8 | Python | btchope/electrumq | /use_conf.py | UTF-8 | 654 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'zhouqi'
import ConfigParser, os
config = ConfigParser.ConfigParser()
# config.readfp(open('defaults.cfg'))
# config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')])
config.add_section('Section1')
config.set('Section1', 'an_int', '15')
config.set('Section1', 'a_bool', 'tru... | true |
909ec4a55f5b4feb56be6bfacc6cb7828409a63c | Python | Silentsoul04/PythonCode | /Import/module/package.py | UTF-8 | 198 | 2.8125 | 3 | [] | no_license | from __future__ import print_function
class MyClass(object):
p = None
def __init__(self, p):
self._p = p
def __repr__(self):
return "MyClass.p = {}".format(self._p)
| true |