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 |
|---|---|---|---|---|---|---|---|---|---|---|
8b5a9f387ad9f5befff2a7091ee38c73b3cd73ad | vivienzou1/Hackerrank-10 | /Algorithm/Implementation/The Hurdle Race.py | UTF-8 | 214 | 2.578125 | 3 | [] | no_license |
import sys
n,k = raw_input().strip().split(' ')
n,k = [int(n),int(k)]
height = map(int, raw_input().strip().split(' '))
# your code goes here
if k>= max(height):
print "0"
else:
print abs(k-max(height))
| true |
becb00030e460d6b1e0302bdecd7d9a5e6579829 | alvin-chang/frankensteinprophet | /defs.py | UTF-8 | 5,106 | 2.78125 | 3 | [
"Unlicense"
] | permissive | def run_prophet(tickers,ticker,market_dfset,modelset,forecastset):
from fbprophet import Prophet
import numpy as np
import yfinance as yf
market_df = yf.Ticker(ticker).history(period="max",auto_adjust=True,prepost=True)
if len(market_df) == 0:
tickers.remove(ticker)
#return
#mar... | true |
efc4e4a856a62a4ef2533d65d7424222902d27bf | bjornwallner/ProQ_scripts | /bin/check_psiblast_matrix.py | UTF-8 | 4,531 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
# Written by Karolis Uziela in 2014
import sys
################################ Usage ################################
script_name = sys.argv[0]
usage_string = """
Description:
The script checks if the psiblast matrix file (.psi) does not contain all-zero matrix. If the matrix is all-zero, i... | true |
79e583044173a93a43283549711c93ad21f18330 | Nishi216/PYTHON-CODES | /CLASSES/static_var.py | UTF-8 | 795 | 4.34375 | 4 | [] | no_license | # to demonstrate the use of class variable or static variable
class Student:
stream = 'computer'
def __init__(self, name, roll):
self.name = name
self.roll = roll
stud1 = Student('ABC',12)
stud2 = Student('DEF',22)
#accessing class variable via object name
print(stud1.stream, stud... | true |
6f9bbc70d44667c7d6df4563d8f286bba4aa737e | YasmeeenBn/Face-detector-app | /Face_Detector_img.py | UTF-8 | 808 | 3.078125 | 3 | [] | no_license | import cv2
# pre trained data
#classifier is to classify smthg by face
trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
#choose img to detect face
#import img
img = cv2.imread('groupe.png')
#convert it to grey !
grayscaled_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#detect faces... | true |
29c31d16d4a5863de167c0c51a5cdea58294d983 | RevengeComing/shooter2dserver | /tests/game/test_player.py | UTF-8 | 440 | 3.171875 | 3 | [] | no_license | import math
from unittest import TestCase
from shooter2d.game.player import Player
class PlayerTestCase(TestCase):
def setUp(self):
self.player = Player(0, 0, "Sepehr")
def test_asd(self):
self.player.update()
self.player.move(
1*math.sin(45*math.pi/180),
1*mat... | true |
02fc796829437dc5372c3a4c7160f2bb247f5000 | darshind/bank_marketing | /run_script.py | UTF-8 | 384 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 2 20:56:37 2017
@author: sidpa
"""
import pandas as pd
import pickle
filename = 'model_v1.pk'
with open(filename ,'rb') as f:
loaded_model = pickle.load(f)
test_df = pd.read_csv('test_df.csv')
def get_prediction(loaded_model, test_df):
return loaded_model.predi... | true |
bcc76e4dbcc191e7912085cbb92c5b0ebd2b047b | thilakkbhaskar/mvc-flask-pymongo | /src/factory/database.py | UTF-8 | 1,970 | 2.671875 | 3 | [
"MIT"
] | permissive | from datetime import datetime
from pymongo import MongoClient
from bson import ObjectId
from config import config
class Database(object):
def __init__(self):
self.client = MongoClient(config['db']['url']) # configure db url
self.db = self.client[config['db']['name']] # configure db name
de... | true |
54445dfa428f99ad737d4b4aaf3f0c0ea66cb039 | Akshaynada/GraphsAndNetworkFlows | /Reinforcement and Inverse Reinforcement Learning/project3_zong.py | UTF-8 | 22,810 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#import libraries needed
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
reward_1 = np.zeros(shape=(10,10))
reward_2 = np.zeros(shape=(10,10))
reward_1[9,9] = 1
reward_2[1,4] = -100
reward_2[1,5] = -100
reward_2[1,6] = -100
reward_2[2,4] = -100
reward_2[... | true |
f206dc09e9e71973da11635ae06077811bb38ec7 | hbishop1/malmo-challenge | /samples/malmo/malmo_tabular_q.py | UTF-8 | 4,535 | 2.53125 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2017 Microsoft Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publis... | true |
73a5aaf4b8069b3d17a50d24b70d601e6bcb3452 | gutierrez310/proyectos-py | /fibonacci_iterativo.py | UTF-8 | 1,166 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 16:08:48 2020
@author: carlo
"""
# =============================================================================
# def ajam(okgood):
# okgood=
# cache=[1,0,0]
# fiboN=1
# for i in range(okgood):
# cache[2]=cache[1]
# cache... | true |
bf25bcc8ccf2dc01fec50cedfda724d52056963a | sharjilm/ENGINEER-1D04-Engineering-Computation | /Minor Lab 2/MinorLab2.py | UTF-8 | 884 | 3.9375 | 4 | [] | no_license | import math
def minor2(p, r, n, t):
# A is the future value of p with compound interest.
A = p*(1+(r/n))**(n*t)
# B is also the future value of p with compound interest, but was calculated using a for loop.
B = []
total = p
for i in range(1, (n*t)+1):
total = total * (1+(r/n)... | true |
c247193e06e285853352bfddca9a3cfbce813efe | mmore500/dishtiny | /dishpylib/pyhelpers/NumpyEncoder.py | UTF-8 | 975 | 2.671875 | 3 | [
"MIT"
] | permissive | import json
import numpy as np
# adapted from https://github.com/hmallen/numpyencoder/blob/master/numpyencoder/numpyencoder.py
class NumpyEncoder(json.JSONEncoder):
""" Custom encoder for numpy data types """
def default(self, obj):
if isinstance(obj, (np.int_, np.intc, np.intp, np.int8,
... | true |
9a1f98fd383e31e786e0347cc8cb01cb673832dd | tpraks/python-2.7 | /prod_array.py | UTF-8 | 581 | 3.359375 | 3 | [] | no_license | def test_result(arr):
prod=1
result_arr = []
for val in arr:
prod *= val
for val in arr:
result_arr.append(prod/val)
return result_arr
def main():
arr = [5,4,6,3,2,8,1]
prod_arr = []
pre_prod = 1
post_prod = 1
prod_arr.append(1)
print len(arr)-1
for i in range(1,len(arr)):
pre_prod ... | true |
5753cc1dc5d9871a8c3418af9424423c0b78bd2c | steffanynaranjov/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/1-last_digit.py | UTF-8 | 307 | 3.890625 | 4 | [] | no_license | #!/usr/bin/python3
import random
number = random.randint(-10000, 10000)
last_dig = number % (-10 if number < 0 else 10)
print("Last digit of", number, "is", last_dig, "and is ", end="")
if last_dig == 0:
print("0")
elif last_dig > 5:
print("greater than 5")
else:
print("less than 6 and not 0")
| true |
e8cb758c16037d23a26d21f7adba369594f2db41 | MonkiyPython/fastapilearning | /fastapiyoutube/002PathParameters/main.py | UTF-8 | 651 | 2.984375 | 3 | [] | no_license | from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def index():
return {"data": "Blog List"}
@app.get("/blog/unpublished")
def unpublished():
return {"data": "All Unpublished Blogs"}
@app.get("/blog/{id}") # Dynamic Data should be inside the '{ }' Paranthesis
def show(
id: int,
): # Dynamic ... | true |
c4bb29a12821ff998a0a5a50193783733024d468 | Ravitejagupta/Python | /leetcode-778.py | UTF-8 | 713 | 3.21875 | 3 | [] | no_license | import heapq
grid = [[0,2],[1,3]]
def swimInWater(grid):
directions = [(0,1),(0,-1),(1,0),(-1,0)]
visited = set()
visited.add((0,0))
l = [[grid[0][0],0,0]]
heapq.heapify(l)
while True:
popped = heapq.heappop(l)
if popped[1:] == [len(grid)-1, len(grid)-1]:
return p... | true |
bbe0df99c667751aaba5fb9fc660c4ceb6e6bb0f | ankit27kh/Computational-Physics-PH354 | /Ankit Khandelwal_HW7/Exercise 9/exercise 9b.py | UTF-8 | 2,562 | 2.84375 | 3 | [
"MIT"
] | permissive | '''
Ankit Khandelwal
15863
Home Work 7
Exercise 9b
'''
from math import exp, log
import matplotlib.pyplot as plt
import numpy as np
a = 2227057010910366687
M = 2 ** 64 - 59
L = 50
grid = np.zeros((L + 2, L + 2), int)
grid[0, :] = -1
grid[L + 1, :] = -1
grid[:, 0] = -1
grid[:, L + 1] = -1
x = 24613417 # seed
x1 = ... | true |
a0dacf6c2d8660ef624bb94a6f9680014acb58fa | patrick473/progProject | /testtimmain.py | UTF-8 | 12,252 | 2.9375 | 3 | [] | no_license | # Import tkinter for Python 3.X or Python 2.X
try:
from tkinter import *
except ImportError:
from Tkinter import *
from csvwriter import *
from sys import exit
#statements en variabelen
helpDisplayed = False
gold='#ffd700'
blue='#0000FF'
white='#FFFFFF'
grey='#666666'
red='#FF0000'
black='#000... | true |
bd8d5e62cb7586d8c92d7328ba501019feb68965 | Ixnaylolymd/go_learn | /learn_rpc/python_test/rpc_test/go_json_rpc_client.py | UTF-8 | 655 | 2.578125 | 3 | [] | no_license | # 1.json_rpc_client
# import json
# import socket
#
# request = {
# "id": "0",
# "params": ["ymdlol"],
# "method": "HelloService.Hello"
# }
#
# client = socket.create_connection(("localhost", 1234))
# client.sendall(json.dumps(request).encode())
#
# # 获取服务器返回的数据
# rsp = client.recv(1024).decode()
# print... | true |
a6e7bd21e9393c59b85e202f8d3681dbc8a1ff4b | tungct/fuzzy-info | /im/xlttm/dijsktra.py | UTF-8 | 10,453 | 3.0625 | 3 | [] | no_license | # Python program for Dijkstra's single source shortest
# path algorithm. The program is for adjacency matrix
# representation of the graph
from collections import defaultdict
import cv2
import sys,time
import numpy as np
import pygame
from pygame.locals import *
import time
import random
import datetime
import math
f... | true |
4ebe4e84aac79630fd5d38d0a33be2d3dc88052d | CrazyPigAndCat/WorkSpace | /C/C基础/1.py | UTF-8 | 395 | 3.109375 | 3 | [] | no_license | #from typing import Sized
intArr = [-40380,-14850,4457,7,-2845,-91,-62041,185,3,9];
intI = 0
intJ = 0
while intI < len(intArr):
while intJ < len(intArr) - intI - 1:
if(intArr[intJ] > intArr[intJ + 1]):
intTemp = intArr[intJ]
intArr[intJ] = intArr[intJ + 1]
intArr[intJ ... | true |
237ba58ef25acf6815a83fe59c3a4fa58c7d1ea0 | colombo0718/D1miniGames | /game_fatCat.py | UTF-8 | 3,618 | 2.546875 | 3 | [] | no_license | import LCD
from machine import freq,SPI,Pin,PWM,ADC,Timer
import time
from flaglib import *
freq(160000000)
spi = SPI(1, baudrate=40000000, polarity=0, phase=0)
lcd = LCD.LCD(spi, 15, 5, 0)
lcd.init()
lcd.setRotation(4)
lcd.clearLCD()
adc = ADC(0)
button = Pin(4, Pin.IN, Pin.PULL_UP)
buzzer = PWM(Pin(12))
left_pixe... | true |
2987bd1b6b7ed158d228c49ca7e0b62b63c7c3c7 | Phatfisher/computational-biology | /dna/motif-and-pssm/pssm_prefix_and_suffix_of_coding_sequence.py | UTF-8 | 3,436 | 2.703125 | 3 | [
"CC-BY-4.0",
"CC-BY-3.0"
] | permissive | from Bio import SeqIO, motifs
from Bio.Alphabet import IUPAC
from Bio.SeqRecord import SeqRecord
import pylab as P
import sys
def get_upstream_prefixes_and_downstream_suffixes(gb_file, chromosome_to_sequence, prefix_suffix_size):
prefix_result = []
suffix_result = []
for gb_record in SeqIO.parse(open(gb_file,"... | true |
fff4542cb593c33084cacdbedd82f5a7789dce98 | cin-derella/python_datascience | /YC_DataAnalysis/search/1. timedecorator.py | UTF-8 | 225 | 3.1875 | 3 | [] | no_license | import time
def costTime(func):
startTime = time.time()
func()
endTime = time.time()
print(endTime-startTime)
@costTime
def go():
num = 0
for i in range(100000000):
num += i
print(num)
| true |
f5f4934edef9587f013942face421c59bac64d76 | juliarizza/brazilian-news-scrapper | /uol/uol/utils.py | UTF-8 | 434 | 3 | 3 | [
"MIT"
] | permissive | import datetime
def daterange(start_date, end_date):
date = start_date
delta = datetime.timedelta(days=1)
while date <= end_date:
yield date
date += delta
def formatted_text(text=''):
return text.replace('<BR>', ' ') \
.replace('<br>', ' ') \
.replace('<BR... | true |
8ae4a9ce101158039e4ba469601c883c0c89da35 | CQ-AI/HIVE-Net | /createVal.py | UTF-8 | 4,238 | 3.03125 | 3 | [] | no_license | import SimpleITK as sitk
import numpy as np
import nibabel
from util.tools_self import *
def cropping(image, crop_size, dim1, dim2, dim3):
"""crop the image and pad it to in_size
Args :
images : numpy array of images
crop_size(int) : size of cropped image
dim1(int) : vertical location ... | true |
e52d996891532726296094b6db76d8553d4b5ae7 | Seoyoung2/Algorithm_Study | /Baekjoon/Dynamic Programming - New/동물원.py | UTF-8 | 192 | 2.859375 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1309
from sys import stdin
n = int(stdin.readline())
dp = [1, 3]
for i in range(2, n+1):
dp.append((dp[i-1] * 2 + dp[i-2]) % 9901)
print(dp[-1]) | true |
2bc6867b4e90ed1bb7d266596a81f3fd4ed90c82 | negi317145/python-assignment | /dimension.py | UTF-8 | 145 | 3.5625 | 4 | [] | no_license | len=int(input("enter length"))
br=int(input("enter breadth"))
if len==br:
print("square dimensions")
else:
print('rectangle dimensions') | true |
10f2e8fd6e2b5fdb3651de13f6c4fb52de0554fe | GKForFun/IDAPython | /calculateAllBasicblocks.py | UTF-8 | 1,484 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
used for calculate the number of basicblocks of a binary file
the result will be written in ./data.txt
"""
import idaapi
import idc
def getBasicblocksByAddr(tgtEA):
if tgtEA is None:
exit
f = idaapi.get_func(tgtEA)
if not f:
print "No function at 0x%x" % (tgtEA)
... | true |
edd60e2e8169ae492ab5edc12dc0e2fccebd6987 | awerenne/multi-robot-mapping | /code/robot/tests/3-maze-solving/data/analysis-distance.py | UTF-8 | 1,801 | 2.921875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import random
plt.style.use('seaborn-whitegrid')
data = pd.read_csv("measures_distance.csv", sep=';')
df = pd.DataFrame(data=data)
df['err'] = abs(df['ground_truth']-df['d'])
# Select only one part of the data (each ground tr... | true |
6f6e0502f2f0cf6a450447ccf0ef5e54076c5aed | Jingwei4CMU/Leetcode | /279. Perfect Squares.py | UTF-8 | 1,142 | 3.296875 | 3 | [] | no_license | # class Solution:
# def numSquares(self, n):
# """
# :type n: int
# :rtype: int
# """
# # Time Limit Exceeded
# dic = {0:0}
# for i in range(1,n+1):
# temp = i
# for j in range(1,i+1):
# prev = i-j**2
# i... | true |
8c136c5d936069bfa3c0ea487aaa039e2afb1920 | lujie0423/Qobject | /Fiddler_test/fiddler_pic.py | UTF-8 | 1,103 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
import os
#报错:check_hostname requires server_hostname,关闭代理
headers = {
'User-Agent': 'lujie'
}
dir_name = '爬虫'
path = r'C:\Users\jie.lu\Desktop\fiddler'
create_url = path + '\\'+ dir_name
if not os.path.exists(dir_name):
os.mkdir(create_url)
for i in range(1,10):
... | true |
f4dc845531cb5666c053360f81e43a7cdefa449a | ShaqeTarverdyan/cs50 | /pset7/houses/import.py | UTF-8 | 1,235 | 3.15625 | 3 | [] | no_license | from csv import reader, DictReader
from cs50 import SQL
from sys import argv
import sqlite3
# Check command line arguments
if len(argv) != 2:
print("error")
exit()
# for input.py
# FOr each row parse name
# Insert each student into the students table of students.db
# HInts
# use split method ... | true |
73ff7c55b8567a3c4ca66f19da2961797a985a55 | lluxury/P_U_S_A | /12_data_persistence/zodb_withdraw_2.py | UTF-8 | 870 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import ZODB
import ZODB.FileStorage
import transaction
import custom_class_zodb
filestorage = ZODB.FileStorage.FileStorage('zodb_filestorage.db')
db = ZODB.DB(filestorage)
conn = db.open()
root = conn.root()
noah = root['noah']
print("BEFORE TRANSFER")
print("===============")
print(noah)
jerem... | true |
f98e5f4d39e91cc0045071d04674aa5d3426ff01 | dangjeremy/Finalised_Msc_Project | /GCMC_metrics.py | UTF-8 | 1,847 | 3.125 | 3 | [] | no_license | #################################################################
# Import NN framework
import torch
import torch.nn.functional as F
#################################################################
def softmax_accuracy(preds, target):
"""
Accuracy for multiclass model.
:param preds: predictions
:par... | true |
ef9a7de5b78ac8c656b99a8998c6821a83d8ff15 | maxbergmark/old-work | /GruPDat/Laboration 1/hittakubsumma.py | UTF-8 | 211 | 4.1875 | 4 | [] | no_license |
summa = int(input("Summa: "))
for a in range(1, int((summa/2)**(1/3)+1)):
for b in range(1, int((summa)**(1/3)+1)):
if a**3 + b**3 == summa:
print(a, "^3 + ", b, "^3 = ", summa)
| true |
26fdfe8e262ec69f04c39e0644876456b7549602 | Fanta-Stick-Org/Prueba_Edward | /prueba.py | UTF-8 | 47 | 3.171875 | 3 | [
"MIT"
] | permissive | a = "Hola"
b = "Mundo\n"
print((a + " " + b)*3) | true |
7222a50bf4d3eddc0cbf1392865f89ac596a2a48 | ElMora96/RECOpt | /datareader.py | UTF-8 | 4,010 | 3.40625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 26 10:45:12 2020
@author: giamm
"""
from pathlib import Path
import numpy as np
import csv
import math
##############################################################################
# This scripted is used to create methods that properly read files
#################... | true |
1720d386b8e34dd57e526eab45ab7e12fb02938a | TPALMER92/HWFin5350 | /FIn5350HW3prob1.py | UTF-8 | 1,421 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 24 19:16:05 2017
@author: courtenaenielson
"""
import numpy as np
from scipy.stats import binom
class VanillaOption(object):
def __init__(self, strike, expiry):
self.strike = strike
self.expiry = expiry
def pay... | true |
e0d884e3c84a3e651c7608e36f18b38629c2ca9b | dozetal/lists-dno-040917-cont-041617 | /01_print_list.py | UTF-8 | 172 | 4.15625 | 4 | [] | no_license | # Create a list of items
items = [1, 2, 6, 3, 9]
def print_list(items):
# Print each item in the input list
for item in items:
print item
print_list(items)
| true |
2a79ce8124ea1c5142b5c127b55cc100ee41d2bc | mbeeby/bioinformatics | /annotate/get_insert_class_stats.py | UTF-8 | 1,944 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
'''
Gets statistics on different flagellin insert classes
'''
import argparse
import re
import sys
import random
import fasta
import numpy
def getClassLengths(classes,seqs,rename):
classLens = {}
for protein in seqs:
accession = rename[protein]
seq = seqs[protein]... | true |
87b09d2197ea14fffabdb49423e847b511d852bb | Carrie0302/CollegeProgramWebScraper | /PreApprenticeshipPrograms.py | UTF-8 | 18,980 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 13 12:50:10 2017
This calls the preapprenticeship web scraper and it tags different filters including entry requirements and age limits and the like by keyword
This requires selenium.
@author: carrie
"""
from selenium import webdriver
import pandas as pd
import ... | true |
c0d307f1bc91b857cb0f1d2de45d54621b3392fe | avielz/self.py_course_files | /self.py-unit9 files/9.3.1.py | UTF-8 | 6,301 | 3.90625 | 4 | [] | no_license |
def note():
"""
>>> print(my_mp3_playlist(r"c:\my_files\songs.txt"))
("Tudo Bom", 5, "The black Eyed Peas")
songs.txt:
Tudo Bom;Static and Ben El Tavori;5:13;
I Gotta Feeling;The Black Eyed Peas;4:05;
Instrumental;Unknown;4:15;
Paradise;Coldplay;4:23;
Where is the love?;The Black ... | true |
b59d967b884b59d9d7fdb234bee896857c26a6fa | coq-community/docker-coq | /external/docker-keeper/keeper.py | UTF-8 | 33,300 | 2.546875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Érik Martin-Dorel
#
# Contributed under the terms of the MIT license,
# cf. <https://spdx.org/licenses/MIT.html>
from bash_formatter import BashLike
from datetime import datetime
import base64
import copy
import json
import requests
import os
impor... | true |
05342f7716134c91012b0d33bf35cf90df9261cf | devThinKoki/learning_repo | /FASTCAMPUS/NKLCB/2nd/3_자료구조이론/test.py | UTF-8 | 1,918 | 3.78125 | 4 | [] | no_license | # print('-'*20)
# for i in range(3):
# for j in range(1,4):
# print("'" * j, end=' ')
# print()
# print("""
# ' '' '''
# ' '' '''
# ' '' '''
# """)
# print('-'*20)
# word = input()
# # Change the next line
# print(word*2)
# print('-'*20)
# implement the function below
# def get_sum(a, b):
# retur... | true |
5a1dd5f64e7cee5edbd09889627627716f744f6c | zopefoundation/ZConfig | /src/ZConfig/tests/test_pygments.py | UTF-8 | 8,216 | 2.546875 | 3 | [
"ZPL-2.1"
] | permissive | ##############################################################################
#
# Copyright (c) 2019 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | true |
8c3d6c008b794b0edd5c37d6440ade9593900987 | jgartsu12/my_python_learning | /python_data_structures/tuples/tuples.py | UTF-8 | 1,479 | 4.28125 | 4 | [] | no_license | # Intro To Python Tuples
# Data Types:
# List: []
# Dictionary: {}
# Tuple: ()
# Differences btween tuples and lists
# why u would use tuple or list
# is this a data structure I want to change or not ????
# Tuple: immutable - cannt change
# List: mutable - can change
# machine learning m... | true |
4f995dada8abec9ce297fad7d571895e88399ab4 | Nienschanz-Automatica/benchmark | /src/Stats.py | UTF-8 | 15,483 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
import sys
import psutil
import subprocess
import pandas as pd
from time import sleep
class Listener():
def __init__(self, save_every_minutes):
self.save_every_minutes = save_every_minutes
self.devices = []
self.saved = False
self.log_file_name = None
def ready_to_sa... | true |
ae1f2c8af4610cbefa91024d02a47fed675443c0 | sgouda0412/samples | /Snowflake Fivetran Utility/snowflake_read_only_role_refresh.py | UTF-8 | 4,477 | 2.609375 | 3 | [] | no_license | '''
Author: Kirk Wilson
Loop through all databases/schemas in Snowflake and grant read-only access to the role READ_ONLY_REPORTING_ROLE.
NOTE: This was created before I knew about the FUTURE option for grants in Snowflake, which renders this basically useless... :-)
https://docs.snowflake.net/manuals/sql-ref... | true |
5f5a0e6f2a289c46b33359785845c73a1bece660 | amartins0/hackerrank_answers | /data_structures/reverse_linked_list.py | UTF-8 | 523 | 3.4375 | 3 | [] | no_license |
#
# Complete the 'reverse' function below.
#
# The function is expected to return an INTEGER_SINGLY_LINKED_LIST.
# The function accepts INTEGER_SINGLY_LINKED_LIST llist as parameter.
#
#
# For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
def reverse(head):
pr... | true |
0bdebbfd3f88149715800effd320a576d6768927 | webclinic017/TradeBot-8 | /script.py | UTF-8 | 970 | 2.703125 | 3 | [] | no_license | import numpy as np
import pandas as pd
main_file = pd.read_parquet('C:/Users/adam/Desktop/tradeBOT/Bitcoin_data/bitcoin_data_indexxxx.pq')
list = pd.read_parquet('C:/Users/adam/Desktop/tradeBOT/Bitcoin_data/bitcoin_usd_min_tf.pq')
TFlist = list['Value'].tolist()
true_np_list = np.where(list['Value']==True)
concaten... | true |
ccdf98ef304b520fd6de6c682f03849c29d55ad4 | Narendon123/python | /new24.py | UTF-8 | 130 | 2.84375 | 3 | [] | no_license | def median(w):
x=sorted(w)
return x[(len(x)//2)]
d=int(input())
w=input()
w=w.split()
w=list(map(int,w))
print(median(w))
| true |
12bb0be7928664d066b9edd916c87092e7dfd34e | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_156/599.py | UTF-8 | 642 | 2.625 | 3 | [] | no_license | with open("B-large.in",'r') as f:
case_num = 0
out =""
cases = int(f.readline())
for i in xrange(cases):
cakes_num = []
D = int(f.readline())
cakes = f.readline().split()
for cake in cakes:
cakes_num += [int(cake)]
cake_max = max(cakes_num)
cake_min = cake_max
for j in xrange(1,cake_max+1):
sum... | true |
3dfcd84055f33b772d336a15de7c0e07ca2d984d | tyzion/python_game | /game.py | UTF-8 | 2,596 | 3.0625 | 3 | [] | no_license | import pygame
import sys
import random
from pygame.time import delay
pygame.init()
clock = pygame.time.Clock()
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SPEED = 30
framerate = SPEED * 1/4
RED = [255, 0, 0]
BLACK = [0, 0, 0]
WHITE = [255, 255, 255]
player_size = 50
player_pos = [SCREEN_WIDTH/2, SCREEN_HEIGHT-player_s... | true |
3238d5297ae4063130e2bc451e9b9f70c7887b9a | zjxs1997/wict_cluster_util | /nvidiasmi.py | UTF-8 | 1,765 | 2.59375 | 3 | [] | no_license | import json
import argparse
import colorama
import requests
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', action='store_true')
args = parser.parse_args()
r = requests.get("http://172.31.32.100/gpustat/info.js")
text = r.text
json_text = text[6:-2]
state_dict = json.loads(json_text)
group_name... | true |
04330246822793948720c0d0cbe3e0aca86b90cd | HekpoMaH/algorithmic-concepts-reasoning | /algos/mst/utils.py | UTF-8 | 7,524 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import torch
import math
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import torch_geometric.utils as tg_utils
import torch_geometric
def _sample_edge_index(kwargs, generator):
def caveman_special(c=2,k=20,p_path=0.1,p_edge=0.3):
p = p_path
path_count = max(... | true |
601f839a758bb220a56b0821bbe410a058e18e73 | persocom01/TestPython | /codity_solutions/02_iterations.py | UTF-8 | 307 | 3.484375 | 3 | [] | no_license | # Longest chain of zeroes in a binary number.
import re
A = "{0:b}".format(3703307)
def solution(A):
pattern = r'[^0](0+)[^0]'
matches = re.findall(pattern, A)
max_len = 0
for m in matches:
if len(m) > max_len:
max_len = len(m)
return max_len
print(solution(A))
| true |
36bd2ee2b7adde56e7ab860915224ddeda52d42b | dapper91/paxb | /paxb/paxb.py | UTF-8 | 9,552 | 2.796875 | 3 | [
"LicenseRef-scancode-public-domain",
"Unlicense"
] | permissive | import xml.etree.ElementTree as et
import attr
from . import encoder as default_encoder
from . import exceptions as exc
from . import mappers
def model(maybe_cls=None, name=None, ns=None, ns_map=None, order=None, **kwargs):
"""
The decorator maps a class to an XML element. It uses a class
name as a defau... | true |
6ca14229394c03382dbdb1ab137a4307816d9551 | oskar-j/thresher | /thresher/interface.py | UTF-8 | 3,585 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import numpy as np
import pandas as pd
from collections.abc import Iterable
from thresher import algorithm
from thresher.oracle import run_oracle, run_computations
from thresher.exceptions import NOT_IMPLEMENTED_ERROR
from thresher.utils import map_labels
class ThresherBase(object):
def _... | true |
bb3d4b663ac03268e59430b652cbc2cb564334d4 | tnakaicode/jburkardt-fipy | /expression_test/expression_test.py | UTF-8 | 7,195 | 3.703125 | 4 | [] | no_license | #! /usr/bin/env python
#
from fenics import *
def expression_test1 ( ):
#*****************************************************************************80
#
## expression_test1 demonstrates some features of the Expression() function.
#
# Licensing:
#
# This code is distributed under the GNU LGPL license.
#
# Modif... | true |
c0d1087aa5ce644d76d122e495f9a184b7f2f348 | tasbolat1/letter-spike | /utils/utils.py | UTF-8 | 4,961 | 2.84375 | 3 | [] | no_license | import os, sys
import numpy as np
import pandas as pd
from pathlib import Path
letters = {'A':0,
'B':1,
'C':2,
'D':3,
'E':4,
'F':5,
'G':6,
'H':7,
'I':8,
'J':9,
'K':10,
'L':11,
'M':12,
... | true |
e85713b453bfb3f9bf5610a057276fbe42de6f70 | honix/Pyno | /pyno/process.py | UTF-8 | 1,553 | 2.875 | 3 | [
"MIT"
] | permissive | from .serializer import Serializer
from .fileOperator import FileOperator
class Process():
'''
Abstract process
'''
def __init__(self):
self.running = -1 # -1: run continously, 0: pause/stop, n: do n steps
self.serializer = Serializer(self)
self.file_operator = FileOpera... | true |
d5dc43ae781c495e91c5f56ceb1fdc01c5a6c832 | tejaswisunitha/python | /median.py | UTF-8 | 321 | 3.375 | 3 | [] | no_license | import math
def sort(values):
for i in range(len(values)):
for j in range(i,len(values)):
if(values[i]>values[j]):
temp=values[i]
values[j]=temp
n=int(raw_input())
values=[int(x) for x in raw_input().split("")
sort(values)
medianIndex=int(math.floor(len(values)/2))
print(values[medianIndex])... | true |
e99feaa9e14fe924d56ece039e94cb634eb389fb | hwc0919/TetrisGame | /gamedisplay.py | UTF-8 | 9,932 | 2.953125 | 3 | [] | no_license | from settings import *
import pygame
class GameDisplay(object):
@staticmethod
def draw_cell(screen, row, col, color):
cell_pos = (GAME_AREA_LEFT + col * CELL_WIDTH + 1,
GAME_AREA_TOP + row * CELL_WIDTH + 1)
cell_area = (CELL_WIDTH - 1, CELL_WIDTH - 1)
cell_rect = py... | true |
0932885cd14e5d229dc138c9bb8c4d46b0b06b33 | ricbit/Oldies | /2013-01-facebook/balanced.py | UTF-8 | 422 | 2.953125 | 3 | [] | no_license | for t in xrange(input()):
prev = set([0])
last = False
for c in raw_input():
old = prev
if c == '(':
prev = set([i + 1 for i in prev])
elif c == ')':
prev = set([i - 1 for i in prev])
if last:
prev = prev.union(old)
last = c == ':'
prev = set([i for i in prev if i >= 0])
... | true |
8bd29a740d1f5b104f02ab4d34b3268eaf5f1d13 | zhuangzhuangliu2345/DCASE_task5 | /.github/单任务/pytorch/models.py | UTF-8 | 15,418 | 2.71875 | 3 | [] | no_license | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def init_layer(layer, nonlinearity='leaky_relu'):
"""Initialize a Linear or Convolutional layer. """
nn.init.kaiming_uniform_(layer.weight, nonlinearity=nonlinearity)
if hasattr(layer, 'bias'):
if layer.bias is not No... | true |
b9ace0a0deccd966b9716096029463a6e7d8ad9a | paddycarey/beardo-build | /app/lib/logger.py | UTF-8 | 552 | 2.65625 | 3 | [
"MIT"
] | permissive | # marty mcfly imports
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
# stdlib imports
import codecs
import datetime
import sys
UTF8Writer = codecs.getwriter('utf8')
sys.stdout = UTF8Writer(sys.stdout)
def logger(message, level='INFO'):
"""
... | true |
2dd9f3e6c2a379feee36527c1ae4fbf25da404ff | paynemiller92/sleep-predictor-grapher | /response.py | UTF-8 | 584 | 2.875 | 3 | [] | no_license |
class Response:
week_day_hrs_of_sleep = 0
week_day_minutes_of_naptime = 0
week_day_minutes_of_exercises = 0
number_of_drinks_consumed = 0
minutes_of_screentime = 0
@staticmethod
def from_csv_record(record):
response = Response()
response.week_day_hrs_of_sleep = record['Q5'... | true |
b55c20b7052b23b96bfdeba8661c9fa7601eb6e9 | naruto2205200/pythondemo | /day01/day03.py | UTF-8 | 1,811 | 3.71875 | 4 | [] | no_license | # def my_abs(x):
# if(x>0):
# return 32
# else:
# return "哈哈"
#
# print(my_abs(3))
#
# def my_none():
# print("这是none")
#
# print(my_none())
#
# def my_abs2(x):
# if not isinstance(x,(int)):
# raise TypeError("bed operand type")
#
#
# 参数调用
# def person(name, age, *args, city, job... | true |
200e0e7f7549188a2fb484a196862844dcee5313 | Miliver/open-source-development-course-hw02-1 | /ossdev/tests/vct_test.py | UTF-8 | 1,655 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ossdev
import unittest
from ossdev import Vector
class VectorTest(unittest.TestCase):
"""Simple vector tests"""
def __init__(self, *args, **kwargs):
super(VectorTest, self).__init__(*args, **kwargs)
def test_add(self):
a = Vector([... | true |
a89c7d1c381366c1ecd1bb4ecd6b0d656c86a68e | Aasthaengg/IBMdataset | /Python_codes/p03252/s031126471.py | UTF-8 | 618 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
from collections import defaultdict
def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))
def main():
S = input()
T = input()
s1 = {}
t1 = {}
for i, (s, t) in enumerate(zip(S, T)):
if s in s1 an... | true |
a65b32eef04933b53a9e4a322594192569c6c7c9 | seraph1122/EPL21-439-Implementation-de-la-fonction-ode45-dans-python | /odeTests/odemassexplicitTest.py | UTF-8 | 3,606 | 2.515625 | 3 | [] | no_license | import unittest, os, sys
import numpy as np
import scipy.sparse as sp
import scipy.linalg as lg
import scipy.sparse.linalg as spl
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from odemassexplicit import odemassexplicit,explicitSolverHandl... | true |
6b790fb9ca4b851ea756e3ba3cb19df5a6386984 | daniel-reich/ubiquitous-fiesta | /cg5p7B5AKh9b7mupc_5.py | UTF-8 | 163 | 3.453125 | 3 | [] | no_license |
def check_inclusion(s1, s2):
for i in range(len(s2)-len(s1)+1):
if ''.join(sorted(s1))==''.join(sorted(s2[i:i+len(s1)])):
return True
return False
| true |
809c5356ad6f23817424c53b22b0077f4e826b6e | sugambudhraja/IntelligentMedicineBox | /src/main.py | UTF-8 | 5,495 | 2.578125 | 3 | [
"MIT"
] | permissive | from event_queue import *
from prescription_manager import PrescriptionManager
from inventory_manager import InventoryManager
from timer import *
from notifier import Notifier
from time import sleep
from anomaly import Anomaly
import getpass
from threading import Lock, Thread
import tkinter
class Main:
def main(... | true |
5e9862b8f0d52c965cbf734fdad09a1d89deea22 | wengyusu/CS-IntroToAI | /Assignment1/fire_maze.py | UTF-8 | 17,059 | 3.296875 | 3 | [] | no_license | import maze
import numpy
import math
import heapq
import BFS
from queue import PriorityQueue
PATH=100
EMPTY = 0
FILLED = 1
FIRE = -1
class A_star(object):
def __init__(self, maze):
self.maze = maze
self.path_length = None
self.path = []
def generate_EuclideanDistance(self):
''... | true |
af7f4e9ec723838e8381288ec94ef23c370b848e | scottx611x/RefAppDjango | /refineryApp/refineryApp/models.py | UTF-8 | 2,060 | 2.96875 | 3 | [] | no_license | from django.db import models
# DB Model for a Category -> Unique name, Description, creation date, last modified date
class Category(models.Model):
id = models.AutoField(primary_key=True)
category_name = models.CharField(max_length=120)
category_Description = models.CharField(max_length=300)
date_Crea... | true |
6b30e6e25063f233152bc46f328418daf25f7c16 | jtchuaco/Python-Crash-Course | /scripts/Chapter 8/making_pizzas.py | UTF-8 | 1,901 | 3.921875 | 4 | [] | no_license | # this file imports the module we just created in pizzuh.py
# the line import tells Python to open the file puzzuh.py
# it copies all the functions into this program
import pizzuh
# to call a function from an imported module
# enter the name of the module you imported followed by the name of the function
# separate t... | true |
35090517d48ade191d8bb54cdf2192184d409856 | matta315/GloVe | /play.py | UTF-8 | 1,833 | 2.875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | from pymagnitude import Magnitude, FeaturizerMagnitude, MagnitudeUtils
word2vec = Magnitude("./vectors.magnitude")
pos_vectors = FeaturizerMagnitude(100, namespace="PartsOfSpeech")
dependency_vectors = FeaturizerMagnitude(100, namespace = "SyntaxDependencies")
print(len(word2vec))
print(word2vec.dim)
print("dog" in ... | true |
dfec4ec0b8c4e8c25337861211c67e19d13705ad | shiki7/Atcoder | /ABC093/B.py | UTF-8 | 193 | 2.859375 | 3 | [] | no_license | a, b, k = map(int, input().split())
if b-a <= k:
for i in range(a, b+1):
print(i)
exit()
for i in range(a, a+k):
print(i)
for i in range(max(a+k, b-k+1), b+1):
print(i)
| true |
5c3ed23dc1ad85c02ff641d29128b5f96fa5692a | MOCRUHA/intro | /count_books.py | UTF-8 | 193 | 3.09375 | 3 | [] | no_license | #count books
import requests
def count_books():
r = requests.get("http://0.0.0.0:8000/books")
total = len(r.json())
print(f"We have {total} books registered.")
count_books() | true |
129291f9c4da7c384725571254b53075a55607ca | c4pt0r/somestuff | /finance/dump_imeigu.py | UTF-8 | 356 | 2.6875 | 3 | [] | no_license | import BeautifulSoup
from BeautifulSoup import BeautifulSoup
import sys
import urllib2
if __name__ == '__main__':
url = sys.argv[1]
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content)
items = soup.findAll(attrs={'class':'bg2 cGreen'}) + soup.findAll(attrs={'class':'cGreen'})
for i ... | true |
5e4d51bb31ab6206a05f611b668e49371a12a356 | seo0/MLstudy | /day1/a_practice/external_function.py | UTF-8 | 2,927 | 3.703125 | 4 | [] | no_license | #jump to python 빈출 외부 라이브러리
#전 세계의 파이썬 사용자들이 만든 유용한 프로그램들을 모아 놓은 것이 파이썬 라이브러리이다. 원하는 정보를 찾아보는 곳.
#모든 라이브러리를 다 알 필요는 없고 어떤 일을 할 때 어떤 라이브러리를 사용해야 한다는 정도만 알면 된다.
#그러기 위해서 어떤 라이브러리들이 존재하고 어떻게 사용되는지 알아야 할 필요가 있다.
"""
sys
시스템 입출력 관련되어있는 라이브러리
pickle 객체의 형태를 그대로 유지하면서 파일에 저장하고 불러올 수 있게 하는 모듈
os
환경변수나 디렉토리, 파일등의... | true |
9388929c36562e66b9b5aa939b8a89c6eed81739 | Pandinosaurus/tensorly | /tensorly/backend/pytorch_backend.py | UTF-8 | 10,629 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | import warnings
from distutils.version import LooseVersion
try:
import torch
except ImportError as error:
message = ('Impossible to import PyTorch.\n'
'To use TensorLy with the PyTorch backend, '
'you must first install PyTorch!')
raise ImportError(message) from error
if Loos... | true |
5347df0aefa49b8d6d07c5f3b97437e9d7cf2675 | LastGunslinger/project_euler | /project_euler/problems/problem_031.py | UTF-8 | 884 | 3.890625 | 4 | [] | no_license | prompt = '''
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using any n... | true |
17cbaee7518c03a6af12411f5e65b800b9345bb8 | lucasbflopes/codewars-solutions | /7-kyu/split-string-by-multiple-delimiters/python/solution.py | UTF-8 | 339 | 3.046875 | 3 | [] | no_license | def multiple_split(string, delimiters=[]):
if not delimiters: return [string] if string else []
ans = []
temp = ''
for letter in string:
if letter not in delimiters:
temp += letter
else:
if temp: ans.append(temp)
temp = ''
if temp: ans.append(t... | true |
c3041f20c36ea93a7df0aa9b5d94eb2737e40b03 | jtc42/kaawash | /kaa.py | UTF-8 | 1,832 | 3.359375 | 3 | [] | no_license | from jinja2 import Template
import os
# Function to replace a particular index within a string
def replace_str_index(text,index=0,replacement=''):
return '%s%s%s'%(text[:index],replacement,text[index+1:])
# Function to create an array of "chordblocks" from a raw songfile string
"""
This can be considered the m... | true |
a6bd700b74b2aceaade3579d7260104d9cc1ebd0 | scollinsam/Biography-Search | /query_bios.py | UTF-8 | 480 | 2.640625 | 3 | [] | no_license | import pymysql
def connection():
return pymysql.connect(host='127.0.0.1', user='root', passwd='16769thSQL', database='biography_search')
def find_relevant_bios(era, region, occupation):
mydb = connection()
mycursor = mydb.cursor()
query = "select * from biographies where era = '{}' and region = '{}'... | true |
c79e3664d69fc14eb926b05819933d719c56508d | bishal-balouria/Classes-in-Python | /classes_test.py | UTF-8 | 2,468 | 4.4375 | 4 | [] | no_license | # class is blueprint for creating instances
class Dummy(object):
a = 90
b = 80
p = Dummy()
print(p)
print(dir(p))
# __init__ is called when ever an object of the class is constructed
# You can see the first argument to the method is self.
# It is a special variable which points to the current obj... | true |
d89e067178555809b6dc5076433152b3f31d5f1a | caseyngyn/Uniquify_code_challenge | /tensor.py | UTF-8 | 1,968 | 3.75 | 4 | [] | no_license |
class Tensor():
def __init__(self,data,shape):
self.data = data
self.shape = shape
if self.check_shape():
self.tensor = self.shape_data()
print(self.tensor)
"""
Data and shape inputs are given as lists of numbers.
Data can be a... | true |
9ba39bdbd07c7e584f905f9fda75ce0bfe1652cb | Robertation256/TEXbook | /utils/MD5_helper.py | UTF-8 | 304 | 3.234375 | 3 | [] | no_license | import hashlib
class MD5Helper(object):
@classmethod
def hash(cls, string: str) -> str:
md5 = hashlib.md5()
md5.update(string.encode("utf-8"))
return md5.hexdigest()
@classmethod
def evaluate(cls, string, hash) -> bool:
return cls.hash(string) == hash
| true |
a2ff8cdf53ba03a0f56071723cd1c12698caa2eb | mauriciosierrac/holbertonschool-higher_level_programming | /0x03-python-data_structures/4-new_in_list.py | UTF-8 | 306 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python3
def new_in_list(my_list, idx, element):
lenght = len(my_list)
new_list = my_list.copy()
if idx < 0 or idx > lenght:
return (new_list)
else:
for i in list(range(lenght)):
if idx == i:
new_list[i] = element
return (new_list)
| true |
725608bf217dea38d8af4e406b60be6b1bcf4e04 | tgteacher/numerical-methods-a2 | /a2.py | UTF-8 | 8,078 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
from numpy import array, arange
'''
NOTE: You are not allowed to import any function from numpy's linear
algebra library, or from any other library except math.
'''
'''
Part 1: Warm-up (bonus point)
'''
def spaces_and_tabs():
'''
A few of you lost all their marks in A1 because the... | true |
8f361afdaac2a7fa1b758f6401012279a98515b4 | scottwedge/MOCK | /random_gen.py | UTF-8 | 704 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
# Generate random number
# Imports
import random
# Constants
MAX = 1000
def get_random(min, max):
r = random.randint(min, max)
return r
def get_rand_min():
min = random.randint(1, MAX/2) # return value between 1 and MAX/2
return min
def get_rand_max(min):
max = random.ra... | true |
83772e3d5016c2529856b34180f9fd5bd1c72db3 | StefanSebastian/SkinDetectionInImages | /licenta/experiments/color_spaces/colorspace_conversion.py | UTF-8 | 383 | 3 | 3 | [] | no_license | import cv2
def convert(image, colorspace):
"""
Convert RGB image to the given colorspace
:param image:
:param colorspace:
:return:
"""
if colorspace == 'HSV':
return cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
elif colorspace == 'YCrCb':
return cv2.cvtColor(image, cv2.COLOR... | true |
02f2d35da7b5166489161df76894603633d3f145 | cohend2012/Turtlesim_ROS_Projects | /TestingBackup.py | UTF-8 | 19,352 | 3.125 | 3 | [] | no_license | # Makeing the robot move foward and back
# Dan Cohen
# 1/21/21
#
#
###############################
# Makeing the robot move foward and back
# Dan Cohen
# 1/21/21
#
#
###############################
import rospy
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
from math import pow,atan2,... | true |
a07b254e70db6f27ceee43513434c2d0384d2e0c | dielsalder/ksh | /split.py | UTF-8 | 1,921 | 2.59375 | 3 | [] | no_license | import scipy.optimize as sp
import pdb
import dna
import ksh
class Split(pdb.Dna):
def __init__(self, Dna):
self.atoms = Dna.atoms
self.res_all = {}
self.angles_all = {}
self.set_numbp()
def split(self, ibp):
"""Split helix at base pair ibp"""
self.i_split = ibp... | true |
4d753d807dbb4bb1b43eae391dafbf853919558a | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc017/B/4899968.py | UTF-8 | 151 | 3.15625 | 3 | [] | no_license | x = input()
a = ["ch", 'o', 'k', 'u']
for a_ in a:
x = "".join(x.split(a_))
if len(x) == 0:
ans = "YES"
else:
ans = "NO"
print(ans) | true |
6cb1b6ac20a41b12c8296dc4db664b2b509b29f3 | diegopnh/AulaPy2 | /Aula 07/Ex008.py | UTF-8 | 168 | 3.546875 | 4 | [] | no_license | a = float(input('Descreva a medida em (m): '))
x = a * 100
y = a * 1000
print('O resultado em centímetros é {:.0f} e o resultado em milimetros é {:.0f}'.format(x,y)) | true |
4523391a67b3e02bdd4ae4156124a0a376b4601f | OnlyKnowALittle/Screen_Read | /Portfolio.py | UTF-8 | 1,005 | 3.671875 | 4 | [] | no_license | #A list of my stocks
#Using JSON to save data and retrieve/read
import pandas as pd
import json
#Creating JSON Data via Lists of Dictionaries
stock = [
{"Name":"Gamestop", "Ticker":"GME", "Shares" :4, "Price": 349.85, "Cost": 1399},
{"Name":"AMC", "Ticker":"AMC", "Shares" :120, "Price": 14.30, "Cost": 1716},... | true |