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 |
|---|---|---|---|---|---|---|---|---|---|---|
4894ce8fe40972a69cc78965aec16463027bdc3a | ens-lgil/PGS_Catalog | /release/scripts/run_release_step_1_db.py | UTF-8 | 3,641 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import sys, os.path
from release.scripts.CreateRelease import CreateRelease
from release.scripts.UpdateEFO import *
from release.scripts.UpdateGWASSamples import *
from catalog.models import *
def run():
# Check that the publications are associated to at least a Score or a Performance Metric
check_publication... | true |
6a5056a45905d2b636569ea1a6e51ebd6f925123 | YimingMiao/comp-225-project | /googleSearch/newsGetter.py | UTF-8 | 1,310 | 2.90625 | 3 | [] | no_license | from GoogleNews import GoogleNews
from newspaper import Article
import newsArticle
import pandas as pd
def initialize(query):
news = GoogleNews()
news.search(query)
return news.result()
def parseData(query):
"""Reads in website data, creates a data fram of all scraped articles, and then creates a lis... | true |
66a0bbc57f8bcf46c568917a9d1ed6aa520c9e59 | johnnoone/json-spec | /src/jsonspec/pointer/bases.py | UTF-8 | 7,592 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | """
jsonspec.pointer.bases
~~~~~~~~~~~~~~~~~~~~~~
"""
__all__ = ["DocumentPointer", "Pointer", "PointerToken"]
import logging
from abc import ABCMeta, abstractmethod
from collections.abc import Mapping, Sequence
from .exceptions import (
ExtractError,
LastElement,
OutOfBounds, # noqa
OutOf... | true |
1b6d884f804688fd94d5aace3a28cb81cce23ada | LongStart/pyproj | /bspline_manual/basis_function.py | UTF-8 | 4,910 | 2.828125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
# from scipy.interpolate import BSpline
from scipy import interpolate
def basis(degree, knot_vector, i, u):
# print("d: {}, i:{}, u:{}".format(degree, i, u))
if 0 == degree :
return np.array([float(knot_vector[i] <= v < knot_vector[i + 1]) for v in u])... | true |
288526c3fa37db792e33995cd6b11ba2b0379532 | FR13ND5/full-fight-game | /ffgame/items/shield.py | UTF-8 | 273 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Abstraction of item
"""
from ffgame.items.item import Item
class Shield(Item):
"""
Shield class
"""
def __init__(self, name):
"""
Set initial values and call super init
"""
Item.__init__(self)
self.name = name
| true |
7dfcf5aa6bdc87a047445da9287498fc11d66736 | VinogradovAU/myproject | /python_less/lesson-5/lesson-5-1.py | UTF-8 | 804 | 3.859375 | 4 | [] | no_license | # -*-coding:utf8; -*-
"""
Создать программно файл в текстовом формате, записать в него построчно данные, вводимые пользователем.
Об окончании ввода данных свидетельствует пустая строка.
"""
print('Задание 5.1')
with open('test.txt', 'w+') as f:
while True:
print("Введите данные - строки, для записи в фа... | true |
488c5504e309152800c0b27b0dac4f62cca070bb | TheCodingAstronomer/Python-3 | /GuessGame.py | UTF-8 | 363 | 3.78125 | 4 | [] | no_license | secret = "Giraffe"
guess = ""
guesscount = 0
guesslimit = 3
outofguesses = False
while guess != secret and not(outofguesses):
if guesscount < guesslimit:
guess = input("Enter Your Guess:")
guesscount+=1
else:
outofguesses = True
break
if outofguesses:
print("Out Of Guesses,... | true |
9fda8849fd42d0bbf037290b39fb3e07725b4429 | jasonayoder/rl_ctrnn | /jason/rl_ctrnn.py | UTF-8 | 12,644 | 2.625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import jsons
import math
from jason.ctrnn import CTRNN
''' This class is an extension of the CTRNN class in this folder.
It was designed to allow the code to be re-used but separated from the original CTRNN implmentation.
This helps to keep the differences as clear a... | true |
2817e86021bb23080e472b780c6c150e62e328b8 | S1ssel/Tareas-de-Jp | /tarea.py | UTF-8 | 1,132 | 4.0625 | 4 | [] | no_license |
def asteri():
x = input("Ingresa numeros y separalos con una (,) para interpretarlos con asteriscos: ")
y = x.split(",")
z = list(map(int, y))
for i in range (0,len(z)):
print(("*") * z[i])
def esfera():
r = float(input("Ingrese el radio de la esfera: "))
v = (4 * 3.1416 * (r**3)) /3
print (... | true |
77c40f411abe3d06f0d5d435b8b4fccf51977269 | Diz138/IndependentStudy | /RuleBased.py | UTF-8 | 460 | 2.515625 | 3 | [] | no_license | import re
def emails_reader(filepath= "emailTest.txt"):
with open(filepath, "r") as file:
data = file.read()
emails = re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.[a-z]+", data)
print (emails)
def url_reader(filepath= "urlTest.txt"):
with open(filepath, "r") as file:
dat... | true |
3cd524b70a2c3763ec2ea9ea48cbf1e537b15457 | aarmea/mumei | /tests/arbitrary.py | UTF-8 | 2,186 | 3.484375 | 3 | [
"MIT"
] | permissive | """
Arbitrary value generators and decorators for random value testing
"""
import functools
import itertools
import random
import string
# The maximum size for generated test cases
MAX_SIZE = 100
# The maximum number of successful tests before succeeding
MAX_SUCCESS = 250
def items(xs):
"""Yield an infinite seque... | true |
e03360bedb58c1f15403b92fa434cb7bf010d92d | marromlam/lhcb-software | /Analysis/Analysis/PyAna/python/PyAna/pyhistoplots.py | UTF-8 | 3,832 | 2.65625 | 3 | [] | no_license | '''Helper functions for plotting histograms, sequences, and ntuple columns
Copyright (c) 2010 Juan Palacios juan.palacios.puyana@gmail.com
Subject to the Lesser GNU Public License - see < http://www.gnu.org/licenses/lgpl.html>
'''
# This program is free software: you can redistribute it and/or modify
# it under... | true |
d37fbc60bbb0ff8a841fc0e3b47c89558d532e8f | Marton-Zeisler/CM1103-Problem-Solving | /Python Review/Python Book/Chapter 7/2.py | UTF-8 | 78 | 3.1875 | 3 | [] | no_license | names = ["marci", "balint", "david"]
while names:
print(names)
del names[0] | true |
446003ef1b1f0a01f4e91fff563e916e49d832d2 | CoachEd/advent-of-code | /2020/day04/part1.py | UTF-8 | 1,123 | 2.96875 | 3 | [] | no_license | import sys
import time
start_secs = time.time()
# read in input file
l=[]
my_file = open("inp.txt", "r")
lines = my_file.readlines()
for line in lines:
l.append(line.strip())
# TODO
passports = []
s1 = ''
for s in l:
if len(s) > 0:
s1 = s1 + ' ' + s
else:
passports.append(s1.strip())
s1 = ''
""... | true |
972ad61b77f054997ea01a6debb015712a53554c | vy538/algo-hw-code | /hw1_5.py | UTF-8 | 231 | 3.828125 | 4 | [] | no_license | def print_duplicates(line):
for i in range(0,len(line)):
for j in range(i+1,len(line)):
if line[i] == line[j]:
print(i,"is same as",j)
print(line[i])
print_duplicates("aaab") | true |
f7f07883485bb6327ab7c5603e362eeceef7f041 | Mazotis/Homeserver | /devices/Playbulb.py | UTF-8 | 4,277 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
'''
File name: Playbulb.py
Author: Maxime Bergeron
Date last modified: 29/02/2020
Python Version: 3.7
The Playbulb BLE bulbs handler class
'''
import bluepy as ble
from core.common import *
from core.bulb import Bulb, connect_ble
class Playbulb(Bulb):
""" Methods for d... | true |
83651d15edebcea5e13c7a41b9a122953500caf9 | roverdotcom/feats.py | /feats/app.py | UTF-8 | 7,937 | 2.578125 | 3 | [
"MIT"
] | permissive | import inspect
from typing import Dict, List, Optional, Type
import copy
from .storage import Storage
from .errors import UnknownSelectorName, UnknownSegmentName
from .feature import Feature
from .feature import default
from .meta import Definition
from .segment import Segment
from .selector import Experiment, Rollout... | true |
5be9b69194db834eb5dca8482e6386fe2d1144a2 | patel327/ece364 | /Prelab08/.svn/text-base/except.py.svn-base | UTF-8 | 448 | 3.53125 | 4 | [] | no_license | #! /usr/bin/env python3.4
#
#$Author$
#$Date$
#$HeadURL$
#$Revision$
if __name__ == '__main__':
values = input("Please enter some values:")
vlist = []
for value in values.split():
try:
vlist.append(float(value))
except (ValueError):
#print(value)
pass
... | true |
fbb26e3f2b40dc0f58bfde7a81c11211203aa9cf | ProgFuncionalReactivaoct19-feb20/clase01-davisalex22 | /Ejemplo2_Declarativo.py | UTF-8 | 157 | 2.953125 | 3 | [] | no_license | """
TrabajoEnClase_1
Autor: David Salazar -@davisalex22
"""
valores = [10, 2, 11, 12, 15]
resultado = list(filter(lambda x: x % 2 == 0, valores))
print(resultado)
| true |
414f83e74cca5a829fb965e7f2fbc62abf476dcc | debjit31/TCS_Codevita | /2014/Round 1/Compiler Design-limit the Method Instructions.py | UTF-8 | 1,014 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | for _ in range(int(input())):
stk = []
s = input()
instr = 0
error = False
insideFunction = False
mainOccurred = False
for i in range(len(s)):
if s[0] != '{':
error = True
break
elif s[1] != '<':
error = True
break
else:
if s[i] == '{' and i == 0:
stk.append(s[i])
elif (s[i] == '{' an... | true |
023d8f9f2c58fa09dc25a65fed4192012511d52f | beaconTau/beaconroot | /examples/beacon_data_reader.py | UTF-8 | 20,118 | 2.828125 | 3 | [] | no_license | #! /usr/bin/env python3
# Example for how to read beacon data with python This mostly defines a
# beacon_data_reader class, but if you run it as a script it will try to plot
# some waveforms from run 362. Normally, you would do something like
#
# import beacon_data_reader
# d = beacon_data_reader.Reader("/p... | true |
c028832a3c37b3cfee357d9cda237a8e240edec7 | southpawgeek/perlweeklychallenge-club | /challenge-105/paulo-custodio/python/ch-1.py | UTF-8 | 584 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
# Challenge 105
#
# TASK #1 > Nth root
# Submitted by: Mohammad S Anwar
# You are given positive numbers $N and $k.
#
# Write a script to find out the $Nth root of $k. For more information, please
# take a look at the wiki page.
#
# Example
# Input: $N = 5, $k = 248832
# Output: 12
#
# Input: $N... | true |
4913df2b4aefce88e19a4be3921b1196bfa73780 | mjhoptics/ray-optics | /src/rayoptics/seq/twoconicmirrors.py | UTF-8 | 4,198 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2018 Michael J. Hayford
""" calculate conic constants for different 2 mirror configurations
.. Created on Tue Jun 26 16:11:58 2018
.. |ParaxialModel| replace:: :class:`~.paraxialdesign.ParaxialModel`
.. codeauthor: Michael J. Hayford
"""
from rayoptics.opt... | true |
1171877b3411f91715d9f2b9f142a3bf58e837d2 | Artificial-Ridiculous/Codes | /Python/offer/leetcode547.py | UTF-8 | 881 | 3.234375 | 3 | [] | no_license | class Solution:
def findCircleNum(self, M) -> int:
n = len(M)
count=0
visited = [False for j in range(n)]
#外层循环保证把每个节点都访问一遍
#i代表n个顶点中的第i个顶点
for i in range(n):
if visited[i]:
continue
else:
visited[i]=True
... | true |
e99cfc2511630491b4fe1a16997270650a62ed89 | parkwisdom/Python-Study-step3 | /day04/day04-05.py | UTF-8 | 9,521 | 3.140625 | 3 | [] | no_license | ##영상 처리 및 데이터 분석 툴
from tkinter import *
import os.path
import math
from tkinter.simpledialog import *
from tkinter.filedialog import *
##함수 선언부
def loadImage(fname):
global window, canvas,paper,filename,inImageR,inImageG,inImageB, outImageR,outImageG,outImageB,inW,inH,outW,outH
photo = PhotoImage(file=filena... | true |
1e8de3f994e74ce10bf145a8374e06536be58279 | rjloura/crypto | /pubkey2addr.py | UTF-8 | 1,412 | 3.265625 | 3 | [] | no_license | # A python example of how a bitcoin address is derived from the public key
# using the steps described in:
# https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
#
# This could be written more elegantly but the goal here is to understand the
# steps.
import hashlib
import base58
import sys
... | true |
9c0eb9556488654ba5ca14b2385850c55adc0cb5 | focusVan/projects | /python/src/algorithm/quicksort.py | UTF-8 | 532 | 3.984375 | 4 | [] | no_license | def quicksort(array):
# 基线条件:为空或只包含一个元素的数组是“有序”的
if len(array) < 2:
return array
else:
# 递归条件
pivot = array[0]
# 所有小于等于基准值的元素组成的集合
less = [i for i in array[1:] if i <= pivot]
# 所有大于等于基准值的元素组成的集合
greater = [i for i in array[1:] if i > pivot]
ret... | true |
36a82f3bc13e1917b49314bec6268860658cced4 | A-Why-not-fork-repositories-Good-Luck/OldWorks | /PAS/2006/src/emul/.svn/text-base/DnsCache.py.svn-base | UHC | 2,513 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: EUC-KR -*-
# DNS Query Program
import socket
import SocketServer
import sys
import time
import threading
import thread
DNS_table = {}
Wait_time = 0.8
class DNSHandler(SocketServer.BaseRequestHandler):
''' Threaded Server ؼ '''
def handle(self):
print "Connected from", self.... | true |
a0a364db865912abc3fc3e969521e0374fe13cf6 | chananiiii/Algorithm | /Simulation/ColoringChessBoardAgain.py | UTF-8 | 1,765 | 3.203125 | 3 | [] | no_license | '''
백준 1018번 - 체스판 다시 칠하기
'''
import sys
sero, garo = map(int, sys.stdin.readline().split())
checkBoard = [[0] * garo for _ in range(sero)]
for i in range(sero) :
temp = sys.stdin.readline()
for j in range(garo) :
checkBoard[i][j] = temp[j]
final = 1000
for i in range(sero - 7) :
for j in range(gar... | true |
99b41b0f0a7e5227bdd2e99f985721fb55b2e4de | ArchieMeng/meituan_scraper | /pickle_cnt.py | UTF-8 | 454 | 3.078125 | 3 | [] | no_license | from pickle import load
import sys
def pickle_count(file_name):
with open(file_name, 'rb') as rf:
cnt = 0
while 1:
try:
load(rf)
cnt += 1
except EOFError:
break
return cnt
if len(sys.argv) > 1:
for filename in sys.arg... | true |
0cb99918dbe5785b1c7c7dce1da6ccd0db5a5077 | JKodner/link | /link.py | UTF-8 | 445 | 2.65625 | 3 | [] | no_license | def gethost():
import urllib2
host = "http://" + raw_input("Type in Domain Name\nhttp://")
return host
def extractlink():
import urllib2, re
host = gethost()
# pattern = r"<a +.*href *= *(\"|\')(.*)\1>"
pattern = r"href *= *(\"|\')(.*)\1"
try:
url = urllib2.urlopen(host)
except urllib2.URLError:
raise urll... | true |
b9874a18e555a65093583af85bd209d594df2093 | immohsin/distributed-cache | /distributed_cache/cache.py | UTF-8 | 398 | 3.28125 | 3 | [] | no_license |
class Storage(object):
'''Wrapper around the storage implementation.
In this case, storage is handled by a simple built-in dictionary
'''
def __init__(self):
self.map = {}
def add(self, key, value):
self.map[key] = value
def get(self, key):
return self.ma... | true |
60043f2e934489072e95bc3e6bf4719b3b565ea0 | wizplan/ml-essence | /04/newton_test1.py | UTF-8 | 979 | 3.359375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import newton
def f1(x, y):
return x**3 - 2 * y
def f2(x, y):
return x**2 + y**2 - 1
def f(xx):
x = xx[0]
y = xx[1]
return np.array([f1(x, y), f2(x, y)])
def df(xx):
x = xx[0]
y = xx[1]
return np.array([[3 * x**2, -2], [2 * x, 2 * y]... | true |
046304cf95db09cb3a180d876170adf12672072c | haveAcat/Python | /例题范例/unit_4/u4_1_Αて戈块ㄏノprint_1.py | UTF-8 | 976 | 4.4375 | 4 | [] | no_license | #
# 格式化資料輸出使用print()
#
# print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
#
# Prints the values to a stream, or to sys.stdout by default.
#
# Optional keyword arguments:
# value: 表示想要輸出的資料,可以一次輸出多筆資料,資料之間以逗號隔開。
# file: 資料輸出的位置,預設是sys.stdout,也就是螢幕。
# sep: 當輸出多筆資料時,可以插入各筆資料之間的分... | true |
38c151ae3ef163fa2f0a70be01416bf065470b42 | AI-DI/Brancher | /development_playgrounds/distributions_test.py | UTF-8 | 1,287 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
from brancher.standard_variables import DirichletVariable, GeometricVariable, Chi2Variable, \
GumbelVariable, HalfCauchyVariable, HalfNormalVariable, NegativeBinomialVariable, PoissonVariable, StudentTVariable, UniformVariable, BernoulliVariable
## Distributions and samples ##
a = DirichletVari... | true |
adbb6ffc9ac88a0ad6a17c13b3aa3e108b1b8f21 | OZ-T/Bilgisayar-Bilimi-Python-Dersleri | /Ders_11_demetler_sozlukler/demetler_02.py | UTF-8 | 111 | 3.046875 | 3 | [] | no_license | isim = "mahmut"
disim = tuple(isim)
print(disim)
liste = ["ilk","iki",1,15]
dliste = tuple(liste)
print(dliste) | true |
e9f3c2f74e277b84b7d5960fbb7d61b493660621 | michael-zero/Django | /django2/core/forms.py | UTF-8 | 1,168 | 2.515625 | 3 | [] | no_license | from django import forms
from django.core.mail.message import EmailMessage
#Produto
from .models import Produto
#python manage.py shell
#from django import forms
#help(CharField) - info do método
class ContatoForm(forms.Form):
nome = forms.CharField(label='Nome', max_length=35)
email = forms.EmailField(label='E... | true |
1322dd23f5e1e47566e44ab9e518a34bc4911536 | matskula/dl_stuff | /CNN/model.py | UTF-8 | 3,602 | 3.203125 | 3 | [] | no_license | import numpy as np
from layers import (
FullyConnectedLayer, ReLULayer,
ConvolutionalLayer, MaxPoolingLayer, Flattener,
softmax_with_cross_entropy
)
class ConvNet:
"""
Implements a very simple conv net
Input -> Conv[3x3] -> ReLU -> Maxpool[4x4] ->
Conv[3x3] -> ReLU -> MaxPool[4x4] ->... | true |
854d9e151a683b2b30b56663a2ba950579c2e364 | TwinkleRing/Backjoon-Study | /16주차 문제 풀이/1449(수리공 항승).py | UTF-8 | 273 | 2.875 | 3 | [] | no_license | from collections import deque
n, L = map(int, input().split())
location = list(map(int,input().split()))
location.sort()
q = deque(location)
start = 0
cnt = 0
while q :
loc = q.popleft()
if start < loc :
start = loc + L - 1
cnt += 1
print(cnt) | true |
aec0e68cc7d94d821557276b93189ce924b16569 | GopiRajuMatta/SeaThru_Network | /blocks.py | UTF-8 | 2,663 | 2.75 | 3 | [] | no_license | import torch
import torch.nn as nn
class DoubleConvBlock(nn.Module):
"""double conv layers block"""
def __init__(self, in_channels, out_channels):
super().__init__()
self.double_conv = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1),
nn.ReL... | true |
f3c29edc437e9a1a2a87207919780b8e42e603a7 | iam-abbas/cs-algorithms | /Stack Algorithms/Balanced Parenthesis Problem/Python/balanced_parenthesis.py | UTF-8 | 714 | 4.125 | 4 | [
"MIT"
] | permissive | def balanced(string):
opening_parens = [ '(', '[', '{' ]
closing_parens = [ ')', ']', '}' ]
parens_dict = dict(zip(opening_parens, closing_parens))
stack = []
for char in string:
if char in opening_parens:
stack.append(char)
elif char in closing_parens:
... | true |
d3ed5a42cc5d5c7ca7b2053e039a4d1641b93edc | dawnmy/Bioinf_scripts | /profile2cami.py | UTF-8 | 10,518 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
File: tocami.py --- convert to CAMI profiling format
Created Date: July 17th 2019
Author: ZL Deng <dawnmsg(at)gmail.com>
---------------------------------------
Last Modified: 22nd Nov 2022 4:36:44 pm
'''
import os
import sys
import click
import time
import re
from et... | true |
8329f17be7974a7c8a0cc0510df8c0cb91b3fe95 | cniehaus/biotools | /biostatisktik/rb.py | UTF-8 | 2,071 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
import random
import time
import csv
import sys
#from PyQt4 import QtCore, QtGui
#
#from beute_ui import Ui_Beute
#
#class MyForm(QtGui.QMainWindow):
# def __init__(self, parent=None):
# QtGui.QWidget.__init__(self, parent)
# self.ui = Ui_Beute()
# self.ui.setupUi(self)
#
clas... | true |
cff5de796c3e30644e0ccf569d218605b679c494 | StackTraceYo/Hackerrank | /hackerrank-python/ds/arrays/2d_arrays_ds.py | UTF-8 | 734 | 3.28125 | 3 | [] | no_license | #
# Complete the array2D function below.
#
def array2D(arr):
#
# Write your code here.
#
size = len(arr) - 1
max = -9 * 9
for i in range(0, size): # for each row
for j in range(0, size):
if j + 2 > size or i + 2 > size:
break
m = sum([arr[i][j], a... | true |
8482df679a0ccaf9b832620ce0d551013dc238e9 | jiulingz/Wire-Frame-3D | /card.py | UTF-8 | 11,019 | 2.609375 | 3 | [] | no_license | from display import *
from gui import *
from textinput import *
class Card(object):
def __init__(self, panelWidth, cardList, icon_confirmD, icon_confirmA, icon_cancelD, icon_cancelA):
self.panelWidth = panelWidth
self.buttonWidth = self.panelWidth / 8
self.gap = 3
self.textSize = 20... | true |
eafd619f5d0e7710b49518a85e590133c5120fd2 | raoqiyu/AlgoLibR | /python/test/test_search.py | UTF-8 | 817 | 2.640625 | 3 | [] | no_license | import numpy as np
from AlgoLibR.search import search
def test_seach(test_count=10):
for search_method in ['binary_search', 'jump_search']:
sucess_cnt = 0
for _ in range(test_count):
nums = np.random.randint(1, 10000, 300)
nums.sort()
target_index = np.random.ch... | true |
5dd3f072a3164d42a87c03de8f7c863d7c584606 | qzson/Study | /test0602_samsung_review/0602_exam/keras_samsung copy.py | UTF-8 | 4,439 | 2.734375 | 3 | [] | no_license | # 20-06-02 화 시험
# 06-03 아침 삼성전자 시가 맞추기
''' 시험 조건
1. 6/3 삼성전자 시가 맞추기
2. CSV 데이터는 건들지 말 것
3. 앙상블 모델 사용
hite + samsung
4. 6시 mail 발송 제목은 "손기범 [0602시험] 57000원"
첨부 : 소스, npy, h5
소스명 : test0602_SKB.py
'''
# 날짜 순이 거꾸로 되어있다. 알아서 처리
# 1. 데이터
# data save
import numpy as np
import pandas as pd
samsungdt = pd.read_... | true |
5442a240cc96e39782b0b7955466ec29bab7febe | YektaDemirci/UoWashington_internship | /tensorBuilder/1row.py | UTF-8 | 2,551 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 18:33:30 2018
@author: Yekta
"""
import csv
import numpy as np
import getpass
userName=getpass.getuser()
import os
try:
newpath = r"C:/Users/"+userName+"/Desktop/propertySelector/1st/527x60/1rowTables/"
os.makedirs(newpath)
except:
pass
... | true |
13db8258451b32075f8293192e060b8058a9f946 | skalahonza/Reversi | /player.py | UTF-8 | 10,042 | 3.46875 | 3 | [] | no_license | # board size 8x8
# 2 rounds
# 1 second per move
# single thread only
from copy import deepcopy
# Values for endgame boards are big constants.
MAX_SCORE = 1176 # biggest score achievable
MIN_SCORE = -MAX_SCORE
class Move:
"""Stores the move coordinates with the points gained by playing it"""
def __init__(se... | true |
968a0dc1fc9a4a4fa1cf86663579e9d2c5b96c51 | assaforon/pycir | /examples/examples.py | UTF-8 | 274 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
x=range(1,6)
y=[1/7,1/8,1/2,1/4,4/17]
wt=[7,24,20,12,17]
fig, ax = plt.subplots()
ax.scatter(x,y,wt,c='black',marker='x') | true |
9c408948e72aa0361b7702ece93fb66e1901a23d | peyloading/Birthday-Dictionary | /main.py | UTF-8 | 438 | 3.296875 | 3 | [
"MIT"
] | permissive |
if __name__ == '__main__':
birthday = {
'peyton conner' : '2/13/2000' ,
'jenna kimble' : '7/26/1999' ,
'jensen conner' : '11/25/2011',
'barack obama' : '8/4/1961' ,
'lee taemin' : '7/18/1993'
}
print('Peyton Conners Birthday Directory')
for name in birthday:
print(name)
print('Whos birthday would you li... | true |
b605c9d28dfd635b66db2c32805da88110996f79 | pi408637535/Algorithm | /com/study/algorithm/offer/剑指 Offer 65. 不用加减乘除做加法.py | UTF-8 | 284 | 3.171875 | 3 | [] | no_license | class Solution(object):
def add(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
c = a ^ b
n = (a & b) << 1
return n + c
if __name__ == '__main__':
a = -10
b = -20
print( Solution().add(a, b) ) | true |
f9cc31590e2e46770b30ccb63369e035be57bb3e | ntumirlab/Speaker-Verification | /Model/Resnet50.py | UTF-8 | 5,291 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torchvision
import numpy as np
print("PyTorch Version: ",torch.__version__)
print("Torchvision Version: ",torchvision.__version__)
__all__ = ['ResNet50', 'ResNet101','ResNet152']
def Conv1(in_planes, places, stride=2):
return nn.Sequential(
nn.Conv2d(in_channels=... | true |
c4f62fde432972ed0ee329bf56c27a7725dee268 | agarrharr/code-rush-101 | /something-learned/Algorithms and Data-Structures/python/tree/max_height.py | UTF-8 | 1,170 | 4.375 | 4 | [
"MIT"
] | permissive | """
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the
longest path from the root node down to the farthest leaf node.
"""
class Node():
def __init__(self, val = 0):
self.val = val
self.left = None
self.right = None
# def max_height(root):
... | true |
9d3ddc543415a9ea204ab8e16f72d934eac0c536 | lasaouma/LlamaNet | /batcher.py | UTF-8 | 710 | 3.125 | 3 | [] | no_license | import numpy as np
#batcher for getting shuffled training samples
class Batcher:
def __init__(self, data):
self.data = np.array(data)
self.data_size = len(data)
self.current_index = 0
self.shuffle()
def shuffle(self):
shuffle_indices = np.random.permutation(np.arange(se... | true |
18c447a5fdae0c6eb28d4f66e199344a662f5f2f | eslamelmishtawy/RSA-assignment | /RSA.py | UTF-8 | 5,107 | 3.65625 | 4 | [] | no_license | import random
import time
from tkinter import *
def gcd(a,b):
while b != 0:
a,b = b, a%b
return a
def generateLargePrime(keysize=512):
# Return a random prime number of keysize bits in size.
while True:
num = random.randrange(2**(keysize-1), 2**(keysize))
if isPrime(num):
retu... | true |
362b7b4ffbd1bfb91df13f20595d959b1e270066 | Mohammedsharook/Python-Training | /Abstraction.py | UTF-8 | 862 | 4.1875 | 4 | [] | no_license | # from abc import ABC, abstractmethod # import ABS class from abs module
#
#
# class Abstract(ABC): # Cannot able to create objects for abstract class
# def __init__(self, name):
# self.name = name
#
# @abstractmethod
# def age(self,number):
# print("His age is",number)
#
#
# obj = Abstrac... | true |
f31e1196c0f70b821bfc628f59905a98243413c9 | askarakshabayev/PP2_2021 | /week10/3.py | UTF-8 | 525 | 3 | 3 | [] | no_license | import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
surf = pygame.Surface((150, 150))
surf.fill((100, 150, 0))
pygame.draw.rect(surf, (10, 150, 200), (10, 10, 20, 20))
done = False
x = 50
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done ... | true |
3ed12408b23832b255683a224d76c6f83857ec03 | nishu959/Pepcodingdynamicprogramming | /totalpathvariablejumpdp.py | UTF-8 | 408 | 2.859375 | 3 | [] | no_license |
m =int(input())
l = []
for i in range(m):
l.append(int(input()))
def vjpath(vn, l,past):
if(vn>len(l)):
return 0
if(vn==len(l)):
past[vn] =1
return 1
if(past[vn]!=None):
return past[vn]
ans = 0
for i in range(1,l[vn]+1):
ans += vjpath(vn+i, l,past)
pa... | true |
d90164e42331ebf9046e3dc9cd217ac7cdd30d50 | zhaolijian/suanfa | /swordToOffer/33.py | UTF-8 | 795 | 3.78125 | 4 | [] | no_license | # 求按从小到大的顺序的第N个丑数(只包含质因子2、3和5)。
# 1 2 3 4 5 6 8 10 一个丑数等于另一个丑数*2或3或5
class Solution:
def GetUglyNumber_Solution(self, index):
if index == 0:
return index
res = [0 for i in range(index)]
res[0] = 1
p2, p3, p5 = 0, 0, 0
for i in range(1, index):
res[i]... | true |
140c640b9a6e6d8379d0d5594d3152d32e7e7d79 | hifish78/mypython | /merge_intervals_leet56_m.py | UTF-8 | 591 | 3.203125 | 3 | [] | no_license | class Solution:
"""
要点:
1) time complexity: O(nlogn)
sort:intervals.sort(key=lambda x:x[0])
2)space complexity: O(n)
"""
def merge(self, intervals):
if not intervals:
return intervals
intervals.sort(key=lambda x:x[0])
res = []
res.append(interva... | true |
ae4b1bdf8eefd55415cbf52e9d38b451fe5adda4 | rohangupta231/Python-codes | /OddEvenInMatrix.py | UTF-8 | 279 | 3.71875 | 4 | [] | no_license | list1=[[1,1],[1,4]]
list_even=[]
list_odd=[]
for i in range (0,2):
for j in range(0,2):
if(list1[i][j]%2==0):
list_even.append(list1[i][j])
elif(list1[i][j]%2!=0):
list_odd.append(list1[i][j])
print(list_even," Are Even Numbers")
print(list_odd," Are odd Numbers")
| true |
23edc129af5c56d5894ba48c73af745915bfb523 | DalavanCloud/scikit-learn.github.io | /0.19/_downloads/plot_mnist_filters.py | UTF-8 | 2,672 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | """
=====================================
Visualization of MLP weights on MNIST
=====================================
Sometimes looking at the learned coefficients of a neural network can provide
insight into the learning behavior. For example if weights look unstructured,
maybe some were not used at all, or if very l... | true |
2d869125ed1ae9fb9dc8f1af8997f13bc86e6ef2 | Krishnan94/Great-Guessing-Game | /GreatGuessingGame/game.py | UTF-8 | 6,123 | 3.390625 | 3 | [] | no_license | '''
This file contains the gameplay function required to play the game
Global variable declarationis present in DATA
Frequency : Dictonary which has all the letters with the frequency
foundchar : list of found charcters
missedguess : list of count of missed letter in a game
badguess : list of count of bad gue... | true |
efbb52a1d9205606d4c88c938f061782d26b861d | fernflower/rpi_ws281x | /utils.py | UTF-8 | 337 | 2.796875 | 3 | [] | no_license | import ConfigParser
CONFIG_FILE = "config.sample"
class Config(dict):
pass
def read_config(section, config=CONFIG_FILE):
parser = ConfigParser.ConfigParser()
parser.read(config)
res = Config()
for param, value in parser.items(section):
res[param] = value
setattr(res, param, value)... | true |
43bcee30e4dab1347120ef5a4685ca4a8165f91b | everbird/leetcode-py | /2015/SubsetII_v0.py | UTF-8 | 576 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
class Solution:
# @param {integer[]} nums
# @return {integer[][]}
def subsetsWithDup(self, nums):
nums.sort()
return self._subsets(nums)
def _subsets(self, nums):
if not nums:
return [[]]
n = nums[0]
items = ... | true |
af6f6d2d99ae6a8710adf3a8993bd2332ca0e23c | Aguinore/IntroDS | /additionals/brilliant.py | UTF-8 | 3,200 | 3.203125 | 3 | [] | no_license | import math
from decimal import *
def is_prime(n):
for i in range(2, math.ceil(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
def another_way_to_try_prime(n):
return n in {
num
for num in range(1, n+1)
if num != 1 and not any([num % div == 0 for ... | true |
ef03029b2a9f2b932262e81bedb9d9528b0c6f1c | sKotenok/itpark-job-test | /6.Threading/parser.py | UTF-8 | 4,118 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
В директории /opt/data содержатся N количество файлов. example1.xml example12.xml .... exampleN.xml.
Необходимо запустить количество thread-ов соответсвующее количеству файлов в директории.
Пример файла файл example.xml
Каждый thread должен распарсить файл и сформировать объект следующей ... | true |
234a74279e2e61ff0f81419456240b32dabdbeb5 | odidev/python-blosc2 | /examples/vlmeta.py | UTF-8 | 955 | 2.625 | 3 | [
"BSD-3-Clause",
"Python-2.0"
] | permissive | ########################################################################
#
# Created: July 28, 2021
# Author: The Blosc development team - blosc@blosc.org
#
########################################################################
import numpy
import blosc2
nchunks = 10
schunk = blosc2.SChunk(chunksize=2... | true |
436bcd2c080b2dbc44e29ee014237d015d5605a4 | dumb-anchovy/mipt_python_1sem | /turtle1/n5.py | UTF-8 | 308 | 3.453125 | 3 | [] | no_license | import turtle
for l in range(10, 210, 20):
turtle.shape('turtle')
turtle.forward(l)
turtle.left(90)
turtle.forward(l)
turtle.left(90)
turtle.forward(l)
turtle.left(90)
turtle.forward(l)
turtle.penup()
turtle.forward(10)
turtle.left(90)
turtle.backward(10)
turtle.pendown()
turtle.exitonclick()
| true |
99de085cdd36487575743d0448cb214ed9afa940 | I2Cvb/hyper_learn | /src/sampling_strategy/i_projection_model.py | UTF-8 | 1,740 | 2.828125 | 3 | [
"MIT"
] | permissive | from random_sampler import *
from data_base import *
class IProjectionModel (object):
"""
IProjectionModel takes a DataBase (or DataSet) and determines a new projection
of the data.
The instances of this class should overwriteits generative methods in order to
output projected data
... | true |
ad536326512568b11f8950ef0c6c1a399fdcbe2e | CDelgado-dev/Python-Projects | /Python Webdata Projects/Week2.py | UTF-8 | 383 | 2.9375 | 3 | [] | no_license | import re
text=open('regex_sum_938648.txt')
numlist=list()
sum=0
for line in text:
line=line.rstrip()
num = re.findall('([0-9.]+)',line)
i=0
while i < len(num):
try:
floater=float(num[i])
#print(floater)
sum=sum+floater
i=i+1
... | true |
c406bf142ff46505fb6b0ca6d57519a7087911e3 | takahashi-ei/python_machine_learning | /detectionTree/detectionTree.py | UTF-8 | 963 | 3.015625 | 3 | [] | no_license |
# coding: utf-8
# # 概要
# トレーニングデータセットの特徴量に基づいて一連の質問を学習し、サンプルのクラスラベルを推測する<br>
# 決定木の目的関数はシタキのように定義されている。<br>
# $IG(D_p,f)=I(D_p)-\sum^{m}_{j=1}\frac{N_j}{N_p}I(D_j)$<br>
# ・$fは分割の特徴量$<br>
# ・$D_pは親のデータセット、D_jはj番目の子ノードのデータセット$<br>
# ・$Iは負純度$<br>
# ・$N_pは親ノードのサンプルの総数、N_jはj番目の子ノードのサンプルの総数$<br>
# 過学習を防ぐため、決定着の深さに... | true |
03574a6c2c13626cab1bcd8c466b0184ddc1353f | vitkarpenko/dailyprogrammer | /291_intermediate.py | UTF-8 | 772 | 3.75 | 4 | [
"MIT"
] | permissive | import math
import collections
def solve_rpn(expression):
operations = {
'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y,
'/': lambda x, y: x / y,
'//': lambda x, y: x // y,
'%': lambda x, y: x % y,
'^': lambda x, y: x ** y
}
... | true |
b0e31c3c35b9a80f389c19e5c545057f876939c9 | neolzh123/ECE5725 | /test.py | UTF-8 | 2,119 | 3.359375 | 3 | [] | no_license | #############################################################
# Function description: time_display.py
# This function will display current time on piTFT screen
# through pygame
#############################################################
import RPi.GPIO as GPIO
import pygame
from pygame.locals import *
import tim... | true |
d44751d7d71c73bb9edaa8a3056c5f780c2e9bd3 | byaminov/advent-of-code-2018 | /aoc/day9.py | UTF-8 | 1,332 | 3.421875 | 3 | [] | no_license | from collections import defaultdict
def solve1(n_players=479, last_marble_worth=7103500):
current = Node(0)
current.right = current
current.left = current
scores = defaultdict(int)
current_player = 1
for m in range(1, last_marble_worth + 1):
if m % 23 != 0:
first = current... | true |
7c8ff6f9e1c2d87a4d9bb9e6392a1767567b9e07 | Hgonzalez/PythonClass201901 | /Python Class/BubbleSortExample.py | UTF-8 | 217 | 3.6875 | 4 | [] | no_license | alist = [3,7,4,6,5]
def bubblesort(x):
for _ in range(len(alist)-1):
for i in range(0,len(alist)-1,1):
if alist[i] > alist[i+1]:
alist[i], alist[i+1] = alist[i+1], alist[i]
print(alist)
bubblesort(alist) | true |
f69cc06ef46fd1219aa7249a3ac1ed2a50274d90 | the-cloud/p2 | /spotkanie_23_alarm_alter.py | UTF-8 | 361 | 3.21875 | 3 | [] | no_license | import microbit
from time import sleep
while True:
czujnik = microbit.pin1.read_digital() # czujnik ruchu
microbit.display.show(czujnik)
if czujnik == 1:
microbit.pin0.write_digital(0) # sygnał domyślnie wysyłany na pin0
sleep(1) # czas trwania dźwięku
microbit.pin0.write_digital(1)
... | true |
4fa8c8598dcc5d4f0bbacd10203721da68b6e6ad | zooniverse/aggregation-for-caesar | /panoptes_aggregation/tests/reducer_tests/test_process_kwargs.py | UTF-8 | 1,447 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from panoptes_aggregation.reducers import process_kwargs
DEFAULTS = {
'a': {'default': 5.0, 'type': float},
'b': {'default': 3, 'type': int},
'c': {'default': 'hi', 'type': str},
}
expected_default = {
'a': 5.0,
'b': 3,
'c': 'hi'
}
class TestProcessKwargs(unittest.TestCase):
... | true |
8d7e6ecbcd6f8e68f0e6e799103827343973ac26 | dctongsheng/my-python | /异常处理.py | UTF-8 | 308 | 3.078125 | 3 | [] | no_license | # _*_ coding:utf-8 _*_
try:
open("aaa.txt","r",encoding="utf-8")
except Exception as e:#有异常时候执行,没有异常执行下面的else
print(e)
else: #没有异常执行的代码块
print("ok")
finally: #都要执行的代码块
print("good") | true |
666c6fed6a4ef945edbce60da2b22c439bbd297f | jvrana/Pillowtalk | /tests/test_relationships/test_chained.py | UTF-8 | 770 | 2.515625 | 3 | [
"MIT"
] | permissive | from pillowtalk import *
from pillowtalk.schemas import add_schema
def test(mybase):
@add_schema
class Person(mybase):
items = []
FIELDS = ["id", "name"]
RELATIONSHIPS = [
Many("emails", "where Person.id <> Email.person.id")
]
@add_schema
class Email(mybas... | true |
d19e7440dd830bd85da884af83ce94dd0da8147b | muokiv/The-Art-of-doing-40-challenges | /20_Rock_Paper_Scissors_App.py | UTF-8 | 1,826 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 16 01:56:06 2020
@author: mitta anand
"""
import random
print("Welcome to Rock, Paper, Scissors App")
num=int(input("No of Rounds: "))
lis=['rock','paper','scissors']
comp=0
user=0
for i in range(num):
print("Round",i+1)
print("User: {}\t Computer:... | true |
e2ba54dadc6e47088167c98fe53b5dab1f4f7542 | mchlp/ICS2O1 | /Tests/Pu_M_Test1.py | UTF-8 | 914 | 3.78125 | 4 | [] | no_license | #Programming Test 1 - Part 1
#2016/10/18
#ICS2O1
#Michael Pu
#TSUNAMI SPEED PROBLEM
import math
import random
h = int(input("Enter the depth of the water in metres: "))
d = int(input("Enter the distance the tsunami wave will travel in metres: "))
if h <= 0:
if d <= 0:
print("\nThe depth and the distance... | true |
dd0dd269fddf352f7622bf29815b5e44f6365116 | yroosel/Python_JSON_Workshop | /JSON Devices IP Management from Excel.py | UTF-8 | 4,512 | 3.453125 | 3 | [] | no_license | ### 2 #### FUNCTIONS TO CREATE (A) list of devices and (B) list of device interfaces
### Using an excel file as input for a Python script
### This script creates a JSON structure based on information an excel spreadsheet
### You have to understand Python dict and Python lists
### Contact yvan.rooseleer@biasc.be if you ... | true |
df36a61ee261d1a7e1be32f3ecbaffd771cf751f | vijay-arya/AIX360 | /examples/matching/models/glove.py | UTF-8 | 2,196 | 3.25 | 3 | [
"Apache-2.0"
] | permissive |
import os
import numpy as np
# utility to count the number of lines in a fiel
def wc(
filename: str,
) -> int:
return sum(1 for _ in open(filename, 'r', encoding='utf-8'))
class Glove:
"""
NLP Model
Glove is a wrapper for loading pretrained word
embedding vectors hosted at http://... | true |
8b6b1c5c63d87a1adb533444cb075e1bbf9c3efa | HarrisonMc555/adventofcode | /2015/day15b.py | UTF-8 | 3,456 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python3
INPUT_FILE = 'input15.txt'
import unittest
import re
DEBUG = True
def debug_print(*args, **kwargs):
if DEBUG:
print(*args, **kwargs)
NUM_SECONDS = 2503
CALORIES = 500
def main():
if 'INPUT_FILE' not in globals():
unittest.main()
return
data = parse_lines(ge... | true |
d90aad7c2dabca0a9a0c7b74e01ea0759358442e | KonradSchieban/minesweeper | /Field.py | UTF-8 | 2,172 | 3.59375 | 4 | [] | no_license | from random import randint
class Field():
def __init__(self, num_cols, num_rows, num_mines):
self._num_cols = num_cols
self._num_rows = num_rows
self._field = []
for row_index in range(num_rows):
row = [0] * num_cols
self._field.append(row)
mine... | true |
fd89cb3fd88815eda05fa7c51bcb08da8ac705d9 | cheneymi/CS-Study | /Python/CS001-week07/mymin2.py | UTF-8 | 171 | 3.296875 | 3 | [] | no_license | def mymin(x):
m=x[0]
for i in x[1:]:
if i<m:
m=i
return m
print(mymin([3,5,7,2,4,6,0,1,2]))
print(mymin([10,9,8,7,6,1,2,3,4,5]))
| true |
139a31604f0da4849a087d0c09ce2460b76a9c14 | bishkou/leet-code | /Linked list/linkIntersection.py | UTF-8 | 1,067 | 3.46875 | 3 | [] | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
first = headA
second = headB
i = 1
j = 1
while first o... | true |
7f900e0df032edac966d7adc62388fe20924ec13 | wmcooper2/TotalEnglishAssistant | /senttab.py | UTF-8 | 5,213 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3.7
# senttab.py
"""GUI's Sentence Tab."""
# stand lib
import os
import sys
import tkinter as tk
from tkinter import ttk
from tkinter import Menu
# custom
from constants import SENT_WIDGET_LEN
from sentutil import get_results
from sentutil import get_results2
from words import remove_punctuation
... | true |
61d2c5a90522c8897f069bb9bea136a4f9e19cee | shivam-soni/Churn-Prediction | /PCA.py | UTF-8 | 4,367 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 27 17:36:14 2018
@author: Shivam Soni
"""
import numpy as np
import matplotlib.pyplot as pt
import pandas as pd
import statsmodels.stats.outliers_influence as oi
df=pd.read_csv('Churn.csv')
for i in df.columns:
df[i]=df[i].replace(" ",np.NaN)
#print (df.isnull... | true |
bc9e19ef966069f800c065b5f24786fc9300029f | ishantk/PythonNwk19 | /Session7e.py | UTF-8 | 1,386 | 4.25 | 4 | [] | no_license | # Class Vs Object
# Whatever is in the Class -> Belongs to Class
# In the class whatever is with self -> Belongs to Object
class FoodItem:
total = 0 # Property of Class
def __init__(self, name, price, count):
self.name = name # self -> property of Object
self.price = ... | true |
3cf6d3646a5351c0641a638124536bc2e1e20d15 | Littlemansmg/pyClass | /Week 5 Assn/Project 15/15-1.py | UTF-8 | 2,255 | 4.1875 | 4 | [] | no_license | # created by Scott "LittlemanSMG" Goes on DD/MM/YYYY
class Rectangle:
def __init__(self, height, width):
self.height = height
self.width = width
def area(self):
return self.height * self.width
def perimeter(self):
return (self.height + self.width) * 2
def __str__(sel... | true |
3cd5ec3591f2dc9cd493b45d7c5ea40f9159721a | thomasly/neutrophil | /source/save_to_hdf5_no_validation.py | UTF-8 | 4,176 | 2.59375 | 3 | [
"MIT"
] | permissive | '''
Filename: save_to_hdf5_no_validation.py
Python Version: 3.6.5
Project: Neutrophil Identifier
Author: Yang Liu
Created date: Oct 3, 2018 3:58 PM
-----
Last Modified: Oct 3, 2018 5:40 PM
Modified By: Yang Liu
-----
License: MIT
http://www.opensource.org/licenses/MIT
'''
import os
import logging
from PIL import Image... | true |
4193cdac682e894710432555913e5b0d4a85ff9a | Lucaswang8/Lucas-Hack | /Finals Project/BenchTest7.py | UTF-8 | 5,538 | 2.8125 | 3 | [] | no_license | # Write your code here :-)
import time
import board
from digitalio import DigitalInOut, Direction, Pull
import analogio
import touchio
import adafruit_lis3dh
import busio
ring = touchio.TouchIn(board.A5)
pinkie = touchio.TouchIn(board.A4)
index = touchio.TouchIn(board.A1)
middle = touchio.TouchIn(board.A3)
prevPinkie... | true |
81538b643be18f34d98487369abc8e900ec52a8d | hhiruma/chainer-gqn | /gqn/nn/upsampler.py | UTF-8 | 991 | 2.546875 | 3 | [
"MIT"
] | permissive | import chainer
import chainer.functions as cf
import chainer.links as nn
from chainer.initializers import HeNormal
class SubPixelConvolutionUpsampler(chainer.Chain):
def __init__(self, channels, scale):
super().__init__()
self.scale = scale
with self.init_scope():
self.conv = n... | true |
8f9b4d6ff22484a968ce6c6500d1fd921be16498 | yscbm/mrzh | /code/mrzh_data.py | UTF-8 | 1,664 | 2.671875 | 3 | [] | no_license | # -*- coding: utf8 -*-
import json
import codecs
class item(object):
"""docstring for item"""
def __init__(self,josn_str):
super(item, self).__init__()
self.name = josn_str['name']
self.level = josn_str['level']
self.quality = josn_str['quality']
self.price = josn_str['price']
self.combine = josn_str... | true |
e764279f5e0f7d8666bc2f84450814a2c79bdda6 | apirrone/IJDAR2020_code3 | /utils.py | UTF-8 | 6,053 | 2.65625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_probability as tfp
import keras.backend as K
import csv
import os
def lr_schedule(epoch):
"""
Returns a custom learning rate that decreases as epochs progress.
"""
learning_rate ... | true |
ba9c42473ef8e2056eb354d89b995d80b4f853a8 | enlambdment/my_pcc | /ch_10/count_planets.py | UTF-8 | 819 | 3.765625 | 4 | [] | no_license | def count_planet(filename):
"""
Counts the number of times the word 'planet' appears in a file's text,
and calculates approximate percentage of the words that are 'planet'."""
try:
with open(filename) as f_obj:
contents = f_obj.read()
except FileNotFoundError:
msg = "Sorry, the file " + filename + " does no... | true |
f7fb84f783b3479c45c4f30c19e2d1cfed3a8a74 | OwerP/PythonTraining | /HomeWork01/zad_1.7.py | UTF-8 | 548 | 4.21875 | 4 | [] | no_license | """
Przy pomocy `input()` zapytaj użytkownika co chce kupić, jaką ilość towaru chce kupić i jaka jest jego cena. Wyświetl odpowiedni komunikat.
Przykład:
Co chcesz kupić? - ziemniaki
Podaj cenę towaru - 5
Podaj ilość towaru - 10
Za ziemniaki, który chcesz kupić, zapłacisz 50 zł
"""
towar= input('o chcesz kupić? - ')... | true |