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 |
|---|---|---|---|---|---|---|---|---|---|---|
5cee48fd3ad2301bc29c1a8f4f1c48bf625ba516 | nestor2502/Modelado | /python/Condicionales5.py | UTF-8 | 461 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
print("Asignaturas optativas año 2019\n")
print("Asiganturas optativas: \n-Informatica grafica \n-Pruebas de software \n-Usabilidad y accesabilidad")
asignatura = raw_input("Escribe la asignatura escogida: ")
if asignatura in("informatica grafica", "pruebas de software",... | true |
91b03fc7d594625b5d019aa8b56fd35e3fcff507 | J0/Kattis | /python/farming/detaileddiff.py | UTF-8 | 272 | 3.78125 | 4 | [] | no_license | num_cases = int(input())
for i in range(num_cases):
output = ""
a = input()
b = input()
for c in range(len(a)):
if a[c] == b[c]:
output+= "."
else:
output+= "*"
print(a)
print(b)
print(output)
print("\n")
| true |
c6df32887087eeb812717c25c0e17be49617d878 | suzuki-kei/python-mysql-etl | /src/main/python/table_defs.py | UTF-8 | 1,659 | 2.6875 | 3 | [] | no_license | from collections import namedtuple
from closeable import Closeable
TableDef = namedtuple("TableDef", (
"host",
"database",
"table",
"column_defs",
))
ColumnDef = namedtuple("ColumnDef", (
"table",
"name",
"data_type",
"column_type",
"default_value",
"is_nullable",
"is_prim... | true |
052d50ff91a0144ad3f6a21c0004caa5a8f461ba | aghoshpub/adversarial | /util_func.py | UTF-8 | 2,372 | 2.875 | 3 | [] | no_license | import numpy as np
from math import sqrt,log
import matplotlib.pyplot as plt
def amsasimov(s,b):
if b<=0 or s<=0:
return 0
try:
return sqrt(2*((s+b)*log(1+float(s)/b)-s))
except ValueError:
print 1+float(s)/b
print (2*((s+b)*log(1+float(s... | true |
8e1d4670705ad6cf69c2540556ceecf857a30ac0 | juesuarezca/PhD_PINNs | /PINNS/NeuralSolvers/PINNFramework/models/moe.py | UTF-8 | 12,944 | 2.984375 | 3 | [
"MIT"
] | permissive | # Sparsely-Gated Mixture-of-Experts Layers.
# See "Outrageously Large Neural Networks"
# https://arxiv.org/abs/1701.06538
#
# Author: David Rau
#
# The code is based on the TensorFlow implementation:
# https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/utils/expert_utils.py
import time
import torch
... | true |
e3d0ee4fe6afd6b310bb1c2a7a490a7ca7af8fc1 | shaketime9/SPO | /noteappforspo.py | UTF-8 | 1,286 | 2.953125 | 3 | [] | no_license | from tkinter import *
import shelve
db= shelve.open('noteapp')
app = Tk()
def add(self):
name = name_entry.get()
number = number_entry.get()
db[str(name)] = number
def show(self):
list_info = Listbox(app)
for key in db.keys():
s = key+ "-"+ db[key]
list_info.insert(0, ... | true |
d6726caf79b03b0cbd08a87ee1e57e0f141d9243 | Shuquanh9009/calculator-project | /calc.py | UTF-8 | 2,483 | 3.984375 | 4 | [] | no_license |
total = 0
cost_car=0
gas = {
"new york": "2.08"
}
parking = {
"new york city": "1000"
}
insurance = {
"16-17": "6100",
"18-19": "4334",
"20-24": "2350",
"25-29": "1608",
"30-39": "1449",
"40-49": "1396",
"50-59": "1296",
"60-69": "1325",
"70-79": "1556",
"80+": "2847",... | true |
5542ead30c91b8949d53fbf44350e1251cf28ef9 | padack/Practice | /practice_서식.py | UTF-8 | 1,435 | 3.78125 | 4 | [] | no_license | print('{:=>70}'.format('='))
print('{:.5f}'.format(1.123456)) #서식-소숫점에 따라 다르게 나타나는
print('{:.0f}'.format(1.123456))
print('%o,%x,%X'%(10,10,10)) # 표현식X8진수, 8진수소문자, 8진수대문자 (C스타일)
print('{:b} {:o}'.format(10,10)) # 2진수, 8진수 서식 (파이썬스타일)
print('{:=>70}'.format('='))
print('|%5d|'%123) # |5개의 고정영역자리 확보 & 123출력|
print('|%5... | true |
dfe41e09a616af43e9a6b874aded8f5e50f029cb | PatrickKvartsaniy/crypto | /models.py | UTF-8 | 957 | 2.53125 | 3 | [] | no_license | import datetime
import sqlalchemy as sa
from aiopg.sa import create_engine
metadata = sa.MetaData()
table = sa.Table('cryptocurrencies', metadata,
sa.Column('name',sa.String(100)),
sa.Column('price',sa.String(100)),
sa.Column('date',sa.String(100)))
class Crypto():
... | true |
f110d0571b2e11f46c8fd874d528a1d521262136 | isk02206/python | /informatics/BA_1 2017-2018/final2017/SungJoon_Park_corkscrew.py | UTF-8 | 2,268 | 4.03125 | 4 | [] | no_license | '''
Name: Sung Joon Park
ID: 01514170
'''
def rotateLeft(natural_number):
'''
>>> rotateLeft(717948)
179487
>>> rotateLeft(142857)
428571
>>> rotateLeft(105263157894736842)
52631578947368421
'''
natural_number = str(natural_number) #converting the number into string form
rotate_n... | true |
89d939e541d8128b7cfc99750a8d07ffcd77fed2 | simranjit20001/robot | /Algoritmos/Rutas sin definir/radar.py | UTF-8 | 3,015 | 3.34375 | 3 | [
"MIT"
] | permissive | # Grafica "en vivo" para actualizar datos
# recibidos por puerto serial
# Plantilla para proyecto, datos de prueba aleatorios
# http://blog.espol.edu.ec/edelros/category/arduino/radar-ultrasonido/
# Tarea: Actualizar los datos en la función una trama para ri,yi
# Con los obtenidos desde el puerto Serial
... | true |
fbe360f81c1a3cb709093f8d6274b53d7bfbef1f | lbzhang/MGE-CNN | /dataset/car.py | UTF-8 | 3,066 | 2.71875 | 3 | [] | no_license | import torch
import PIL
from PIL import Image
import os
import pandas as pd
import math
from torch.utils.data.sampler import WeightedRandomSampler
import numpy as np
from scipy.io import loadmat
def pil_loader(path):
with open(path, 'rb') as f:
img = Image.open(f)
return img.convert('RGB')
def ge... | true |
07f34c248bd46334688a52c38843e6a58b2433a4 | KalaiSelvan21V/python3 | /pro2.py | UTF-8 | 155 | 2.609375 | 3 | [] | no_license | from itertools import combinations
n1,n2=map(int,input().split())
a=len(str(n1))
b=list(combinations(str(n1),a-n2))
b=(sorted(b))
k="".join(b[0])
print(k)
| true |
9e60451bed9cfc298ddb064e01022fd874e3220f | Brianpan/leetcode | /algorithms/406_Queue_Reconstruction_by_Height.py | UTF-8 | 913 | 3.453125 | 3 | [] | no_license | #---------Tags---------
#Greedy
#----------------------
#---------Notes---------
# from greatest to smallest to build the ans
#-----------------------
class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
h... | true |
2d28a4ed36c7c4a65d9ab0835ca047afc956cfc7 | GeauxEric/WhenStackStopsOverFlow | /feature_union.py | UTF-8 | 7,260 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
sns.set()
plt.rcParams['figure.figsize'] = (12, 8)
sns.set_style("darkgrid")
sns.set_context("poster", font_scale=1.3)
import re
from bs... | true |
a5ed55c41a595eaf1a73da299a78680f510a89e5 | alxwrd/dodge-this | /main.py | UTF-8 | 9,459 | 2.859375 | 3 | [
"MIT"
] | permissive | import pygame
import random
__version__ = '0.1'
pygame.init()
# Import all required assets
crash_sound = pygame.mixer.Sound('Crash.wav')
pygame.mixer.music.load('Four_on_the_Dancefloor.wav')
car_img = pygame.image.load('car.png')
pygame.display.set_icon(car_img)
# Set screen resolution
display_width = 400
display_h... | true |
9407c1c17764acac1a0aee0e05771ccb79bec922 | sanhawhaw/NLP---Sastrawi-Bahasa | /Stopword_sastrawi.py | UTF-8 | 710 | 3.15625 | 3 | [] | no_license | # Filtering dengan sastrawi 2.0
import string
import nltk
import Sastrawi
from Sastrawi.StopWordRemover.StopWordRemoverFactory import StopWordRemoverFactory
from nltk.tokenize import word_tokenize
factory = StopWordRemoverFactory()
stopword = factory.create_stop_word_remover()
kalimat = "makan nasi padang adalah pan... | true |
785cc3858023ed700f8bd3f47f12997b2aa81924 | Kalkberg/GeoTools | /beachball.py | UTF-8 | 9,619 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Code for ingesting moment tensor solutions and generating KMZ files with
"beachball" diagrams at epicenter locations, colored by depth and sized by
magnitude
Currently configured to plot data from the Montana Regional Seismic Network,
which is operated by the Montana Bureau of Mines and Ge... | true |
f8f6c07caf1d2e8646aa99ece197e0f29c62ef27 | thoth-ky/algorithms-and-data-structures | /search/sequential.py | UTF-8 | 1,063 | 4.25 | 4 | [] | no_license | def sequential_search(item_list, item):
for index, value in enumerate(item_list):
if value == item:
return True
return False
def alt_seq_search(item_list,item):
n = len(item_list)
pos = 0
while pos < n:
if item_list[pos] == item:
return True
pos += 1
return False
data = [1,2,3,4,'... | true |
6b099beb38e9cc2a38a433019c5709e86bd421d0 | machin2e/toolbox | /clay-listen-udp-broadcast.py | UTF-8 | 792 | 2.84375 | 3 | [] | no_license | import socket, traceback
listen_port = 4445
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind(('', listen_port))
# s.settimeout(1)
print "Clay"
print "Listening for UDP broadcasts on port %s" % (... | true |
3e837eefca98e76d9189daacf5f0f4d4d2e8bb97 | angelrash53/day5s | /yoblist.py | UTF-8 | 419 | 4.34375 | 4 | [] | no_license | #Write a function that takes a list of YOB and the CY as parameters,
#then calculate and return a list containing the age of each YOB prodided in the parameter.
YOB = ["1915","1952","1965","1982","2012"]
print(YOB)
def calculateage(currentyear, YOB):
Age = []
for year in YOB:
age = currentyear - year... | true |
b52bd71aaf25923fc7f53e506b07ac6726841b1c | monkeyboot/Common-Voice-Kaldi | /lib/extractCSV.py | UTF-8 | 1,194 | 3.015625 | 3 | [] | no_license | # Extract CSV file from common voice
import csv
import os
def extractCSV(input, output_dir, config):
data=[]
_delimiter=""
extracted_data=[]
if config["delimiter"] == "tabs" :
_delimiter = '\t'
elif config["delimiter"] == "comma" :
_delimiter = ','
else :
print("delimit... | true |
cf25c0731e7747fb1aa56efc9cf0910d18769e2d | S-Angu-Hari-Hara-Karthik/tic-tac-toe | /SourceCode.py | UTF-8 | 2,763 | 3.75 | 4 | [] | no_license | from IPython.display import clear_output
def display(b):
clear_output()
print(" "+b[7]+" | "+b[8]+" | "+b[9])
print("-----------")
print(" "+b[4]+" | "+b[5]+" | "+b[6])
print("-----------")
print(" "+b[1]+" | "+b[2]+" | "+b[3])
def mark(b,sp,pos):
b[pos]=sp;
def checkspace(b,pos):
... | true |
8c7f3a87979a64ad100b00e3290588be5f46c6f5 | kjw130/python-projects | /Sudoku/Sodoku_game.py | UTF-8 | 4,311 | 3.59375 | 4 | [] | no_license | from random import sample
class Game:
def __init__(self):
print("Welcome to Sudoku!")
self.get_board = Board()
self.sudoku_board,self.hidden_board, = self.get_board.generate_board()
self.main()
def user_choice(self):
print("Enter a square followed by the value you want ... | true |
09fdda66c538f7ef15216b8669f23cf30f5786d1 | nadhiyap/hset1 | /spow.py | UTF-8 | 116 | 3.3125 | 3 | [] | no_license | n1=int(input("enter a number"))
k=len(str(n1))
a=0
s=0
while n1!=0:
a=n1%10
s=s+a**k
n1=n1//10
print(s)
| true |
485e8335949c33abe9219a5631dbf01e08d4a30d | rumpeltux/vm-kernel-introspection | /comparator.py | UTF-8 | 5,445 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from c_types import *
from threading import Thread, RLock, Lock
import signal
class ComparatorThread(Thread):
def __init__(self, comparator):
Thread.__init__(self)
self.comparator = comparator
self.compared = 0
for sig in range(1, signal.NSIG):
try:
signal.signal(sig, si... | true |
a88bebd71e0f405d31ed7055ac70421fc893345c | Amenable-C/Python_practice | /gradingSystem.py | UTF-8 | 778 | 4.0625 | 4 | [] | no_license | #Grading System
nums = [0,]
score = 0
while True:
score = int(input("Enter a score (-1 to quit): "))
if score == -1:
break
nums[0:0] = [score]
count = len(nums) - 1
total = 0
highest = nums[0]
lowest = nums[0]
i = 0
while i < count:
total = total + nums[i]
if highest < nums[i]:
highest = ... | true |
ce2f02abfb7f8294e2fa04cf732bfa377c861569 | giuliolovisotto/aidm_hand_in | /assign1/maintask_stuff/tfidf.py | UTF-8 | 2,338 | 2.796875 | 3 | [] | no_license | __author__ = 'giulio'
import sys
import sqlite3
import math
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Use this like this\n python tfidf.py <db_file>"
sys.exit()
db_name = sys.argv[1]
# open output SQLite file
conn = sqlite3.connect(db_name)
q = "ALTER TABLE lyric... | true |
63d879bd594eebe57fc35168b7c3d61e92c804eb | trevjacobson/CASH-Senior-Project | /Hardware/LED_Dimming.py | UTF-8 | 2,140 | 2.921875 | 3 | [] | no_license | import RPi.GPIO as GPIO # GPIO Library
import os
import json
PiLed1 = "/var/www/html/cash_json/PiLed1.txt"
PiLed2 = "/var/www/html/cash_json/PiLed2.txt"
PiLed3 = "/var/www/html/cash_json/PiLed3.txt"
WebLed1 = "/var/www/html/cash_json/WebLights1.json"
WebLed2 = "/var/www/html/cash_json/WebLights2.json"
WebLed3 = "/va... | true |
9267c2be83bf0bed7f439c72f8e6060a850d0add | bauhuasbadguy/magazine_scraper | /ngc_scraper.py | UTF-8 | 2,396 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 5 00:05:37 2018
@author: stuart
"""
#download NGC magazine automatically
from bs4 import BeautifulSoup
import requests
import re
import shutil
import time
#homepage_url = 'https://archive.org/details/ngc_magazine'
save_folder = '/home/stuart/Documents/Python_script... | true |
8c74b52ae8cbae873711ea90faa0f4413ba0ebdc | nachtmaar/androlyze | /androlyze/analyze/parallel/AnalysisStatsView.py | UTF-8 | 2,358 | 2.5625 | 3 | [
"MIT"
] | permissive |
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
from datetime import timedelta
import sys
from time import sleep
from time import time
from androlyze import Constants
from androlyze.util import Util
from androlyze.util.StopThread import StopThread
from Queue... | true |
61e189aac9e3f32aaeace504e25236a289f79fa6 | binchen15/leet-python | /linkedlist/prob876.py | UTF-8 | 1,074 | 3.765625 | 4 | [] | no_license | # 876 Middle of the linked list
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def middleNode(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
... | true |
f2f3e6301323fa7e41e138c3742ffc01c7c23bbb | iliyasmshn/Project_CloudFlix | /misc/file_reform.py | UTF-8 | 1,322 | 2.625 | 3 | [] | no_license |
import os,re
for dirname, dirnames, filenames in os.walk('/Users/pratiksomanagoudar/Downloads/30sets'):
for filename in filenames:
print filename
new_file_name = filename
new_path_name = dirname+"_new"
file_new = open(new_path_name+"/"+new_file_name, "w+" )
with open(dirn... | true |
19c3b4bd270e94d85f58e37a6291331718891b55 | peeranon98/ParallelEx3 | /p6.py | UTF-8 | 918 | 3.015625 | 3 | [] | no_license | import random
import time
import multiprocessing
import numpy
arrsize = 1000000
NUM_CPU = 4
chunksize = int(arrsize/NUM_CPU)
lock = multiprocessing.Lock()
glob = multiprocessing.Value('i',0)
def generate():
arr = []
for i in range(arrsize):
arr.append(random.randint(0,100000000))
return arr
def find... | true |
d27dab107ce210b565b601227d0fdff5ea9111af | SimLeek/svtk | /svtk/tk_integration.py | UTF-8 | 525 | 2.75 | 3 | [
"MIT"
] | permissive | def vtk_tk_anchor_left(vtk_win, tk_win):
# tk rect (mostly)
x = tk_win.winfo_x()
y = tk_win.winfo_y()
h = tk_win.winfo_height()
mid_y = y + h / 2
s = vtk_win.GetSize()
new_x = x - s[0]
new_y = mid_y - s[1] / 2
vtk_win.SetPosition(int(new_x), int(new_y))
def vtk_tk_match_height(vt... | true |
59c4573d7b4943ff1703a11ed62ed9638eeb62ef | GrahamDB/phyluce | /bin/align/extract_taxon_data_from_alignments.py | UTF-8 | 2,052 | 2.8125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
File: extract_taxon_data_from_alignments.py
Author: Brant Faircloth
Created by Brant Faircloth on 02 June 2012 14:06 PDT (-0700)
Copyright (c) 2012 Brant C. Faircloth. All rights reserved.
Description: Given a directory of alignments, extract those
sequence data for a singl... | true |
668a5d05a184db7b4aab71ad59a057d23c9d7c09 | lucifermorningstar1305/deeplearning | /image_recognition/mnist.py | UTF-8 | 5,725 | 2.75 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
import time
import configparser
mnist = input_data.read_data_sets("MNIST_data/",one_hot=True)
config = configparser.ConfigParser()
config.read('config.ini')
## Set the value of the pa... | true |
ef83569248c2a23df3e83e366a7286fa7016c186 | alphasaft/cypher | /bot/memory.py | UTF-8 | 2,753 | 2.515625 | 3 | [] | no_license | import discord
from typing import Any, Dict
from enum import Enum, auto
from dataclasses import dataclass
from .io import JsonIOSupporter, LoadAsync
class EventType(Enum):
PUBLISH = auto()
MESSAGE_POST = auto()
MESSAGE_EDIT = auto()
REACTION_ADD = auto()
REACTION_REMOVE = auto()
class Memory(JsonIOSupporter):... | true |
bfa8d4f9a9fd8cd2b5216c88e9e5114f1e156df6 | Vanille-N/codeforces | /.verdict.py | UTF-8 | 497 | 2.578125 | 3 | [] | no_license | def accepted():
return ("Accepted", "brightgreen")
def wrong_ans(num, pre=False):
return (
"Wrong%20answer%20on%20{pre}test%20{num}".format(
pre=("pre" if pre else ""),
num=num,
),
"yellow" if num == 1 else "red"
)
def runtime(num, pre=False):
return (
... | true |
c526b75ee5e32caf80f212b76a679f1720f18c0e | abhay2209/Search-Algorithms-Pacman | /search.py | UTF-8 | 14,834 | 3.703125 | 4 | [] | no_license | # search.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# At... | true |
8e24c4fb225e13adbb72996e9f4cfba9340e9bb1 | brightgems/question-generation-nus-ids | /data_processing/utils.py | UTF-8 | 278 | 3.203125 | 3 | [] | no_license | from functools import reduce
from typing import List
def array_to_string(arr: List[str]) -> str:
# Some words actually contain spaces (mostly irrelevant and noisy data)
arr = list(w.replace(' ', '\\') for w in arr)
return reduce(lambda t1, t2: t1 + " " + t2, arr)
| true |
d8d9aac0b6b0b2a32c3f3f712e131ae39f739b49 | himichael/LeetCode | /src/801_900/0842_split-array-into-fibonacci-sequence/split-array-into-fibonacci-sequence.py | UTF-8 | 869 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | class Solution:
def splitIntoFibonacci(self, S: str) -> List[int]:
ans = list()
def backtrack(index: int):
if index == len(S):
return len(ans) >= 3
curr = 0
for i in range(index, len(S)):
if i > index and S[index] == ... | true |
5f431ca782fcca930b1b15e7c6322d8badee3573 | handee/spiw | /ex6.py | UTF-8 | 774 | 3.21875 | 3 | [] | no_license | import cv2
import sys
import glob
import matplotlib.pyplot as plt #lets us draw graphs
cv2.namedWindow('Plant Image')
subdir="images/"
filelist=glob.glob(subdir+"*.png")
filelist.sort()
size=(640,480)
x=330
y=300
rpixels=[] # set up an empty list for us to save our pixels
for filename in filelist:
im=cv2.imread... | true |
a139e0732a290987ef9b7d55708d7265d64e4179 | zeynep-aslan/opencv-tutorials | /tic-tac-toe/oyun.py | UTF-8 | 5,390 | 2.96875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
def oyunAlani(image,values=[' ' for x in range(9)]):
font = cv2.FONT_HERSHEY_SIMPLEX
h,w,kanalS=image.shape
sayac=0
for i in range(3):
for j in range(3):
if sayac==9:
break
cv2.putText(image, values[sayac],((int(((2*(j+1)-1)*... | true |
bd6b68e46fb3144f430a1ba30564ca58269966fb | xenaletters/telegram-debt-bot | /src/debt.py | UTF-8 | 1,710 | 3.6875 | 4 | [] | no_license | """
Module: debt
Description:
The debt module contains the class of a debt.
Each unique debt is stored as a debt object.
"""
class Debt:
"""
The debt class contains attributes of a debt.
These can be returned as dictionary entries.
"""
def __init__(self, debt_id, creditor, category, amount, dead... | true |
da61f87a5c6e1e4df843aaacaa884cdccf6f13da | sv1024/leetCode | /deepest-leaves-sum.py | UTF-8 | 1,000 | 3.8125 | 4 | [] | no_license | #https://leetcode.com/problems/deepest-leaves-sum/submissions/
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def deepestLeavesSum(self, r... | true |
ff5dfb85172099a69f85ad66b10a97c924422960 | d-nct/compendium | /derivative.py | UTF-8 | 1,912 | 3.765625 | 4 | [] | no_license | #! utf-8
# Derivada Central
# ----------------
def df(f, x: float, h: float=1e-6):
"""Retorna a derivada numérica central de f no ponto x, com aproximação de h.
Parameters
----------
f : function
Função a ser derivada em x.
x : float
Ponto em que f será derivada.
h :... | true |
4776a6d8739fc8e3f77de0768ab9d845e55b3cf2 | enku/larry | /src/larry/plugins/gnome_terminal.py | UTF-8 | 972 | 2.640625 | 3 | [] | no_license | """Larry plugin for the Gnome Terminal"""
from larry import Color, ColorList
from larry.config import ConfigType
# schema how to set gnome-terminal profiles
SCHEMA = "org.gnome.Terminal.Legacy.Profile"
PATH = "/org/gnome/terminal/legacy/profiles:/:{profile}/"
def plugin(colors: ColorList, config: ConfigType) -> None... | true |
21cbb5dc0d007b6220ec59e074e2523b78f9099c | mridul-puri/linkedlistapi_python | /src/modules.py | UTF-8 | 1,887 | 3.125 | 3 | [] | no_license | class ListNode:
def __init__(self, name, birthyear):
self.name = name
self.birthyear = birthyear
self.next = None
class LinkedList:
inc = 100
def __init__(self):
LinkedList.inc += 1
self.length = 1
self.id = LinkedList.inc
self.nodeid = 0
def create(self,node):
self.head = n... | true |
bf4848d286fcbf6f1134139211de509ae33db22a | jorisboeye/aipnd-project-app | /src/aipnd-project-app/predict.py | UTF-8 | 945 | 2.765625 | 3 | [] | no_license | """
Predict script. Example usage:
python predict.py "./flowers/test/1/image_06743.jpg" "./checkpoints/densenet121/500-250/checkpoint_best.pth" --gpu --top_k 3 --category_names "./flowers/cat_to_name.json"
"""
import argparse
import json
from functions import predict
parser = argparse.ArgumentParser()
parser.add_ar... | true |
67e23dff84fddb9721827d3eea0f7664d94b5110 | ting-python/Python0709 | /d11/OO6(繼承).py | UTF-8 | 863 | 4.40625 | 4 | [] | no_license | # class - 繼承
class Human: # father
def __init__(self, name, age, sex) -> None:
self.name = name
self.age = age
self.sex = sex
def __str__(self) -> str:
return 'name:%s, age:%d, sex:%s' % (self.name, self.age, self.sex)
class Student(Human): # son
def __init... | true |
6179d4b91e82a59423b1921dd5ec086923913cbb | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | /students/stan_slov7/lesson06/mailroom4.py | UTF-8 | 6,937 | 3.390625 | 3 | [] | no_license | ##!/usr/bin/env python3
#+----------------------------+
#| Mailroom Part 4 - Lesson 6 |
#+----------------------------+
# Refactoring:
# 1. added getbd - getter function for db verification
# 2. changed add_donation to return the resulting string in addition to printing
import sys, os.path
cur_dir = os.getcwd(... | true |
478f7ad29677cc554ea4fa4d855e5feb8284fbf4 | huangyingw/submissions | /65/65.valid-number.234341430.Accepted.leetcode.py | UTF-8 | 1,253 | 3.109375 | 3 | [] | no_license | class Solution(object):
def isNumber(self, s):
try:
new_num = float(s)
except:
return False
return True
"""
DFA
"""
class Solution(object):
def isNumber(self, s):
states = [{},
{'blank': 1, 'digit': 2, 'sign': 3, 'dot': 4},
... | true |
d9b8f6cba6a071878caa66122bef4cd96e11f9ca | MarianoAIglesias1994/PyLab | /TTS_TextToSpeech/asistente.py | UTF-8 | 362 | 3.015625 | 3 | [] | no_license | #https://github.com/pndurette/gTTS
from gtts import gTTS
import pygame
import time, sys
sentence = input("Ingrese su texto:\n")
tts = gTTS(text=sentence, lang='es-us')
tts.save("asistente.mp3")
pygame.mixer.init()
pygame.mixer.music.load("asistente.mp3")
print ("")
pygame.mixer.music.play()
while pygame.mixer.music.... | true |
349ea05b2863e21f4d806d927e0d4b7a538f9182 | notsayyu/spider | /slave/AIHR/spiders/zlzpSpider.py | UTF-8 | 2,607 | 2.578125 | 3 | [] | no_license | # encoding: utf-8
import datetime
import scrapy #导入scrapy包
from scrapy.selector import Selector #选择器
from bs4 import BeautifulSoup
from scrapy.http import Request #一个单独的request模块,需要跟进URL的时候需要用它
from AIHR.items import AihrItem, CompanyItem, MasterItem #自己定义的需要保存的字段
# 1. 导入RedisCrawlSpider类,不使用CrawlSpider
from scrapy_red... | true |
a9e946283ad0887423381c7eed4f350d6159491a | mortrevere/opencv-art | /filters/window.py | UTF-8 | 1,854 | 2.671875 | 3 | [] | no_license | import numpy as np
import cv2 as cv
import math
from filter import Filter
from oscillator import Oscillator
import random
class WindowFilter(Filter):
def init(self):
self._mask = np.full((self.rows, self.cols), 0, dtype=np.uint8)
self.o1 = Oscillator(freq=5, zero=True)
self.o2 = Oscillator... | true |
626b09f603df6d9977f7a372fab49a69c720b40f | hanovator/algorithm | /섹션 3/9. 봉우리/AA.py | UTF-8 | 682 | 3.265625 | 3 | [] | no_license | import sys
sys.stdin = open("in1.txt", 'r')
# 상하좌우 검색.
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
n = int(input()) # n * n의 격자판을 만들 n.
a = [list(map(int, input().split())) for _ in range(n)]
# 아래 위에 0행렬 추가.
a.insert(0, [0] * n) # 0번행에 0행렬 추가.
a.append([0] * n) # 마지막행에 0행렬 추가.
# 왼쪽 오른쪽에 0행렬 추가.
for x in a:
x.inse... | true |
f5101167a703df287abb7e163b1a58a80e14e997 | samfin/RouteTem | /scripts/import_moves.py | UTF-8 | 1,394 | 3.015625 | 3 | [] | no_license | import urllib2
from bs4 import BeautifulSoup
from pprint import pprint
import csv
from collections import defaultdict
wiki_template = "https://temtem.gamepedia.com/%s"
species_page = "Techniques"
def lookup(page):
raw = urllib2.urlopen(wiki_template % page)
return BeautifulSoup(raw, 'html.parser')
headers = ['name... | true |
296b642054caeeca957d2d0178e3409bbd544ee4 | fenghui2013/myblog_source | /python/peewee_test/test.py | UTF-8 | 1,305 | 2.65625 | 3 | [] | no_license | import logging
from datetime import date
import time
from peewee import MySQLDatabase, Model, CharField, DateField, BooleanField, IntegerField
logger = logging.getLogger("peewee")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
db = MySQLDatabase('peewee_test', host='192.168.99.110', port=3... | true |
3923f7a8461134ec8ce9bd3b0d663b2c83840979 | motovmp1/mosh_python_2020 | /p_24_exceptions.py | UTF-8 | 95 | 3.171875 | 3 | [] | no_license | # exceptions
# input()
#
# numbers = [1, 2]
# print(numbers[3])
age = int(input("Age: "))
| true |
991ae1f0d0baf50ce73fae5e08064f8f00b6b208 | biaohe/submission | /core/acquisitions/uei.py | UTF-8 | 2,331 | 2.5625 | 3 | [] | no_license | # Copyright (c) 2019
# Copyright holder of the paper "Noisy-Input Entropy Search for Efficient Robust Bayesian Optimization" submitted to NeurIPS 2019 for review.
# All rights reserved.
import numpy as np
from core.acquisitions.acquisition_base import AcquisitionBase
from core.util.misc import optimize_gp_2, pro... | true |
b6e903120b30f79d5eae92bd955674f7ae1d711d | rasalt/demo-flaskhello | /echohello.py | UTF-8 | 701 | 2.78125 | 3 | [] | no_license | #http://10.1.1.1:5000/login?username=alex&password=pw1
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def hello():
greeting = "hello and welcome"
print(greeting)
return greeting
@app.route('/hello/<name>')
def success(name):
return 'Hello and Welcome %s \n' % ... | true |
a061393dde6f76896c9ed09ccd6f9dac07594bf7 | iandreariley/toolshed | /Src/tools.py | UTF-8 | 2,018 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Tool represents some kind of code utility. It should be executable. That's it for now. 3-30-19
"""
import logging
import os
import subprocess
import shed
import script_handlers
import exceptions
logger = logging.getLogger("project")
class Tool:
def __init__(self, script, invocation=None, invoke_from=None, ... | true |
853c84a6f3a36d8cdad00c73edb7c85700f533c4 | skaugvoll/TDT4171-AI-metoder | /four/src/I_1.py | UTF-8 | 1,659 | 3.609375 | 4 | [] | no_license | # coding=utf-8
'''
Plotting:
make a grid {
w = (w1, w2),
w1 ∈ [−6, 6],
w2 ∈ [−6, 6]
}
and plot the values of Lsimple(w)
Lsimple(w) = Lsimple(w) = [σ(w, [1, 0]) − 1]^2 + [σ(w, [0, 1])]^2 + [σ(w, [1, 1]) − 1]^2
(Matlab, Octave or matplotlib in python should make this easy for you).
By inspecting the graph ... | true |
748c0b5ef34a0c2102e5ea2ea118b459b69b38b8 | RockterHam/py_exper | /sy2/t4.py | UTF-8 | 384 | 4.0625 | 4 | [] | no_license | while True:
inp = input("请输入一个字符:")
if (str.isdigit(inp) == True) & (str.isalpha(inp) == False):
print("输入的为数字")
elif (str.isdigit(inp) == False) & (str.isalpha(inp) == True):
print("输入的为字母")
elif str.isalnum(inp):
print("输入的为字母与数字")
else:
print("输入的为其他字符")
| true |
9eb93c011acf1e6d29a0028f23fb02e23d4a9264 | JasonMcKinlay/HyperGAN | /hypergan/losses/f_divergence_loss.py | UTF-8 | 8,455 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import numpy as np
import hyperchamber as hc
import torch
from hypergan.losses.base_loss import BaseLoss
TINY=1e-8
class FDivergenceLoss(BaseLoss):
def __init__(self, gan, config):
super(FDivergenceLoss, self).__init__(gan, config)
self.tanh = torch.nn.Tanh()
def _forward(self, d_real, d_fake... | true |
d56b6410b6430e4f24cdaff738340a1addba238c | ComplexNetworkJN/ComplexNetwork | /Alignment_Result_Evaluation/write_paircomparison_withlabel.py | UTF-8 | 1,556 | 2.8125 | 3 | [] | no_license | import pickle
def add_tofile(protein1,protein2,specie1,specie2):
file="-".join(sorted([specie1,specie2])) # "a-b"
try:
file=open(f"{file}.txt","a+")
file.write(f"{protein1} {protein2}\n")
finally:
file.close()
def write_file(spe_pro_dict): # {specie : [protein] , s : [p]}
a=t... | true |
63ac59bd70ed3cc0cf6b0e1757a71b0c7564f89b | GabeOchieng/EbolaVirusLifeTree | /GlobalAlignmentTree.py | UTF-8 | 2,492 | 2.578125 | 3 | [] | no_license | import numpy as np
from Bio import SeqIO
import edlib
# reading genomes from fasta files
for record in SeqIO.parse("fastaData/Zaire_genome.fasta", "fasta"):
Zaire_genome = str(record.seq)
print(str(record.seq).__len__())
for record in SeqIO.parse("fastaData/Sudan_genome.fasta", "fasta"):
Sudan_geno... | true |
39f9dd59d567f4c81d02e3ab8e0f9086783d449f | buddydeepansh/LEtsUpgrade_Python_Batch7 | /Day5.py | UTF-8 | 1,186 | 3.703125 | 4 | [] | no_license | # prime numbers using filter.
lst = (range(2500))
def isPrime(p):
num1 = p
b1 = True
if p == 1:
return 1
elif p == 2:
return 1
else:
for i in range(2, p):
if p % i == 0:
b1 = False
break
if b1:
return p
... | true |
4ac36a6a35fbf21a4781c56ac7e1ea0016674e0f | rohitkuk/MLWithPytorch | /Day-01-Linear-Regression/LinearRegression.py | UTF-8 | 1,839 | 3.59375 | 4 | [] | no_license | import torch
class LinearRegression:
def __init__(self):
"""
:desc lr: Learning Rate
:desc iteration: Number of iterations over complete data set
"""
self.lr = 0.01
self.iterations = 1000
def y_pred(self, X, w):
"""
:desc w: weight tensor
... | true |
9549286a8ee7d986a4246ce3051b9dc50733c77c | sulabh-shr/cs685-robotics | /hw2/3_potential_fields.py | UTF-8 | 4,673 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
def plot_3d(x, y, z, title=None):
fig = plt.figure(figsize=(25, 25))
ax = fig.add_subplot(projection='3d')
ax.plot_surface(x, y, z)
plt.title(title)
plt.show()
plt.close()
def dist_to_point(map_x, map_y, point):
... | true |
287a49a9ff10d6367605999beebb68b33495fc48 | agrawalraj/ds_labs | /solutions/bootstrap.py | UTF-8 | 3,058 | 3.5625 | 4 | [] | no_license |
"""
Lab : Ex 1 Solutions
References:
See http://www.sagepub.com/sites/default/files/upm-binaries/21122_Chapter_21.pdf
on pg. 597
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
def bootstrapSample(n, num_resamples=1000):
"""
input:
n - ... | true |
171b998e32a6fde1dd5b037ee117c863026c12e8 | josedoneguillen/python-profesional | /anotaciones/comprehension.py | UTF-8 | 457 | 3.703125 | 4 | [] | no_license | #lista = []
#
#for x in range(0, 101):
# lista.append(x)
#
#print(lista)
estructura_lista = [ "indice-" + str(x) for x in range(0, 100) ]
print(estructura_lista)
estructura_tupla = tuple(( x for x in range(0, 100)
if x % 2 == 0) )
print(estructura_tupla)
estructura_d... | true |
2fc4b982a2a2ea1894ea47ba617620092fb03b0d | GINK03/project-euler-solvers | /99/euler.py | UTF-8 | 208 | 2.734375 | 3 | [] | no_license | import sys, math
evalist = []
for i, line in enumerate(sys.stdin):
b,e = map(int, line.strip().split(','))
evalist.append((i+1,math.log(b)*e))
print 'ans', sorted(evalist, key=lambda x:x[1]).pop()
| true |
fcc44cbd7e4de933dab5cdab9c5a823ea4102411 | geoffreynyaga/ANGA-UTM | /weather/worker.py | UTF-8 | 2,064 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from datetime import datetime
import psycopg2
import psycopg2.extras
import requests
import logging
def fetch_data():
api_token = "146b384d03128d96"
url = (
"http://api.wunderground.com/api/" + api_token + "/conditions/q/KE/Nairobi.json"
)
# TODO: Wunderground API is dead. Moved to... | true |
2e3e51f3cdb517e9100f8e9dfaf06469cabe804e | ggchaves/FlaskExample | /app.py | UTF-8 | 1,096 | 2.671875 | 3 | [] | no_license | # coding=utf-8
from flask import Flask, render_template, request, session, jsonify, make_response, redirect as r
from flask_httpauth import HTTPBasicAuth
from flask_bcrypt import Bcrypt
import config as c
app = Flask(__name__)
app.secret_key = c.secret_key
bcrypt = Bcrypt(app)
auth = HTTPBasicAuth()
@auth.... | true |
037c5ac4f4ca679acd3906fdeac6ac7cdf65a9fc | svinepels/Python | /numerisk_integrasjon.py | UTF-8 | 790 | 3.546875 | 4 | [] | no_license | # Trapes-metoden
import math
def floatrange(start, end, number_of_steps):
# liste = []
step = float(end - start) / number_of_steps
k = 0
while k <= number_of_steps:
# liste.append(float(start + k * step))
yield float(start + k * step)
k += 1
# return liste
def trapes(func... | true |
75b0c8ffc2bbcee27dc9c2a3b29f19b4466258a5 | hottbox/hottbox | /hottbox/metrics/decomposition.py | UTF-8 | 1,589 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from math import sqrt
from hottbox.core.structures import Tensor, TensorCPD, TensorTKD, TensorTT
from hottbox.utils.generation.basic import residual_tensor
def mse(tensor_true, tensor_pred):
""" Mean squared error
Parameters
----------
tensor_true : Tensor
tensor_pred : {Tensor... | true |
fd43cb466efe999ddc406e544d2f1665062661c0 | betty29/code-1 | /recipes/Python/65226_Expanding_and_Compressing_Tabs/recipe-65226.py | UTF-8 | 1,727 | 3.71875 | 4 | [
"Python-2.0",
"MIT"
] | permissive | # of course, in Python, we do have a built-in tab expansion string method:
# method .expandtabs(tablen=8) of string objects! If we *didn't* have
# it, though, here's how we might make it ourselves...:
# string processing tends to be faster in a split/process/rejoin
# approach than by repeated overall-string transform... | true |
5cdf852a13ec128cb319280f3038a1d0750e94fb | srgsoroka/PT1 | /day3-1.py | UTF-8 | 895 | 3.5625 | 4 | [] | no_license | import pickle
def load():
with open("todo.pickle","rb") as f:
return pickle.load(f)
def save(obj):
with open("todo.pickle","wb") as f:
pickle.dump(obj,f)
try:
tasks = load()
except FileNotFoundError:
tasks = {}
while True:
action = input("""a - add
l - list
q - quit\n?""").lowe... | true |
4e49e981f1fa1285603b3d4360fbf3a8435dbf0a | Connor-R/nba_shot_charts | /archive_scripts/x_nba_shot_charts.py | UTF-8 | 26,307 | 2.84375 | 3 | [
"MIT"
] | permissive | import requests
import urllib
import os
import shutil
import csv
import sys
import glob
import math
import pandas as pd
import numpy as np
import argparse
import matplotlib as mpb
import matplotlib.pyplot as plt
from matplotlib import offsetbox as osb
from matplotlib.patches import RegularPolygon
from datetime import ... | true |
b0d1c1c4d05ad3a2337859a5a932f9037f954200 | Pragyanand/Facial-Recognition-Attendance-System-Facenet-OpenCv-Dnn | /create_dataset.py | UTF-8 | 4,123 | 2.78125 | 3 | [] | no_license | import errno
import cv2, os, time, pickle
import numpy as np
net = cv2.dnn.readNetFromCaffe("face_detection_model/deploy.prototxt", "face_detection_model/dnn_model.caffemodel")
def face_extractor(frame):
# net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
# net.setPreferableTarget(cv2.dnn.D... | true |
cc0070e16cb08abd9fe6717783c03a6c054756cf | crazymerg/rude_qa_bot | /src/restriction.py | UTF-8 | 842 | 2.703125 | 3 | [] | no_license | import logging
from typing import Dict, Any
from telebot.types import User
from dto import RestrictedUserDto
from error import UserNotFoundInStorageError
class RestrictionStorage:
_storage: Dict[Any, RestrictedUserDto]
def __init__(self, logger: logging.Logger):
self._storage = dict()
self.... | true |
fa6c68332197dcba74c2e8d96112351fe08d65e2 | starcksophie/pysap | /examples/mri/p_mri_cartesian_reconstruction.py | UTF-8 | 3,843 | 2.828125 | 3 | [
"LicenseRef-scancode-cecill-b-en"
] | permissive | """
Neuroimaging cartesian reconstruction
=====================================
Credit: L Elgueddari, S.Lannuzel
In this tutorial we will reconstruct an MRI image from the sparse kspace
measurments.
"""
# Package import
import pysap
from pysap.data import get_sample_data
from mri.numerics.linear import Wavelet2
from... | true |
09e05954aedcb95b7557d295fe3d89d3bd34c78f | snst/bikecomputer | /test/test_smooth.py | UTF-8 | 650 | 2.578125 | 3 | [] | no_license | import unittest
import struct
import site
import sys
site.addsitedir('./src') # Always appends to end
site.addsitedir('./modules') # Always appends to end
site.addsitedir('./emu') # Always appends to end
from smooth import *
class TestSmooth(unittest.TestCase):
def setUp(self):
self.s = Smooth()
d... | true |
1a7ad035bb9ce0556c80b8db66a9f21bdd55c74b | piotrplaneta/adventofcode2020 | /day07/day07.py | UTF-8 | 1,529 | 2.984375 | 3 | [] | no_license | import re
from collections import defaultdict
def data():
def line_parser(line):
parent, children = line.split(" bags contain ")[0], line.split(" bags contain ")[1].split(", ")
children = [re.sub(r"\.| bags| bag", "", child) for child in children]
children = [(child.split(" ", 1)[0], child.... | true |
6992565fbdc4cdf480e15b0b3a83a915d55b9d63 | yehonadav/learn_git | /eyalle/lvl1/fibonacci_sum.py | UTF-8 | 230 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | import time
fibonacci_sum = 0
i = 0
y = 1
# print (f'{i}\n{y}\n')
while True:
fibonacci_sum += y
# print (f'fib {fibonacci_sum}')
y = i
print (f'{y}')
i = fibonacci_sum
# print (f'i {i}')
time.sleep(1) | true |
f8b1dad0f018fb6239c1a2e9e09c4b334c4bddc3 | t2othick/leetcode | /25.py | UTF-8 | 2,057 | 3.5 | 4 | [] | no_license | # Definition for singly-linked list
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def reverseKGroup(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
count = 0
... | true |
8360546e1d925ef383efbf772b5c96584a482d13 | priyanshkedia04/Codeforces-Solutions | /Part A/cut ribbon.py | UTF-8 | 296 | 2.984375 | 3 | [] | no_license | def cut_ribbon():
n,a,b,c = map(int, input().split())
cutting = [a,b,c]
cutting.sort()
dp = [float("-inf")] * (n + 1)
dp[0] = 0
for cut in cutting:
for length in range(n+1):
if cut <= length:
dp[length] = max(dp[length], 1+dp[length-cut])
print(dp[n])
cut_ribbon() | true |
edc1e90be10e28ec02551e116a49a1bbcebe4a09 | tuita520/EcsSync2 | /Doc/create_headers.py | UTF-8 | 301 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
AVERAGE_LATENCY = (33, 66, 100, 200, 500, 1000, 2000)
LATENCY_JITTER = (10, 20, 30, 50)
PACKET_LOSS_RATE = (0, 5, 10, 15, 20, 25)
for al in AVERAGE_LATENCY:
for lj in LATENCY_JITTER:
for plr in PACKET_LOSS_RATE:
print("{}ms / {}% / {}%".format(al, lj, plr)) | true |
dc287a5e118955f395fb27197098d17b825e39f2 | yoojinhwang/baboon-tracking | /phase/test_phase.py | UTF-8 | 1,728 | 3.203125 | 3 | [
"MIT"
] | permissive | import unittest
from phase import Phase
from multiprocessing import Process, Queue
from multiprocessing import Manager
class TestPhase( unittest.TestCase ):
# Square every number in an integer sequence using Phase
def test_apply_1( self ):
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = []
pi... | true |
c8de9b665d5c61a3da5f76e13dceeb065098ec6b | gadepall/numerical_methods | /ode/manual/codes/euler_modified.py | UTF-8 | 360 | 3.25 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
a = 0
b = 5
n = 25
x = np.linspace(a,b,n)
h = (b-a)/(n+1) #interval
y=[]
tempy = 1
for i in range(n):
y.append(tempy)
tempy = tempy + h*(1-x[i]*tempy)
#Plotting
plt.plot(x,y)
plt.grid()
plt.xlabel('$x$')
plt.ylabel('$y$')
#Comment the following line
plt.savefig('.... | true |
76bccde3e722afd8edc565307279a94a4f7a631b | martinescobarr/MetodosEscobarMartin- | /EscobarMartin_final/EscobarMartin_Fourier.py | UTF-8 | 1,630 | 3.640625 | 4 | [] | no_license | # Tiene una serie de tiempo, donde los datos de tiempo estan almacenados en un arreglo t y los datos de amplitud en un arreglo amp.
#1) Usando los paquetes de scipy de la transformada de Fourier, haga un FILTRO de la senial que elimine las frecuencias mayores a 1000Hz en las senial original.
#2) Haga una grafica de la ... | true |
1ac27518f4b7724aae1a86e5309dbdafd83b21de | anupamvamsi/python | /practice/0004_disemvowel.py | UTF-8 | 648 | 4.1875 | 4 | [] | no_license | # CodeWars 0002
def disemvowel(string):
# Converting string input to two lists
strin = list(string)
string = list(string)
# Making a list of vowels
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
# Detecting if vowels are in the string and removing them
for i in range(len(s... | true |
8d40cb3b15d2b9a19c482a31ef91dc47d6b1b62e | KennethEnevoldsen/augmenty | /src/augmenty/token/insert.py | UTF-8 | 12,158 | 2.6875 | 3 | [
"MIT"
] | permissive | import random
from functools import partial
from typing import Callable, Dict, Iterator, List, Optional, Union
import spacy
from spacy.language import Language
from spacy.tokens import Token
from spacy.training import Example
from wasabi import msg
from ..augment_utilities import make_text_from_orth
from .wordnet_uti... | true |
2a4753ed6608e0a17a61147d041eafd6dac26093 | savfod/d16 | /IHumonen/cerp.py | UTF-8 | 638 | 3.140625 | 3 | [] | no_license | import tkinter
c=tkinter.Canvas(width=1000,height=1000)
c.pack()
n=5
c.create_line(0, 1000, 500, 0)
c.create_line(500, 0, 1000, 1000)
c.create_line(1000, 1000, 0, 1000)
def mddl_trngl(x1, x2, x3, y1, y2, y3, i):
if i<n:
xn1=(x1+x2)/2
xn2=(x3+x2)/2
xn3=(x1+x3)/2
yn1=(y1+y2)/2
... | true |
28771fb827a1b2205c31d57af90f95d06676d7b6 | lukaskellerstein/PythonSamples | /50_libraries/1_pandas/1_dataframes/selection.py | UTF-8 | 1,071 | 3.640625 | 4 | [] | no_license | import numpy as np
import pandas as pd
# ----------------------------------------------------
# ----------------------------------------------------
# DataFrames - operations
# ----------------------------------------------------
# ----------------------------------------------------
my_df = pd.DataFrame(np.random.ran... | true |
223cfcb80273529f90b393dcaac5ee3ee725569e | erjantj/hackerrank | /calendar-matching.py | UTF-8 | 3,703 | 3.171875 | 3 | [] | no_license | def toTimeString(time):
m = time%60
h = (time - m)//60
if m == 0:
return '%s:00'%(h)
return '%s:%s'%(h,m)
def toMinutes(string):
h, m = string.split(':')
return int(h) * 60 + int(m)
def slotToMinute(slot):
if slot:
return [toMinutes(slot[0]), toMinutes(slot[1])]
return ... | true |
cd1ec8815abba1c0fe01e888b0d98703184ffe37 | leekmyass/Hacktoberfest-2021 | /palindrome.py | UTF-8 | 460 | 4.5 | 4 | [] | no_license | # Palindrome
def palindrome_str(string):
string = string.casefold()
revStr = reversed(string)
if list(string) == list(revStr):
print("The string is a Palindrome.")
else:
print("The string is not a Palindrome.")
# We can't use function overloading
def palindrome_num(num):
res = str... | true |
c5009742a28de8b3e889af7a7f609b1b7390d0f5 | Zolor/adventofcode2019 | /day07/intcode.py | UTF-8 | 1,455 | 2.765625 | 3 | [] | no_license | def intcode_program(list, input_value, start_pos):
def parameter(instr, x):
mode = instr // (10 ** (x + 1)) % 10
if mode == 0:
return list[list[start_pos + x]]
elif mode == 1:
return list[start_pos + x]
else:
raise NotImplementedError(mode)
input_counter = 0
while start_pos < len(list):
instr = li... | true |