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 |
|---|---|---|---|---|---|---|---|---|---|---|
15952f8e84863044cfd6face0000d9da88e3f1e6 | yselivonchyk/RFF_SVM | /src/GausianClusters.py | UTF-8 | 4,829 | 2.890625 | 3 | [] | no_license | import numpy.random as rnd
import numpy.linalg as la
import numpy as np
author = "y.selivonchyk"
class GausianClusters:
"""Class allows to draw inputs according to 2 n-dimensional gaussian clusters.
Clusters intersect each other significantly"""
def __init__(self, d=3, clusterscale=1, random_state=None,... | true |
87e045cf80303811a27dbae40f8538ed87a8846d | cheriezhang/LCode | /TowardOffer/19-stack.py | UTF-8 | 979 | 3.9375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 题目描述
# 定义栈的数据结构
# 请在该类型中实现一个能够得到栈最小元素的min函数。
class Solution:
def __init__(self):
self.m_data = [] # 数据栈
self.m_min = [] # 最小值栈
def push(self, node):
# 比较
self.m_data.append(node) # 加入数据栈
# 加入最小值栈
if self.m_min == [] or node < self.m_m... | true |
25b5e6a57ac471a313b0ea9a0eb6d20d83463219 | weronikaolejniczak/porter-stemmer | /porter stemmer/tools.py | UTF-8 | 17,930 | 3.4375 | 3 | [
"MIT"
] | permissive | import re
class PorterStemmer:
def __init__(self):
self.word = "" # holds a word to be stemmed
self.buffer = []
self.steps = []
self.part_of_speech = []
self.first = 0
self.last = 0
self.j = 0 # offset into the string
def clear(self):
self.bu... | true |
1ddc735f45720658914a2a55c452bbe9a6af7a90 | Gencid/SelMercuryTours | /Pages/MercuryWelcome.py | UTF-8 | 842 | 2.71875 | 3 | [] | no_license | from selenium.webdriver.common.by import By
class Welcome:
def __init__(self, mercurydriver): # Define mydriver and find all important links and boxes
self.driver = mercurydriver
self.signon_link = (By.LINK_TEXT, "SIGN-ON")
self.register_link = (By.LINK_TEXT, "REGISTER")
s... | true |
25c3dfc845e87192e43171571988eb25f7f516b6 | JackFurby/NotReceipt | /dataset/balanceData.py | UTF-8 | 1,025 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
import os
import random
# Returnes an array for image file paths and image type
def addItem(filePath, type):
data = []
for file in os.listdir(filePath):
data.append([filePath + file, type])
return data
# folders containing images
receipt = "K:/notReceipt/processed/receipt/"
notReceipt = "K:/... | true |
79a7126393191428966d6b308ab8c1e50b0ec6f2 | franciscovillaescusa/Pylians3_ML | /Examples/1D_to_1D/architecture.py | UTF-8 | 5,562 | 2.71875 | 3 | [] | no_license | import torch
import torch.nn as nn
import numpy as np
import sys, os, time
######## 1 hidden layer ##########
# inp ---------> size of input data
# h1 ----------> size of first hidden layer
# out ---------> size of output data
# dr ----------> dropout rate
class model_1hl(nn.Module):
def __init__(self, inp, ... | true |
ac5d917a1925fd8f15cad2b0c8ee9d7e78736cc7 | liudandanddl/python_study | /python_core/test_TCP_and_UDP/test_TCP_socket_client.py | UTF-8 | 590 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
from _socket import AF_INET, SOCK_STREAM
from socket import socket
__author__ = 'ldd'
HOST = '127.0.0.1'
PORT = 21566
BUFSIZ = 1024
ADDR = (HOST, PORT)
if __name__ == "__main__":
tcpCliSock = socket(AF_INET, SOCK_STREAM) # 创建客户端套接字, 用的是IPV4
tcpCliSock.connect(ADDR)
... | true |
1b8ae400251385bf54d91d96849217e6c5195f00 | sunlei0227/myscripts | /count_icSHAPE_nucleotides.py | UTF-8 | 2,478 | 2.59375 | 3 | [] | no_license |
import sys
input =sys.argv[1]
#output = open(sys.argv[2].'w')
print input
d ={} ... | true |
08b146075ad7b98955783bce22c878993ba73601 | clipo/rapanuisim | /rapanuisim/math/wright_fisher_process.py | UTF-8 | 1,919 | 2.90625 | 3 | [] | no_license | # Copyright (c) $today.year. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Creative Commons-GNU General Public Llicense 2.0, as "non-commercial/sharealike". You may use, modify, and distribute this software for non-commercial purposes, and you must distribute any modifications u... | true |
910e75d41e3910ff3f14e5f5c8289a0b08aaffff | sanjaykhanal/working-with-mender | /test_cam_time.py | UTF-8 | 195 | 2.515625 | 3 | [] | no_license | from time import time
import cv2
t1 = time()
vid = cv2.VideoCapture(0)
t2 = time()
print(t2-t1)
for i in range(10):
t2 = time()
ret,frame = vid.read()
t3 = time()
print(t3-t2)
| true |
7949dc75137c5fa97ec7de3d9444844bc13dd03a | it-ster-python/twisted | /test.py | UTF-8 | 4,524 | 2.6875 | 3 | [] | no_license | import unittest
from data import models
from utils import tools
class TestUserModel(unittest.TestCase):
def setUp(self):
self.model = models.User
self.test_data = {"login": "admin", "hash_pass": "*"}
def test_create_model_1(self):
user = self.model()
# self.assertRaises(Assert... | true |
f49b1eba5c34bd2e398707e427511cb25fa63d5c | bidgars/python | /strings.py | UTF-8 | 827 | 4.1875 | 4 | [] | no_license | # Strings: ordered, immutable, text representatins
mystr = "I'm a programmar"
print(mystr)
mystr = """Hello
New World"""
print(mystr)
mystr = """Hello \
New World"""
print(mystr)
mystr = "New\nLine"
print(mystr)
mystr = "I'm a programmar"
print(mystr)
for i in range(len(mystr) - 12):
print(mystr[i])
print(mystr... | true |
8839c7fef19f8638bddeab6c955bc7da6e642ea6 | yanxurui/keepcoding | /python/algorithm/leetcode/41.py | UTF-8 | 1,165 | 3.3125 | 3 | [] | no_license | # https://leetcode.com/problems/first-missing-positive/discuss/17071/My-short-c%2B%2B-solution-O(1)-space-and-O(n)-time
class Solution(object):
def swap(self, nums, i, j):
if nums[i] == nums[j]:
return False
tmp = nums[i]
nums[i] = nums[j]
nums[j] = tmp
return Tr... | true |
cbc38e71ffd692b517f569d30572b5313b5ab884 | oarodriguez/covid19analysismx | /src/covid19mx/cli.py | UTF-8 | 8,773 | 2.515625 | 3 | [] | no_license | """Command Line Interface of the project."""
from pathlib import Path
from typing import Optional
from zipfile import ZIP_DEFLATED, ZipFile
import click
import duckdb
import pandas as pd
from covid19mx import Config, DataManager, DBDataManager, console
# CLI application instance.
from covid19mx.config import PROJEC... | true |
5c8888f4ad917dec802451ad555f5d4b55d11c7d | Decision2016/ExperimentRepo | /DRChanllenge/PictureDetect/TKDetect.py | UTF-8 | 3,580 | 2.671875 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import askopenfilename
from PIL import Image, ImageTk
import threading
from DetectClass import Detect
class TKDetect(object):
file_path: str
def __init__(self):
self.window = tk.Tk()
self.window.style = ttk.Style()
s... | true |
afa178256ff9f3d05c931ffd47df8c72a2ce2f86 | jhj9109/TIL | /Class_On_SWEA/Class_104/codes/8강 매개변수 사용한 calc (1).py | UTF-8 | 274 | 3.484375 | 3 | [] | no_license | #매개변수로 오퍼레이터 받는 calc
def calc(oper,x,y):
return oper(x,y)
def plus(op1,op2):
return op1+op2
def minus(op1,op2):
return op1-op2
ret_val=calc(plus,10,5)
print("{0}".format(ret_val))
ret_val=calc(minus,10,5)
print("{0}".format(ret_val)) | true |
d99c2248850e4f1b4dffe8f459172b2dce8540c6 | MrHamdulay/csc3-capstone | /examples/data/Assignment_8/chtrom001/question2.py | UTF-8 | 745 | 4.5625 | 5 | [] | no_license | #question2.py
#program checks if the number of pairs of adjacent letter
#romelon chetty
#07 may 2014
def pairs(word):
#checks if the number of pairs of adjacent letter
if len(word)<=1:
return 0 #only one character-string cannot have a pair
elif word[0]==word[1]: # checks if first equal se... | true |
527f134d80f613a70688a9eb3b73cd3b99be2d33 | MarcosC98/POO-2018-2-Proyecto-1 | /Persona.py | UTF-8 | 20,795 | 2.765625 | 3 | [] | no_license | from Textos import Texto
from Lapida import Lapida
class Persona:
personas_totales = []
def __init__(self,nombre,documento,fechaNac):
self._nombre = nombre
self._documento = documento
self._fechaNac = fechaNac
Persona.personas_totales.append(self)
def imprimirDat... | true |
a59fafc3da0f6943756fa4c91c3c8f64d9a74c55 | P-eaceHan/RelationClassification | /preprocessing/word_embeddings.py | UTF-8 | 3,270 | 2.703125 | 3 | [] | no_license | """
Code to generate the word embedding matrix from pretrained word embeddings.
Instructions to obtain embeddings in comments below.
Run this before running classify_rels.py
@author Peace Han
"""
import pickle
import time
import numpy as np
# from gensim.models import KeyedVectors
# prepping the embedding matrix
print... | true |
2b29a66cbd97b3ca500f057e2f1ace3d6d6eb726 | rcarino/Project-Euler-Solutions | /problem37.py | UTF-8 | 1,126 | 3.578125 | 4 | [] | no_license | __author__ = 'rcarino'
# solution: check all primes up to n for truncatable primes. That n happens to be < 1,000,000
import math
def prime_sieve(n):
s = [True] * (n+1)
s[0] = s[1] = False
for i in range(2, int(math.sqrt(n)) + 1):
is_prime = s[i]
if is_prime:
for j in range(i*2,... | true |
d41cc7eff34b6e1275e09f24d6e9996f7157dc2a | andidar83/Python-for-gravity-inverse-and-forward-moddeling | /Processing GRvity/processing gravity.py | UTF-8 | 2,193 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 12 21:04:05 2021
@author: Andidar83
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as inter
from scipy.signal import convolve2d
#Read data freeair dan elevasi dari Topex berformat txt
#Format data Untuk saat ini X, Y, elev... | true |
a739d26034d760164b6006200b297403b2f8c755 | guozhenjiang/Python | /prj/idl/00_try/03_ball.py | UTF-8 | 1,550 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import numpy as np
## 创建一个GL视图小部件来显示数据
app = QtGui.QApplication([])
w = gl.GLViewWidget()
w.show()
w.setWindowTitle('Cute Ball')
w.setCameraPosition(distance=50)
## 向视图添加网格
g = gl.GLGridItem()
g.scale(... | true |
d12d35b8d4a1bcd71829a27ab9c19bb4acbfa440 | spacecase123/PornFreeKit | /TitlePolice/index.py | UTF-8 | 1,994 | 2.625 | 3 | [] | no_license |
# Blocked
blacklisted = [
"porn",
"hentai",
"masturbation"
]
whitelisted = [
"pornfree",
"overcoming porn addiction",
"pornfreekit",
"stay clean",
"get out of that"
]
msgs = [
"STOP BRUH",
"Hey, have you pray to your god today?"
]
# Sorry i skidded
imp... | true |
1b61cc2b9b6ce993dc38cbee6e0c19259e197c48 | pochmann/codility | /MaxCounters.py | UTF-8 | 785 | 2.78125 | 3 | [] | no_license | from collections import defaultdict
# Two solutions based on https://stackoverflow.com/a/60592052/12671057
# 100%: https://app.codility.com/demo/results/trainingX6MXQ4-MCN/
def solution(N, A):
counters = defaultdict(int)
for a in A:
if a <= N:
counters[a] += 1
elif counters:
... | true |
f7a033999cdeef6b0b4c523cd03839e7ba7f0b22 | workready/pythonbasic | /sources/t06/t06ejer03.py | UTF-8 | 410 | 3.875 | 4 | [
"MIT"
] | permissive | class Shape:
pass # Tu codigo aqui
class Rectangle(Shape):
pass # Tu codigo aqui
newRectangle = Rectangle(12, 10)
print(newRectangle.area) # 120
print(newRectangle.perimeter) # 44
newRectangle.width = 5
newRectangle.height = 8
print(newRectangle.area) # 60
print(newRectangle... | true |
b8ecf5b208bfed80da60b4361caee807fc84496b | wz139704646/FinancialRobot | /FinancialRobot/app/utils/finance_utils.py | UTF-8 | 2,624 | 3.234375 | 3 | [] | no_license | from decimal import Decimal
def capitalized_amount_of_money(amount):
amount = round(amount, 2)
amount_strs = str(amount).split('.')
# 转换的最大位数
# 只能识别亿级及以下的
max_mag = 9
if amount > 10**max_mag:
return '.'.join(amount_strs)
print(amount_strs)
# 每种数字对应大写
digit_li = ['零', '壹', '... | true |
c67deff90641f9bee23eaf28b35f9f122414f3a4 | CU-SRL/DAQ | /rocket/RocketModule/receiveConfig.py | UTF-8 | 1,372 | 2.703125 | 3 | [] | no_license | import tkinter as tk
import os
import time
import json
import threading
import socket
import sys
# ! treating rocket/raspberryPi as server
class recieveConfig():
def __init__(self, pilotIP, pilotPORT, rocketIP, rocketPORT):
self.initialRecvSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | true |
269819efac757d4e84b57eb6a682b5e28a83d875 | iblech/mathezirkel-kurs | /mathecamp-2014/fraktale-programmieren/spirale.py | UTF-8 | 286 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Ausführen auf: https://trinket.io/ oder http://www.skulpt.org/
from turtle import *
speed(0)
tracer(8,25)
for i in range(11):
for j in range(22):
for k in range(33):
right(44)
forward(55)
left(66)
forward(77)
| true |
3fa537a88889929e0f252dd72d5d33a9e3ab7de9 | albert-rian/BirthDate_Digits_using_SKLearn_Toy_Dataset | /birthdate.py | UTF-8 | 429 | 3.078125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.datasets import load_digits
import matplotlib.pyplot as plt
dataDigit = load_digits()
user = input('Input your birthdate (ddmmyy format): ')
position = 1
fig = plt.figure(figsize=(10,2))
for i in user:
plt.subplot(1, 6, position)
plt.imshow(dataDigit['ima... | true |
16cf50771ec232c416e4a9096314026b9b408b4c | skeien/Bootcamp-Python | /24_Day_Statistics/day24.py | UTF-8 | 11,344 | 3.875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 7 19:54:29 2020
@author: sebas
"""
# How to import numpy
import numpy as np
# How to check the version of the numpy package
print('numpy:', np.__version__)
# Checking the available methods
print(dir(np))
# Creating python List
python_list = [1,2,3,4,5]
# Checking data... | true |
529f386b40aa667c48432a320545fbc525e10bbb | swo/swo.github.io | /template.py | UTF-8 | 2,327 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pystache, datetime, argparse, os.path, unicodedata, re
class Template:
template = """
---
title: {{title}}
date: {{date}}
permalink: /posts/{{year}}/{{month}}/{{slug}}/
tags:
---
""".strip()
@staticmethod
def slugify(value, allow_unicode=False):
"""
Conve... | true |
c29303ba842943c8779339687fd9603b5540a3c3 | Aasthaengg/IBMdataset | /Python_codes/p03147/s725180145.py | UTF-8 | 400 | 2.75 | 3 | [] | no_license | n = int(input())
h = list(map(int, input().split()))
ans = 0
def solve(li_h):
l = 0
for i in li_h:
if(i==0):
l += 1
else:
break
r = l + 1
for i in li_h[l+1:]:
if(i==0):
break
r += 1
for i in range(l, r):
li_h[i] -= 1
... | true |
7a041fdee4eef2e75468dee538d6c93975ad0001 | 2Animesh/Animesh | /Zero_Kaanta.py | UTF-8 | 2,363 | 3.734375 | 4 | [] | no_license |
def printer(board):
print(" | | ")
print(" " + board[1] + " | " + board[2] + " | " + board[3] + " ")
print(" | | ")
print("_ "*6)
print(" | | ")
print(" " + board[4] + " | " + board[5] + " | " + board[6] + " ")
print(" | | ")
print("_ "*6)
print... | true |
03fb18ba70bebee301224fe6cffff5e61b84c397 | rinoguchi/python_sandbox | /src/unittest/mixin/test_scraping.py | UTF-8 | 1,199 | 2.609375 | 3 | [] | no_license | import unittest
import requests
from bs4 import BeautifulSoup
from requests import Response
from base_test_case import BaseTestCase # type: ignore
from test_webserver import TestWebserver # type: ignore
class TestScraping(BaseTestCase, TestWebserver):
@classmethod
def setUpClass(cls):
print('TestS... | true |
c74ec64543d85d1107f243d0d431a5d19a630485 | hien/Project-Euler | /euler2.py | UTF-8 | 494 | 3.640625 | 4 | [] | no_license | #!/usr/bin/python
#filename euler2.py
def sum_fibonacci_upto_this(maxValue):
firstTerm = 1
secondTerm = 2
nextTerm = 0
sum = secondTerm
while True:
nextTerm = firstTerm + secondTerm
if(nextTerm > maxValue):
break
if nextTerm % 2 == 0:
s... | true |
37298290c6bfae32b7dc710d2780242ef783c9b5 | 1193700079/ai_doctor | /on_line/bert_server/app.py | UTF-8 | 1,362 | 2.828125 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
# 导入若干工具包
from flask import Flask
from flask import request
app = Flask(__name__)
import torch
# 导入中文预训练模型的编码函数
from bert_chinese_encode import get_bert_encode
# 导入微调网络模型
from finetuning_net import Net
# 设置训练好的模型路径
MODEL_PATH = "/root/ai_doctor/on_line/bert_server/model/YRQ_BERT_net_1618668193.... | true |
fc69e6ff44536aca670463325cc55d28afd9ae9d | cameron-terry/DoTTy | /libs/helpers.py | UTF-8 | 2,700 | 3.265625 | 3 | [] | no_license | import sys
DIVIDER = "="*48
def next_power_of_2(x):
return 1 if x == 0 else 2**(x - 1).bit_length()
def die(message):
"""Print status and exit."""
print(message)
exit(0)
def print_stats(stats_list):
"""Print statistics about image."""
print("[*] Statistics: ")
for i in range(len(stats_... | true |
e49fe4d1878b877bafd230c455b5e301b1bacb00 | positionering/PathAndObject | /aim_goal_fixed.py | UTF-8 | 2,552 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import math
import numpy as np
import rospy
from std_msgs.msg import Float32MultiArray
from std_msgs.msg import String
msg_to_publish = Float32MultiArray()
qr = 0
value = 0
def calcpos(x_GPS, y_GPS, t_gps):
global value
#rotation av gps koordinat system.
x_gps_diff = flo... | true |
45539f9933f8b36ffcb9a5a5d7f1ec3110149555 | PacktPublishing/Mastering-Python-Design-Patterns-Second-Edition | /chapter14/rx_example3.py | UTF-8 | 678 | 2.9375 | 3 | [
"MIT"
] | permissive | from rx import Observable, Observer
def get_quotes():
import contextlib, io
zen = io.StringIO()
with contextlib.redirect_stdout(zen):
import this
quotes = zen.getvalue().split('\n')[1:]
return enumerate(quotes)
zen_quotes = get_quotes()
Observable.interval(5000) \
.flat_map(lambda se... | true |
f624734538396897c51b9dc2958086369867b51e | davidsmiles/learningpython | /oop/advanced_oop/app.py | UTF-8 | 337 | 2.734375 | 3 | [] | no_license | from oop.advanced_oop.admin import Admin
from oop.advanced_oop.database import Database
a1 = Admin('david', 'david', 3)
u1 = Admin('james', 'james', 5)
users = [a1, u1]
[user.save() for user in users]
print(Database.find(lambda x: x['username'] == 'david'))
Database.remove(lambda x: x['username'] == 'david')
print(D... | true |
082e6942bbdd16d80fd8d464a4fa664e60614766 | davidhyun/nomasknopass | /Iot/EdgeDevice/test14.py | UTF-8 | 788 | 2.890625 | 3 | [] | no_license | import spidev, time
import matplotlib.pyplot as plt
def analog_read(channel):
# 매개변수 (시작비트, 채널, 자릿수 맞춤 위치), 리턴값 : 아날로그 값
r = spi.xfer2([1, (0x08+channel)<<4, 0])
adc_out = ((r[1]&0x03)<<8) + r[2] # 수신 데이터 결합
return adc_out
spi = spidev.SpiDev()
spi.open(0,0) # (버스, 디바이스)
spi.mode = 3
spi.max_speed_hz =... | true |
1aa1edaf35032d88ffbb44dc2b8033ceaa20c147 | dracos/Theatricalia | /fields.py | UTF-8 | 8,558 | 2.875 | 3 | [] | no_license | import copy
import datetime
import re
import time
from datetime import date
from widgets import PrettyDateInput
from django.db import models
from django import forms
from django.forms import ValidationError
from django.utils import dateformat
class ApproximateDate(object):
"""A date that accepts 0 for month or da... | true |
39198c228004bc9ddc0a59a4a5bcd6db41930b8f | magasaniganeshkumar/PythonLibraries | /Numpy/multiply_with_element.py | UTF-8 | 382 | 3.8125 | 4 | [] | no_license | # Python program to create an array of (3, 4) shape, multiply every element value by 3 and display the new array
# importing the numpy library
import numpy as np
array1 = np.arange(12).reshape(3, 4)
print("before array elements : ")
print(array1)
for element in np.nditer(array1, op_flags=['readwrite']):
element[.... | true |
7c4f31a8f1c74a6bc8a70fd00f2cbf0056417b6a | claudiovaliense/visualizacao_covid | /chaves/graficos_chaves.py | UTF-8 | 4,137 | 2.6875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import plotly.graph_objs as go
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import os
class GraficoChaves:
def atualizar(self, estado, tipo):
dir_path = os.path.dirname(os.path.realpath(__file_... | true |
500b8e01626bd1922a3a31f34acad90b67c2b523 | Liaoyingjie/Pythonlearn | /Python编程快速上手3.6/10/100举例报错.py | UTF-8 | 463 | 2.796875 | 3 | [] | no_license | #Python 执行无效代码时,就会抛出异常
# try except
#抛出异常用rasie语句
#1 raise关键字 2 对exception函数调用 3传递给Exception 函数的字符串 包含出错信息
raise Exception('这个是错误信息')
#如果没有 try和 except 语句来覆盖 异常的raise 语句
#程序就会崩溃 并且显示出异常的出错 信息
#一般 raise在函数中 Try和except 在调用 该函数的 代码中
####
###
| true |
d531bb154242daad9c4d5da421d23c6724465424 | nihole/ACY | /scripts/presentation/y2e.py | UTF-8 | 264 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import yaml
import pandas as pd
data = """
thermal_properties:
- temp: 0.0
free_energy: 10
- temp: 1.0
free_energy: 11
- temp: 2.0
free_energy: 12
"""
x = yaml.load(data,Loader=yaml.FullLoader)
pd.DataFrame(x['thermal_properties']).to_excel('file.xlsx')
| true |
89e8d4f465cad67aaf1dfdc745e27d15bdba38ff | cdturizo15/Alien-invasion | /alien_invasion.py | UTF-8 | 5,996 | 2.984375 | 3 | [] | no_license | import sys
import pygame
from time import sleep
from game_stats import Game_stats
from settings import Settings
from ship import Ship
from stars import Stars
from bullet import Bullets
from alien import Alien
from button import Button
from scoreboard import Scoreboard
from lifes import Lifes
class AlienInvasion:
... | true |
a94c2fc5d93402b5853bafe3cc01eeaa0dcbc4fc | Daniil7575/Python_practice | /Practice_3/21.2.py | UTF-8 | 302 | 3.5625 | 4 | [] | no_license | def transpose(matrix):
tmp_matrix = matrix[::]
for i in range(len(tmp_matrix)):
tmp = []
for j in range(len(tmp_matrix[i])):
tmp.append(tmp_matrix[j][i])
matrix.append(tmp)
matrix.pop(0)
# mtrx = [[1, 2], [3, 4]]
# transpose(mtrx)
# print(mtrx)
| true |
db21808cd9b1ae119df247be9da8ab6fdb9979d9 | pdames/ray | /python/ray/ml/preprocessors/tokenizer.py | UTF-8 | 1,275 | 2.984375 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | from typing import List, Callable, Optional
import pandas as pd
from ray.ml.preprocessor import Preprocessor
from ray.ml.preprocessors.utils import simple_split_tokenizer
class Tokenizer(Preprocessor):
"""Tokenize string columns.
Each string entry will be replaced with a list of tokens.
Args:
... | true |
dffe57932f7e1c84cc32acf781fca7f7715216ff | JakubKazimierski/PythonPortfolio | /Coderbyte_algorithms/Hard/OptimalAssignments/test_OptimalAssignments.py | UTF-8 | 646 | 3.140625 | 3 | [] | no_license | '''
Unittests for OptimalAssignments.py
December 2020 Jakub Kazimierski
'''
import unittest
import OptimalAssignments
class test_OptimalAssignments(unittest.TestCase):
'''
Class with unittests for OptimalAssignments.py
'''
# region Unittests
def test_ExpectedOutput(self):
... | true |
19e4a52279f9eeaa7d85be76ee0a15ba7f198ef4 | Gog400/VT-Bot | /legacy code/test.py | UTF-8 | 1,110 | 3.21875 | 3 | [] | no_license | # def writeText(text):
# # if __name__ == '__main__':
# queue.append(text)
# for c in queue:
# time.sleep(0.5)
# PressKey(c)
# time.sleep(0.5)
# ReleaseKey(c)
#
# writeText("Titan's treasure")
# from MouseEvents import Mouse
# import time
#
# mouse = Mouse()
# mouse.click((20... | true |
835c429f04f90d2c895e3b5f1a8d607fa3a3be1b | emanuel2718/Game_Engine | /src/controller.py | UTF-8 | 513 | 2.609375 | 3 | [] | no_license | import pygame
# Created by Emanuel Ramirez Alsina on 03/23/2020
UP = pygame.K_w
DOWN = pygame.K_s
LEFT = pygame.K_d
RIGHT = pygame.K_a
# Event keys for w, a, s, d, e and f respectevely
player_keys = [119, 97, 100, 115, 101, 102 ]
# Event keys for p and d
game_keys = [112, 102]
class Getkey:
def __init__(self, g... | true |
bcd6a34a83481c746f6b0f88e60876aa6cdb6ccb | LoyolaMARS/rocketPerformanceCode | /F/P_tank/P_tank.py | UTF-8 | 969 | 3.046875 | 3 | [] | no_license | import math
import numpy as np
#Create a Rocket Class
class P_tank():
lox_density = 1.140
kero_density = 1.02
def __init__(self):
p = self
def calculate_tank_volume(self, oxidizer_fuel_ratio, propellant_mass):
kero_mass = propellant_mass/(1+oxidizer_fuel_ratio)
lox_mass = pr... | true |
508379386479d4baf3a5d1b8651c9df444b80af0 | jasemichael/fractal_visualizer | /src/4.0/mbrot_fractal.py | UTF-8 | 5,298 | 3.234375 | 3 | [] | no_license | #!/bin/env python3
# Mandelbrot Set Visualizer
import sys
from tkinter import Tk, Canvas, PhotoImage, mainloop
# This color gradient contains 100 color steps.
gradient = [
'#ffe4b5', '#ffe5b2', '#ffe7ae', '#ffe9ab', '#ffeaa8', '#ffeda4',
'#ffefa1', '#fff29e', '#fff49a', '#fff797', '#fffb94', '#fffe9... | true |
6442c8220621dadf24c6519c83d87b27881952d9 | mecthew/LeetcodeTop100 | /answer/114.二叉树展开为链表.py | UTF-8 | 949 | 3.34375 | 3 | [] | no_license | from typing import List
# Medium
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
prev_node = None
def flatten(self, root: TreeNode) -> None:
"""
Do not return anything, modify roo... | true |
d784a6ec322765f54362888206bbbd6fd0c2f60b | run-fourest-run/PythonDataStructures-Algos | /Chapter 4 - Collections/44_CounterObjects.py | UTF-8 | 2,121 | 4.25 | 4 | [] | no_license | from collections import Counter
'''
Counter Objects:
* Counter is a subclass of Dictionary where each dictionary key is a hashable object and the associated value is an integer count of that object.
* There are three ways to intialize a counter.
1). We can pass it any sequence object
2). a dictionary of key:value p... | true |
9631745415ec6000f925a80f6dbfe01dd55c9e2a | marromlam/lhcb-software | /LbScripts/LbRelease/python/LbRelease/SoftConfDB/LbSdbAddPlatform.py | UTF-8 | 2,191 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
"""
A script to add a project to the Software Configuration DB
"""
import logging
import sys
from LbConfiguration.Repository import getRepositories
from LbUtils.Script import Script
from LbRelease import rcs
from LbRelease.SoftConfDB.SoftConfDB import SoftConfDB
# SVN Repositories definition
ur... | true |
7f5ad93a2d83f4a4ffb56ef3146db46d6a7071cc | laoqiukantianxia/PythonSource | /myproject/learn-python3/package/3_serialization.py | UTF-8 | 1,283 | 4 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 把变量从内存中变成可存储或传输的过程称之为序列化,在Python中叫pickling
# 局限:只能用于python,并且可能不同版本的Python彼此都不兼容
# dumps():把任意对象序列化成一个bytes //dump(),直接把对象序列化后写入一个file-like Object:
# loads(): 把序列化的对象反序列化写入内存 //load(),从一个file-like Object中直接反序列化出对象
import pickle
d = dict(name='Bob', age=20, score=88)
print(pickle.dumps(d)... | true |
b712a0b715f2263749ffb8c0d32af00e781fe7f3 | SGU-winter-study/CodingTestStudy | /week6/HongheeLee/LeetCode_739_210212.py | UTF-8 | 1,349 | 3.359375 | 3 | [] | no_license | '''
문제설명
리트코드 739 일일 온도(스택 이용)
매일의 화씨 온도 리스트를 입력받고 더 따뜻한 날씨를 위해서는 며칠을 더 기다려야 하는지 출력
해결전략
현재의 인덱스를 계속 스택에 쌓아두다가, 이전보다 상승하는 지점에서 현재 온도와 스택에 쌓아둔 인덱스 지점의 온도 차이를 비교해서,
더 높다면 스택의 값을 팝으로 꺼내고 현재 인덱스와 스택에 쌓아둔 인덱스의 차이를 정답으로 처리한다.
만약 더 높은 온도가 나오지 않아 스택이 비워지지 않았다면 해당 인덱스의 답은 0으로 남게 된... | true |
0afe712180e88ba6f7f58ae6cd85ba7e858511e3 | dskrad/binfolder | /conv-ppt.py | UTF-8 | 769 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# Takes markdown formatted file and converts all '# ' to none
# all '* ' to \t (tab), 4 spaces to tab, and line endings to DOS
# The result is an outline file suitable for Powerpoint
# Import sys and regular expressions
import sys
import re
filein = sys.argv[1]
f = open(filein, 'r')
fileout = f.... | true |
b2b09a561d8d249fa0e355f9ada4387870c1bfce | hooman734/S3-Browser-Tkinter | /functions/help_localstack.py | UTF-8 | 964 | 2.59375 | 3 | [] | no_license | from tkinter import Toplevel, Label, W, LEFT
def help_localstack():
help_window = Toplevel()
help_window.title("S3 - Browser Help - Localstack")
help_window.geometry("500x200")
message = Label(help_window, anchor=W, justify=LEFT, text="""
To use localstack fake S3 service, the only thing you... | true |
be2591c61ae0e466b0dffb69951afddbe1739822 | adv1996/ff-data-engine | /populate_users.py | UTF-8 | 5,038 | 2.6875 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
import json
import sleeperParser
import sleeperFetches as sleeper # need to change value of sleeperFetches
from time import perf_counter
# these should be aws lambdas in the future
def create_connection(db_file):
""" create a database connection to the SQLite database
... | true |
747af51cb051f518823fdd274938328c6c7d925d | SYYDSN/py_projects | /query_server/test/r查询测试.py | UTF-8 | 2,649 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import sys
__root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if __root_path not in sys.path:
sys.path.append(__root_path)
import requests
import datetime
from tornado.httpclient import AsyncHTTPClient
import asyncio
import urllib.parse
import threading
impo... | true |
c075085c0a2c233c6b1ea340d37de40931cccf83 | diegoduncan21/subastas | /subastas_repo/subastas/date_to_words.py | UTF-8 | 1,449 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | from datetime import datetime
FIJOS = {
0: "Cero",
1: "Un",
2: "Dos",
3: "Tres",
4: "Cuatro",
5: "Cinco",
6: "Seis",
7: "Siete",
8: "Ocho",
9: "Nueve",
10: "Diez",
11: "Once",
12: "Doce",
13: "Trece",
... | true |
58be0726379d2ce6982a1a83e0028f8c7f279444 | WeiningLi/Short_Fun | /image_manipulations/advanced_ascii_art.py | UTF-8 | 5,094 | 2.78125 | 3 | [] | no_license | import sys
import os
import time
import threading
import termios
import tty
import cv2
import pyprind
# CharFrame is used to convert each frame to frame made by chars
class CharFrame:
ascii_char = "#@$=+-\"'^` "
# convert a single pixel to char
def pixelToChar(self, luminance):
return self.ascii_c... | true |
a9af37519d03ef5a31e34135b34c07f2a46ca1ba | kiminhan/Python | /inhan/test.py | UTF-8 | 376 | 3.640625 | 4 | [] | no_license | while True:
number = int(input("입력 : "))
if number >= 1:
print("제법인데요?")
break
try:
if number <= -1:
print("양수를 입력하세요.")
except:
print("양수를 입력하세요.")
try:
if number == 0:
print("0은 안됩니다.")
except:
print("0은 안됩니다.")
| true |
d67f2be2adf8dba83ea5f599d57baa520cb3ba8f | York618/Tinystart | /Sources/config.py | UTF-8 | 4,292 | 2.859375 | 3 | [
"MIT"
] | permissive | # Tiny_start config and install tool
# Before running this config tool,you should check these softwares: 在运行配置工具之前,你需要检查这些软件
# Python >=3.5 Python版本必须大于或等于3.5
# requests >= 2.23 requests版本必须大于或等于2.23
import requests
configname = 'config.conf'
print('Tiny_start 配置向导')
# 获取本机IP
try:
city_ip_url = 'http://ip-api.com/... | true |
7b2c8f93f58be107833ee6041effcab6d05201f1 | vikas-ukani/Hacktoberfest_2021 | /Python/amicable_pairs.py | UTF-8 | 756 | 4.375 | 4 | [] | no_license | """ *Amicable numbers* are two different numbers so related that the sum of the proper divisors of each is equal to the other number.
A proper divisor of a number is a positive factor of that number other than the number itself.
For example, the proper divisors of 6 are 1, 2, and 3.
"""
#finding proper divisors of a nu... | true |
4c0a9c406f1ce6f8e4f7c04e00ebcee5a685674d | matibilkis/institute-gui-pyqt | /aj.py | UTF-8 | 1,293 | 2.59375 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QGridLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
s=0
class App(QWidget):
def __init__(self):
super().__init__()
self.title = 'Ay ay ay!'
self.left = 10
self.top = 10
self.wi... | true |
fb5d26daab79c771a7f91b6f93e7633d29dc1612 | ritikapatel1410/Python_Data_Structure | /Basic_Programs/Data_Structure/Basic_Program/get_sys_command_output.py | UTF-8 | 460 | 2.671875 | 3 | [] | no_license | '''
@Author: Ritika Patidar
@Date: 2021-02-24 10:21:10
@Last Modified by: Ritika Patidar
@Last Modified time: 2021-02-24 10:21:38
@Title : get system command output
'''
import subprocess
# file and directory listing
returned_text = subprocess.check_output("dir",shell=True,universal_newlines=True)
print("=======... | true |
7e628c3e727f68167ab07a0de7da517bdb201bac | AlexHarn/iceopt-generator | /log_version.py | UTF-8 | 1,042 | 2.78125 | 3 | [] | no_license | import click
import subprocess
import settings
def log_version(target_dir):
"""
Creates a logfile that contains information on the currently used generator
version and saves it in the specified directory.
Parameters
----------
target_dir : String
The directory to save the version file... | true |
e39cd93a6d23aa7b908eeec734057a2e863f5ece | hgbritten/automation | /automation/automation.py | UTF-8 | 1,072 | 2.625 | 3 | [] | no_license | import re
import shutil
import glob
with open(
"/home/the_procter/codefellows/code401/automation/automation/potential_contacts.txt"
) as file:
potentials = file.read()
phone = []
phone.extend(
re.findall(
"\d{3}[-\.\s]??\d{3}[-\.\s]??\d{4}|\(\d{3}\)\s*\d{3}[-\.\s]??\d{4}|\d{3}[-\.\s]??\d{4}",
... | true |
43939b020a72dcbe728fe21993599b2e43e21973 | ivelintod/Algo-Solutions | /week4/day1/BS.py | UTF-8 | 2,236 | 2.890625 | 3 | [] | no_license | class BP:
def __init__(self, num_of_pr, projects, choice, dependencies):
self.num_of_pr = num_of_pr
self.choice = choice
self.projects = projects
self.dependencies = dependencies
self.graph = {}
self.visited = []
self.visited2 = set()
self.count = 1
... | true |
0aa93c92f8b4a4d280935a6caf9bdcd61ffd21b8 | EshaMaharishi/tools | /parse_logkeeper_times.py | UTF-8 | 1,948 | 2.640625 | 3 | [] | no_license | from __future__ import print_function
import collections
import datetime
import re
import os.path
import sys
import dateutil.parser
startPattern = re.compile(r" (?P<time>[0-9\-T:\.\+Z]+) Running (?P<testname>[\w\.:]+)\.\.\.$")
endPattern = re.compile(r" (?P<time>[0-9\-T:\.\+Z]+) Writing output of [A-z]+ (?P<testname... | true |
56a967edf717e79dde5473f72c8fe7104bca59ea | DidiMilikina/DataCamp | /Machine Learning Scientist with Python/19. Image Processing with Keras in Python/01. Image Processing With Neural Networks/05. Build a neural network.py | UTF-8 | 1,500 | 4.15625 | 4 | [] | no_license | '''
Build a neural network
We will use the Keras library to create neural networks and to train these neural networks to classify images. These models will all be of the Sequential type, meaning that the outputs of one layer are provided as inputs only to the next layer.
In this exercise, you will create a neural netw... | true |
6a0cf9eaa3a78494af283bbf86a85f5b8a0747c3 | DeanDupalov/Softuni-Python-OOP | /exams/exam_02_apr_2020/project/player/player_repository.py | UTF-8 | 693 | 3.578125 | 4 | [] | no_license | class PlayerRepository:
count: int
players: list
def __init__(self):
self.count = 0
self.players = [] # collection of players
def add(self, player):
if player.username in map(lambda p: p.username, self.players):
raise ValueError(f"Player {player.username} already e... | true |
82df09833ccf39a160c1272da7aa4e61af30e471 | itsEmShoji/TCScurriculum | /1_poker/complete_solution/Player.py | UTF-8 | 3,789 | 3.484375 | 3 | [
"MIT"
] | permissive | from Deck import Deck
from Hand import Hand
class Player:
def __init__(self, id_, money, hand = None):
self.id = id_ # id determines order of play
self.money = money
self.hand = hand # defaults to None
def __repr__(self):
return 'Player(id=%r, money=%r, hand=%r)' % (self.id, self.money, self.hand)
def de... | true |
26f5a56596356aa18b2e88a6aea50ce0e5d84a62 | eastonYi/ReinforcementLearning | /src/agents/agent.py | UTF-8 | 3,475 | 2.5625 | 3 | [] | no_license | '''
the template of agents
'''
import numpy as np
import random
from abc import ABCMeta, abstractmethod
import logging
import sys
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, format='%(levelname)s(%(filename)s:%(lineno)d): %(message)s')
from src.tools import MCTS
class Agent(object):
__metaclass__... | true |
f6b5827a65763ce8f283f925590d72c25e84cd52 | khalifazada/Test_Questions | /question1.py | UTF-8 | 150 | 3.0625 | 3 | [] | no_license | from random import randint
random_list = [randint(0, 100) for i in range(0, 30, 1)]
print("Question 1\n", random_list)
print(len(random_list), "\n")
| true |
4d1546be4a9d198737b0349dc4da6b4fbabe6bfe | Faleye-jide/Job_scraping | /job_scraping.py | UTF-8 | 1,612 | 2.8125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import pandas as pd
def extract(page):
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"}
url = f'https://uk.indeed.com/jobs?q=python&l=london&start={page}'
r =... | true |
d391d5ed0a748643d5ee686f250c82c00378337f | ertyseidohl/aesthetic-landscape | /colors.py | UTF-8 | 1,415 | 2.515625 | 3 | [] | no_license | from util import lerp
import random
WHITE = 0
WHITE_RGB = (0xff, 0xff, 0xff)
BG_DARKEST = 1
BG_DARKER = 2
BG_DARK = 3
BG_LIGHT = 4
BG_LIGHTER = 5
BG_LIGHTEST = 6
FG_DARK = 7
FG_MID = 8
FG_LIGHT = 9
TRANSPARENT = 10
TRANSPARENT_RGB = (0xff, 0x00, 0xff)
TEST_COLOR = 11
TEST_COLOR_RGB = (0xcc, 0xcc, 0xcc)
_purples = ... | true |
a8652f83505164a8aecc5d08feb23ebc9f49f3b7 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_1/167.py | UTF-8 | 2,006 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
import logging
CurrentDebugLevel=logging.DEBUG
#engineNameList = []
#queryRequestList = []
def ProcessQueries(engineNum, queryNum, engineNameList, queryRequestList):
switchNum = 0
logging.debug('E=%d Q=%d', engineNum, queryNum)
#logging.debug(engineNameList)
#logging.d... | true |
6781e1453719ac7c04475125abca7132014bbae9 | dhruvgami/eb_django_app | /eb_django_app/neo4j/tests.py | UTF-8 | 1,313 | 2.640625 | 3 | [] | no_license | import requests
from django.test import TestCase
import json
from django.test.client import Client
from django.contrib.auth.models import User
def get_test_user():
u = User(username="username", is_superuser=True)
u.set_password("password")
u.save()
return u
def get_test_building():
b = models.Bui... | true |
ed34ecbc285266c4a085a0b16108378268467f2a | codewitty/GaiaAI | /Minesweeper_Python/src/NyAI.py | UTF-8 | 9,386 | 3.234375 | 3 | [] | no_license | # ==============================CS-199==================================
# FILE: MyAI.py
#
# AUTHOR: Justin Chung
#
# DESCRIPTION: This file contains the MyAI class. You will implement your
# agent in this file. You will write the 'getAction' function,
# the constructor, and any additional helper functions.
#... | true |
8787a4d38bc72bf4c0600335e3b7a59a5a0ed1bd | xlzan/pyscf | /pyscf/scf/test/test_diis.py | UTF-8 | 780 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
import unittest
import numpy
from pyscf.scf import diis
class KnowValues(unittest.TestCase):
def test_addis_minimize(self):
numpy.random.seed(1)
ds = numpy.random.random((4,2,2))
fs = numpy.random.random((4,2,2))
es = numpy.random.random(4)
v, x = diis... | true |
55fd644e13dc05c10dc291885cfede3ce6d77ce9 | awesomemachinelearning/ELL | /interfaces/python/package/ell/util/gallery.py | UTF-8 | 3,112 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 'Class that lists the model files available on Github and provides a way to choose one interactively'
import re
from collections import defaultdict
import os
import time
import datetime
class ModelGallery:
'Choose models from the Model Gallery on Github'
def __init__(self):
self.model = None
... | true |
7c346be7e934a9f19b53f335fd1c88df2223018b | mahaaad/algorithmic-complexity-visualiser | /file_chooser.py | UTF-8 | 2,090 | 3.46875 | 3 | [] | no_license | from menu import *
from files_and_directories import *
import os
def get_file_path_and_name(prompt='Choose a file by number:',
dir='.',
pattern='*',
allow_cd=False):
while True:
filenames = get_filenames(dir, pattern)... | true |
24cc08a86ae1be778258ee16bbd493c5d8c9305d | davidemoraschi/ahttpserver_019_src | /out/web/python/url_valid_chars.py | UTF-8 | 520 | 3.21875 | 3 | [] | no_license |
chars = []
for i in range(0, 255):
ch = chr(i)
if (ch >= 'a') and (ch <= 'z'):
chars.append ("true")
elif (ch >= 'A') and (ch <= 'Z'):
chars.append ("true")
elif (ch >= '0') and (ch <= '9'):
chars.append ("true")
elif (ch == '.') or (ch == '-') or (ch == '_') or (ch == '\'')... | true |
78bdb94b1e0cc3741cc606455e7eededf0b12643 | jesoleil/PythonExamples | /odev1.py | UTF-8 | 1,261 | 3.9375 | 4 | [] | no_license |
"""ODEV1
sayi1=int(input("Birinci sayıyı giriniz : "))
sayi2=int(input("İkinci sayıyı giriniz : "))
sayi3=int(input("Üçüncü sayıyı giriniz : "))
sonuc=sayi1*sayi2*sayi3
Print("Çarpım sonucu: {}".format(sonuc))"""
"""ODEV2
boy=float(input("Boyunuzu giriniz(m) : "))
kilo=float(input("Kilonuzu giriniz(kg) : ")... | true |
742e70ff7fe786146992dee644af6b0d3109b006 | dipto0321/datastructures-and-algorithm | /python/mixed/fibonacci.py | UTF-8 | 663 | 4.03125 | 4 | [] | no_license | def fiboTabulation(n):
cache = [None] * (n + 1)
cache[0] = 0
cache[1] = 1
for i in range(2, n+1):
cache[i] = cache[i - 1] + cache[i - 2]
return cache[n]
def fiboMemoization(n, cache):
if n < 2:
return n
if cache[n] != None:
return cache[n]
else:
... | true |
998330fedf54aa970e515cc90d56c3b2899c5571 | georgzepf/pi-spigot-algorithm | /pi.py | UTF-8 | 2,744 | 3.140625 | 3 | [] | no_license | # Copyright (C) Georg Zepf <contact@zepfgeorg.com>
# Idea / Explanation Prof. Dr. Edmund Weitz / HAW Hamburg
import math, sys, os
# generate new pi matrix
def matrix_generator():
i = 1
j = 3
while True:
yield [[i, 2 * j], [0, j]]
i += 1
j += 2
matrix = matrix_generator()
# conver... | true |
e35364084cdf96136d294fb1398b5e20297858c4 | Uday-Gurugubelli/tensorflow_examples | /autoencoder_rbm.py | UTF-8 | 6,389 | 2.9375 | 3 | [] | no_license | '''
This code implements the G. E Hinton and R. R. Salakhutdinov Science July 2006.
As said, 2-layer RBM are trained firest as the process of pre-training and
then trained together, given that the weights are initilized with
pre-trained weights.
'''
import tensorflow as tf
from tensorflow.examples.tutorial... | true |
1c927a486c85a59b4d99e8f2054802f378335c38 | sheenachu/PBT | /coc_data.py | UTF-8 | 5,691 | 3.4375 | 3 | [] | no_license | # Reads and organizes the City of Chicago data.
#
# Created by Kevin Bernat
#
import csv
import coords_to_block
import numpy as np
def read_csv(filename):
"""
Reads a csv file and stores the information into a list.
"""
l = []
with open(filename, newline='') as csvfile:
spamreader = csv.r... | true |
194eda055b52bf0929011657f7a4e40a63f21df5 | MasaruFukazawa/blockchain_no_kyokasho | /chapter_008/list_008_001.py | UTF-8 | 365 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import binascii
def main():
""" 秘密鍵を生成する
"""
# 32バイトの乱数を生成する
private_key = os.urandom(32)
print(private_key)
# バイナリデータを16進数に変換する
print(binascii.hexlify(private_key))
if "__main__" == __name__:
main()
| true |
f33fc3889537e2a4ff75e004f0c717f61eba77ba | paulossjunior/seon | /SEON/service/Service_Abstract.py | UTF-8 | 1,097 | 2.5625 | 3 | [] | no_license | from requestx.RequestX import RequestX
from pprint import pprint
import json
from collections import namedtuple
from urllib.error import HTTPError
class Service_Abstract (object):
def __init__(self, url = None):
self.host = 'https://enterprise-ontology-service.herokuapp.com/'
self.url = url
... | true |
add4c3d85d93b4f42a3b02d830d5c9b052245da5 | evandervanwolfswinkel/Datamining-Project | /Article.py | UTF-8 | 1,206 | 3.671875 | 4 | [] | no_license | class Article:
"""
@:Author: Anton Ligterink
@:Function: Class for storing articles within an object.
"""
def __init__(self, title, abstract, year, pubmed_id):
"""Constructor method for the Article class.
:param title: (str) title of the article, max length is 250 characters... | true |
ed22f07a373b1c01fb20caa91e2040e4b0116fc5 | Edvard88/leetcode | /Python/1920_v1_Build_Array_from_Permutation.py | UTF-8 | 312 | 3.1875 | 3 | [] | no_license | from typing import List
class Solution:
def buildArray(self, nums: List[int]) -> List[int]:
ans = [nums[nums[i]] for i in range(len(nums))]
return ans
if __name__ == '__main__':
input = [0,2,1,5,3,4]
solution = Solution()
result = solution.buildArray(input)
print(result)
| true |
afed7c3499fafc67f67df9468a39387ca63204bc | sjhan2781/real_clone | /account/views.py | UTF-8 | 2,680 | 2.546875 | 3 | [] | no_license | from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from django.contrib.auth.hashers import make_password, check_password #비밀번호 암호화 / 패스워드 체크(db에있는거와 일치성확인)
import json
from django.db import IntegrityError
from .serializers import AccountSerializer
... | true |
7f97da08ffa86e66773e0e94913c6da9dad59e97 | Alfred-CQ/Git_Taller_Grupo11 | /characters/Megamente.py | UTF-8 | 87 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | class Megamente:
def SayName(self):
print("Lo logró señor. Lo logré!?")
| true |
ad65d94215d328e1e2ee98435c6fb03ee159077c | nam2297ptit/BT_T3H | /Day4/Ex4.py | UTF-8 | 563 | 2.859375 | 3 | [] | no_license | import string
lines = '''
Ngư60ời 'theo hư@ơng' hoa 100mây mù [giăng lối]
Làn 25 sương khó30i phôi phai 90 đưa bư$ớc ai xa rồi 35
100Đơn c#ôi m99ình ta {vấn vương} hồi ức tro^ng ... men say (chiều mưa) buồ80n
Ng~ăn "giọt lệ" ngừng k2hiến khoé mi sầu bi.1
'''
lines = lines.splitlines()
result = []
for line in lines:
... | true |