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 |
|---|---|---|---|---|---|---|---|---|---|---|
d84614b2d572618b5ed3c73d48677704cbe8caa6 | JAbrantesRadiology/PythonCrashCourse | /motorcycles.py | UTF-8 | 837 | 3.9375 | 4 | [] | no_license | motorcycles = ["honda", "yamaha", "suzuki"]
print(motorcycles)
#substituir elementos na lista
motorcycles[0] = "ducati"
print(motorcycles)
#adicionar elementos a lista
motorcycles.append('triumph')
print(motorcycles)
#podemos colocar elementos no local onde quisermos, sem eliminar outros
motorcycles.insert(2, "motoguzz... | true |
9ef36b0b33d5551fad6109b4d4e61c8be1c212de | RandallKayser/GR_Hydro | /vis/vis2d.py | UTF-8 | 939 | 2.734375 | 3 | [] | no_license | import matplotlib as mp
import matplotlib.pyplot as pp
import numpy as np
from itertools import islice
f = open("output/first_test.txt", 'r')
i = 0
frame = 0
time_now = 0
xcellnum = 25
ycellnum = 25
rhovals_at_time_t = [0] * xcellnum * ycellnum
def makeframe(i):
pp.clf()
string = "vis/frame" + (4 - len(str(i))) * ... | true |
afbc295a3cd4af550967f7b3523a6485a6189ae9 | maheshmj24/Fingerprint_Project | /finger.py | UTF-8 | 6,484 | 2.53125 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
import sys
<<<<<<< HEAD
=======
img1 = cv2.imread('./database/101_1.tif',0) # queryImage
img2 = cv2.imread('./database/103_2.tif',0) # trainImage
cv2.imshow("Input1",img1)
cv2.waitKey(0)
cv2.imshow("Input2",img2)
cv2.waitKey(0)
>>>>>>> 796078eca4... | true |
afc673499edc018bf1f749d5adf336e63cb7d762 | gaofubao/algorithm019 | /Week_01/42_trapping-rain-water.py | UTF-8 | 935 | 3.71875 | 4 | [] | no_license | # 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。
# https://leetcode-cn.com/problems/trapping-rain-water/
class Solution1:
"""
单调栈
"""
def trap(self, height) -> int:
length = len(height)
if length < 3: return 0
res, idx = 0, 0
stack = []
while idx < length:
... | true |
5efe78942317a5d693f57eeb4c97ddc369d25bd0 | jinkaido1/License-Plates-Recognition | /definitive.py | UTF-8 | 14,354 | 3.109375 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
import imutils
import tesserocr
from PIL import Image
import pytesseract
def scale_contour(contour, scale_factor):
"""Scales a given contour keeping its coordinates
Args:
contour (nparray): OpenCV contour to scale.
scale_factor (float): Scaling factor... | true |
10796c2e90057c3fafcaa54285425774739c4714 | Activity00/Python | /Intrtoalgorithms/反转整数.py | UTF-8 | 731 | 3.3125 | 3 | [] | no_license | # coding: utf-8
"""
@author: 武明辉
@time: 2018/7/1 17:56
"""
from utils import time_this
"""
反转整数不使用第三方库
"""
@time_this()
def reverse_int0(num):
num_list = list(str(num))
num_list.reverse()
return ''.join(num_list)
@time_this()
def reverse_int(num):
tmp = []
while num // 10 > 0:
tmp.ins... | true |
e8993cec85bfa6e517b769924e757623446ac41d | thesloppyguy/ML | /1Regression/p_reg.py | UTF-8 | 1,537 | 3.46875 | 3 | [] | no_license | from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv("DATA/Position_Salarie... | true |
c91b683a03dc4c959720574bd3baa3f9d0f4790a | dgmiller/tonight_show_hashtags | /streamer/streamer2.py | UTF-8 | 939 | 2.703125 | 3 | [] | no_license | # Collect Twitter data from the Tonight Show starring Jimmy Fallon
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import json
import os
# Authentication tokens and keys
ckey = "3dKkKQNv4IhDRYTAq6yGuMb8t"
csecret = "jnKsBAXm0dFlKDRasTmu2Y34eBT3EUSdj6YkFRaj4b290vP... | true |
5a8aa71a84bbbfd61999ed9ff4659f2c8dbf73b2 | jakelever/blah4 | /predict_classiclinkprediction.py | UTF-8 | 3,070 | 2.890625 | 3 | [
"MIT"
] | permissive | import argparse
import itertools
import random
import sys
import networkx as nx
import LinkPrediction
from collections import defaultdict
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Make link predictions using the RESCAL ALS algorithm')
parser.add_argument('--trainingData',required=True... | true |
b54f21e22876459dc9bda219cd1e8c0ab9970752 | timverlaan/programmeren | /Homework/Week_3/convertCSV2JSON.py | UTF-8 | 747 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
"""Universal CSV to JSON converter with scalability options"""
__author__ = "Tim Verlaan 11669128"
import csv
import json
def convert():
"""Convert CSV file to JSON file"""
# Open the CSV
f = open( 'data_april1.csv')
# Change each fieldname to the appropriate f... | true |
6987faeeceae11283f8de9205efa492be8ece8fa | VincentGaoHJ/Automatic-Taxonomy-Generation-based-on-Graph-Representation | /generateTree.py | UTF-8 | 12,515 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Date: Created on 2019/7/10
@Author: Haojun Gao
@Description:
"""
import os
import csv
import json
import time
import datetime
import pandas as pd
from visualize import visualize
from paras import load_init_params
class DisjointSet(dict):
"""
不相交集
"""
def add(self, item)... | true |
dd3ee3758b200db5b3b130bd6dd741293c6fa1f8 | edu-athensoft/stem1401python_student | /sj200116_python2/py200430/func_args_2.py | UTF-8 | 246 | 3.578125 | 4 | [] | no_license | """
function argument
"""
def product(a, b):
return a * b
# case 1: missing arguments
# result = product(2)
# print("result is {}".format(result))
# case 2: extra arguments
result = product(2,3,10)
print("result is {}".format(result))
| true |
ad7db334bf9a0939654fd53a8f1086f226dcfed3 | asdlei99/OpenCppTest | /opencpptest_0.1.py | UTF-8 | 577 | 3.171875 | 3 | [] | no_license | #coding:UTF-8
"""test1.c样本
#include<stdio.h>
void test1(int x1, int x2){
if(x1 > x2)
if(x1 >= 10)
if((2 * x1 + x2) == 40)
if((x1 - x2) == 5)
printf("Solved!");
}
"""
from z3 import *
x1 = Int('x1')
x2 = Int('x2')
solve(x1 > x2, x1 >= 10, (2 * x1 + x2) == 40,... | true |
51682dd13be8692328cd18d3074c56ced0d9bf5a | mathigatti/CellularAutomataClustering | /more/3D/mandelbulb.py | UTF-8 | 3,910 | 3.203125 | 3 | [
"MIT"
] | permissive | import math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import random
# Constantes
alpha = 30
def sen(grados):
return math.sin(math.radians(grados))
def cos(grados):
return math.cos(math.radians(grados))
def toIsometric2D(coords):
x = coo... | true |
6956e34393568e2b3197aee17da61c855a850df4 | mlnance/JHU_Class_Material | /comp_prot_pred_and_des/TRP_to_sugar_project/residue_to_sugar_feature_calc.py | UTF-8 | 20,476 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
'''
TODO: make this work on a directory of pdb structs and write to one df
have to change how data gets added to df? dictionaries are instantiated when needed
maybe make all dicts in the beginning before for loop and then add to them continuously
store pdb name in the df too
clarify intent of gettin... | true |
c1174abf9cba70ec90e6f06ba1ef620ea793d2c8 | adhamu/learn-python | /scripts/lists.py | UTF-8 | 261 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
# lists
colours = ['red', 'blue', 'green']
print(colours)
print(colours[0])
print(len(colours))
# dicts
dict = {}
dict['a'] = 'apple'
dict['b'] = 'ball'
dict['c'] = 'cat'
dict['d'] = 'dog'
print(dict)
print(dict['a'])
print(len(dict))
| true |
10d6240e924eb7fa666c470c51c20bd5527522f4 | dtoma95/converting_rs_legal_acts_to_akoma_ntoso | /form_akoma/AkomaBuilder.py | UTF-8 | 4,085 | 2.609375 | 3 | [] | no_license | from tokenizer.patterns import is_vrsta_akta
from tokenizer.TokenType import TokenType
import xml.etree.ElementTree as ET
PREFIX = "{http://www.akomantoso.org/2.0}"
class AkomaBuilder():
def __init__(self, akomaroot):
ET.register_namespace('', "http://www.akomantoso.org/2.0")
self.akomaroot = a... | true |
2b7db3f1b7948e551b1fdaa505e23772b3355e81 | moonseokho85/baekjoon | /2675.py | UTF-8 | 310 | 3.90625 | 4 | [] | no_license | ''' Repeating Characters '''
T = input()
for i in range(int(T)):
S = input()
# Split the string
S = S.split()
# Setting the repeat variables
R = S[0]
# Setting the paragraph variables
P = ""
for j in range(len(S[1])):
P += S[1][j] * int(R)
print(P) | true |
91ec066d62f1cd0206deb8295e72213ddd7d900c | zqureshi/vocab | /source.py | UTF-8 | 1,410 | 3.03125 | 3 | [
"MIT"
] | permissive | import logging
import requests
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
def fetch_page(url):
"""Given a URL returns a BeautifulSoup object of its contents"""
logger.debug('fetching page ' + url)
request = requests.get(url)
if request.status_code != 200:
raise Excep... | true |
ca85682aeb9d629d84bb6eccf19307c123890a2c | themap/themap | /common/filter_outliers.py | UTF-8 | 846 | 3.109375 | 3 | [] | no_license | import math
def filter_outliers(data,value_fn,threshold=1.5):
data_length = len(data)
if data_length <= 4:
return data
data = sorted(data, key=value_fn, reverse=False)
q1 = 0
q3 = 0
if ((data_length / 4) % 1) == 0:
q1 = 1 / 2 * (value_fn(data[math.floor(data_length / 4)]) + val... | true |
c3734edcf21795e4ecb6356d54b48e15842442b6 | CVL-dev/StructuralBiology | /EMAN2/2.06/lib/filter.py | UTF-8 | 31,202 | 2.796875 | 3 | [] | no_license | #!/usr/local/eman/2.06/Python/bin/python
# Author: Pawel A.Penczek, 09/09/2006 (Pawel.A.Penczek@uth.tmc.edu)
# Copyright (c) 2000-2006 The University of Texas - Houston Medical School
#
# This software is issued under a joint BSD/GNU license. You may use the
# source code in this file under either license. However, not... | true |
90bb8533bef2e9151dfe218a06b93b08b9e911d6 | PKlimo/CryptoChallenge | /set3/ch19/solver.py | UTF-8 | 1,633 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
from __future__ import print_function
import binascii
import sys
from colorama import Fore, Style
def show(blok, keys):
for i in range(0, len(blok)):
for j, znak in enumerate(blok[i]):
if j < len(keys):
print("{}".format(chr(znak ^ keys[j])), end="")
... | true |
5ee8e97c9015d8150459ac3a9b8dc65b424b6abc | Q1ianxiao/LOL-yunding | /action.py | UTF-8 | 1,226 | 3.0625 | 3 | [] | no_license | import pyautogui
import win32api
import win32con
from random import randint
from random import random
# --------------------------------基础动作-------------------------------------
# 左击
def leftClick(x, y):
pyautogui.moveTo(x + randint(0, 10), y + randint(0, 10), duration=random())
pyautogui.click(x, y, button='... | true |
acb8153bdfc51f73da703dbe163a5129b72fa746 | AlexFisun/AI_Bidding_System | /split_cluster_columns.py | UTF-8 | 530 | 2.5625 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv("~/Downloads/broadterms_cpcOnly_120_desktop_clustered (1).csv")
clustered_kws = df['Clustered Words'].apply(lambda x: x.split(','))
clusters_df = pd.DataFrame(columns= ['kwd', 'clusterd_kws'])
i, j = 0, 0
for kwd in df['Unnamed: 0'].values:
for cw in clustered_kws[j]:
... | true |
50591a77074e1932b39a3abc7a369f701b9ff8d1 | wpy-111/python | /Spider/day05/07_thread.py | UTF-8 | 250 | 3.09375 | 3 | [] | no_license | """
多线程实例
"""
from threading import Thread
list = []
#线程1
def f1():
print("我是发1")
t = Thread(target=f1)
t.start()
for i in range(0,5):
t = Thread(target=f1)
list.append(t)
t.start()
for i in list:
i.join() | true |
25b79b3e8ef70def365cceff0bf2fc0f09485e67 | tsharanya18/Python | /basics/printformats.py | UTF-8 | 155 | 4.40625 | 4 | [] | no_license | name = input("Enter a name: ")
age = input("Enter a age: ")
print("Hello, " + name + "! You are " + age)
print("Hello, {}! You are {}".format(name, age))
| true |
d75adee974956c46d6d3c51af422429b66932827 | mlololoer/midi-to-disklavier | /scriptwithGUI.py | UTF-8 | 19,275 | 2.875 | 3 | [] | no_license | from mido import MidiFile
import mido
from tkinter import *
#from tkinter import scrolledtext
from tkinter import messagebox
from tkinter.filedialog import askopenfilename
#Created by Hyun Joon Jeong. Aug 2020
#Updated July 2021
# Added pedal command offsets
# Added better logic for solving overlapped note... | true |
479ba0a1f27acef916089722a8b7d9985311b59e | langlang0/data_structure | /001排序/计数排序.py | UTF-8 | 836 | 3.65625 | 4 | [] | no_license | from typing import List
def countsort(nums: List):
# 列表去重
ilist = []
for i in nums:
if i not in ilist:
ilist.append(i)
# 列表排序
ilist.sort()
# 新建字典,接收值及对应个数
dic = {}
for i in ilist:
dic[i] = nums.count(i)
# 新建空列表,遍历字典,追加元素
res = []
for k, v in dic.... | true |
819147fd8beb92e0e995318d83cda7a87620664f | mtaziz/scrapy-example-spiders | /finest-se-spider/finest_spider/utils/sample_selenium.py | UTF-8 | 1,130 | 2.640625 | 3 | [] | no_license | def parse(self, response):
# selenium part of the job
self.driver.get('http://www.italki.com/entries/korean')
while True:
more_btn = WebDriverWait(self.driver, 10).until(
EC.visibility_of_element_located((By.ID, "a_show_more"))
)
more_btn.clic... | true |
afa847c6b24f57754aa3486a4cd7440f0ff3e19e | jonghocook/Archive | /python/03_영어단어맞추기게임/start.py | UTF-8 | 1,178 | 4.0625 | 4 | [] | no_license | import random
wordsDict = {
"사자": "Lion",
"호랑이": "Tiger",
"새": "Bird",
"비행기": "Airplane",
}
words = []
for word in wordsDict:
words.append(word)
#wordsDict라는 딕셔너리에서 word는 하나의 객체를 뜻하고 Key값많을 가리킨다. wordsDict딕셔너리 안에 있는 모든 Key값을 words리스트안에 append()함수를 써서 넣게된다.
random.shuffle(words)
#랜덤안에 셔플함수로 words... | true |
f0ca1266b635e9b9e0ec62c88275128d11f2554f | boini-ramesh408/Datastructures_programs | /calandar.py | UTF-8 | 1,389 | 3.75 | 4 | [] | no_license | from Datastructures.com.bridgelabz.datastructures.Utility import Calander
def calandar_program(): #this function is used for printing the calendar in 2D array
global month, year
cal = Calander()
while True:
try: # this block is used to handle the exception
month = int(input("Enter Mon... | true |
3b52363ec2794269b7864d039acda6157b0dc33e | Aasthaengg/IBMdataset | /Python_codes/p03962/s136058395.py | UTF-8 | 164 | 3.015625 | 3 | [] | no_license | x=list(map(int,input().split()))
x.sort()
if (x[0]==x[1])or(x[1]==x[2]):
if x[0] == x[1] == x[2]:
print(1)
else:
print(2)
else:
print(3) | true |
13634d4c382a1f411879919253607b27e4dc2067 | hbluan/kartemap | /testing.py | UTF-8 | 1,585 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 20:04:14 2020
@author: simon
"""
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objects as go
fro... | true |
98979e69783d8cbbee9c7bc30f837780e05f0867 | dmwm/DLSAPI | /Client/Tests/FunctionalTestSuite/lfc_del_dir.py | UTF-8 | 9,786 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# lfc_del_dir.py
# 11/05
# Author: Antonio Delgado Peris. CERN, LCG.
"""
This module provides functions and a command line tool to delete directories
in an LFC catalog, including the contained LFNs and associated replicas, if
specified.
These methods do not check if a physical file is asso... | true |
2e6b0b2e4f3ea6bd3d54c6f7dd02f1c5323e90d0 | maestrojeong/VAE-for-CIFAR10 | /generator.py | UTF-8 | 2,518 | 2.75 | 3 | [] | no_license | import os
from scipy.misc import imsave
from utils import merge
import numpy as np
class Generator(object):
def update_params(self, input_tensor):
'''Update parameters of the network
Args:
input_tensor: a batch of flattened images
Returns:
Current loss value
... | true |
5640a4162a48babd062bce5bfd682d789a9d0e19 | jmariscal-harana/segmentation_QC | /scripts/utils.py | UTF-8 | 1,342 | 2.765625 | 3 | [] | no_license | import os
import numpy as np
import pandas as pd
def find_patient_date_folders(path_DICOM_formatted):
patient_folders = sorted([fname for fname in os.listdir(path_DICOM_formatted) if (not fname.startswith('.') and os.path.isdir(os.path.join(path_DICOM_formatted, fname)))])
patient_date_folders = []
... | true |
1f3058e8bb8f2a1e4d01b2f00cfb55a74cd68956 | simonseo/poododger | /poododger.pyde | UTF-8 | 18,923 | 2.71875 | 3 | [] | no_license | add_library('sound')
add_library('minim')
import os
import time
import random
path = os.getcwd()
class Game:
def __init__(self, width, height, ground):
self.width = width
self.height = height
self.ground = ground
### player init: x_pos, ground, hygienelvl, radius ###
self... | true |
650984b1924c9d73d7cb4003078b9b0574f0df1c | obassett/twitter-analysis | /pull-twitter.py | UTF-8 | 8,265 | 2.703125 | 3 | [] | no_license | # Pull Twitter Data and push into kinesis.
from TwitterAPI import TwitterAPI
from TwitterAPI import TwitterRequestError
from TwitterAPI import TwitterConnectionError
from botocore.exceptions import ClientError
from botocore.exceptions import ConnectionError as awsConnectionError
import re
import json
import boto3
im... | true |
22bf12ff2ad2b2ae001b0096e6949ba013980155 | kahnadam/IntroML | /Proj7-Outliers/outlier_cleaner.py | UTF-8 | 765 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
def outlierCleaner(predictions, ages, net_worths):
"""
Clean away the 10% of points that have the largest
residual errors (difference between the prediction
and the actual net worth).
Return a list of tuples named cleaned_data where
each tuple is of the ... | true |
8d5a25dde0004e46bb1c4ce648ac86496c03e962 | Zeldyy/exercicios-python-cursoemvideo | /Exercícios Python/ex062.py | UTF-8 | 403 | 3.953125 | 4 | [
"MIT"
] | permissive | print('Programa que lê os 10 primeiros termos ou mais de uma Progressão aritmética.')
p = int(input('Primeiro termo: '))
r = int(input('Razão: '))
c = 1
termos_extras = 1
soma = 10
while termos_extras != 0:
print('{}º Termo: {}'.format(c, p + (c-1)*r))
c += 1
if (c-1) == soma:
termos_extras = int(in... | true |
f67696e49e12ca9a0fbca1d78972761d16db1b41 | ZCW-Data1dot2/python-basic-stats-amanda-wink | /statzcw/zcorr.py | UTF-8 | 493 | 2.765625 | 3 | [
"MIT"
] | permissive | import statzcw
from statzcw import zcount
from statzcw import zmean
from statzcw import zstddev
def correlation(listx, listy):
num = 0
sample = zcount.count(listx)
x_mean = zmean.mean(listx)
y_mean = zmean.mean(listy)
s_x = zstddev.st_dev(listx)
s_y = zstddev.st_dev(listy)
for i in range(le... | true |
9f74bbd9ea5c22befca86526508ab5f0c7f79cf9 | theclairecamp/ABCDReproNim_Project | /cleanABCDdf.py | UTF-8 | 13,897 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# First load in container for python analysis below.
# -
# Start python analysis - First collapse all txt files from the ABCD 3.0 data release into one dataframe, with no duplicates:
# -
#
# Code below is adapted from the ABCD ReproNim Course created by James Kent https://github... | true |
8d4a91633dd90d9e1dd1462f3ed1761727583683 | shankar7791/MI-10-DevOps | /Personel/Harshalm/Python/25Feb/Prog1.py | UTF-8 | 283 | 4.03125 | 4 | [] | no_license | #Write a Python program to add two positive integers without using the '+' operator.
num1 = int(input("Enter first number :-"))
num2 = int(input("Enter second number :-"))
while num2 != 0 :
sum = num1 & num2
num1 ^= num2
num2 = sum << 1
print("Adiitionn is :-", num1)
| true |
f22b677dea4186d7db884bcfe18c2676cb43ba7b | keshan-spec/COVID19-API | /main.py | UTF-8 | 3,213 | 3.03125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import sys
import json
URL = "https://www.worldometers.info/coronavirus/"
def run():
return BeautifulSoup(requests.get(URL).content, features="html.parser")
def get_updates():
soup = run()
infect_count = soup.find_all("div", {"class": "maincounter-number"})... | true |
db455b45df1f160c9ac641f01199bad7dbfc8e63 | speedcell4/CoPL-Py | /ReduceNatExp/rule.py | UTF-8 | 6,098 | 2.578125 | 3 | [] | no_license | import logging
from typing import List
from EvalNatExp.rule import PlusIs, TimesIs
from Nat.rule import PZero, PSucc, TZero, TSucc
from ReduceNatExp.data import Exp, ExpNat, ExpPlus, ExpTimes
from bases.derivation import Assertion, Rule, System
from bases.util import type_checking
class Reduce(Assertion):
def __... | true |
f29c2a95e6fd6b4311c9eea15ce98a7178842016 | kuolunwang/Deep-Learning-and-Practice | /Lab5/dataset/dataset.py | UTF-8 | 2,047 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
from torch.utils.data.dataset import Dataset
from .converter import Converter
import torch
from torch.nn.utils.rnn import pad_sequence
class WordDataset(Dataset):
def __init__(self, mode):
self.converter = Converter()
self.__readdata(mode)
self.max_length = self.get_m... | true |
23c42208eaa93f6b7a6935553ae6833f0fe2c746 | oconorr3/ML-Disk-Load-Balancing | /config.py | UTF-8 | 6,249 | 2.671875 | 3 | [] | no_license | """
Machine learning configuration file.
"""
from sklearn.preprocessing import *
from sklearn.neural_network import *
from sklearn.linear_model import *
# Define size classes for disk I/O sizes:
def size_classes(size):
"""
Definitions of size classes:
2048 >= size => 0 -> 'small'
4096 >= size ... | true |
4d3f436a722328d381a127cee7a4fc68a3c61e06 | johl/nlqa | /nlqa.py | UTF-8 | 3,859 | 3.03125 | 3 | [
"MIT"
] | permissive | import spacy
import requests
import json
def extract_entities(question, language="en"):
"""
Extract item and property out of question.
Process question. We assume the token with part of speech marker 'NOUN'
to be the property and token with pos marker 'PROPN' to be the item of
the query.
Par... | true |
60d3187907193b43937998131d988db90593cf6e | Epicord/epicord-bot | /cogs/language.py | UTF-8 | 3,060 | 3.171875 | 3 | [
"MIT"
] | permissive | # NOQA
import asyncio
import requests
from xml.etree import ElementTree
from itertools import islice
from discord.ext import commands
class Language:
"""Dictionaries & other word things."""
def __init__(self, bot):
"""Cog constructor."""
self.bot = bot
@commands.command()
async def d... | true |
895097756db22dff75cd2c96df7f99c8068fb917 | DUDA18/ProgISD20202-1 | /Jade/Aula4/aula4.py | UTF-8 | 2,882 | 4 | 4 | [] | no_license | '''
logicValue = int(input("Você é uma pessoa inteligente?\n"))
if(logicValue):
print("Não deixe o trabalho para depois!\n")
logicLazy = int(input("Você é uma pessoa Preguiçosa?\n"))
logicInteligent = int(input("Você é uma pessoa inteligente?\n"))
if(logicLazy and not logicInteligent):
print("Você é pr... | true |
eb3cc4432ccd607407b55ac2188740037f944491 | Will-is-Coding/exercism-python | /grains/grains.py | UTF-8 | 92 | 2.90625 | 3 | [] | no_license | def on_square(num):
return 2 ** (num - 1)
def total_after(num):
return 2**num - 1
| true |
3d16ff5ec75ed3258ac044f27a3bcf7b609d7ad8 | JRArrington/CoffeeMachine | /main.py | UTF-8 | 4,723 | 3.234375 | 3 | [] | no_license | import math
from data import menu
from data import resources
money = 0
espresso_cost = float(menu['espresso']['cost'])
latte_cost = float(menu['latte']['cost'])
cappuccino_cost = float(menu['cappuccino']['cost'])
refund = 0
water = resources['water']
milk = resources['milk']
coffee = resources['coffee']
# Check reso... | true |
d724b33238c4bddb94339595fb6b62ace5b5bf80 | wangyendt/LeetCode | /Contests/301-400/week 311/2415. Reverse Odd Levels of Binary Tree/Reverse Odd Levels of Binary Tree.py | UTF-8 | 2,317 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author: wangye(Wayne)
@license: Apache Licence
@file: Reverse Odd Levels of Binary Tree.py
@time: 2022/09/18
@contact: wang121ye@hotmail.com
@site:
@software: PyCharm
# code is far away from bugs.
"""
from typing import *
import collections
import sys
sys.pa... | true |
909f0737e1e2269337e0e0f159f4864927bf658a | mathsn/futuquant | /futuquant/myProFiles/tradeByMacd.py | UTF-8 | 8,939 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
验证接口:下单然后立即撤单, 为避免成交损失,买单价格港股放在十档,美股为一档下降10%, 买单数量为1手(美股为1股)
"""
from time import sleep
import sys
import os
from futuquant.myProFiles import stockData
sys.path.append(os.path.split(os.path.abspath(os.path.pardir))[0])
from futuquant.open_context import *
'''
验证接口:下单然后立即撤单, 为避免成交损失,买单价... | true |
bbb02ccf1fd877978a255440d1defc5a6999d2ef | abhi7000/PROGRAM | /programs/chocolate_birhtday.py | UTF-8 | 376 | 3.484375 | 3 | [] | no_license | def birthday(s, d, m):
count=0
if(m>1 and (len(s)>=1) and m<=len(s)):
for i in range(len(s)-(m-1)):
curr=s[i]
for j in range(1,m):
print(i,end="")
curr+=s[i+j]
if(curr==d):
print("added",i)
count+=1
else:
if(s[0]==d):
count+=1
return count
s=[2,5,1,3,4,4,3,5,1,1,2,1... | true |
d80f5bad7e0fa4a505480bc6a7099c06876336f4 | YvesAugusto/clustering-redistribution | /clustering/clustering.py | UTF-8 | 3,677 | 2.5625 | 3 | [] | no_license | from sklearn.preprocessing import LabelEncoder
from clustering-redistribution.clustering.functions import *
import numpy as np
import logging, pickle, time
logging.getLogger('matplotlib').setLevel(logging.WARNING)
def train_cluster(n_clusters=None):
# initializing
start_timestamp=time.time()
dataset=load_f... | true |
e6d1b3bcd490799ad46be29c6bb096280de059dc | Pashton/TrentML | /SPAF_Hybrids/graphingUtility.py | UTF-8 | 2,812 | 2.828125 | 3 | [] | no_license | """
This tutorial introduces stacked denoising auto-encoders (SdA) using Theano.
Denoising autoencoders are the building blocks for SdA.
They are based on auto-encoders as the ones used in Bengio et al. 2007.
An autoencoder takes an input x and first maps it to a hidden representation
y = f_{\theta}(x) = s(Wx+b),... | true |
61d2dded0e6f2a7ca9f391add444c56292628530 | fuyuanlyu/CS239-data-visualization-project | /data.py | UTF-8 | 3,325 | 2.90625 | 3 | [] | no_license | import csv
import os
readfile_name = 'hydata_swjl_0'
read_name = readfile_name + '.csv'
write_name = readfile_name + '_new.csv'
# 读取csv
csvFile = open(read_name, "r")
reader = csv.reader(csvFile)
# 写入csv
#csvFile2 = open(write_name, "wb")
#writer = csv.writer(csvFile2)
fileHeader = ["PERSONID","SITEI... | true |
8d864569005225d70e504ee2c0f461806b3013c0 | wenjixin/pyspark_example | /1.5.1/streaming/word_count.py | UTF-8 | 474 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
# create a streamingcontext
sc = SparkContext(appName='test')
ssc = StreamingContext(sc, 10)
lines = ssc.socketTextStream('127.0.0.1', 9999)
words = lines.flatMap(lambda line: line.split(" "))
pairs = words.map(la... | true |
047b20385914a1498c6dff1ff890f07732730689 | Kiwitiki/Jimmy | /tiles.py | UTF-8 | 6,070 | 3.5625 | 4 | [] | no_license | import items
import textwrap
import clinical
########################################## Starting tiles ########################################
class MapTile:
def __init__(self, x, y):
self.x = x
self.y = y
def intro_text(self):
raise NotImplementedError()
def modify_player(self, ... | true |
f05d4ead209310cc3a3ad28b57e601f070a64281 | mayanbhadage/LeetCode | /518.CoinChange2/coin_change_2_bottom_up.py | UTF-8 | 591 | 2.65625 | 3 | [] | no_license | class Solution:
def change(self, amount: int, coins: List[int]) -> int:
dp = [[-1] * (amount + 1) for _ in range(len(coins) + 1)]
for c in range(len(dp[0])):
dp[0][c] = 0
for r in range(len(dp)):
dp[r][0] = 1
for i in range(1, le... | true |
9683140645c3e8e7f9752235876e29c9600475cd | oshaughn/research-projects-RIT | /MonteCarloMarginalizeCode/Code/RIFT/interpolators/BayesianLeastSquares.py | UTF-8 | 9,944 | 2.578125 | 3 | [
"MIT"
] | permissive | #!
#
# REFERENCES
# util_ManualOverlapGrid.py
# 20160906-Pankow-ProgressPortingNRVariantToMaster/util_ManualOverlapGrid.py
#
import scipy.linalg as linalg
import numpy as np
def fit_quadratic(x,y,x0=None,variable_symmetry_list=None,gamma_x=None,prior_x_gamma=None,prior_quadratic_gamma=None,verbose=False,n_digi... | true |
ef90a14bcf5a5c867787f98219b1471f0b5bda89 | Rzar8767/trivago-RecSys-Challenge-2019-fun | /split_data_preparation.py | UTF-8 | 5,980 | 2.984375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import gc
from tqdm.auto import tqdm
def save_small_set(df):
shrink_set(df, "small_set", int(len(df) * 0.01))
def save_medium_set(df):
shrink_set(df, "medium_set", int(len(df) * 0.2))
def save_large_set(df):
shrink_set(df, "large_set", int(len(df) * 0.4), )
# S... | true |
a1f7de75bea4801c02b09ff6f38eca8a8b54f806 | frances-zhao/ICS207 | /homework/lesson 16/lesson16b_3.py | UTF-8 | 1,712 | 4.375 | 4 | [] | no_license | # *****************************************************
#
# Program Author: Frances Zhao
# Completion Date: May 19 2021
# Program Name: lesson16b_3.py
# Description: Write a program which takes a list of strings and sorts it alphabetically.
# Challenge: Have it sorted alphabetically except all entries that start with “... | true |
dc9e873164e0410d37c2ad582d3263e4650a7fb2 | KevyVo/wfh-security-system | /test/DB/unix.py | UTF-8 | 640 | 2.765625 | 3 | [] | no_license | import boto3
from boto3.dynamodb.conditions import Key
from datetime import datetime
#Complete the query table, in acsending order
def query_dates(date, dynamodb=None):
if not dynamodb:
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('SmartLogs')
response = table.query(
KeyCo... | true |
37e2f8fd4350895fe1a9b8177921ad4051899b71 | enzomaneira/Python | /Calculadora.py | UTF-8 | 276 | 3.734375 | 4 | [] | no_license | """
Calculadora Básica
"""
def calculadora(num1, num2, op):
if op == '+':
return num1 + num2
if op == '-':
return num1 - num2
if op == '/':
return num1 / num2
if op == '*':
return num1 * num2
print(calculadora(742, 90, '+')) | true |
e9f0cead0c9f3da296076ff7f08103befc9f23a1 | cmehl/ai_reacting_flows | /ai_reacting_flows/tools/utilities.py | UTF-8 | 15,871 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 12:22:15 2019
@author: mehlc
"""
import sys
import numpy as np
from scipy.stats.kde import gaussian_kde
import cantera as ct
import oyaml as yaml
import copy
#==============================================================================
# COM... | true |
65ea686d96e8ba4be6695301f9555ad3d2cd899f | c0ns0le/HackBulgaria | /week01/week01_03/p06_theGroupFunction.py | UTF-8 | 763 | 3.609375 | 4 | [] | no_license | def group(items):
answers = []
tempArr = []
for x in range(0, len(items)):
# Out of bounds stoper
if x == len(items) - 1:
break
# Last elements case
if x == len(items) - 2:
tempArr.append(items[x])
answers.append(tempArr)
# Same e... | true |
1bf37a4443f25b64ec9ba040a57c68769459f1b7 | JingyiHU/Hadoop_and_Map_reduce_Udacity | /Final_Project/Top_Tags/reducer.py | UTF-8 | 725 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import sys
import csv
import operator
reader = csv.reader(sys.stdin, delimiter='\t', lineterminator='\r\n')
writer = csv.writer(sys.stdout, delimiter='\t', quotechar = '"', quoting = csv.QUOTE_ALL)
rev_tab = dict()
oldnodeid = None
for line in reader:
if (line != None) and (len(line) == 3):
no... | true |
89a41ab7be576609fd1be4e6c4c4ade33a19f85d | meniscus/AtCoder | /ABC/ABC154/B.py | UTF-8 | 49 | 2.828125 | 3 | [] | no_license | S = input()
out_str = 'x' * len(S)
print(out_str) | true |
70888f90399e5004e735e09a916c2da316ba8415 | php-phat13/ph-tbu-i-2 | /phát1.py | UTF-8 | 895 | 3.390625 | 3 | [] | no_license | #Lập chương trình thực hiện công việc sau:
# Nhập ba số a, b, c bất kì từ bàn phím
# Giải nghiệm phương trình bậc 2: ax^2 + bx + c = 0
#(Kể cả trường hợp a=0)
print("giai phuong trinh bac 2: ax^2 + bx + c =0")
a = float(input("nhap a:"))
b = float(input("nhap b:"))
c = float(input("nhap c:"))
import m... | true |
e1c73ec7a43eed0ce318c860b1c799661facff61 | inesusvet/pyclub | /problems/last_one.py | UTF-8 | 311 | 3.90625 | 4 | [] | no_license | def main(numbers):
"""
Given a list of zeroes and ones. Find index of the last one.
When there is no ones in the sequence, return -1
>>> main([1])
0
>>> main([0, 0, 0, 1])
3
>>> main([1, 1, 0, 0])
1
>>> main([1, 0, 0, 1])
3
>>> main([0, 0, 0, 0])
-1
"""
| true |
0e6a99e869f065339f56616bf016b434b33ea27e | gezer2/jroMI | /Grid2D.py | UTF-8 | 2,677 | 3.28125 | 3 | [] | no_license | """
Grid2D establishes a namespace to display
the covariances for each tx-ty in a 2-D grid
Usage :
import Grid2D as G2D
Gr2D = G2D.grid_2D
FigGrid = G2D.FigGrid
CovFigGrid = G2D.CovFigGrid
grid,tx,ty = Gr2D(dci,ns)
FigGrid(grid,dci,ns) # Optional
CovFigGrid(tx,ty,dr,Ne,h)
"""
from pylab import *
... | true |
2d01833ff19bad3aad72f1288c493d0f8f17d347 | DonaldY/MachineLearning-Practice | /com.donaldy/Regression/linear-regression/sklearn/sklearn_regression_practice.py | UTF-8 | 592 | 3.203125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Time : 7/29/2018 10:00 AM
# @Author : DonaldY
"""scikit-learn 线性回归拟合
"""
from sklearn.linear_model import LinearRegression
import numpy as np
import scipy
# 1. 定义数据集
x = np.array([56, 72, 69, 88, 102, 86, 76, 79, 94, 74])
y = np.array([92, 102, 86, 110, 130, 99, 96, 102, 105, 92])
# 2... | true |
5105c5c6b8fbb7dd99e807b74d500a809a1fa5da | calpaterson/missive | /missive/adapters/rabbitmq.py | UTF-8 | 3,549 | 2.609375 | 3 | [] | no_license | from typing import Any, Type, Sequence, MutableMapping
from logging import getLogger
from contextlib import ExitStack
import socket
import kombu
import missive
from missive.shutdown_handler import ShutdownHandler
logger = getLogger(__name__)
class RabbitMQAdapter(missive.Adapter[missive.M]):
def __init__(
... | true |
ab417391e8006f960130e1c55a391ac25afbd104 | masomel/py-import-analysis | /libs/Mailman/flufl/i18n/_substitute.py | UTF-8 | 551 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | """Substitutions."""
import string
from public import public
_missing = object()
@public
class Template(string.Template):
"""Match any attribute path."""
idpattern = r'[_a-z][_a-z0-9.]*'
@public
class attrdict(dict):
"""Follow attribute paths."""
def __getitem__(self, key):
parts = key.s... | true |
2b765aec193d67c8a8040f25fa932892ab4e423a | adocquin/RSA_Encryption | /RSA_Encryption.py | UTF-8 | 4,187 | 3.65625 | 4 | [
"MIT"
] | permissive | # encoding: utf-8
#Found phiden with p and q
def nphiden(p, q):
n = p * q
print("\nn = ", n)
phiden = (p - 1) * (q - 1)
return (n, phiden)
#Found pgcd with a and b
def pgcd(a, b):
while a != b:
if a > b:
a = a - b
else:
b = b - a
return a;
#Found e with p, q and ph... | true |
644f24fa3eeb724f31f32e47188cd4fe2e80202a | sandymahalo/pyes | /pyes/tests/geoloc.py | UTF-8 | 3,647 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for pyes. These require an es server with thrift plugin running on the default port (localhost:9500).
"""
import unittest
from pyes.tests import ESTestCase
from pyes import *
#--- Geo Queries Test case
class GeoQuerySearchTestCase(ESTestCase):
def setUp(sel... | true |
5131df405669eeecdcf44e5781dc1f16ce7b5494 | NicolauPinto/projeto | /cores .py | UTF-8 | 533 | 3.171875 | 3 | [] | no_license | import colorama
from colorama import Fore
carro = " __________\n | |__ \n |_(0)____(0)_| \n"
lista = []
ocupacao = [1,0,0,0,0,0,0,1,1,0,0,1,1,0,0]
i = 0
while i < 15:
lista.append(carro)
i = i + 1
colorama.init()
#print (Fore.GREEN + carro)
#print (Fore.GREEN + carro)
pos = 0
... | true |
e5fee344b8a1e043722af5d986858556aaf4444a | teddylew12/NIST_Measurements | /Code/Python/Resistance_Measurements/Beta/Live_Plot_Functions.py | UTF-8 | 4,840 | 2.5625 | 3 | [] | no_license | '''
Created at some point in the past
@author: Soroush
'''
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.Point import Point
import pyqtgraph as pg
import random
import sys
import numpy as np
import math
import IV_curve_v3 as iv
import matplotlib.pyplot as plt
import Input_Functions as inpfunc
... | true |
82d6dd26e5566f0ec8c0e0be7b49252ef6847da3 | irenedutta23/CPTLab_ThermalStudies | /Resistor_studies/compare.py | UTF-8 | 4,311 | 3.203125 | 3 | [] | no_license | # Functions of this script
# - Input 2 seperature versions of thermistors_time.py where two different data sets are analyzed
# - Plots comparis
import numpy as np
import matplotlib.pyplot as plt
import csv
import datetime
import math
from scipy import optimize
#---------------------------------------------------------... | true |
df2b8f1ebe54db197a6fb0fb8ab9a5eed84003b2 | thesombady/Fysc12 | /Gamma_Spectroscopy/lib/fittingFunctions.py | UTF-8 | 6,852 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
import csv ## for reading in our data files
import logging ## for orderly print output
import numpy as np ## for handling of data
import sys ## useful system calls (used to exit cleanly)
im... | true |
1ceebcc057d1e8df78136be4ce1fc6665fb769e5 | JohnOmernik/pimeup | /colorui/server.py | UTF-8 | 2,982 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import time
from dotstar import Adafruit_DotStar
import gevent.monkey
gevent.monkey.patch_all()
from flask import Flask, request, render_template, jsonify, make_response
from wtforms import Form, BooleanField, HiddenField, TextField, TextAreaField, widgets, SelectMultipleField, RadioField
import hash... | true |
a8781fe28b905816f8a2c5e3e16693816e586985 | Susensio/random | /add_n.py | UTF-8 | 1,133 | 3.265625 | 3 | [] | no_license | from tkinter import *
from random import randint
root = Tk()
root.title("ADD 1")
# tkFont.nametofont('TkDefaultFont').configure(family='Source Code Pro', size=150)
number = StringVar()
number.set("")
text = Label(root, textvariable=number, width=4, anchor=W, padx=50, font=('Source Code Pro', 150))
text.pack()
def ... | true |
74a1bab59e86d24e77e87a1a687aa845796c77f6 | snejDev/ElementaryCodes | /HackerRank/CavityMap.py | UTF-8 | 788 | 2.53125 | 3 | [] | no_license | a,s=[],''
n=int(input())
def accept():
global n,a
for x in range(0,n):
a.append("")
while(len(a[x])!=n):
a[x]=list((input().strip()))
for y in range(0,n):
a[x][y]=int(a[x][y])
#print(a)
accept()
for x in range(1,n-1):
for y in range(1,n-1)... | true |
bdc7cfbcd0bf9fd08235daf092d9b121e465693b | dltjrgks/Bigdata | /01_Jump_to_Python/Chap04/function_type.py | UHC | 1,016 | 3.59375 | 4 | [] | no_license | # coding:cp949
def my_sum1(num1, num2) : # Է, ϴ ̽
result = num1 + num2
return result # , Ͻ
def my_sum2(num1, num2) :
result = num1 + num2
print("%d + %d = %d"%(num1,num2,result))
def my_sum3() :
num1 = int(input("ù ° Էϼ : "))
num2 = int(input(" ° Էϼ : "))
result = num1 + ... | true |
0b6b7b6a958777511a90b8c07f2b68764eec6706 | jgerrish/nltk_ext | /pipelines/index.py | UTF-8 | 1,611 | 2.75 | 3 | [] | no_license | # The Index module builds an index of terms to documents
from nltk_ext.graph import Graph
from nltk_ext.pipelines.pipeline_module import enumModuleType, enumModuleProcessingType, PipelineModule
class Index(PipelineModule):
def __init__(self):
self.module_type = enumModuleType(enumModuleType.Document)
... | true |
9d557fc71f36f15a1be93e95781effaf6838735e | bobnorigun/my-first-blog | /caldist/models.py | UTF-8 | 948 | 2.671875 | 3 | [] | no_license | from django.db import models
# Create your models here.
from django.forms import ModelForm
# read the django docs on models:
# https://docs.djangoproject.com/en/dev/topics/db/models/
# a model for an airport
class Airport(models.Model):
"""class representing an airport"""
# airport letter code (usu 3 or 4 letters... | true |
07ab21fb98283859a54ef7a95a20653d365e13d4 | udyaluashok/interviewquestions | /sorting/merge_sort.py | UTF-8 | 1,127 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python
'''
David Lettier (C) 2014.
http://www.lettier.com/
'''
import random;
a = [ random.randint( -20, 20 ) for i in range( 0, 23 ) ];
print( a, "\n" );
def merge( left, right ):
result = [ ];
while ( len( left ) > 0 or len( right ) > 0 ):
if ( len( left ) > 0 and len( right ) > 0 ):
... | true |
8148d9c4481f5d903d77ab957cb56078f4be6804 | saltstack/libnacl | /tests/unit/test_auth_verify.py | UTF-8 | 4,668 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Import nacl libs
import libnacl
import libnacl.utils
# Import python libs
import unittest
class TestAuthVerify(unittest.TestCase):
'''
Test onetimeauth functions
'''
def test_auth_verify(self):
msg = b'Anybody can invent a cryptosystem he cannot break himself. Except Bruce Schneier.'
... | true |
38d8f025ce904e9023bfbbc26fdc271d2cc7fc5a | heimoshuiyu/msw | /plugins/input.py | UTF-8 | 2,517 | 2.515625 | 3 | [] | no_license | import threading
import copy
import os
from mswp import Datapack
from forwarder import receive_queues, send_queue
from config import msw_queue
from config import dprint as print
receive_queue = receive_queues[__name__]
def main():
while True:
try:
_main()
except Exception as e:
... | true |
1093d4c1a8fd853571e58dd41ffb0f681eb4b1d1 | chengong825/python-test | /638. 大礼包.py | UTF-8 | 2,321 | 3.40625 | 3 | [] | no_license | # 在LeetCode商店中, 有许多在售的物品。
#
# 然而,也有一些大礼包,每个大礼包以优惠的价格捆绑销售一组物品。
#
# 现给定每个物品的价格,每个大礼包包含物品的清单,以及待购物品清单。请输出确切完成待购清单的最低花费。
#
# 每个大礼包的由一个数组中的一组数据描述,最后一个数字代表大礼包的价格,其他数字分别表示内含的其他种类物品的数量。
#
# 任意大礼包可无限次购买。
#
# 示例 1:
#
# 输入: [2,5], [[3,0,5],[1,2,10]], [3,2]
# 输出: 14
# 解释:
# 有A和B两种物品,价格分别为¥2和¥5。
# 大礼包1,你可以以¥5的价格购买3A和0B。
# 大礼包2, 你可以... | true |
521fc34e5294dbb5c8a89177c491dd8c06fa299d | Iliamish/YandexML | /week5/task5RandomForest.py | UTF-8 | 796 | 2.953125 | 3 | [] | no_license | import pandas
import numpy
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import KFold, cross_val_score
df = pandas.read_csv('abalone.csv')
df['Sex'] = df['Sex'].map(lambda x: 1 if x == 'M' else (-1 if x == 'F' else 0))
X = df.loc[:, 'Sex':'ShellWeight... | true |
8a6002af0b86db4de239317ce5c79b11b2f5bb1c | Jvsdsilva/grandpyjs | /grandpyapp/test_grandpy.py | UTF-8 | 1,694 | 2.6875 | 3 | [] | no_license | import grandpyapp.model.parse as script
import grandpyapp.views as view
# content of test_show_warnings.py
import pytest
from mediawiki import MediaWiki
import requests
import json
import urllib.request
# custom class to be the mock return value
# will override the requests.Response returned from requests.get
class M... | true |
4bd00cc28884df210597ac231fd0115dcc0d2394 | vaishviksatyam/RouteNet | /Behaviour.py | UTF-8 | 2,153 | 3.515625 | 4 | [] | no_license | #This Python Script is the create a natural behavior of robots over the course of time
#Weather defines how often robot shivers
#Freshness defines how fast robot responds to voice
#Life defines breaking in Speed and with how much stiffness he walks with
#Exploration how often robot gets distracted
#Cheerful how often ... | true |
0a83cb24bd61a99d0d18671df04721ed9fb7c901 | AFHEEM/AHClassifier | /src/model/model.py | UTF-8 | 901 | 2.53125 | 3 | [] | no_license | import torch
from torch import nn
class DeepModel(nn.Module):
def __init__(self):
super().__init__()
self.model = nn.Sequential(
self.conv(3, 8), # 14
nn.ReLU(),
self.maxpool(),
self.conv(8, 8), # 7
nn.ReLU(),
self.maxpool()... | true |
a25a208459bd007c50d1500664e280f8a242ecd0 | luongthomas/Python-Mini-Projects | /ChangeCalculator/changeCalc.py | UTF-8 | 1,407 | 4.15625 | 4 | [] | no_license | # Title: Change Calculator
# Author: Thomas Luong
# Purpose: Calculates number of coins types that add up to an inputted amount
# Usage: Practice logic
# Notes: If inputs $1.47, the program will say 5 quarters, 2 dimes, 0 nickels and two pennies
# Subgoals: Allows input of price, and money given to calculate chang... | true |
08fa33c92c70254f31a5e0de4400516626237a29 | KingBendico/python_handin | /modules/Run.py | UTF-8 | 1,025 | 2.90625 | 3 | [] | no_license | #
import argparse
from Week2 import read_csv, write_lines_to_file
from utils import get_file_names, get_all_file_names, print_line_one, print_emails, write_headlines
print("hej")
parser = argparse.ArgumentParser(description='A program that write and read from a csv file')
parser.add_argument('-f', dest="file", requir... | true |
cd39256add49c0942ebad214f1d40750f133693a | smoriya1/Webscience-Crawler | /Cluster.py | UTF-8 | 2,620 | 2.78125 | 3 | [] | no_license | from pymongo import MongoClient
import matplotlib.pyplot as plt
from nltk.corpus import stopwords
from nltk.tokenize import TweetTokenizer
import re
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.fe... | true |
8886e4d20f403e7595607581efae5db9fe3b045c | schuach/semapp | /semapp.py | UTF-8 | 5,498 | 2.640625 | 3 | [
"MIT"
] | permissive | import pickle
from sys import argv, exit
import urllib.parse
import requests
import easygui
# config for api-key -- DO NOT PUT THIS FILE UNDER VERSION CONTROL!
import config.config as config
# get api-key from config
api_key = config.keys["Sandbox"]
# api-url-templates
base_url = 'https://api-eu.hosted.exlibrisgrou... | true |