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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53e6764f7c5d28ce27bf76c19bbabb3a8f2a3a6e | Python | ege-k/nlp4nethack | /nethack_baselines/torchbeast/models/bert_util.py | UTF-8 | 2,367 | 2.53125 | 3 | [
"MIT"
] | permissive | import pickle
import torch
from NetHackCorpus.corpus_loader import load_corpus
from tqdm import trange
import psutil
from transformers import BertModel, BertTokenizer, logging
def load_ftb_from_file(file="ftb.pkl"):
with open(file, "rb") as f:
ftb = pickle.load(f)
return ftb
def save_ftb_in_file(ftb... | true |
3a248a853337e811d65b18bcd36320cadb25da13 | Python | Aasthaengg/IBMdataset | /Python_codes/p02735/s650632389.py | UTF-8 | 880 | 2.640625 | 3 | [] | no_license | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
h,w=map(int,input().split())
S=[input() for _ in range(w)]
DP=[[0]*w for _ in range(h)]
if S[0][0]=='#':
DP[0][0]=1
for j in range(1,w):
if S[0][j-1]=='.' and S[0][j]=='#':
DP[0][j]=DP[0][j-1]+1
... | true |
e1e6d6a941193854b93b72da87e4c57c304fc031 | Python | Aasthaengg/IBMdataset | /Python_codes/p02595/s192636809.py | UTF-8 | 183 | 2.921875 | 3 | [] | no_license |
count = 0
n, d = map(int, input().split())
for _ in range(n):
l, m = map(int, input().split())
z = (l ** 2 + m ** 2) ** 0.5
if z <= d:
count += 1
print(count)
| true |
1fd7f6a2ff9c676c0e9f08cba3be0973c51a2910 | Python | MayukhSobo/ML | /KNN/Utils.py | UTF-8 | 562 | 3.265625 | 3 | [
"MIT"
] | permissive | """
This module stores all the utility functions
that are required for the implementation of
of any Machine Learning logic but not associated
to any particular technique.
"""
import numpy as np
def euclidean_distance(data_points):
"""
It calculates euclidean distance between two
set of points.
:para... | true |
ba6b533ff621260ad71691da465e4a6b0c428e10 | Python | igrekus/fiddle | /solutions_old/text-to-pin-code-func.py | UTF-8 | 1,854 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import json
from functools import singledispatch, update_wrapper
from itertools import chain, groupby
from string import ascii_uppercase as uppercase
class pipe:
def __init__(self, fun):
self.fun = fun
update_wrapper(self, fun)
def __ror__(self, other):
... | true |
006a2134f38efd9beee876373e4d74410ce8897c | Python | luffyguy/Luffy-Desktop-Assistant | /calc.py | UTF-8 | 948 | 2.90625 | 3 | [] | no_license | import pyttsx3
import operator
import speech_recognition as sr
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
r = sr.Recognizer()
mic= sr.Microphone(device_index=1)
with mic as source:
... | true |
f891034cf4ad34492de35554f3f6c2e01ad198e6 | Python | wuwx/Deviot | /commands/deviot_open_build_folder.py | UTF-8 | 525 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from sublime_plugin import WindowCommand
from sublime import run_command
from ..libraries.paths import getTempPath
from ..libraries.tools import get_setting
class DeviotOpenBuildFolderCommand(WindowCommand):
"""
Show the PlatformIO web site.
Extends: sublime_plugin.WindowCommand
"""
def run(self)... | true |
fc73c660df345d5b53f2c03ec779e0bd26a887ba | Python | jupyter/nbviewer | /nbviewer/client.py | UTF-8 | 4,460 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | """Async HTTP client with bonus features!
- Support caching via upstream 304 with ETag, Last-Modified
- Log request timings for profiling
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
import hashlib
import pickle
import time
from tornado.curl_h... | true |
fdc74ef6c33dbf6cae4344cd9ca460deb4fada9e | Python | khangdong89/Supply-demand-forecasting | /exploredata/poi.py | UTF-8 | 3,099 | 2.921875 | 3 | [
"MIT"
] | permissive | import pandas as pd
from districtid import singletonDistricId
class ExplorePoi:
"""Utility class for converting time slot ID
one day is uniformly divided into 144 time slots t1,t2, t144, each 10 minutes long
"""
def __init__(self):
return
def __load_raw_poi(self):
filename ... | true |
d414f06a729391f633d73928577ede8ff486e874 | Python | sk2-2/YouTubeDownloader | /youtube downloader/YouTube Downloader.py | UTF-8 | 970 | 3.015625 | 3 | [] | no_license | from tkinter import *
from pytube import YouTube
import time
root=Tk()
root.title("YouTube Downloader")
root.geometry("500x500")
def download():
pass
global e1
string=e1.get()
yt = YouTube(str(string))
videos = yt.streams.filter(subtype='mp4').all()
l=[]
for v in videos:
l.... | true |
4e71e6bb9ebcf7ca38f06ce00754a1be20e2b628 | Python | RandomLab/texte-generatif | /process_training.py | UTF-8 | 1,467 | 2.796875 | 3 | [] | no_license | import sys
from helpers import *
from model import *
from train import *
def main():
"""
process training with dataset data/input.txt
args:
model name (str)
number of epochs (int)
number of steps (int)
number of sequences (int)
numbers of layers (int)
dropou... | true |
9629beedbc2c6588ca5d2b3c0fc8fd3c5f73b930 | Python | DenisLamalis/cours-python | /lpp101-work/index_40.py | UTF-8 | 6,020 | 3.859375 | 4 | [] | no_license | # Dictionaries - exercise part 2
#create stores
freelancers = {'name':'freelancing Shop','brian': 70, 'black knight':20, 'biccus diccus':100, 'grim reaper':500, 'minstrel':-15}
antiques = {'name':'Antique Shop','french castle':400, 'wooden grail':3, 'scythe':150, 'catapult':75, 'german joke':5}
pet_shop = {'name':'P... | true |
37bb0b363e05a4f5ec06c1ec9073469f9bb6eba8 | Python | clayll/zhizuobiao_python | /练习/day11/8.三维散点图.py | UTF-8 | 778 | 3.328125 | 3 | [] | no_license | #三维散点
#ax.scatter(x,y,z, s=大小, c=颜色, marker=点型)
import numpy as np
import matplotlib.pyplot as mp
from mpl_toolkits.mplot3d import axes3d
n = 1000 #生成1000个随机数
x = np.random.normal(0, 1, n)
y = np.random.normal(0, 1, n)
z = np.random.normal(0, 1, n)
d = np.sqrt(x**2 + y**2) #距离正下方的点
mp.figure('Scatter3D')
ax = mp.gca(p... | true |
4960f02fa3604475a2d512e4d9483fd2a1dba231 | Python | skorohodovn/sda | /venv/python fundamentals/03-varible-and-operators/utf8.py | UTF-8 | 105 | 2.625 | 3 | [] | no_license | s = "This string is ynicode"
print(s.encode('utf-16le'))
print(s.encode('utf-16le').decode('utf-16be'))
| true |
0937b54bf702d3b375825765a7b1be06354da94b | Python | realbigws/From_CA_to_FullAtom | /modeller9v8/examples/all-steps/compare.py | UTF-8 | 1,143 | 2.546875 | 3 | [] | no_license | # Step 2: prepare an alignment of all template structures and the
# target sequence
#
# Align all of the best template structures detected in the previous step
# and compare them. Then align the target sequence with this block of
# aligned structures to generate an alignment suitable for modeling.
from modelle... | true |
0b8d2808fd7159fd2415c97e92c8f1cafd9aaf5d | Python | Lauraparedesc/Algoritmos | /Parcial_I/Noticia/Parcial.py | UTF-8 | 2,513 | 3.875 | 4 | [] | no_license | # 2 formula del codigo : 8 + xyw + x + w
# 3 valor n
print('sucesión 1')
def sucesion(n):
return (1/2**n)
print(sucesion(0))
print(sucesion(1))
print(sucesion(2))
print(sucesion(3))
print('sucesión 2')
def sucesion(n):
return (2*n)+3
print(sucesion(0))
print(sucesion(1))
print(sucesion(2))
print(suces... | true |
5f59235ea278535e11b17bb504d2a62a2e866612 | Python | sdweston/LikelihoodRatio | /src/q_m.py | UTF-8 | 2,210 | 2.921875 | 3 | [] | no_license | #===========================================================================
#
# q_m.py
#
# Python script to query mysql database to determine the
# q(m) for the likelihood ratio.
#
#===========================================================================
#
# S. Weston
# AUT University
# March 2013
#====... | true |
3df2d2f7c3f0478784aecfa182b540e30687a044 | Python | scikit-hep/mplhep | /src/mplhep/error_estimation.py | UTF-8 | 2,204 | 2.71875 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
import warnings
import numpy as np
import scipy.stats
_coverage1sd = scipy.stats.norm.cdf(1) - scipy.stats.norm.cdf(-1)
def poisson_interval(sumw, sumw2, coverage=_coverage1sd):
"""Frequentist coverage interval for Poisson-distributed observations
Parameters
---------... | true |
29bca5e70bdf6198147f2932b52792f6f697a60f | Python | keyouk/Coding-Challenges | /CodingChallenges/HotelMatrixChallenge/HotelMatrixChallenge.py | UTF-8 | 261 | 3.40625 | 3 | [] | no_license | def matrixElementsSum(matrix):
total_sum = 0
for x in range(len(matrix) - 1):
for y in range(len(matrix[x])):
if matrix[x][y] == 0:
matrix[x + 1][y] = 0
else:
continue
for x in matrix:
total_sum += sum(x)
print total_sum
return total_sum | true |
2de8f2034a9d61e6eaa616d5fb25cdfedca5d6eb | Python | Nixtla/statsforecast | /experiments/ray_ets/experiment.py | UTF-8 | 1,275 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import os
from time import time
import ray
import pandas as pd
from statsforecast.utils import generate_series
from statsforecast.models import ets
from statsforecast.core import StatsForecast
if __name__=="__main__":
parser = argparse.ArgumentParser(description='Scale StatsForecast using ray')
... | true |
47803e47b854cc8bd7a5f8f5203e0afe99a65c14 | Python | rohit-nair/adventofcode | /2019/python/day06/d06_2.py | UTF-8 | 1,987 | 3.3125 | 3 | [] | no_license | #! /usr/bin/env python3
from collections import namedtuple
class Result:
def __init__(self, san, you):
self.SAN = None
self.YOU = None
self.Ancestor = None
class Mass:
def __init__(self, key):
self.key = key
self.children = []
def add_child(self, child):
self.children.append(child)
def... | true |
3db6687edf61adcc08c6ec1d950695952db4f543 | Python | ace510/advent | /day2p1.py | UTF-8 | 2,291 | 3 | 3 | [] | no_license | import random
''' (1,0,0,3,99)
[0] is opcode (1 Add, 2 multi, 99 Halt)
[1] is operand 1
[2] is operand 2
[3] output location
add 1(0) t0 1(0) and store in 3
[3] = 1
'''
input_clean = [1,12,2,3, # 3 1, 12, 2, 3
1,1,2,3, # 7
1,3,4,3, # 11
1,5,0,3, # 15
2,13,1,19, # 19
... | true |
045d258f7a119b2b39ba430e093be6a89ed8ea79 | Python | Programacion-Algoritmos-18-2/2bim-clase-01-CeliaMaca | /ejercicio-desarrollo-clases/paquete_archivos/Archivos.py | UTF-8 | 1,251 | 3.484375 | 3 | [] | no_license | """
Importamos la libreria codecs para evitar conflictos pro caracteres especiales
"""
import codecs
"""
creamos una clase Archivo para leer el archivo
"""
class MiArchivo:
"""
Contructor de la clase que abre el archivo
"""
def __init__(self):
"""
"""
self.archivo=codecs.open("data\informacion.csv", "r")#ab... | true |
5eab9e6d93f04bae626a7b81f743d11e39d1911b | Python | dd2-GWFinTech-Projects/Project2-InvestmentSuggestionFramework | /src/main/datastructures/StockInfoContainer.py | UTF-8 | 4,159 | 3.015625 | 3 | [] | no_license | import pandas as pd
from ..datastructures.StockFinancialMetadata import StockFinancialMetadata
from ..datastructures.StockScore import StockScore
class StockInfoContainer:
def __init__(self):
self.__ticker_set = set()
self.__stock_raw_score_map = {}
self.__stock_composite_score_map = {}
... | true |
245de919a90efc704b660cab0263de86a6091209 | Python | celsopa/IFAl-ALPG101 | /EstruturasDeRepeticao-230419/ex002.py | UTF-8 | 234 | 3.984375 | 4 | [] | no_license | # 2) Elaborar um programa que apresente no final o somatório dos valores pares existentes
# na faixa de 1 até 500.
soma = 0
for x in range(0, 501, 2):
soma += x
print(f'O somatório dos números pares entre 1 e 500 é {soma}')
| true |
486e208c0dc23e763f6c4410bfd9a903a094549c | Python | mistersingh179/opencv-fundamentals | /code_examples/Chapter_2_Basics_of_a_video/demo.py | UTF-8 | 918 | 2.796875 | 3 | [] | no_license | import cv2
from datetime import datetime as dt
vs = cv2.VideoCapture(0)
original_fps = int(vs.get(cv2.CAP_PROP_FPS))
original_width = int(vs.get(cv2.CAP_PROP_FRAME_WIDTH))
original_height = int(vs.get(cv2.CAP_PROP_FRAME_HEIGHT))
print(original_fps, original_width, original_height)
fourcc = cv2.VideoWriter_fourcc('M'... | true |
0b832407be4baa57dde17c7948db4444e309368f | Python | adithbharadwaj/algorithms-and-data-structures | /dynamic_programming/lis.py | UTF-8 | 290 | 3.5625 | 4 | [] | no_license |
# longest increasing subsequence using dp
def lis(s):
n = len(s)
a = [1] * n
for i in range(1, n):
for j in range(0, i):
if(s[i] > s[j] and a[i] < a[j] + 1):
a[i] = a[j] + 1
print(max(a))
if __name__ == '__main__':
x = list(map(int, input().split()))
lis(x)
| true |
2de5172a23927cbed44a361d05e01d077a8e6649 | Python | nacho1415/Toy_Blockchain | /OneDrive/바탕 화면/알고리즘/2000~3000/2947.py | UTF-8 | 311 | 3.59375 | 4 | [] | no_license | items = list(map(int, input().split()))
i = 0
max = -1323123
while(items != [1, 2, 3, 4, 5]):
for i in range(len(items)-1):
if(items[i] > items[i+1]):
temp = items[i]
items[i] = items[i+1]
items[i+1] = temp
print(" ".join(list(map(str, items))))
| true |
aaf6e6c9e0b4d8f83045c459ffa8d448270aeb35 | Python | karanrs96/forsk_btcp | /Day14/Karan_Raj_Singh_46.py | UTF-8 | 1,210 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 29 13:11:19 2018
@author: Karan
"""
import pandas as pd
loan = pd.read_csv("Loan.csv")
str_col_names = list(pd.DataFrame(loan).select_dtypes(include=[object]))
from sklearn.preprocessing import LabelEncoder
labelencoder = LabelEncoder()
for i in str_col_names:
lo... | true |
c73e51c13a134b0f2c43cc648d3ac92396c7d97f | Python | crantz007/ARTWORK_PROJECT | /model/Model.py | UTF-8 | 550 | 3.5625 | 4 | [] | no_license | # Define Artwork class
class Artwork():
def __init__(self, artist, name, price, available):
self.artist = artist
self.name = name
self.price = price
self.available = available
def __str__(self):
return f'Name:{self.name}, Artist:{self.artist},Price:{self.price},Availabl... | true |
3fa66679da8ee2349b5eb7d7d3b2e9e90a56a8d4 | Python | jacketsu/NYPD-Crime | /partII/deliverable/scripts/level_hour.py | UTF-8 | 1,305 | 2.71875 | 3 | [] | no_license | from __future__ import print_function
import sys
import time
from operator import add
from pyspark import SparkContext
from csv import reader
def devidetime(x):
level = x[11].strip()
temp = x[2].split(":")
if temp[0] == "24":
x[2] = ("%s:%s:%s") % (0, temp[1], temp[2])
... | true |
7057b8a23fbfddadfae7d4e86db3428fae4c405d | Python | yangsg/linux_training_notes | /python3/basic02_syntax/classes/02_a-first-look-at-classes.py | UTF-8 | 2,324 | 4.5 | 4 | [] | no_license |
#// https://docs.python.org/3.6/tutorial/classes.html#a-first-look-at-classes
#// 类定义需要先执行才能生效(可以将class 定义放在if 语句块或函数的内部)
if True:
class ClassInIfBlock():
pass
def function():
class ClassInFunction:
pass
#// 当进入 class definition 时,被当做 local scope的一个新的名字空间(namespace) 就被创建了
#// When a class d... | true |
20f6d0fb856f897094177e909683aa4ce208a4b4 | Python | nikmedoed/pybinar | /src/utils/addons.py | UTF-8 | 2,660 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 Nikita Muromtsev (nikmedoed)
# Licensed under the Apache License, Version 2.0 (the «License»)
from time import time, strftime, gmtime
import re
from copy import deepcopy as dc
def getQ(distrib, pairs):
return sum(list(map(lambda x: x*distrib.index(x), distrib))) / pairs
def getDistrib(nc, intere... | true |
640908852138ebdd6ce5ca6eede9295b51f0a6d1 | Python | derekmerck/DIANA | /old/DianaConnect/old/tithonus.old.py | UTF-8 | 13,577 | 2.625 | 3 | [
"MIT"
] | permissive | """
Tithonus
Gatekeeper script for mirroring deidentified and reformatted medical images
(Named after _P. Tithonus_, the Gatekeeper butterfly)
[Derek Merck](derek_merck@brown.edu)
Spring 2015
<https://github.com/derekmerck/Tithonus>
Dependencies: requests, yaml, GID_Mint
See README.md for usage, notes, and license... | true |
32a5cde6b9f3cee3b5849d1eebb0677cf6d195fc | Python | mrabhi20iitk/PythonDSA | /DataStructures/hash_table_with_collision_handling.py | UTF-8 | 1,221 | 4 | 4 | [] | no_license | #hash table with collision handling by chaining. In chaining for multiple elements to be stored at same index , the key along with the data is stored at that location
class HashTable:
def __init__(self):
self.MAX = 10
self.arr = [[] for i in range(self.MAX)]
def get_hash(self,key):
... | true |
1ef8ede2b8759d2ba2581181fdf77795199b88d3 | Python | ilnomel/Game | /Graphics/Chapter_12_Lab.py | UTF-8 | 3,899 | 3.796875 | 4 | [] | no_license | """
Pygame base template for opening a window, done with functions
Sample Python/Pygame Programs
Simpson College Computer Science
http://programarcadegames.com/
http://simpson.edu/computer-science/
"""
import pygame
import random
# The use of the main function is described in Chapter 9.
# Define some col... | true |
7060a15bb4ee28d9dc45f6a1965cef91db57148e | Python | cwilko/quantutils | /quantutils/core/statistics.py | UTF-8 | 8,743 | 2.9375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from scipy import stats
import quantutils.core.timeseries as tms
import statsmodels.api as sm
from scipy.stats import norm
from statsmodels.tsa.stattools import adfuller
def sharpe(x):
return (x.mean() / x.std()) * np.sqrt(252)
def getStats(x):
return [x.mean(), x.var(... | true |
87d27c894151e6c67438420fce8c19cc9bafd0cf | Python | lemon89757/homework | /exe_3.py | UTF-8 | 204 | 3.375 | 3 | [] | no_license | greet = " how you doing ."
print (greet)
hello_L = greet.split(" ")
hello_LL =[s for s in hello_L if s!=""]
say_hello = " ".join(hello_LL)
print (say_hello) #去掉字符串中连续的多余空格
| true |
2132306bbb7244abb51f926153ffe0d7c7e44a4d | Python | TonkoshkuraMisha/Python_Egoroff_OOP | /polymorfizm.py | UTF-8 | 760 | 3.671875 | 4 | [] | no_license |
class Restangle:
def __init__(self, a, b):
self.a = a
self.b = b
def __str__(self):
return f'Restangle {self.a} x {self.b} = {self.a * self.b}'
#def get_rect_area(self):# был ранее
def get_area(self):
return self.a * self.b
class Square:
def __init__(self, a):
... | true |
6e8549c0fe7a6735c4be0c67e66b319455e35314 | Python | jaibheem/trash | /practice/mystuff.py | UTF-8 | 2,821 | 4.125 | 4 | [] | no_license | """Class is something that just contains the structure but Instance is the blueprint of the class
which defines how the class looks like.. more over like template and manifest"""
#Example 1:
def greet(name):
return name
print "Hello", greet("Jai")
print "Hello", greet("Anil")
#Example 2:
prices = {"Apple" : 40, "Ban... | true |
cbdeaab290b686ac6b81bd5cd29529e3ba201a3c | Python | Prgmaz/make-simple-chatbot-with-python-3-and-tensorflow | /main.py | UTF-8 | 1,161 | 2.734375 | 3 | [] | no_license | import tflearn
import tensorflow as tf
import json
import random
import numpy as np
from functions import get_bag
int2types = {}
types2int = {}
words2int = {}
data = []
with open("response.json") as f:
d = json.load(f)
for s in d["data"]:
data.append(s)
with open('data.json') as f:
dump_data = js... | true |
fecd4590664bcc2eda6bb312321c6f5d54d2829d | Python | ch-canaza/holberton-system_engineering-devops | /0x16-api_advanced/0-subs.py | UTF-8 | 619 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python3
""" Write a function that queries the Reddit API and returns
the number of subscribers (not active users, total
subscribers) for a given subreddit """
import requests
def number_of_subscribers(subreddit):
"""
returns the number of subscribers
"""
user = {'User-Agent': 'u/ch_... | true |
4bf9607c7e4da91931b768960eb91f44611197a9 | Python | AdityaThaokar/Community-Detection-Empirical-Study | /q2_jazz.py | UTF-8 | 1,698 | 2.796875 | 3 | [] | no_license | # girvan newman clustering
import itertools
import time
import networkx as nx
import networkx.algorithms.community as nx_algo
from networkx.algorithms.community import greedy_modularity_communities
from networkx.algorithms.community.centrality import girvan_newman
from sklearn.cluster import SpectralClustering
start_t... | true |
7bf6a28feff8b31a64d81245121f4c074640dce8 | Python | Leownhart/My_Course_of_python | /Exercicios/ex022.py | UTF-8 | 811 | 4.0625 | 4 | [] | no_license | nome = str(input('Digite seu nome completo: ')).strip()
print('Analisando seu nome...')
print('Seu nome em maiúsculas é {}'.format(nome.upper()))
print('Seu nome em minúsculas é {}'.format(nome.lower()))
print('Seu nome tem ao todo {} letras'.format(len(nome) - nome.count(' ')))
print('Seu primeiro nome em {} letras'.f... | true |
ea85b3a078d01fb968893f00f1d7355e66082a4d | Python | szhong945/AI-AStar | /UI-2.py | UTF-8 | 5,653 | 3.109375 | 3 | [] | no_license | from CreateMap import create_map, set_state, draw_map, writemap, readmap
from A_star import create_map, A_star, draw_path,write_path
from A_star_Integrated import create_map, A_star_Integrated, draw_path,write_path
from A_star_sequential import create_map, A_star_sequential, draw_path,write_path
import copy
import thre... | true |
25350346133ab99aab77e9c3e9ab81f0980a1cfb | Python | bharatanand/B.Tech-CSE-Y2 | /intro-AI/theory/revision/topperTestProg.py | UTF-8 | 1,738 | 3.171875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import random
marksList = [random.randint(20, 100) for i in range(20)]
percentageList = [(x / 100) * 100 for x in marksList]
data = {
'SAP': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
'Name': [
'Ona Yamanaka',
'Mellissa Begay',
'Leonard... | true |
5df3916becd848034ef28aaf48eaf5f273d55a50 | Python | Halfwake/inject-here | /neon_pets/neon_pets.py | UTF-8 | 5,835 | 2.9375 | 3 | [] | no_license | from flask import Flask
from flask import render_template, request, url_for, session, redirect
import sqlite3
import random
import hashlib
app = Flask(__name__)
app.secret_key = '4' # Number chosen by die roll. Guranteed to be random!
app.debug = True
@app.route('/')
def home():
if 'username' in session:
... | true |
33a2339a376e88408c68ba7b83042f6c3c4f9aaf | Python | faradayio/pachyderm_union_join_test | /join.py | UTF-8 | 1,408 | 2.8125 | 3 | [] | no_license | from glob import glob
import os
import os.path
import pandas as pd
import sys
# Parse our command-line arguments.
if len(sys.argv) != 4:
print("Usage: python join.py POPULATION_PATH LATLON_PATH OUT_PATH",
file=sys.stderr)
sys.exit(1)
_ignored, population_path, latlon_path, out_path = sys.argv... | true |
37d0b73b0672f8bca20ca45420285bf94589770a | Python | zhaolijian/suanfa | /leetcode/1579.py | UTF-8 | 3,772 | 3.625 | 4 | [] | no_license | # Alice 和 Bob 共有一个无向图,其中包含 n 个节点和 3 种类型的边:
# 类型 1:只能由 Alice 遍历。
# 类型 2:只能由 Bob 遍历。
# 类型 3:Alice 和 Bob 都可以遍历。
# 给你一个数组 edges ,其中 edges[i] = [typei, ui, vi] 表示节点 ui 和 vi 之间存在类型为 typei 的双向边。
# 请你在保证图仍能够被 Alice和 Bob 完全遍历的前提下,找出可以删除的最大边数。
# 如果从任何节点开始,Alice 和 Bob 都可以到达所有其他节点,则认为图是可以完全遍历的。
# 返回可以删除的最大边数,如果 Alice 和 Bob 无法完全遍历... | true |
8bc802dd076db88b3d559f3d5983b74b32f06b4c | Python | IdeasLabUT/dynetworkx | /dynetworkx/tests/test_intervalgraph.py | UTF-8 | 17,868 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | import os
import networkx as nx
import dynetworkx as dnx
current_dir = os.path.dirname(__file__)
def test_intervalgraph_degree():
G = dnx.IntervalGraph()
G.add_edge(1, 2, 3, 5)
G.add_edge(2, 3, 8, 11)
assert G.degree(2) == 2
assert G.degree(2, 2) == 2
assert G.degree(2, end=8) == 1
assert... | true |
dcff8c497a1f4465796990f47923b006a1171191 | Python | Bibin22/pythonpgms | /Tutorials/W3 Resources/15.sum of 3 numbers.py | UTF-8 | 234 | 3.375 | 3 | [] | no_license | def sum(a, b, c):
if a == b == c:
return (a + b + c) *3
else:
return a + b + c
a = int(input("Enter a number"))
b = int(input("Enter a number"))
c = int(input("Enter a number"))
res = sum(a, b, c)
print(res) | true |
f934601041fdf082acadbdcf96e1f2bc61fb8e1c | Python | harryjmoss/AOC2020 | /02-password-philosophy.py | UTF-8 | 1,332 | 3.359375 | 3 | [
"MIT"
] | permissive | import re
def check_password(input_file):
file_contents = []
with open(input_file, 'r') as infile:
file_contents = infile.read().splitlines()
password_matches = []
new_policy_valid = []
for line in file_contents:
numbers = line.split(" ",1)[0]
num_range= numbers.split("-")... | true |
cb0d32db1a63cb80a89090b2ec080053170683fb | Python | compatibleone/accords-platform | /tools/codegen/OCCI/Attribute.py | UTF-8 | 1,561 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on 28 Mar 2013
@author: Jonathan Custance
'''
import Scope
class Attribute(object):
'''
Class to represent an attribute
'''
def __init__(self, name, attrtype, required, immutable, validation, index, default = None, units = None, legacytype = None, scope = "all", script = None):
''... | true |
b8dfaebe64b9d78cb0f441f6b80d7d9ea5701b48 | Python | ardipta/Python-Practice | /Python/while.py | UTF-8 | 299 | 4 | 4 | [] | no_license | n = int(input("Enter n: "))
count = 1
sum = 0
while count <= n:
sum = sum + count
count = count + 1 # update counter
print("The sum is", sum)
counter = 0
while counter < n:
print("Inside while loop")
counter = counter + 1
else:
print("Inside else ")
| true |
f498149995508ab27189a25b6631abf7d569c630 | Python | lov435/SoftwareImprovement | /Comment-Summarization/annotation-engine/trainingdata/training_data.py | UTF-8 | 2,351 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 15:24:14 2020
@author: viral
"""
import csv, sys, datetime, copy
from general.comment import Comment
from general.author import Author
enrichedFile = "Enriched annotations.csv"
class Training_Data:
def loadData(self):
with open(enrichedFile, newline='', ... | true |
4c231b6ad581731949d2055c944bd69040628014 | Python | cdkharris/pytecplot-accessories | /pytecplot_with_pandas.py | UTF-8 | 917 | 3 | 3 | [
"MIT"
] | permissive | import pandas
import tecplot
def pandas_to_zone(df,dataset,zone_name='pandas'):
"""Adds a zone and populates the variables from a pandas dataframe.
Make sure the column keys match the variable names.
See also zone_to_pandas().
"""
dfzone = dataset.add_ordered_zone(zone_name,df.shape[0])
for k i... | true |
cfbd2cd62c73c9836361bf14a342474495b8be56 | Python | arbalest339/myLeetCodeRecords | /offer39majorityElement.py | UTF-8 | 643 | 3.15625 | 3 | [] | no_license | class Solution:
def majorityElement(self, nums) -> int:
nums.sort()
s = 0
e = 0
cur_num = nums[0]
for i, num in enumerate(nums):
if num != cur_num:
e = i
length = e-s
if length > len(nums) // 2:
r... | true |
32768a8042616e1f3ff3eb92f02636369650178c | Python | muscct/all_install_scripts | /misc/liveGraphing.py | UTF-8 | 2,149 | 2.671875 | 3 | [] | no_license | from subprocess import call
from _thread import start_new_thread
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
def getLogFileName(name):
return name + ".log"
def getCommand(name, command):
logFileName = getLogFileName(name)
return command + ' >> ' +... | true |
6817bd079bee48f871c9ca9822e6af01bdcbae07 | Python | Mao-E/Hello | /hello.py | UTF-8 | 113 | 3.015625 | 3 | [] | no_license | print("Hello World!")
print("Here is my message:")
with open('message.txt','r') as f:
print(f.read().upper()) | true |
72e074a026ab68180329c0ccf0c6f97800074cd0 | Python | j-m-nash/Past-Projects | /partia-flood-warning-system/Task2B.py | UTF-8 | 824 | 3.3125 | 3 | [
"MIT"
] | permissive | from floodsystem.stationdata import build_station_list
from floodsystem.flood import stations_level_over_threshold
def run():
"""Requirements for Task 2B
"""
print("*** Task 2B: CUED Part IA Flood Warning System ***")
# Build list of stations
stations = build_station_list()
sta... | true |
0024031b87bcab7429d805854dc9b4439c3574f5 | Python | MechanisM/FamilyFeed | /sources/youtube.py | UTF-8 | 847 | 2.671875 | 3 | [
"MIT"
] | permissive | import datetime
import gdata.youtube.service
import atom
#TODO No timezone - is time in UTC?
def atom_datetime(atom_date):
return datetime.datetime.strptime(atom_date.text, '%Y-%m-%dT%H:%M:%S.%fZ')
class YoutubeVideo(object):
def __init__(self, entry):
self.title = entry.title.text.decode('utf-8... | true |
bfde5c3b0cdc0693240ca823f51c45fef2d577ff | Python | lpwgroup/programming-tutorial | /3_classes/mdsim/force/lj_force.py | UTF-8 | 2,517 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from mdsim.force.md_force import MDForce
class LJForce(MDForce):
"""
LJForce class implements the Lennard-Jones force
Reference
---------
The LJ force takes the formula:
Fij = (-12 x sigma^12 / rij^13 + 6 x sigma^6 / rij^7) * 4 * epsilon * [rij]/rij
"""
def __ini... | true |
3ea1ff0e2ae5118b3a0b536889b304b64e90ec22 | Python | zackdilan/Python-Morsel- | /Exercise 1/add.py | UTF-8 | 1,051 | 4.0625 | 4 | [] | no_license | """
Hey! ✨
I'd like you to write a function that accepts two lists-of-lists of numbers and returns one list-of-lists with each of the corresponding numbers in the two given lists-of-lists added together.
It should work something like this:
>>> matrix1 = [[1, -2], [-3, 4]]
>>> matrix2 = [[2, -1], [0, -1]]
>>> add(mat... | true |
23bd06b0a1f0a67cf5c073365c5aa4726850cd8f | Python | iamtemazhe/excel_API | /queries.py | UTF-8 | 3,477 | 2.75 | 3 | [
"MIT"
] | permissive | from typing import List
from sqlalchemy import select, update, delete
from .loggers import getLogger
logger = getLogger()
async def get_object(conn, query, many=False):
"""Получение объекта(объектов) из БД.
Args:
conn (SAConnection): открытое соединение с БД.
query (Select):
Returns: з... | true |
cda5353ab1e59bc0588559edc5a7f7d111ea6288 | Python | loopback-kr/sefa | /interface.py | UTF-8 | 4,197 | 2.546875 | 3 | [
"MIT"
] | permissive | # python 3.7
"""Demo."""
import numpy as np
import torch
import streamlit as st
import SessionState
from models import parse_gan_type
from utils import to_tensor
from utils import postprocess
from utils import load_generator
from utils import factorize_weight
@st.cache(allow_output_mutation=True, show_spinner=False... | true |
ef36b698f00c5fbddd7e3e2e50c4344af1b67eca | Python | Ed1196/HunterCollabServices | /models/users.py | UTF-8 | 6,032 | 2.703125 | 3 | [] | no_license | from typing import Dict, List, Union
from db import db
from models.classes import ClassesModel, ClassesJSON
from models.skills import SkillsModel, SkillsJSON
from models.collaborations import CollabJSON
# Costume(custom JSON) return type, will help in type hinting
UserJSON = Dict[str, Union[str, str, str, str, List[Sk... | true |
e79bc57694b9cb852e0d5a21f2d29a58098bb6ab | Python | zzz686970/leetcode-2018 | /1475_finalPrices.py | UTF-8 | 523 | 3.125 | 3 | [] | no_license | def finalPrices(prices):
res = []
for idx, price in enumerate(prices):
for j in range(idx+1, len(prices)):
if price >= prices[j]:
res.append(price-prices[j])
break
else:
res.append(price)
return res
def finalPrices(self, prices):
... | true |
8720ced23d6369414b978450813433f9ef14fc89 | Python | shubhamdhingra38/Advent-Of-Code-2020 | /py/day12.py | UTF-8 | 3,745 | 2.90625 | 3 | [] | no_license | """
author: Shubham Dhingra
10/12/2020
10:26
"""
#===============================================================================================
import sys
import math
from collections import defaultdict as ddict
from collections import deque
import heapq
from queue import Queue
from copy import deepcopy
from bisect ... | true |
0e13f69e8eb62d6435d543c96fc37ef0e9bc4e84 | Python | TheEzo/IPP | /interpret.py | UTF-8 | 24,796 | 2.609375 | 3 | [] | no_license | __author__ = "Tomas Willaschek"
__login__ = "xwilla00"
__email__ = "xwilla00@stud.fit.vutbr.cz"
__project__ = "IPP 2018"
import sys
import os
from re import match, compile
from xml.etree import ElementTree as et
import argparse
class Interpreter:
def __init__(self, file):
self.file = file
self... | true |
d3ccf10f8120ba45c102c89b1563d7e0f4826e35 | Python | ViktorTelecom/Basic | /Natenka Tasks/parse_dhcp_snooping_functions.py | UTF-8 | 5,315 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def create_db (db_filename,schema_filename): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creating/opening DB file
db_exists = os.path.exists(db_filename)
conn = sqlite3.connect(db_filename)
cursor = conn.cu... | true |
c93caa6e697480515e920a30ecdcf1b62918f0d2 | Python | hamza-mughees/Statistical-Methods | /Mid-Term-Assignment/1a.py | UTF-8 | 400 | 3.40625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# 'data.csv' containing baskets and items
df = pd.read_csv('./data.csv', header=None)
# summing each row to get number of items in each basket
x = df.sum(axis=1)
# changing from frequencies to probabilities
weights = np.ones_like(x) / len(x)
# pl... | true |
a7e935f1bba183254eedea6ade3fe51ce56b0418 | Python | Aasthaengg/IBMdataset | /Python_codes/p03131/s452307526.py | UTF-8 | 235 | 2.8125 | 3 | [] | no_license | import math
import sys
k, a, b = map(int, sys.stdin.readline().rstrip().split())
if b - a <= 2:
print(k + 1)
else:
t = max(0, (k - a + 1) // 2)
print(k + 1 + t * (b - a - 2))
# print(max(0, math.ceil((k - a + 1)/2)))
| true |
057f23a265c7770c010c4330e6fd6cec99afff77 | Python | evanhosmer/Soccer-Capstone | /src/soccer.py | UTF-8 | 23,144 | 2.640625 | 3 | [] | no_license | import sqlite3
import pandas as pd
from sklearn.neighbors import NearestNeighbors
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.decomposition import PCA, FastICA, NMF
from sklearn.cluste... | true |
5ede8ad75938d013a9226af9f605ad97ef476c0b | Python | PNeekeetah/Leetcode_Problems | /Populating_Next_Right_Pointers_in_Each_Node.py | UTF-8 | 1,665 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 23:18:42 2021
@author: Nikita
"""
"""
Took me 5 minutes to come up with this solution.
I cheated a bit here. I reused my previous bfs implementation
since it suited the task so well.
I am aware I don't need to keep track of the levels since it's
a perfect BT, but si... | true |
9626f92072dd81e6999803810070e59cd1bc4aca | Python | clee1994/CreditDefault | /analysis.py | UTF-8 | 6,443 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
#machine learning libraries
from bayes_opt import BayesianOptimization
import xgboost as xgb
from sklearn.metrics import accuracy_score, average_precision_score, f1_score, recall_score, roc_auc_score
from sklearn.model_selection import train_test_split, cross_val_score
from skle... | true |
a48d686689aa3befb2ad8cafe9ea619c44fbb1d4 | Python | kingawel/Python | /algorithms/zad_4.py | UTF-8 | 741 | 3.9375 | 4 | [] | no_license | from random import randint # or it is possible to use random (0-1.0)
def matrixCreate(n,m): # n-rows, m-columns
matrix = [0] * n
for i in range (0,n):
matrix[i] = [0] * m
for x in range(0,n):
for y in range(0,m):
matrix[x][y] = (randint(-10,10))
return matrix
def matrixSum(matrix1,matrix2,matrix3):
prin... | true |
a955592a230127010df99c917d6961df4316b2df | Python | Jasonma886/leetcode_py | /reversedNumber.py | UTF-8 | 843 | 3.078125 | 3 | [] | no_license | class solution(object):
def reversedNumber(self, x):
if x >= 2 ** 31 - 1 or x <= -2 ** 31:
return 0
else:
strg = str(x)
if x >= 0:
revst = strg[::-1]
else:
temp = strg[1:]
temp2 = temp[::-1]
revst = "-" + temp2
... | true |
88c0a5bc5362add3a0daa06e3623748609f6d97a | Python | btrif/Python_dev_repo | /BASE SCRIPTS/Logging/logging_messages_yaml.py | UTF-8 | 735 | 2.734375 | 3 | [] | no_license | #this is app.py
import logging.config
import yaml
from os import path
def init_logging(config_file ):
if path.exists(config_file):
with open(config_file, 'r') as f:
config = yaml.safe_load(f.read())
return config
else : print('Not a valid file or the file does not exist !')
co... | true |
be8d3b17b7b4a9b28a06af5ff3ba57e1514bc5fc | Python | noisebridge/PythonClass | /instructors/need-rework/24_curses/cu0.py | UTF-8 | 1,099 | 3.8125 | 4 | [
"MIT"
] | permissive | import curses
def main(stdscr):
""" Curses is controlled from here.
This might be called 'the loop' in a game.
game loop: http://gameprogrammingpatterns.com/game-loop.html
"""
curses.textpad.rectangle(stdscr,0,0,10,10)
keypress = int()
# 113 is the lowercase 'q' key.
while ke... | true |
585aa534c294b12cafca370e108372afbaae07b5 | Python | tigju/Data-Structures | /binary_search_tree/queue.py | UTF-8 | 2,189 | 4.5625 | 5 | [] | no_license | """
A queue is a data structure whose primary purpose is to store and
return elements in First In First Out order.
1. Implement the Queue class using an array as the underlying storage structure.
Make sure the Queue tests pass.
2. Re-implement the Queue class, this time using the linked list implementation
as t... | true |
b9ed41f81c2ec7f80dffcb9aafb9bddf1e77c42f | Python | nathanhoverter/rosalind | /3a_motif_enumeration.py | UTF-8 | 2,293 | 3.34375 | 3 | [] | no_license | import pattern_to_number
import itertools
dna = ['AAGTGGATCGTAGTGGCAGGTGTAA','ATTTTCAAATGATCGATGGTTTGAA', 'TTACGAAACAGACCGCAACTCGTCA', 'GACTGCCGGGGTGGGGCAAATACGG', 'TATGCCACGATTAGCGACCGAGCAA', 'TCTTTCGGGTCCATTTGCTGGAACG']
def score_kmer(kmer1, kmer2, d):
"""Returns 1 if kmer1 matches kmer2 with at most d misma... | true |
87ab1c3171dae2493fa2a4547737e6a19824d2a3 | Python | 652diamondhands/prototype | /parsing/CSVBuilder.py | UTF-8 | 3,258 | 3.640625 | 4 | [] | no_license | #This class will take a dictionary of strings and integers and transform it into a CSV file with the correct converted metric names.
class CSVBuilder:
#Constructor for the class. Accept a filename as a string, and a dictionary.
#First, if the dictionary is not in the correct format (all keys are strings, and ... | true |
6bead9c0c73a9303512706f00d4163702583ffd6 | Python | executablebooks/markdown-it-py | /markdown_it/rules_block/table.py | UTF-8 | 6,987 | 2.84375 | 3 | [
"MIT"
] | permissive | # GFM table, https://github.github.com/gfm/#tables-extension-
from __future__ import annotations
import re
from ..common.utils import charStrAt, isStrSpace
from .state_block import StateBlock
headerLineRe = re.compile(r"^:?-+:?$")
enclosingPipesRe = re.compile(r"^\||\|$")
def getLine(state: StateBlock, line: int) ... | true |
de681c5ad4fe2cd8be12e9fd4781725a44f59bb0 | Python | YoonHyunSung/Bitcamp_Python | /scraping/bug.py | UTF-8 | 1,230 | 3.09375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from urllib.request import urlopen
'''
지원하는 Parser종류
"html.parser" : 빠르지만 유연하지 않기 때문에 단순한 HTML문서에 사용합니다.
"lxml" : 매우 빠르고 유연합니다.
"xml" : XML 파일에만 사용합니다.
"html5lib" : 복잡한 구조의 HTML에 대해서 사용합니다.
'''
class Bugmusic(object):
def __init__(self, url):
self.url = url
def scrap(sel... | true |
a84ee343bd7522d478b24acd1a0f33081d98481e | Python | BingqiangZhou/LearningOpenCV | /Python/day086.py | UTF-8 | 2,627 | 2.8125 | 3 | [] | no_license | '''
Author : Bingqiang Zhou
Date : 2021-08-29 11:52:40
LastEditors : Bingqiang Zhou
LastEditTime : 2021-08-29 12:52:11
Description : 视频分析 – 稠密光流分析
光流跟踪方法分为稠密光流跟踪与稀疏光流跟踪算法,KLT是稀疏光流跟踪算法,前面我们已经介绍过了,
OpenCV还支持稠密光流的移动对象跟踪方法,OpenCV中支持的稠密光流算法是由Gunner Farneback在2003年提出来的,
它是基于前后两帧所有像素点的移动估算算法,其效果要比稀... | true |
2cb0445c95e93bf81c1f21acf0e139328e9bc8bb | Python | slightlynybbled/coffeecam | /coffeecam/camera.py | UTF-8 | 704 | 2.609375 | 3 | [
"MIT"
] | permissive | import time
import os
import logging
from coffeecam.base_camera import BaseCamera
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class Camera(BaseCamera):
"""An emulated camera implementation that streams a repeated sequence of
files"""
img_path = os.path.dirname(__file__) + '/stat... | true |
b0fdd8fcf8ea79a22d73cfd1710d516857ed8e16 | Python | BrianHooper/drive_sync | /flashdrive_sync.py | UTF-8 | 1,309 | 3.265625 | 3 | [] | no_license | # pickle/depickle old file list
# compare old file list to new file list
# separate new files, modified files, and deleted files
def read_file(input_filename):
read_data = {}
with open(input_filename, 'r') as file:
for line in file.read().splitlines():
parsed_line = line.split(',')
... | true |
2d036023805777f09a0484e9ed830439b47c1cc6 | Python | sudharkj/iad-assignments | /hw1/ray_tutorial.py | UTF-8 | 9,157 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Part 1 - Remote Functions (15 pts)
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
import time
import numpy as np
import pickle
ray.init(num_cpus=4,
include_webui=False,
ignore_rein... | true |
5159ad898a7d136b74ddc84ae685d563ed87445b | Python | omidkhalafbeigi/face_motion_detection | /Face_Motion_Detection.py | UTF-8 | 2,203 | 2.765625 | 3 | [] | no_license | import cv2 as cv
import numpy as np
def get_detected_body(classifier, frame):
img_gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
img_blur = cv.GaussianBlur(img_gray, (5, 5), cv.BORDER_DEFAULT)
detected_body = classifier.detectMultiScale(img_blur)
if len(detected_body) > 0:
detected_... | true |
bff603acde04f8d0895b1456d3d72f2e85887e1a | Python | ale-mendez/instrumentacion19 | /unidad2/example2.py | UTF-8 | 579 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
# example class 3
class MiLista:
def __init__(self,contenido):
self.contenido = contenido
def __len__(self):
return len(self.contenido)
def multiplicar(self, mult):
y=[]
for elemento in self.contenido:
y.append(mult*elemento)
re... | true |
b752fc9f824a314d323e89b21a3270de12d37802 | Python | skrobchik/LuaPointBot | /roll_cmd.py | UTF-8 | 2,153 | 3.4375 | 3 | [] | no_license | import economy
import utilities
GAMBLING_OUTCOMES = {'lose' : 10, 'double' : 5, 'keep' : 6, 'quadruple' : 2, 'JACKPOT' : 1}
GAMBLING_BET_AMOUNT = 10
def return_command_response(message):
author = message.author
return_string = ""
if economy.get_user_balance(author) >= GAMBLING_BET_AMOUNT:
econom... | true |
4a116857cc78a7816a3e266d4b5f3639a1fd6278 | Python | wcswcswcs/Stocks-particle-filters | /code/PlotUtils.py | UTF-8 | 711 | 2.8125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def quantiles_plot(y_data, y_sampled, areas, label, lw):
T, N = y_sampled.shape
# y_sampled is TimexNsamples
y_sorted = np.sort(y_sampled, axis = 1)
colors = ['g', 'tab:orange', 'r', 'c', 'm', 'y_sampled', 'k']
i = 0
for a in areas:
c... | true |
aa3faaaacf7d392ff1968b424558757352a93ff2 | Python | residoo/project_euler | /archive/euler001.py | UTF-8 | 404 | 4.21875 | 4 | [] | no_license | # euler001.py
# https://projecteuler.net/problem=1
"""
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
number = 1
sum = 0
while number < 1000:
if number % 3 == 0 or number %... | true |
b4992ad37c8f8835aaf5c920cdcda6b85f704aa1 | Python | MizaGBF/MizaBOT | /views/chest_rush.py | UTF-8 | 3,854 | 2.90625 | 3 | [
"MIT"
] | permissive | from . import BaseView
import disnake
import random
# ----------------------------------------------------------------------------------------------------------------
# Chest Rush View
# ----------------------------------------------------------------------------------------------------------------
# Chest Rush... | true |
083a71107e6d8b3e2e1b380ccd9ffe257bc5339c | Python | DCIDA2019/dcida2020ii-mchvz | /Aug28/PenduloVal.py | UTF-8 | 1,363 | 3.5 | 4 | [] | no_license |
# coding: utf-8
# In[22]:
#Pide al usuario valore para resolver las ecuaciones par un péndulo
#In: l
#Out: Plot
import numpy as np
import matplotlib.pyplot as plt
# In[23]:
#Se define la función
def F(x,y):
f=-k*np.sin(x)+y
return f
# In[24]:
#Se define la función Runge-Kutta
#name es el título de l... | true |
e84f7fdfc39d7241f09b3aee80e79a12cbe26790 | Python | baharbiazar/fraud_detection | /src/model.py | UTF-8 | 759 | 2.890625 | 3 | [] | no_license |
import pickle
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import helper
def random_forest_model(X_train, y_train):
'''
returns the fitted model
'''
rf= RandomForestClassifier(class_weight... | true |
1d2dea915fb1593abf8f8e4b89a581ae2d13decc | Python | schmidtc/pysom-thesis | /code/utils/ll2xyz.py | UTF-8 | 3,615 | 2.59375 | 3 | [] | no_license | """ This program take N, the size of the dissired network as an argument,
It runs the sxyz_voroni code which results in a few XYZ files,
one containing the Delaunay trigulation
This program relys on,
sxyz_voronoi.f90
stripack.f90
"""
import geosom,os
import sys
from co... | true |
e06c962c9124fc588f85c3527555a1293eee11ae | Python | humzatariq1994/basic-data-sci-pipeline | /src/features/clean_csv.py | UTF-8 | 1,671 | 3.265625 | 3 | [] | no_license | ########## importing packages ###########
import os # use to load file
import pandas as pd # use to create dataframes for data processing
############## setting base and data directories #################
cwd = os.getcwd()
## setting base directory as current directory
BASE_DIR = os.path.dirname(os.path.dirname(os... | true |
5a25070d02120ed8e1703d318795c650b4966fae | Python | bmarx112/Misc | /FolderRecurse.py | UTF-8 | 1,492 | 3.6875 | 4 | [] | no_license | import os
#This code recursively builds a symmetric directory of folders specified by a user.
#The number of folders created on the lowest level is the product of the sum of folders on each subdirectory level
#The total number of folders is the sum of these products on every directory level
st = input("Enter Di... | true |
f38ada3c5fa3d09a1e56f1779437a4b681d40333 | Python | PaulRaUnite/ai-course | /temperature prediction/visualize.py | UTF-8 | 345 | 2.90625 | 3 | [
"MIT"
] | permissive | import csv
import sys
import matplotlib.pyplot as plt
results = []
reader = csv.reader(sys.stdin)
next(reader)
for row in reader:
try:
*_, result = map(float, row)
except ValueError as e:
print(row)
raise e
results.append(result)
plt.plot(results)
plt.xlabel('hours')
plt.ylabel('... | true |