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 |
|---|---|---|---|---|---|---|---|---|---|---|
0f5df4a6efebddcf6357d38967d5076a3100929f | ckim89/EVE | /src/vec2.py | UTF-8 | 687 | 3.828125 | 4 | [] | no_license | import math
class vec2():
def __init__(self, x, y):
self.x = x
self.y = y
def magnitude(self):
return (self.x ** 2 + self.y ** 2) ** (1 / 2.0)
def __add__(self, a):
return vec2(self.x + a.x, self.y + a.y)
def __sub__(self, a):
return vec2(self.x - a.x, self.y... | true |
bead2d33ecb93281373e3304672e10f82984a838 | masiro97/Python | /week/7주차_선형 재귀와 반복(과제)/7-1.1.py | UTF-8 | 501 | 2.828125 | 3 | [] | no_license | def gcd2(m,n):
if m!=0 and n!= 0:
if m %2 ==0 and n %2 ==0:
return 2*gcd2(m/2,n/2)
elif m%2 ==0 and n%2 !=0:
return gcd2(m/2,n)
elif m%2 !=0 and n%2 ==0:
return gcd2(m,n/2)
else:
if m<=n:
return gcd2(m,(n-m)/2)
... | true |
8e973fd7453a5a63368182b2449eb96e49e488f2 | Splatter-dev/Curso-em-Video-Python | /Mundo_1/002_mod/aula_009/ex027.py | UTF-8 | 1,318 | 4.8125 | 5 | [] | no_license | #027: Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome separadamente.
nome = input('Digite seu nome completo: ')
def prinome():
firstname = nome.split()
return print('O primeiro nome é: {}'.format(firstname[0]))
def segunome(): # itens de uma lista são ... | true |
65577c0e9e29ff440a0d86b0ef9ae0b4e39d8889 | BohemianXen/Uni | /FYP/Software/Training/StreamManager.py | UTF-8 | 1,691 | 2.53125 | 3 | [] | no_license | import asyncio
from PyQt5.QtCore import QRunnable, QObject, pyqtSignal, pyqtSlot
from Logger import Logger
class StreamManagerSignals(QObject):
"""Slot signals to link back to main thread. Not currently used."""
deviceFound = pyqtSignal(bool)
dataReady = pyqtSignal(list)
connected = pyqtSigna... | true |
bc40b8d431143c178bb1532bae875401d7cc0aa9 | timodonnell/genomisc | /genomisc/plots/mds.py | UTF-8 | 403 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import numpy
from matplotlib import pyplot
def plot_embedding(points, labels, colors=None):
points = numpy.array(points)
figure = pyplot.figure()
pyplot.axes([0., 0., 1., 1.])
pyplot.scatter(points[:, 0], points[:, 1], color=colors)
for i in range(len(labels)):
pyplot.annotate(
... | true |
db11c727bad25b40220a5adb65775d394f0167bd | giuper/teaching | /OldClasses/ALGO20/Exams/210715/LinkedList-11/LLmax.py | UTF-8 | 364 | 2.765625 | 3 | [] | no_license | from linkedList import LinkedList
class LLmax(LinkedList):
def massimo(self):
if self.head is None:
return 0
cmax=self.head.data
curNode=self.head
while curNode.next is not None:
curNode=curNode.next
if curNode.data>cmax:
cmax=cur... | true |
0bc5f4ab7e0f98a4039597861df2199976357f55 | cloew/PersonalAccountingSoftware | /src/Qt/GUI/Category/TableWidgets/name_table_item.py | UTF-8 | 598 | 2.734375 | 3 | [] | no_license | from db.categories import Categories
from Qt.GUI.Core.kao_table_item import KaoTableItem
class NameTableItem(KaoTableItem):
""" Represents a Table Widget Item for a Category Name """
def __init__(self, category):
""" Initialize the Name Item """
self.category = category
Ka... | true |
b74b574a7c93af575d1cbb3486bc0013141f1510 | roiti46/Contest | /atcoder/arc/arc013/b.py | UTF-8 | 177 | 3 | 3 | [] | no_license | C = int(raw_input())
x = y = z = 0
for i in xrange(C):
a, b, c = sorted(map(int, raw_input().split()))
x = max(x, a)
y = max(y, b)
z = max(z, c)
print x * y * z
| true |
d71c03c4c9b9a487c7c617c8b97fd3018ec0c8ab | gosch/Katas-in-python | /2019/october/josephusProblem.py | UTF-8 | 351 | 3.203125 | 3 | [] | no_license | def josephusProblem(n, k):
r = [True] * n
i = 0
c = 0
t = n
while n > 0:
if r[i]:
c += 1
if c == k:
r[i] = False
n -= 1
c = 0
if n == 0:
break
i = i + 1 if i + 1 < t else 0
return i + 1
... | true |
b3bdeb4e273cbe0567f3cef20681e7f87acc9612 | tails1434/Atcoder | /ABC/152/D-1.py | UTF-8 | 484 | 3.140625 | 3 | [] | no_license | def main():
N = int(input())
cnt = [[0] * 10 for _ in range(10)]
for i in range(1,N+1):
tmp = str(i)
top = int(tmp[0])
end = int(tmp[-1])
cnt[top][end] += 1
ans = 0
for a in range(10):
for b in range(10):
for c in range(10):
for d i... | true |
5449fb62ad294f29c052f62b249902c390fa43f4 | toby-hagan/invertedPendulum | /Question1.py | UTF-8 | 1,241 | 3.359375 | 3 | [] | no_license | import sympy as sym
# step 0. introduce the necessary symbols
M, m, g, x1, x2, x3, x4, F, ell = sym.symbols('M, m, g, x1, x2, x3, x4, F, ell')
phi = 4*m*ell*x4**2*sym.sin(x3) + 4*F - 3*m*g*sym.sin(x3)*sym.cos(x3)
phi /= 4*(M+m) - 3*m*sym.cos(x3)**2
# declaration of psi function
psi = -3*(m*ell*x4**2*sym.sin(x... | true |
f32915ef1c5e9945038ef8cdd9338a33cd43fe11 | ruskolo/binance_bottas | /voller.py | UTF-8 | 27,704 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
import time
import math
import os
import sys
import multiprocessing as mp
from random import randint
from binance.client import Client
from binance.enums import *
loop_buy_style = 'hi'
client = Client(<API>, <API_SECRET>)
print ' _ _ _ '
print '| | | | | | ... | true |
79d6d033a9346e3c7215fc2931c629dbc16da7cd | joheb70/Data_science_python | /Basic/basics.py | UTF-8 | 1,121 | 4.625 | 5 | [] | no_license |
#The start of Python Mega Course
#Author: Abdul Joheb Ansari------------------------------------------------------------------------------------------------------
# 1st program : Learn basic of modular code
day_hours = 24
week_days = 7
week_hours = day_hours * week_days
print(week_hours)
# 2nd program : Learn a... | true |
8b68fbc14faa63fd736eea02e68d6174c53399ff | iliaspap/dataBases | /init.py | UTF-8 | 1,625 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
import mysql.connector
import csv
print("Getting things ready, please wait...")
# Connecting to mysql
print("Connecting to mysql...", end="")
mydb = mysql.connector.connect(
user = "asdf_admin",
passwd = "databases2021",
)
print("Done")
mycursor = mydb.cursor()
d... | true |
e096d53b1ed967097088e027d1638a79f2598fed | pcaldentey/lana-challenge | /app/tests/e2e/test_delete_basket_endpoint.py | UTF-8 | 972 | 2.703125 | 3 | [] | no_license | import json
import requests
import unittest
class TestDeleteBasketEndpoint(unittest.TestCase):
def setUp(self):
self._server_url = 'http://0.0.0.0'
def test_delete_unexisting_basket(self):
response = requests.delete('{}/basket/{}'.format(self._server_url, 25))
data = json.loads(respon... | true |
15e858b67178b9210dd18d37d2c47d657f50cd3d | gaoming-123/myspiders | /bid_tender/bid_tender/common/pur_name.py | UTF-8 | 4,801 | 3 | 3 | [] | no_license | import re
import logging
# 先判断 招标人在网页中 使用招标人一套标准
JY_START = ['招标人:', '招标人名称:', '招标单位:', ]
# 先判断 采购人在网页中 使用采购人一套标准
CG_START = ['采购人:', '采购人名称:', '采购人:单位名称:']
# 结束字符串列表(不包含在所需要的字段内容)
END_WITHOUT_STR = ['(二)采购人地址:', '盖单位章招标代理:', '公章法定代表人:', '采购地址:', '招标代理机构:', '联系人:', '单位名称:', '招标单位联系人:', '招标人通信地址:',
... | true |
3b06495ec34acf5c052cffcc6c439e211428fe2c | tom-cityu/writing.com-archival | /defs.py | UTF-8 | 943 | 2.546875 | 3 | [] | no_license | from collections import namedtuple
from typing import Dict, Any
class StoryInfo(namedtuple('StoryInfo', ['id', 'author_id', 'author_name', 'description', 'pretty_title', 'brief_description', 'image_url', 'created', 'modified', 'last_full_update'])):
def to_dict(self) -> Dict[str, Any]:
temp = self._asdict(... | true |
393cb3a8aaec48f7a71f14bf2de822a4231ebc52 | PSharon7/Course-Project | /AI/value_iteration.pyclass ver2.py | UTF-8 | 9,011 | 2.734375 | 3 | [] | no_license | import numpy as np
import copy
# np.set_printoptions(threshold=np.nan)
f_in = open("input2.txt", "r");
grid_world = []
n_row = 0
n_column = 0
pro_walk = 0
pro_run = 0
terminal_state_num = 0
terminal_state_pos = []
terminal_state_rew = []
reward = []
discount = 0
rewards = []
max_change = float('inf')
epsilon = float... | true |
dab01eb94f88b63b63149b2e3de730ec76e2c446 | chasecolford/Leetcode | /problems/159.py | UTF-8 | 729 | 3.296875 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int:
"""
since we can only have two distict characters in out substring,
we can use sliding window and always keep track of the widest windows
we have seen up to some point i
"""
l, r, counts = ... | true |
5f779e9ad4203353f2304e97bb5166a05ff0c52f | honchen22/LeetCode | /程序员面试金典/面试题 04.02. 最小高度树.py | UTF-8 | 592 | 3.515625 | 4 | [
"MIT"
] | permissive |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sortedArrayToBST(self, nums: List[int]) -> TreeNode:
nums.sort()
return self.help(nums,0,len(nums)-1)
def help(... | true |
a52628dc9c02e83db380a006878885d63d05916c | Robert0202/Atividades | /Algoritmo_Logica/Lista_While/while 5.py | UTF-8 | 194 | 3.40625 | 3 | [] | no_license | import random
cont = 0
numero = random.randint(1, 10)
while(numero != 10):
cont += 1
numero = random.randint(1, 10)
print('Foram gerados {} numeros para obter o numero 10'.format(cont))
| true |
cfd46edb15bd7dd9d9a247b08f2b9955ac34a5a0 | brianturn/dsp | /python/advanced_python_regex.py | UTF-8 | 2,240 | 3.640625 | 4 | [] | no_license | import csv
import re
print ()
# Q1.
print ('Q1.')
def degrees():
with open('faculty.csv') as file:
reader = csv.reader(file, delimiter=',')
header = next(reader)
degrees = []
for row in reader:
degree = row[1].strip()
match = re.search('\.', degree)
if match:
degrees.append(degree.replace(matc... | true |
46f04fa02c3500dfd07cb6c404a5ff58d6153d56 | niemmi/algolib | /algolib/sort/merge_sort.py | UTF-8 | 2,137 | 3.9375 | 4 | [
"BSD-3-Clause"
] | permissive | """Two different implementations of merge sort. First one is the standard sort
that creates the result to new list on each level. Second one is an in-place
sort that uses two alternating buffers and offsets to limit memory usage
to O(2n).
"""
def sort(lst):
"""Standard merge sort.
Args:
lst: List to ... | true |
8be4e63f6f02bba43a05a57745dbc00c177dd399 | Nika1411/Laba20 | /zadanie1.py | UTF-8 | 1,086 | 3.140625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- config: utf-8 -*-
from tkinter import *
box1 = ["apple", "bananas", "carrot", "bread", "butter", "meat",
"potato", "tomato", "milk"]
def move_to_right(event):
select = list(lbox1_listbox.curselection())
select.reverse()
for j in select:
lbox2_listbox.insert(0... | true |
21cfbd459a7948648025b07421be82cdf2f0349d | Creedes/HarvardCourse | /python/global.py | UTF-8 | 262 | 3.9375 | 4 | [] | no_license | print("-----global-----")
# If you need to modify a global variable from within a function, use the global statement:
def spam():
global eggs
eggs = 'spam'
eggs = 'global'
print("Vorher:", eggs)
spam()
print("Nachher:", eggs)
print("----------------\n") | true |
ffa4b0fed0211d9a3f8665ae0d2253ba5232767e | KUAN-HSUN-LI/CTF | /CrpytoHack/MISC/Armory/armory.py | UTF-8 | 981 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
import hashlib
FLAG = b"crypto{???????????????????????}"
PRIME = 77793805322526801978326005188088213205424384389488111175220421173086192558047
def _eval_at(poly, x, prime):
accum = 0
for coeff in reversed(poly):
accum *= x
accum += coeff
accum %= prime
retu... | true |
e63520969190d517f319d202311d36f174b86275 | Dollars/svl | /src/hydraulic_network/segmentgraph.py | UTF-8 | 4,696 | 2.578125 | 3 | [] | no_license | # -*-coding:Utf-8 -*
'''
Created on 13 déc. 2012
@author: jwillaim
'''
from hydraulic_network.networks import Network
from hydraulic_network.valve import Valve
import copy
class SegmentValveGraph(object):
def __init__(self, inNetwork):
super(SegmentValveGraph, self).__init__()
self.segmentMap = dict()
s... | true |
5c5defa0aa8015d437fd03730410eb5a5d635f5b | FATEC0SJC/2020-2-ADS-3A | /EQUIPE 2/backend/app/service/session.py | UTF-8 | 396 | 3.34375 | 3 | [
"MIT"
] | permissive | class Session():
def __init__(self):
self.session = dict()
def addUser(self, user):
self.session[user.email] = user
def removeUser(self, user):
if user.name in self.session:
self.session.pop(user.email)
else:
print(f'ERRO: O usuário {user.name} nã... | true |
5eed8839387321ae1f3d0320c9e0c230841ef364 | miuho/Wikipedia-Trends | /src/mapper.py | UTF-8 | 2,257 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import os
# Read each line from large data set
for line in sys.stdin:
# Split each line by space ' '
info = line.split()
# Each entry must have 4 elements
if (len(info) != 4):
continue
# Exclude if entry is not English Wikipedia
if ("en" != i... | true |
46ba5b8c985e860a99d9ee1fe0114c70c9428a77 | kstonekuan/formatted-emailer | /emailer.py | UTF-8 | 1,680 | 2.71875 | 3 | [] | no_license | import csv, smtplib, ssl, time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
message = MIMEMultipart("alternative")
message["Subject"] = "MY SUBJECT"
from_address = "MYEMAIL@gmail.com"
password = 'MYPASSWORD'
message["From"] = from_address
# Normal text and HTML versions in cas... | true |
c00351e658e96032a1bb31bc1c8db07d2efba5a0 | gautamabhishek46/IVP_Assignment_3 | /Utilities.py | UTF-8 | 2,874 | 2.84375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as read
import cv2
MIN_PIXEL_VALUE = 0
MAX_PIXEL_VALUE = 255
def load_image(name, usecv=True, type=None):
if usecv:
if type is not None:
return cv2.imread(name, type)
else:
return cv2.imread(name)
... | true |
ff2591d53df4f912d89ffd68832b58a3f7154972 | lazyplatypus/natcar-server | /server/framework/database.py | UTF-8 | 665 | 3.046875 | 3 | [] | no_license | """
On each request, we create and close a new connection.
"""
from config import config
import psycopg2
import psycopg2.extras
psycopg2.extras.register_uuid()
def make_db_connection():
"""
Create a database connection.
"""
db_config = {
'host': config['pg_host'],
'dbname': config['pg_dbname'],
... | true |
244db33f3c299fa09ff7680c30ce9f696ddc066c | SymmetricChaos/MyOtherMathStuff | /GEB/Chapter1TheMUPuzzle.py | UTF-8 | 1,510 | 3.421875 | 3 | [] | no_license | import re
def MIU_rule1(S):
if S[-1] == "I":
yield S + "U"
def MIU_rule2(S):
if S[0] == "M":
yield S + S[1:]
def MIU_rule3(S):
for pos in range(len(S)):
if S[pos:pos+3] == "III":
yield S[:pos] + "U" + S[pos+3:]
# We use regex to save some work here. It doesn't matter... | true |
176552d0539301d4c45eea808b9bf8f20ad7ac81 | adgryz/AdventOfCode2018 | /1/1_5.py | UTF-8 | 309 | 2.8125 | 3 | [] | no_license | frequencies = [int(line.rstrip('\n')) for line in open('input_1_5.txt')]
count = len(frequencies)
summ = 0
i = 0
buffor = 100000
maxcount = 1000000
results = [buffor]*maxcount
while i<maxcount:
summ += frequencies[i % count]
results[summ] += 1
if results[summ] == buffor + 2:
print(summ)
break
i+=1 | true |
c41eea3bf05e947a19074f73d3eeaa87d9a9d8c4 | UW-ParksidePhysics/Rizzo-Paul | /Files, Dictionaries, and Strings/6.6_acc2vel_12.py | UTF-8 | 382 | 2.96875 | 3 | [] | no_license | from numpy import array, zeros, loadtxt
import matplotlib.pyplot as mp
def velocity(a, dt):
n = len(a)
v = zeros(n)
for k in range(1, n):
v[k] = v[k-1] + (a[k-1] + a[k]) / 2
v = v * dt
return v
a = loadtxt('acc.txt')
dt = 0.1
v = velocity(a, dt)
t = array([i * dt for i in r... | true |
fc2c61e3257c938d45151dff2871dd4b7e2b29dd | inwk6312winter2019/classroomtask1-93akshaykumar | /LAB_2/LAB2_TASK4.py | UTF-8 | 116 | 3.171875 | 3 | [] | no_license | def print_back_string(val):
for i in range(len(val),0,-1):
print(val[i-1])
print_back_string('Akshay')
| true |
782e9ab91a15d02cd11f4706b659484951f3563d | Yuhang-Wu/Portfolio_Management_DL-RL | /Programs/PredictStockPrice.py | UTF-8 | 3,781 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers.recurrent import LSTM
from keras.layers.core import Dense, Activation, Dropout
CONST_TRAINING_SEQUENCE_LENGTH = 12
CONST_TESTING_CASES = 5
def dataNormalization(data):
return [(datum - da... | true |
06f3c7044a4db087253e67baf1e8339e2cba0111 | mmore500/dishtiny | /web/make_html.py | UTF-8 | 1,492 | 2.765625 | 3 | [
"MIT"
] | permissive | import jinja2
from markdown2 import Markdown
import toml
INPUT = 'keys.toml'
OUTPUT = 'index.html'
TEMPLATE = "template.html.jinja"
DIR = "web/"
# load our TOML file
with open(DIR + INPUT, 'r') as file:
data = toml.load(file)
# process and generate badge
def make_badge(str, color):
# it's a badge!
# det... | true |
d809782d4ba6205e689f42b510834c3d68764262 | benja263/generative_models | /Flow/utils/squeeze.py | UTF-8 | 700 | 3.390625 | 3 | [] | no_license | """
Squeeze and reverse squeeze operations from section 3.6 arXiv:1605.08803
"""
def squeeze(x):
"""
Transform input shape from C x H x W -> 4C x H/2 x W/2
:param x: input
:return:
"""
# C x H x W -> 4C x H/2 x W/2
B, C, H, W = x.shape
x = x.reshape(B, C, H // 2, 2, W // 2, 2)
x =... | true |
1b4bc0a9e6b114baca70fb689eccc06452bab2a2 | LuboO/rtt-pyscript-base-docker | /rtt_pyutils/MySQLDatabaseInfo.py | UTF-8 | 946 | 2.9375 | 3 | [
"MIT"
] | permissive | class MySQLDatabaseInfo:
def __init__(self, host, port, database, username, password):
self.host = host
self.port = int(port)
self.database = database
self.username = username
self.password = password
@staticmethod
def get_from_cnf(config):
config.check_has_... | true |
974bbe00cb45bac2fefa7a07a68a5da75b130966 | kenbranson/KenPythonCodeExamples | /math_examples.py | UTF-8 | 488 | 3.484375 | 3 | [] | no_license | import math
import numpy
import matplotlib.pyplot as plt
x = [1,2,15,3,6,17,8,16,8,3,10,12,16,12,9]
#some examples of using stats functions
print(numpy.min(x))
print(numpy.max(x))
print(numpy.std(x))
print(numpy.mean(x))
print(numpy.median(x))
# some examples of using plotting functions for graphs
plt.boxplot(x)
plt... | true |
df4e7dbc22c1eb346f15d18b88f7002ace1b4b0c | doraa7/codility-prac | /toptal.py | UTF-8 | 2,429 | 3.3125 | 3 | [] | no_license |
import math
def isPrime(N):
sq = int(math.sqrt(N)) + 1
if N < 2: return False
elif N == 2: return True
else:
for i in range(3, sq, 2):
if N%i == 0:
return False
return True
isPrime(15)
def x():
if 2 in {3, 4, 2}:
return True
else:
retu... | true |
90879085593b8ec0bb215da823776332ecec37f7 | aditya-chhaparia/csoc-2021-algorithms | /python/longest_increasing_subsequence.py | UTF-8 | 397 | 3.859375 | 4 | [] | no_license | def longest_increasing_subsequence(nums):
n = len(nums)
lis = [1]*n
for i in range(1, n):
for j in range(0, i):
if nums[i] > nums[j] and lis[i] < lis[j] + 1:
lis[i] = lis[j]+1
return max(lis)
nums = [int(x) for x in input("Enter numbers:\n").split()]
print("Length... | true |
05ae68fc937d620e131de2c92fa4b35ef837088b | juacompe/django-slumber | /slumber/http.py | UTF-8 | 482 | 2.640625 | 3 | [
"BSL-1.0"
] | permissive | from simplejson import dumps
from django.http import HttpResponse
def view_handler(view):
"""Wrap a view function so it can return either JSON, HTML or someother response.
"""
def wrapper(request, *args, **kwargs):
response = {}
http_response = view(request, response, *args, **kwargs)
... | true |
6b864b5e835e4863317843ff59e078576023c819 | liyi1013/Algorithms | /Leetcode_oj/?Word Break.py | UTF-8 | 395 | 3.140625 | 3 | [] | no_license | class Solution:
# @param s, a string
# @param dict, a set of string
# @return a boolean
def wordBreak(self, s, dict):
for i in range(len(s)):
if s[i] in dict:
return self.wordBreak(s[i+1,len(s)], dict)
else
pass
if __name__=="__main__":
... | true |
c3427cb9f6b89fa29aa0f5ec2c3ef6f00abf45ed | guillermobet/SIRIUS | /SIRIUS/index/scoreEvaluator.py | UTF-8 | 1,103 | 2.5625 | 3 | [] | no_license | #
# cf: Correction Factor
# up: Usability Percentage
#
def get_cf(criterion, criteria, website_type):
relevance = criterion.meta_criteria.get_relevance_list()[website_type]
relevance_value = criterion_relevance_mapping[relevance]
denominator = 0
for crit in criteria:
if(crit.value != 'NA'):
relevance = cri... | true |
5ae1a8e6fb073725a90d0fafdf611a772d67f62c | MoleImg/TFWork | /Apps/RNNECGRWavePredictor/DataParser.py | UTF-8 | 1,056 | 3.0625 | 3 | [] | no_license | '''
Todo:
ECG data import and realign
'''
import numpy as np
def read_data_from_txt(file_name):
with open(file_name, 'r') as f:
data = []
while True:
lines = f.readline()
if not lines:
break
lines_list = lines.split(r',')
try:
... | true |
2c2f55662527190a1ad0c1a13086ca137e42b9ab | zsbati/PycharmProjects | /Currency Converter2/Currency Converter/task/fifth.py | UTF-8 | 206 | 2.71875 | 3 | [] | no_license | # write your code here!
import json
import requests
currency = input().lower()
url = f'http://www.floatrates.com/daily/{currency}.json'
r = requests.get(url).json()
print(r.get('usd'))
print(r.get('eur'))
| true |
d5a69e651a59475a6ef9ae0f37ed102ae8b3c24c | HorseSF/xf_Python | /day02/code/04-输出语句.py | UTF-8 | 383 | 4.09375 | 4 | [] | no_license | # print语句来输出内容
# print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
# sep参数用来表示输出时,每个值之间使用哪种字符作为分隔,默认使用空格
# end当执行完一个print语句后,接下来要输出的字符,默认换行符
# file输出路径
print("hello", "good", "yes", "hi", sep='+', end='------')
print('大家好')
| true |
6d1b41537277111ae35762523c0acf6ace315eee | nikhilNathwani/saviors | /scripts/util.py | UTF-8 | 1,987 | 2.984375 | 3 | [] | no_license | import numpy
import sys
import time
import urllib2
import csv
import os
import json
from bs4 import BeautifulSoup
'''~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ web scraping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'''
def grabSiteData(url):
usock= urllib2.urlopen(url)
data= usock.read()
usock.close()
return Beautif... | true |
ec3826b8d17031ecb06c582d957b8aa30be92746 | Aasthaengg/IBMdataset | /Python_codes/p02873/s727666138.py | UTF-8 | 518 | 3.078125 | 3 | [] | no_license | s=input()
ans=0
c=1#連続数
temp=0
for i in range(len(s)):
if i==0:
ans+=1
else:
if s[i]==">" and s[i]==s[i-1]:
c+=1
if temp>=c:
ans+=c-1
else:
ans+=c
elif s[i]==">" and s[i]!=s[i-1]:
temp=c
c=1
... | true |
ae291ea6d874a605f888b314452dc53d9711d725 | Gurjotsm/100_days_of_code | /day13.py | UTF-8 | 978 | 4.3125 | 4 | [] | no_license | " Day 13
Function to check if a singly linked list is a palindrome
Given a singly linked list of characters, write a function that returns True if the given list is a palindrome, else False.
Sample input
("r" -> "a" -> "d" -> "a" -> "r" )
Sample output
True
"
# Definition for singly-linked list.
class Li... | true |
725b9c598752505a44de0ce7f1464d01ea649a1d | clambering-goat/honner-progect | /final_code/gcode_recve/get _z_change_time.py | UTF-8 | 398 | 2.921875 | 3 | [] | no_license |
file=open("time_layer_data","r")
data=file.readlines()
file.close()
for w in data:
for q in w:
if q=="Z":
time_stamp=w.split("G")
time_stamp=time_stamp[0]
time_stamp=time_stamp[1:]
name=w.split(" ")
name=name[-1]
name=name.str... | true |
4c58f11bbda52ff9ba9ecb4a6d7533736b8738e0 | pandaman0103/Python-Project | /part2.py | UTF-8 | 3,215 | 3.125 | 3 | [] | no_license | ############### part II : Stocks ########################
##import modules
import pandas as pd
import matplotlib.pyplot as plt
import os
#IMPORT DATA
datapath = 'H:\\UT1\M2\S2\python for finance\project\Data'
filepath = os.path.join(datapath,"AAPL.csv")
AAPL_df = pd.read_csv(filepath,";")[[0,2]]
AAPL_df['Date']... | true |
0973f33a339318f52f9226bd5ba00467f4804e9b | cszr-liuxiaobo/bert-002 | /mctest_utils.py | UTF-8 | 10,138 | 2.515625 | 3 | [] | no_license | import re
import os
import numpy as np
import torch
import glob
import json
from pathlib import Path
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed import DistributedSampler
from transformers import AdamW, DistilBertForMultipleChoice, BertForMu... | true |
430df8dd0be773875a1cb8d4e8f3e53e235aa612 | jkoberg/sk2812 | /python/examples/SK6812_png.py | UTF-8 | 2,105 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python2
import time, random, colorsys, collections, sys, threading, Queue, os
from PIL import Image
from neopixel import *
# LED strip configuration:
LED_COUNT = 288 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 1000000 ... | true |
54c4f82d919b6c47caa738bd870524a87a4a9ad5 | mitryahina/properties | /actions.py | UTF-8 | 4,696 | 3.390625 | 3 | [] | no_license | from buildings import Property, House, Apartment, get_valid_input
class Purchase:
"""
Represents class for purchasing property
"""
def __init__(self, price='', taxes='', **kwargs):
"""
Initialize property with price and taxes
"""
super().__init__(**kwargs)
... | true |
eca18e3f6d0fe67b040fc9f14bdb1025f0d6be05 | akeele/document-level-fiskmo | /document_max_cosine.py | UTF-8 | 9,870 | 2.734375 | 3 | [] | no_license | import numpy
import sys
import gzip
import operator
from sklearn.preprocessing import normalize
import argparse
import time
from collections import Counter
DIMENSIONS = 1024
def read_embeddings(embeddings_file, number_of_embeddings):
embeddings = numpy.memmap(embeddings_file, dtype='float32', mode='r', shape=(nu... | true |
e8c38fad77334b5c3f823f76974905afb7e37be0 | nevermorezjh/website-practice | /quant/get_combine.py | UTF-8 | 676 | 2.703125 | 3 | [] | no_license | import re
import sys
import subprocess
result = subprocess.check_output(['C:/JoinQuant-Desktop-Py3/Python/python.exe', 'C:/JoinQuant-Desktop-Py3/Python/TEST1.py'])
result = result.decode()
result = result.split('\n')
i, line_num = 0, len(result)
keys = []
while i < line_num:
if "Selling" in result[i]:
stock = re.fi... | true |
5fd5e886775ef6fda188142bccc940d28d21adb6 | x8lucas8x/dodo_commands | /dodo_commands/framework/config.py | UTF-8 | 7,210 | 2.59375 | 3 | [
"MIT"
] | permissive | """Module for working with the dodo configurations."""
from dodo_commands.framework.command_error import CommandError
from dodo_commands.framework.config_expander import ConfigExpander
from dodo_commands.framework.config_expander import Key, KeyNotFound # noqa
import glob
import os
import sys
import ruamel.yaml
def... | true |
6db387affc783a5eec4e31f10e14d8e6c1510664 | es335mathwiz/SPSolve | /pythonAMA/Amalg.py | UTF-8 | 4,432 | 2.890625 | 3 | [] | no_license | # Import the numpy package
from numpy import *
# Import necessary user-defined functions
from Shifts import exactShift, numericShift
from buildA import buildA
from Eigensystem import Eigensystem
from copyW import copyW
from reducedForm import reducedForm
from checkA import existsNaN, existsInf
from makePhi import make... | true |
80ffc573d08eea2c6fa2530e86d19549eaf1c995 | Brooks-Willis/comprobo2014 | /src/warmup_project/scripts/obj_avoid.py | UTF-8 | 6,024 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# Software License Agreement (BSD License)
import rospy
from math import cos, sin, radians, sqrt, atan2, pi
from numpy import std
from std_msgs.msg import String
from geometry_msgs.msg import Twist, Vector3
from sensor_msgs.msg import LaserScan
valid_ranges = {}
def getch():
""" Return the ... | true |
c2df423b0896bd3f0a57ddb483d9fb35a688a1ea | hellJane/Python_DataAnalysis | /Optimization/minimize_scalar.py | UTF-8 | 1,718 | 3.640625 | 4 | [] | no_license | import scipy.optimize as so
'''
黄金分割法来进行标量函数的最小化问题, 也称为一维搜索
无约束的,unconstrained.
'''
# scipy里面的golden method即用黄金分割法来进行求解的
def fx(x):
return x**4 - 14*x**3 + 60*x**2 -70*x
# 黄金分割法的唯一前提是f(x)在起始区间[a0, b0]内是单峰的,即只有一个最小值
# bracket为起始的搜索区间,这个可以给3个值的tuple也可以给两个值的tuple
# 如果是三个值(a, b, c), 则必须保证f(b) < f(a), f(... | true |
7b29d0ecb764da8233c654f1e8e2d9e51067e324 | diel21/Python | /main.py | UTF-8 | 574 | 4.15625 | 4 | [] | no_license | # comando print e input
#input guarda informaçoes e guarda em variaveis
#nome = input ('Digite o seu nome\n')
#var1 = 3
#var2 = 1.2
#print ('Prazer te Conhecer',nome)
#print (type(var1))
#print (" Nome: {} \n Valor 1: {}\n Valor 2 : {}\n Soma: {}\n".format(nome,var1,var2,(var1 + var2)))
#Expressôes Aritimet... | true |
ea84dc29dff518b095382d87b4f3377835e96eb7 | Code-Institute-Submissions/esse-app | /accounts/tests.py | UTF-8 | 2,246 | 2.609375 | 3 | [] | no_license | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse, resolve
class TestCustomUser(TestCase):
"""Test user creation."""
def test_create_user(self):
User = get_user_model()
user = User.objects.create_user(
username='usernam... | true |
42dcd454d970a8dd4c24323714df17510f0aac43 | BlakeAvery/YHack2019 | /GoogleCloudThing/instacrawl.py | UTF-8 | 844 | 2.734375 | 3 | [] | no_license | """ Downloads all pictures from an instagram account """
import instaloader
from InstagramAPI import InstagramAPI
def find_posts(username):
""" Returns an Instagram users posts """
# Load instaloader
IL = instaloader.Instaloader()
# Login to Instagram
#IL.login("USERNAME", "PASSWORD")
# Get pr... | true |
b67a28b023a92312db54fd7ed348bde51d17344e | hourofci/lessons | /intermediate-lessons/big-data/supplementary/simplereader.py | UTF-8 | 742 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | import geopandas as gpd
import fiona
MAX_RECORDS = 1000
def read_file(fileName):
#just read the file using fiona and check if there are more than 1000 rows.
fileMeta = fiona.open(fileName)
if len(fileMeta)>MAX_RECORDS:
raise MemoryError('Memory Error. Cannot read more than 1000 rows. You might want ... | true |
bcd01b6d67dfaa6fcd26e8e2aa4740d26fff6e66 | Th3Lourde/l33tcode | /110_balanced_height_bt.py | UTF-8 | 3,720 | 4.25 | 4 | [] | no_license |
class TreeNode:
def __init__(self, x=None):
self.val = x
self.left = None
self.right = None
def __str__(self):
return "TreeNode: 'val': {}, 'left': {}, 'right': {} ".format(self.val, self.left, self.right)
class Solution:
def get_height(self, node: TreeNode, height=0) ->... | true |
a3a2abeafbe8f2dcd07a6378708dcecb3b02097b | mkaskiris/AMLS_assignment20_21 | /b2/b1.py | UTF-8 | 2,395 | 2.75 | 3 | [] | no_license | import pandas as pd
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
def data_preprocessing(path, task):
DIR, img_dir, labels = get_path(path)
df = load_data_cartoon(DIR)
if task == 'eyes':
X,y = get_eyes(img_dir,df)
if task == 'faces':
X,y =... | true |
ab19dcd3b802db72103a2a1b60ece709ffb0e472 | Childe-Chen/study-python | /base/module_using_sys.py | UTF-8 | 130 | 3.203125 | 3 | [] | no_license | import sys
print("The command line args are ")
for arg in sys.argv:
print(arg)
print("The path of python is\n ", sys.path)
| true |
c621f5d4722dd00d5b40ddfdba7e3dbaa2414fa0 | calvar122/EXUAGO2021-VPE-L1 | /0929/francisco.lopez/fibonacci.py | UTF-8 | 1,761 | 4.4375 | 4 | [] | no_license | #!/usr/bin/env python3
# c-basic-offset: 4; tab-width: 8; indent-tabs-mode: nil
# vi: set shiftwidth=4 tabstop=8 expandtab:
# :indentSize=4:tabSize=8:noTabs=true:
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Programa que recibe un numero y encuentra su sucesion de fibonacci
by Francisco Lopez y Ezra Charles
"""
... | true |
ea7f2f17e7059d6390585656fca90d7f3a2d65cd | edu-athensoft/ceit4101python | /stem1400_modules/module_10_gui/s05_container/s051_frame/frame_02_with_widget.py | UTF-8 | 621 | 3.65625 | 4 | [] | no_license | """
Container
Frame
"""
from tkinter import *
root = Tk()
root.title("Python GUI - Frame")
root.geometry("300x200")
# root.config(bg="#ddddff")
# print(root.keys())
frameUpper = Frame(root, bg="lightgreen", height=150, width=200)
frameUpper.pack()
btnRed = Button(frameUpper, text="Red", fg="red").pack(side=LEFT)
bt... | true |
2d169b78372cc1a41cf7a24c6e011e3e6460cafb | dnguyen0304/tuxedo-mask | /tuxedo_mask/repositories/tuxedo_mask_users_repository.py | UTF-8 | 1,881 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import bcrypt
from sqlalchemy import orm
import tuxedo_mask
from . import TuxedoMaskBaseRepository
from tuxedo_mask import models, repositories
class TuxedoMaskUsersRepository(TuxedoMaskBaseRepository):
def get_by_username(self, username, application):
query = (
sel... | true |
be69875b193b2bcb5962a34fc8d59dc643b38ed0 | ggers/Homework_2.4_Path_work | /find_procedure.py | UTF-8 | 3,343 | 3.03125 | 3 | [] | no_license | # Задание
# мне нужно отыскать файл среди десятков других
# я знаю некоторые части этого файла (на память или из другого источника)
# я ищу только среди .sql файлов
# 1. программа ожидает строку, которую будет искать (input())
# после того, как строка введена, программа ищет её во всех файлах
# выводит список найденных... | true |
32def5e79b0ba6ef00645f10cd1d1dca336b24a4 | otaviov/python3.modulo1 | /Desafios/010.py | UTF-8 | 362 | 4.0625 | 4 | [] | no_license | '''
Crie um programa que leia quanto dinheiro
uma pessoa tem na carteira e mostre quantos
dólares ea pode comprar.
considere US$1,00 = 3,27.
'''
print('{:*^60}'.format(' CONVERTENDO REAIS EM DÓLAR '))
real = float(input('Quanto você tem na carteira? '))
dolar = real / 3.27
print('Com R${:.2f} você pode... | true |
349b233054904684df175e226c6fc93734e29ea2 | s-gulzar/python | /febnass.py | UTF-8 | 142 | 3.65625 | 4 | [] | no_license | n = int(input("Enter the Number: "))
print('0')
i=0
a=1
b=0
c=0
while (i <= n):
c = a + b
a = b
b = c
i += 1
print(c)
| true |
e03478091a43e9ece0f660d7798a213f04a3ae0b | daniel-reich/ubiquitous-fiesta | /527uLRjSofaTsMu36_11.py | UTF-8 | 141 | 3.59375 | 4 | [] | no_license |
def get_middle(word):
middle= int(len(word)/2)
if (len(word))%2==0:
return word[middle-1:middle+1]
else:
return word[middle]
| true |
c4df9dd89e7cb73545efda5b4590ef054d20e3ff | C00reNUT/Style_Transfer-2 | /main1.py | UTF-8 | 1,332 | 2.984375 | 3 | [] | no_license | ####### 고흐의 별이 빛나는 밤에 화풍으로 바꾸기
import cv2
import numpy as np
# 다운로드 받은 딥러닝 모델 로드
net = cv2.dnn.readNetFromTorch('./models/eccv16/eccv16/starry_night.t7')
# Load Image
img = cv2.imread("imgs/01.jpg")
h, w, c = img.shape
# 적당한 크기로 resizing
img = cv2.resize(img, dsize=(500, int(h / w * 500)))
#(325, 500)
# 이미지 비율을 유... | true |
57c9323682db2046a5835637ac068e5c073f83b6 | MaksimTitenko/intership_step_2_unittest | /main.py | UTF-8 | 229 | 3.03125 | 3 | [] | no_license | from calculator import calculator
if __name__ == '__main__':
print(calculator(1, 2, '+'))
print(calculator(3, 1, '-'))
print(calculator(10, 2, '/'))
print(calculator(8, 4, '*'))
print(calculator(5, 2, '**'))
| true |
32f5d9d755a3fd3a479150ed97994b2551d4c187 | MakarSan/3D_rast | /3D_rastr.py | UTF-8 | 6,510 | 2.796875 | 3 | [] | no_license | from PIL import Image, ImageColor
from PIL import ImageDraw
from Point import Point
Cw = 1200 # Ширина холста
Ch = 1200 # Высота холста
Vw = 10
Vh = 10
d = 1
RED = (255,0,0)
BLUE = (0,0,255)
GREEN = (0,255,0)
YELLOW = (255,255,0)
PURPLE = (160,32,240)
CYAN = (0,255,255)
BACKGROUND_COLOR = (255,255,255)
P0 = Point... | true |
04b0c86eb1c7956a07efa892e0b83f7b9e4ba779 | Saeid-Zadran/SW-Praktikum-SS21 | /src/server/bo/Chat.py | UTF-8 | 1,627 | 3.21875 | 3 | [] | no_license | from server.bo.BusinessObject import BusinessObject as bo
class Chat(bo):
def __init__(self):
super().__init__()
self._learngroup_id = 0
self._is_accepted = 1
self._sender= None
self._message= None
def set_learngroup_id(self, learngroup_id):
"""Setzen der Lern... | true |
1e77d2c3472e31be7cc6573d94809de750c74488 | bikegriffith/build-a-saas-app-with-flask | /catwatch/blueprints/stream/twitter.py | UTF-8 | 2,944 | 2.78125 | 3 | [
"MIT"
] | permissive | import json
import logging
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler, Stream
from catwatch.blueprints.stream.broadcast import Broadcast
class CatStream(StreamListener):
def __init__(self, broadcast=False, broadcast_internal_url=None,
broadcast_push_token=None):... | true |
1e113214da91b8b04a2af0466fc9b5f2b216d64f | finiteautomata/hatEval | /tests/test_bow_model.py | UTF-8 | 988 | 3.09375 | 3 | [] | no_license | import unittest
import numpy as np
from hate.nn import BowModel
class BowModelTest(unittest.TestCase):
def test_it_is_created_with_correct_input_size(self):
model = BowModel(num_words=10)
self.assertEqual(model.layers[0].input_shape, (None, 10))
def test_it_creates_with_embedding_size(self):... | true |
6fc0fccb0a32e68f70a12fb6df50a35d82b0050b | igorsantos314/Hangman-Game | /jogoForca.py | UTF-8 | 13,583 | 2.9375 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from hangman import *
from random import choice
from time import sleep
import winsound, _thread as th
class game:
def __init__(self):
self.colorTheme = 'White'
self.titleColor = 'DarkGreen'
self.banner = 'SeaGreen'
self.fontCour... | true |
b9cb11006859214f5970f92a49d18d741415aea7 | songdanlee/python_code_basic | /day04/dict_practice.py | UTF-8 | 486 | 3.4375 | 3 | [] | no_license | dic = {'name':'张三','age':18,'sex':1,'phone':'13090807060'}
# 索引值
print(dic['name'])
print(dic.get('sex',0))
# 添加/修改
dic['name'] = '李四'
print(dic)
dic.setdefault('addr','beijing')
dic.setdefault('addr','shanghai')
#删除
dic.pop('sex')
print(dic)
dic['acd']='123'
dic.popitem()
print(dic)
# 遍历
for i in dic.keys():
pr... | true |
44eb998501dd046abc50cf5912a31b6d1e73887d | dhyeyrob/ENPM-673 | /Project 1/part1-a.py | UTF-8 | 2,542 | 2.65625 | 3 | [] | no_license | # Importing Libraries
import cv2
import numpy as np
from matplotlib import pyplot as plt
# Function to detect the AR tag
def frame_det(path):
path1 = path
cap = cv2.VideoCapture(path1)
fl = True
while fl == True:
for i in range(60):
success, img = cap.read()
... | true |
5cdd367a4c164b29acf89a36869e2716a09912df | zostera/django-icons | /tests/test_css.py | UTF-8 | 1,967 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | from django.test import TestCase
from django_icons.css import merge_css_list, merge_css_text
class CSSTest(TestCase):
"""Test the CSS utilities."""
def test_merge_css_list(self):
# No arguments results in an empty list
self.assertEqual(merge_css_list(), [])
# Falsy arguments are igno... | true |
3d9a1378b133ccb92525844d2fe920e0fde36228 | DanferWang/Python_Learning | /SimpleDataType/name.py | UTF-8 | 777 | 4.15625 | 4 | [] | no_license | # 字符串的大小写
# name = "trump suck!"
# print(name.title())
# print(name.upper())
# upper_name = name.upper()
# print(upper_name)
# print(upper_name.lower())
# 字符串连接
# last_name = "wang"
# first_name = "haochen"
# full_name = last_name.title() + " " + first_name.title()
# full_name1 = "Hello " + last_name.t... | true |
b01a7c1cbbd84b4ca3b14461c8819bf1d8ba2f0b | jwodder/euler | /digits/euler0052.py | UTF-8 | 926 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python
"""Permuted multiples
It can be seen that the number, 125874, and its double, 251748, contain
exactly the same digits, but in a different order.
Find the smallest positive integer, $x$, such that $2x$, $3x$, $4x$, $5x$,
and $6x$, contain the same digits."""
__tags__ = ['digits', 'digit ... | true |
19ae45fa26def5883d7fd76c96fe60781d232a41 | giacomomutti/horizomer | /horizomer/utils/tree.py | UTF-8 | 24,183 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, The Horizomer Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------... | true |
5c07cacc346bfddaecf689e16bf16792c0048524 | gitter-badger/graphcore | /graphcore/sql_reflect.py | UTF-8 | 3,896 | 2.796875 | 3 | [] | no_license | import sqlalchemy
import inflect
from .sql_query import SQLQuery
_pluralizer = inflect.engine()
def _column_to_property(column):
""" assumes the column name has _id postfix """
return column[:-3]
class SQLReflector(object):
def __init__(self, graphcore, engine, sql_query_class=SQLQuery):
""" ... | true |
4dbc7bfb98031be16eb759215eaa0599b0c0298e | zelenyid/WeatherForecast | /app.py | UTF-8 | 4,799 | 3.015625 | 3 | [] | no_license | from collections import Counter
from pprint import pprint
from flask import Flask, render_template, request, redirect, url_for
from weather.api.open_weather_forecast import OpenWeatherForecaster
from weather.api.weatherbit_forecast import WeatherBitForecaster
from weather.api.accu_weather_forecast import AccuWeatherF... | true |
0be66b97abe6aea7bdb2941e122df9b76b368815 | qzq2514/GAN | /Mnist_Based/DCGAN/DCGAN_SuperResolution/net/DCGAN_sr_mnist.py | UTF-8 | 3,518 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
class DCGAN_mnist:
def __init__(self,smooth,is_training):
self.smooth=smooth
self.is_training=is_training
def leakyReLU(self,inputs,leak=0.01):
return tf.maximum(leak * inputs, inputs)
def sample(self,input,type="down"):
shape=input.get_shape().as_l... | true |
e1d6bae58a6d8c5634cbbb750bb668a8784e69c8 | mjguzman12/Python-Pandas-Training | /Code/3. Python Pandas Training 3 - Conditional Variable Generation, Loops, Regular Expressions.py | UTF-8 | 15,440 | 4.03125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 09:05:46 2021
@author: GuzmanMJ
"""
######################################
######################################
#####PYTHON PANDAS TRAINING THREE#####
######################################
######################################
###########
###INTRO##... | true |
ee3a03407cd33fdbe5b9cbe10efa539b36b43744 | VincentSch4rf/codefights | /kbonacci/kbonacci.py | UTF-8 | 197 | 2.78125 | 3 | [
"MIT"
] | permissive | def kbonacci(k, n):
f = [1]*k+[k]
if n > k:
i = k
while i < n:
f += [(2 * f[-1] - f.pop(0))]
i += 1
r = n > k and f[k] or f[n]
return str(r) | true |
339dff0a44fd28fff00a324433c19b427791696f | Prashant-Jonny/ScratchABlock | /core.py | UTF-8 | 7,612 | 3.109375 | 3 | [] | no_license | import sys
import re
from graph import Graph
def natural_sort_key(s):
arr = re.split("([0-9]+)", s)
return [int(x) if x.isdigit() else x for x in arr]
class Singleton:
def __init__(self, n):
self.n = n
def __repr__(self):
return self.n
UNK = Singleton("UNK")
DYN = Singleton("DYN")
... | true |
112eec0a68fa40743c8c0ec0ac387068bf456db6 | d-yuji/atcoder_study | /abc/ABC123/b.py | UTF-8 | 541 | 3.15625 | 3 | [] | no_license | # coding: utf-8
def main():
time = []
time_zero = []
for i in range(5):
temp = int(input())
if temp%10 == 0:
time_zero.append(temp)
else:
time.append([temp,temp%10])
sort_list = sorted(time, key=lambda x:x[1],reverse=True)
# print(sort_list)
ans ... | true |
24bbd862e6f5aed15cc110a244bfcd359a75c93f | moritztiedje/lionfish | /src/main/Logic/stateMachine.py | UTF-8 | 7,081 | 3.21875 | 3 | [] | no_license | from enum import Enum
from random import random
class StateTypes(Enum):
FINAL_STATE = 0
CHOICE_STATE = 1
AUTO_PROCEED_STATE = 2
class ResultTypes(Enum):
SUCCESS = 0
FAIL = 1
GAME_OVER = 2
class State:
def __init__(self, state_type, text):
self.type = state_type
self.tex... | true |
00422d3fea1851205f76e664c8533199488e9b99 | zhicongliu/ImpactTPSA | /testrun/ImpactZ.py | UTF-8 | 10,767 | 2.53125 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | #!/usr/bin/env python
#This script is run Impact-Z using a TraceWin lattice.
#It converts a TraceWin lattice file
#to a Impact-Z input file and call Impact-Z.
#Some parameter need to be set as following.
import sys
import math
import subprocess
print 'Impact, From Python input file'
#-------------------------------... | true |
b6a841eaf9acb6cd6024f94b497fef307e1ebfd0 | Strangemother/Virtual-Operating-Layer | /v1/src/container/cef.py | UTF-8 | 1,633 | 2.65625 | 3 | [] | no_license | # Hello world example. Doesn't depend on any third party GUI framework.
# Tested with CEF Python v55.3+.
from cefpython3 import cefpython as cef
import platform
import sys
import time
import winsound
from multiprocessing import Process
from http import server
HOST = 'localhost'
PORT = 8093
def beep(fre... | true |