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 |
|---|---|---|---|---|---|---|---|---|---|---|
d330de68a8dd1231c9136e9b59036221ddbf6022 | refurd/OpenCV_Libraries | /2018.04.05. Chromatic transformations/zoldhatter-3-py3.py | UTF-8 | 2,163 | 2.875 | 3 | [] | no_license | # -*- coding: utf8 -*-
# "Zöld háttér technika": egyszerű változat.
# az in_hatter-ben megadott kép lesz a háttér, amit bemásol
# in_minta azon pixelei helyére, ahol in_minta élénkzöld pixeleket
# tartalmaz.
#
# Harmadik változat: elkülönített programrészek, értékek a kép tetjéről
#
# Még ez sem tökéletes, de szab... | true |
f9e76ab81dc10a5e6eec9c36a5b9cb53306775e5 | robotframework/robotframework | /doc/userguide/src/SupportingTools/LoggingLibrary.py | UTF-8 | 2,617 | 3.515625 | 4 | [
"Apache-2.0",
"CC-BY-3.0"
] | permissive | class LoggingLibrary:
"""Library for logging messages.
= Table of contents =
%TOC%
= Usage =
This library has several keyword, for example `Log Message`, for logging
messages. In reality the library is used only for _Libdoc_ demonstration
purposes.
= Valid log levels =
Valid lo... | true |
30f8399a6087c2b1835884a05fc5da98ff5c3218 | shanil07/The-Food-App | /DataScience/FlaskApp-edited/ds_comp/train_model.py | UTF-8 | 1,391 | 2.6875 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, BatchNormalization
from keras.applications import vgg16
from pathlib import Path
import joblib
# Loads the extracted features
x_train = joblib.load("x_train.dat")
y_train = joblib.load("y_train.dat")
x_test = joblib.load("x_test.dat"... | true |
866c4376131a2f07ec8241a10c4c22a7dc58d676 | barchuckie/metaheuristic | /l3/z2/main.py | UTF-8 | 1,871 | 3.796875 | 4 | [] | no_license | """L3/Z2.
Find the best matching word from dictionary with multiset of chars and their points
to calculate words scores. Searching is performed by Genetic Algorithm
with maximising the function of score.
Author: Patryk Barczak
"""
import os
import sys
import time
from genetic import GeneticAlgorithm
from trie import... | true |
fc8f67ba809a2a2b44db960f29cf0752c365163e | liuguoyou/Scale-Adaptive-Network | /seg_layer/part_attention.py | UTF-8 | 14,810 | 2.53125 | 3 | [
"MIT"
] | permissive | # imports
import json
import time
import pickle
import scipy.misc
import skimage.io
import cv2
import caffe
import numpy as np
import os.path as osp
from random import shuffle
from PIL import Image
import random, copy
from human_parse import load_human_part_annotation
import multiprocessing
class ImageSegDataLayer(c... | true |
cebd2352383c32b0662aa118c6a93b245ab7987d | landsurveyorsunited/NewsFeed | /Apps/ImageProcessing/image_functions.py | UTF-8 | 305 | 2.6875 | 3 | [] | no_license | import urllib, cStringIO
from PIL import Image
def return_image_dimensions(url):
url_resource = urllib.urlopen(url).read()
file = cStringIO.StringIO(url_resource)
img = Image.open(file)
(width, height) = img.size
return dict(width = width, height = height, size = len(url_resource))
| true |
e18fe0b666328529ad477455d34fa2518350223d | vas0x59/ev3_ps3_rc | /main.py | UTF-8 | 3,220 | 2.765625 | 3 | [] | no_license | import threading
# import ev3dev.ev3 as ev3
stop = False
m0_speed = 0
m1_speed = 0
running = True
MAX_SPEED = 70
MIN_SPEED = 1
def send_command(command, val):
print(command, val)
def scale(val, src, dst):
return (float(val - src[0]) / (src[1] - src[0])) * (dst[1] - dst[0]) + dst[0]
def scale_stick(value):
... | true |
557fbe7ee23fdd3a9de4a60143eced115e1b7aa4 | gabrielmacedoanac/kgextension | /kgextension/schema_matching.py | UTF-8 | 21,253 | 2.625 | 3 | [
"MIT"
] | permissive | import collections
import itertools
import re
from tqdm.auto import tqdm
from functools import reduce
import numpy as np
import pandas as pd
from kgextension.endpoints import DBpedia, WikiData
from kgextension.schema_matching_helper import (get_common_prefixes,
calc_str... | true |
51c4b8048f80bbae5ce449a5d8520c0857d5c8dc | JYleekr847/python_summer | /Chapter4/4.py | UTF-8 | 1,954 | 4.03125 | 4 | [] | no_license | # filter(<function> | none, <이터레이션 가능한 자료형>)
List = [10,25,30]
IterL = filter(None,List) # 필터링 기준이 되는 함수 X
for i in IterL:
print("Item:{0}".format(i))
def GetBiggerThan20(i) :
return i > 20
a = GetBiggerThan20(25)
print(a)
IterL = filter(GetBiggerThan20, List)
for i in IterL:
print("item:{0}".format(i))
... | true |
8fb47612496bcf36346bbcc012f238d3caff001a | anilkumar0470/git_practice | /selenium_practice/sample_script.py | UTF-8 | 1,224 | 2.9375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# driver = webdriver.Chrome(executable_path="C:\\Users\\pathapaa\\Downloads\\chromedriver.exe")
# # driver = webdriver.Firefox(executable_path=r"C:\Users\apathapa\Downloads\geckodriver.exe")
# driver.get("https://www.youtube.com/")
# # as... | true |
708a3a9dfce254cae7cb8237587b88c487dbc574 | iblisbuu/SDP_WB_crawler | /windows/googletest.py | UTF-8 | 1,486 | 2.953125 | 3 | [] | no_license | import csv
from crawler_class import GoogleCrawler
from multiprocessing import Pool
def google_search_word_input(path):
search_word_list = []
with open(path,newline='') as swinput:
reader = csv.reader(swinput)
for row in reader:
search_word_list.append(row[0])
return search_wor... | true |
234cc77bd8ff0b2660dba8025de07f32290df62e | Natgho/Ebse-X | /ara_deneme | UTF-8 | 349 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
import os
#print("Şu an ki dizinimiz;")
#print(os.getcwd())
filee = open("ornek.txt","w")
filee.write("icerisinde bunlar olacak.\nbak ayni zamanda bu da olacak haberin olsun.")
filee.close()
file2 = open("ornek.txt")
icerik = file2.read()
print(type(icerik))
al = icerik.replace("bunlar","sezer"... | true |
938b36e70623b53e4a57bed42a1b8f5e6987a950 | ManishkapoorDS/leetcode | /solutions/0210.Course_Schedule_II/python_solution.py | UTF-8 | 938 | 3.34375 | 3 | [
"MIT"
] | permissive | class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
# 0: unlearned, 1: learning, 2: learned
self.course_status = [0] * numCourses
self.adv_dict = collections.defaultdict(list)
for adv, base in prerequisites:
self.adv_dict[b... | true |
a034170fe013f901c792feaf9fb00536f233a2a9 | Peter-Pater/Introduction-to-Computer-Science | /Exercises/course exercises/On class exercise.py | UTF-8 | 1,331 | 3.25 | 3 | [] | no_license | S_WAIT_FOR_OPRD1 = 1
S_WAIT_FOR_OPRD2 = 2
S_WAIT_FOR_OP = 3
S_DONE = 4
result = 0
OPERATOR_LIST = ['+','-','*','/']
state = S_WAIT_FOR_OPRD1
while state != S_DONE:
if state == S_WAIT_FOR_OPRD1:
the_input = input('Please input oprand1:')
if the_input == 'q':
print('quiting')
state = S_DONE
elif the_input ... | true |
2b2214745008b8290ba720aa90b6009096d3883f | georgy-schukin/mpiaa-py | /mpiaa/sorting/sort_tests.py | UTF-8 | 782 | 3.15625 | 3 | [] | no_license | import unittest
class SortTests(unittest.TestCase):
def set_sort_func(self, func):
self.sort_func = func
def setUp(self):
self.set_sort_func(sorted)
def test_empty(self):
self.assertEqual(self.sort_func([]), [])
def test_single(self):
self.assertEqual(self.sort_func(... | true |
a07b8e4261aa089eb61d4fdcc7b34b6b5bbd4dcc | privateHmmmm/leetcode | /719-find-k-th-smallest-pair-distance/find-k-th-smallest-pair-distance.py | UTF-8 | 1,623 | 3.640625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pair (A, B) is defined as the absolute difference between A and B.
#
# Example 1:
#
# Input:
# nums = [1,3,1]
# k = 1
# Output: 0
# Explanation:
# Here are all the pairs:
# (1,3) -> 2
#... | true |
ee51105b8104481a3bc7591603624d4a3768d936 | shaokat/Medicine_Recommendation- | /Model/Medicine.py | UTF-8 | 468 | 2.921875 | 3 | [] | no_license | class Medicine:
type = ['tablet', 'capsule', 'inspection']
referenceCounter=0
def setName(self,name):
self.MedicineName = name;
#print(self.MedicineName)
def setDosageAmount(self,amount):
self.dosageAmount = amount
def MedicalName(self,medicalName):
self.MedicaleName ... | true |
9f5d9c9043745f9d84327e6d87c0d35dcb027a8b | mako101/python-pro-course | /10_python_apps/Data Analysis with Pandas/9.59_deleting.py | UTF-8 | 583 | 3.140625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import pandas
# In[20]:
df1=pandas.read_json('supermarkets.json')
df1=df1.set_index('Address')
# In[21]:
# 1 to indicate you are deleting a column
df1.drop("ID", 1)
# In[22]:
# 0 to indicate you are deleting a row
df1.drop("3995 23rd St", 0)
# In[26]:
# To delete by index, need t... | true |
62b10083583276e92e423d6c02194a8c5252bc90 | dannyhduckworth/qbb2017-answers | /Week-3/01-plot.py | UTF-8 | 950 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
"""
./01-plot.py <filtered.vcf> <plot name>
Plot allele frequency spectrum of identified variants
"""
import sys
import itertools
import matplotlib.pyplot as plt
alleleFile = open(sys.argv[1])
alleles = []
#Find the AF value and plot the frequency
for line in alleleFile:
if line.start... | true |
4b904b611a8ef78ed1e435d777ae2de4f1146abe | Offliners/Python_Practice | /code/125.py | UTF-8 | 355 | 3.625 | 4 | [] | no_license | # saving a data structure in a file
# in JSON
import json
data = {"alpha" : [3,5,7],
"beta" : [4,6,8]}
with open("code/Data/data.json","w") as f:
json.dump(data,f)
# ...
# using text format now
with open("code/Data/data.json","r") as f:
restored = json.load(f)
print(restored)
# Output:
# {'alp... | true |
afdedf914846c5510c9f03f0226039b39fe0ea02 | Sgiomlaireachd/Matplotlib-University-Task | /Titanic.py | UTF-8 | 1,787 | 3.125 | 3 | [] | no_license | import matplotlib.pyplot as plt
class Passanger:
def __init__(self,args):
self.pclass = args[0]
self.survived = args[1]
self.name = args[2]
self.sex = args[3]
self.age = args[4]
self.sibsb = args[5]
self.parch = args[6]
self.ticket = args[7]
s... | true |
a729579ce65b2e5cd86e6d743487691df943dacb | adrianabarca42/CPE-202 | /lab7 - Huffman Coding/min_pq.py | UTF-8 | 5,556 | 4.125 | 4 | [] | no_license | """Minimum Priority Queue
For:
CPE202
Sections 7 & 9
Fall 2019
Author:
Adrian Abarca
"""
class MinPQ:
"""Minimum Priority Queue
Attributes:
capacity (int): the capacity of the queue. The default capacity is 2,
but will be increased automatically.
num_items (int): the ... | true |
13af02bbaa4c6053e36b70bd3e4d90b3b3175c74 | trifonova-n/comic-translate | /apps/convert_labels.py | UTF-8 | 1,234 | 2.59375 | 3 | [] | no_license |
import argparse
import json
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Convert labels exported from Labelbox')
parser.add_argument('file', help='Exported file with labels')
parser.add_argument('--mapping', '-m', default='data/names_mapping.txt', help='mapping of file names a... | true |
24deceeb33a1bd32ed871880533d5452f237de96 | kirmalyshev/django_example | /apps/appointments/tests/test_selectors.py | UTF-8 | 551 | 2.53125 | 3 | [] | no_license | from django.test import TestCase
from apps.appointments.factories import AppointmentFactory
from apps.appointments.selectors import AllAppointmentsSelector
class AllAppointmentsSelectorTest(TestCase):
def test_get_or_none__none_returned(self):
actual = AllAppointmentsSelector.get_or_none(100500)
... | true |
d15d11ab6082bfcda0fba4c169940234a8ac9c7a | tinatsaitp/2020-Spring | /CS Q19.py | UTF-8 | 357 | 3.671875 | 4 | [] | no_license | #Name: Yun-Ting Tsai
#Email: Yun-Ting.Tsai01@myhunter.cuny.edu
#Date: 03.05.2020
#This program is to make a turtle spiral.
mess = int(input("How many number of stemps? "))
import turtle
tina = turtle.Turtle()
tina.shape("turtle")
tina.penup()
step = int(20)
for i in range(mess+1):
step = step + int(2)
... | true |
376eea8a154e1d04b55ce6dce9cf13c3e836f7ba | lukepkerrr/ADPY2-diplom | /diplom.py | UTF-8 | 5,842 | 2.640625 | 3 | [] | no_license | import requests
import pprint
import time
import datetime
from pymongo import MongoClient
from collections import Counter
class User():
def __init__(self, id, info, weight=0):
self.id = id
self.info = info
self.weight = weight
class Vkinder():
TOKEN = 'b759f7c046868... | true |
8e512ee477761558d44d31a9e1ba4cf162c17136 | tm-roamer/python-learn | /src/basic_study/hello_world.py | UTF-8 | 708 | 3.546875 | 4 | [] | no_license | #
# print('hello world')
#
# print('hello world', 'jumps over')
#
# print('100 + 200 =', 100 + 200)
#
#name = input()
#print('your name:', name)
#
# print('1024 * 768 =', 1024 * 768)
#
# a = 100
# if a >= 0:
# print(a)
# else:
# print(-a)
#
# print('''... line1
# ... line2
# ... line3 ''')
#
# r 是原字符串输出,\反斜线不会特殊对待... | true |
123dcd639d3dfba8664109d137bfe0895bff570f | paulykp/python_practice | /tip_counting.py | UTF-8 | 624 | 3.1875 | 3 | [] | no_license |
#weekday & Saturday tip counting
def tc(tip1, tip2, tip3, tip4, tip5):
open_one = tip1 + tip2 + tip3
open_three = open_one + tip4
ten_close = tip2 + tip3 + tip4 + tip5
noon_close = ten_close - tip2
print(" Shift 1 : %.2f \n Shift 2 : %.2f \n Shift 3 : %.2f \n Shift 4 : %.2f \n \n" % (ope... | true |
4eaf699787a61d2ce8f8f239c29e4496ced4a746 | Varsha-P/Text-Classification | /PRE-POST Processing/preprocessIMDBforMegaM.py | UTF-8 | 506 | 2.6875 | 3 | [] | no_license |
def main():
inputFile = open('labeledBow.feat','r')
outputFile = open('correctDataIMDB.txt','w')
for line in inputFile:
z = line.split()
if(int(z[0])>=7):
outputFile.write("1")
else:
outputFile.write("0")
for l in range (1,len(z)):
tokens1... | true |
da8fdad7e00ed78a36a61be2eac63c71a5f27591 | W1nU/algorithm | /first/1786.py | UTF-8 | 828 | 3.21875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
def make_pi(P):
length = len(P)
j = 0
pi = [0] * length
for i in range(1, length):
while j > 0 and P[i] != P[j]:
j = pi[j - 1]
if P[i] == P[j]:
j += 1
pi[i] = j
return pi
def KMP(T, P):
pi = make_p... | true |
5a55c01fbfd515a6ecc874524953ca3f89a221eb | bcdasilv/R_Python_ForDataScience | /data_visualization_missions/Data visualization and exploration-131.py | UTF-8 | 527 | 3.203125 | 3 | [] | no_license | ## 4. Practice: histograms ##
recent_grads.hist(column='Sample_size', bins=50)
## 7. Practice: box plots ##
recent_grads[['Sample_size', 'Major_category']].boxplot(by='Major_category')
plt.xticks(rotation=90)
recent_grads[['Total', 'Major_category']].boxplot(by='Major_category')
plt.xticks(rotation=90)
## 9. Pract... | true |
1acbfb1f07720cb060e75bd0ab6a3b953c761da7 | EnriqueStrange/Victor-hacker_asisstant | /portscanner.py | UTF-8 | 380 | 2.78125 | 3 | [] | no_license | import socket
from IPy import IP
class PortScan():
banners = []
open_ports = []
def __init__(self, target, port_num):
self.target = target
self.port_num = port_num
def scan(self):
for port in range(1,500):
self.scan_port(port)
def check_ip(self):
try:... | true |
8fb9c4173d89f4415996ce2863a1e36dc03817ab | MariusArhaug/TreeStructure | /main.py | UTF-8 | 7,729 | 3.484375 | 3 | [] | no_license | from __future__ import annotations
from node import Node
from typing import Optional, List, Tuple
import pandas as pd
import math
from pprint import pprint
def read_file(filename: str) -> Tuple[List[str], List[str]]:
"""
Read file
:param filename: Read file with filename
:return: Two lists with ID and... | true |
c36825cee6191ade5e62c983f9e71ef92903c589 | heagan01/myTestProject | /index.py | UTF-8 | 864 | 3.171875 | 3 | [] | no_license | import pickle
pickle_in = open('data.p', 'rb')
f = pickle.load(pickle_in)
numberOfWheatForData = f['numberOfWheat']
numberOfCornForData = f['numberOfCorn']
dataOut = open('data.p', 'wb')
dataIn = open('data.p', 'rb')
data = {
'numberOfWheat': numberOfWheatForData,
'numberOfCorn': numberOfCornForDat... | true |
83e7e075d6da1b8de82526a1970eae2d9d1d4450 | poweruptechacademy/dog-object | /dog-class.py | UTF-8 | 502 | 3.890625 | 4 | [] | no_license |
class Dog:
color="brown"
name="Rusty"
favoriteToy ="frisbee"
def __init__(self, name):
self.name = name
def bark(self):
print("Woof! My name is " + self.name)
def play(self):
game = input("Will you play " + self.favoriteToy + " with me?")
... | true |
161e176a144a2b1de51ee40cebfa6c0f9196906c | RedFT/HexTiler | /hextiler/camera.py | UTF-8 | 479 | 3.28125 | 3 | [
"MIT"
] | permissive | import numpy as np
class Camera:
def __init__(self, screen_size):
self.position = np.array(screen_size[:2])
self.size = np.array(screen_size[2:4])
def move_camera(self, position):
self.position += position
def follow_camera(self, position):
return position + self.position... | true |
2ece7bb73045c74d4639b446ce321f19a2f9c028 | syurskyi/Python_Topics | /140_gui/pyqt_pyside/examples/Advanced_Python_Scripting/004_Text data formats/001_002.py | UTF-8 | 1,136 | 3 | 3 | [] | no_license | import os
path = 'C:/Users/Sergej/Dropbox/nuke/.nuke/example/PYTHON_EXAMPLE/Python_Example_All_Tutorials/VIDEO/Advanced_Python_Scripting/004_Text data formats/'
# /Users/sergejyurskyj/.nuke/example/PYTHON_EXAMPLE/Python_Example_All_Tutorials/VIDEO/Advanced\ Python\ Scripting/004_Text\ data\ formats/
fileName = 'settin... | true |
a39960e631ad3765734e5495615bcf735c913800 | Vladimetr/docs | /tutorial/progress_bar.py | UTF-8 | 1,650 | 3.140625 | 3 | [] | no_license | from tqdm import tqdm
import time
import sys
sum_ = 0
# trange = tqdm(range(100), ncols=80, desc='hello', unit='epoch')
# возвращает тот же список range(100)
# можно задать свой формат вывода
# my_bar = '| {n_fmt}/{total_fmt} [{elapsed}<{remaining}] loss=0.3'
# n_fmt - текущее кол-во итераций
# total_fmt - полное ко... | true |
e1d540360c3d861da59f49f392ee8d5380eb9c10 | gujie1216933842/codebase | /python-fileoperation文件操作/05_python逐行读取文件.py | UTF-8 | 305 | 2.703125 | 3 | [] | no_license | import os
file_name = os.path.dirname(__file__) + '/new.txt'
new_file_name = os.path.dirname(__file__) + '/newfile.txt'
fn = open(file_name, 'r+') #读写
fn1 = open(new_file_name, 'w') #读写
lines = fn.readlines()
print(lines)
for line in lines:
fn1.write(line.replace('大','小'))
fn.close()
| true |
52d103772e04ff79a8a3ae3766a50844d752ca17 | rwrth/Coordinate_Reconstruction | /make_log_bs.py | UTF-8 | 4,126 | 2.59375 | 3 | [] | no_license | import os
import datetime
from shutil import copyfile
import torch
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import numpy as np
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no',... | true |
1dff2569d276abc312dcb0d21c392d447d85ad68 | MarcPartensky/Machine-Learning | /Coursera/Lesson1-Neural Networks/Week2/vectors.py | UTF-8 | 105 | 2.859375 | 3 | [] | no_license | import numpy as np
a = np.random.randn(5)
print(a)
print(a.shape)
print(a.T)
print(np.dot(a, a.T))
| true |
bf6babeee6ac2a8ee4abade1d604d6c0a2e854d5 | sravan212100/Advanced-Data-Driven-Text-Mining | /kaggle-challenge/core/clean_utils.py | UTF-8 | 1,458 | 3.078125 | 3 | [] | no_license | import re
import nltk
import string
import numpy as np
from nltk.tokenize import word_tokenize
from nltk.stem.snowball import SnowballStemmer
from nltk.corpus import stopwords
nltk.download('punkt')
nltk.download('stopwords')
stop_words = stopwords.words('english')
def remove_URL(text):
url = re.compile(r'https?... | true |
3f2cbb6c484578fdba52f475ff3c6b5d256d572b | GabrielGM01/Exercicios_Logica_Python | /Teste_de_Seleção.py | UTF-8 | 610 | 3.859375 | 4 | [] | no_license | """Leia um valor de ponto flutuante com duas casas decimais.
Este valor representa um valor monetário. A seguir, calcule o menor número de notas e moedas possíveis no qual o valor pode ser decomposto. As notas consideradas são de 100, 50, 20, 10, 5, 2. As moedas possíveis são de 1, 0.50, 0.25, 0.10, 0.05 e 0.01.
A se... | true |
43498c7f872873487b55957a184e74091c22a34e | zulip/zulip-terminal | /zulipterminal/server_url.py | UTF-8 | 2,544 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | """
Constructs and encodes server_url of messages.
"""
import urllib.parse
from zulipterminal.api_types import Message
def hash_util_encode(string: str) -> str:
"""
Hide URI-encoding by replacing '%' with '.'
urllib.quote is equivalent to encodeURIComponent in JavaScript.
Referred from zerver/lib/ur... | true |
284bcf6c16c6e2a4d79088f9c2b3875027d8e282 | Eckankar/datanet-httpd | /Uri.py | UTF-8 | 1,761 | 3.453125 | 3 | [
"MIT"
] | permissive | from Log import Log
class Uri:
"""
Represents an URI
'originalUri' contains the string originally used to represent the target
'target' contains the handler targeted
'resource' contains the resource requested on the handler
'query' contains the query string passed
To visualize: /targ... | true |
2c2ec622dda203466374ea456cdda6ea0b974883 | lanzhiwang/common_algorithm | /data_structures/07_hashing/number_theory/prime_numbers.py | UTF-8 | 1,505 | 3.984375 | 4 | [] | no_license | #!/usr/bin/env python3
"""
module to operations with prime numbers
"""
def check_prime(number):
"""
it's not the best solution
number = 0 -> 2
number = 1 -> 2
number = 2 -> 3
>>> number = 20
>>> l1 = [i for i in range(2, number)]
... | true |
b828ce10e20fb8f99483f32f491ea608444f689c | xueyhchina/encephal | /svg_render/grid_objects.py | UTF-8 | 14,129 | 2.859375 | 3 | [] | no_license |
__author__ = 'hadware'
from svg_render.network_elements import ElementType
from enum import Enum
from svg_render.cdata_patch import ET
DEFAULT_CSS_PATH = "graph_style.css"
class GridObjectType(Enum):
RECT = 1
ELLIPSE = 2
RHOMBUS = 3
class GridObject:
def __init__(self, object):
self.origin... | true |
3dafb2933f2d0b00b71c077c1065f7d809b7b2b9 | bazilevs31/MD_gel_simulation | /test_files/test_3.py | UTF-8 | 1,933 | 3.125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# Note higher "kappas" (second arg) result in a _narrower_ distribution
def cart2pol(x, y):
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return(rho, phi)
def dist(x, y):
"""dist"""
return np.linalg.norm(x-y)
def get_kappa(x, y, nrem, N):
... | true |
340be9046c7792ddaa49580bc2490d7610f96177 | mccormd1/Foobar-google-fun- | /Level_3/matrix_fuelprob.py | UTF-8 | 12,648 | 4.21875 | 4 | [] | no_license | '''
Doomsday Fuel
=============
Making fuel for the LAMBCHOP's reactor core is a tricky process because of the exotic matter involved.
It starts as raw ore, then during processing, begins randomly changing between forms, eventually reaching a stable form.
There may be multiple stable forms that a sample could ultima... | true |
bb5876a37e7648e38b039bc855680db7dcae7ee7 | ReDnAxE/holyzipcracker | /src/Dezipper.py | UTF-8 | 464 | 2.734375 | 3 | [] | no_license | from zipfile import ZipFile
class Dezipper:
def __init__(self, zippedFilePath):
self.zippedFilePath = zippedFilePath
def extractZip(self, password):
try:
with ZipFile(self.zippedFilePath) as zipFile:
zipFile.extractall(pwd=password.encode())
zipFile... | true |
ac83b8aeeb164f033f172ccf89a5737bebc5a453 | stonelyd/ultimate-texas-hodelm | /tests/testHand.py | UTF-8 | 1,891 | 3.15625 | 3 | [] | no_license | __author__ = 'monica_wang'
from card import Card
from hand import Hand
files = ["royalflush.txt", "straightflush.txt", "fourofakind", "fullhouse.txt", "flush.txt", "straight.txt", "threeofakind.txt", "twopair", "pair.txt", "highcard.txt"]
expects = ["[10 of Diamond, J of Diamond, Q of Diamond, K of Diamond, A of Diam... | true |
1f191e10aebec92d1a09931163abe461569547a9 | luxxcn/Introduction-to-Tornado | /4.Databases/definitions_readwrite.py | UTF-8 | 2,317 | 2.703125 | 3 | [] | no_license | """
Example 4-2.A read/write dictionary service: definitions_readwrite.py
"""
import signal
import logging
import time
from os import path
import random
import pymongo
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado import web
from tornado.web import RequestHandler
from torn... | true |
2b4940442dae24e9bb188d0ea2f3931c64882a2a | wallefan/minefish | /swordfish_launcher/gui/setup/__init__.py | UTF-8 | 862 | 2.6875 | 3 | [] | no_license | import tkinter
import tkinter.ttk
class SetupWizardDialog(tkinter.Frame):
def __init__(self, parent):
super().__init__(parent, width=800, height=600)
self.bottom_frame = tkinter.Frame(self)
self.bottom_frame.pack(side='bottom', expand=1, fill='x', padx=3)
tkinter.ttk.Button(self.bot... | true |
efe1e5eac7e398252d9f028424f14debc0feb448 | q759729997/qytPytorch | /qytPytorch/modules/conv_layer.py | UTF-8 | 875 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | """
module(conv_layer) - 卷积常用层.
Main members:
# GlobalAvgPool2d - 全局平均池化层.
# GlobalMaxPool1d - 时序最大池化.
"""
from torch import nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
"""全局平均池化层.可通过将池化窗口形状设置成输入的高和宽实现"""
def __init__(self):
super().__i... | true |
4e3014093eec8985260deef378ea1a1b41e44186 | piquepq/milp_constrained_gan | /launchers/plot_change.py | UTF-8 | 3,940 | 2.703125 | 3 | [] | no_license | """Plot the kl divergence, average path and unique&valid levels percentage of generated levels with the model at different epoches."""
import os
import numpy as np
import torch
import tqdm
import matplotlib.pyplot as plt
import algos.torch.dcgan.dcgan as dcgan
from launchers.hamming_distance_analysis import get_vali... | true |
2c1e4904e69d94a7a83c8c1b8e36ba81e92f5422 | aashishksingh/HackerRankSoln | /reducedstring.py | UTF-8 | 558 | 3.3125 | 3 | [] | no_license | #!usr/bin/env python3
def main():
s=str(input().strip())
nochange=False
temp=list(s)
while not (nochange):
l=len(temp)
for i in range(l-1):
if(i+1<len(temp)) and (temp[i]==temp[i+1]):
temp=[temp[j] for j in range(l) if not (j==i) and not (j==i+1)]
... | true |
d08d07d6ffe2a11f0555b8f4d2efd6016a5c9fb0 | rxjhfmf/WebApp | /www/config/__init__.py | UTF-8 | 880 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Frank Fu'
# 数据库默认设置
db_config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': 'root',
'db': 'awesome'
}
class Dict(dict):
'''
Simple dict but support access as x.y style.
'''
def __init__(self, names=(), values=(), ... | true |
db21c0ef58dda27b00203c6669b3c6827209a4f1 | PatrycjaHomosapiens/Python | /Listy_dodawanieElementów.py | UTF-8 | 909 | 4.34375 | 4 | [] | no_license | """
TYPY SEKWENCYJNE
Napisz program, ktory 5 razy poprosi o podanie imienia. Podane imiona beda zapisywane do listy.
Wypisz dla wszystkich imion ponizszy komunikat
Cześć <tutaj imię z listy>
"""
imiona = [] # pusta lista
im1 = input("Wpisz imię nr 1: ")
imiona.append(im1)
im2 = input("Wpisz imię nr 2: ... | true |
3c155b68bec556f1e798c4188a7f1870c2a74562 | floriandaniel/pg_geodata_intgration | /Projet-2018/TestFinal/data_integration-0.0.1/src/utils/demo2.py | UTF-8 | 1,107 | 3.484375 | 3 | [
"WTFPL"
] | permissive | # -*- coding: utf-8 -*-
def printAllo() :
"""
Effectue une division
:return: la valeur entiere de la division
:rtype: int
"""
print("Allo")
def ma_fonction_simple(numerateur, denominateur):
"""
Effectue une division
:param numerateur: le numerateur de la division
:type numera... | true |
4c96897d9fc7d6fb7666fd82f62e77278c08d2db | tbe07tyg/Tensorflow2 | /BreathingRecognition/CoreMyCodes/RealTrainAutoGraph.py | UTF-8 | 12,342 | 2.59375 | 3 | [] | no_license | """
Train our RNN on extracted features or images in Tensorflow 2.0 with autograph conception.
"""
import re
import os
import csv
from tensorflow.python.keras.utils.data_utils import Sequence
from numpy import math
import numpy as np
import glob
import tensorflow as tf
from tensorflow.keras.preprocessing.image import i... | true |
ceb9f96b45808bbfe019608de6b957a13e304c21 | acasasaez/Warm-up | /ejercicio10.py | UTF-8 | 74 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import datetime
curent_time = datetime.datetime.now()
print(curent_time)
| true |
9c0117c0b68f57269202ff70852f3df617ed07e9 | ftahery/Accounting | /accountingApp/models.py | UTF-8 | 1,811 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django.db import models
from django.core.validators import RegexValidator
# Create your models here.
class Customer(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,10}$', ... | true |
91a92e5b6f5de039be66b1678e8658a31a8d7d8f | zzc2444057878/algorithm | /剑指offer66题/合并两个排序的链表.py | UTF-8 | 170 | 2.59375 | 3 | [] | no_license |
'''
题目:
输入两个单调递增的链表,输出两个链表合并后的链表,合并后的
链表满足单调不减规则。
'''
'''
思路:
''' | true |
0c796a6b6968de52c8096ad2668eaef67400b99c | pm1945/PY-1-6388-HW | /lesson03/examples/2.3_func_part2.py | UTF-8 | 1,915 | 4.0625 | 4 | [] | no_license | # ====================
# Функции часть-2
# ====================
# Уточню! Чтобы не было путаницы...
# переменные, в которые функция получает значения - ПАРАМЕТРЫ,
# значения, которые передаются в функцию - АРГУМЕНТЫ:
# def func(param1, param2, ...):
# pass <-- тело функции
# return value <-- возвр... | true |
aa1cb7343d53c76f3e3d2e773e6f6792d6521f19 | Akshat-Goyal/Jetpack-Joyride | /board.py | UTF-8 | 6,400 | 3.140625 | 3 | [] | no_license | import numpy as np
import sys
import os
import colorama
from colorama import Fore, Back, Style
import time
class Board:
''' contains the design of board '''
def __init__(self, length, breadth, frame):
self.__length = length
self.__breadth = breadth
self.__frame = frame
self.__col = Back.BLACK + Fore.BLACK
... | true |
05c1e22d1269665429c54814ec84cf90ec3355c9 | mmcgov/pybites_exercises | /189/alt_control_flow.py | UTF-8 | 470 | 3.1875 | 3 | [] | no_license | IGNORE_CHAR = 'b'
QUIT_CHAR = 'q'
MAX_NAMES = 5
def filter_names(names):
results = list()
for name in names:
if name[0] == IGNORE_CHAR:
continue
elif any(char.isdigit() for char in name):
continue
elif name[0] == QUIT_CHAR:
break
... | true |
8928b529e64470a3aa79a990d6351ad117859fa3 | DominanceFrontier/Stratagem | /runner.py | UTF-8 | 331 | 2.53125 | 3 | [] | no_license | import sys
if __name__ == "__main__":
sys.path.append(sys.argv[1])
script = sys.argv[2]
exec('import %s as script' % script)
#reload(script)
state = sys.argv[3]
time_left = int(sys.argv[4])
player = sys.argv[5]
sys.stdout.write('\n')
sys.stdout.write(script.get_move(state, time_left... | true |
71a0af3621af9acb5b8f13fc8f5cbe5303d8bacf | Timonevontimonsson/Rymdspel | /scripts/data/tools.py | UTF-8 | 5,454 | 2.640625 | 3 | [] | no_license | import os
import pygame
from scripts.data import constant as c
from scripts import player
import pickle
keybinding = {
'left':pygame.K_a,
'right':pygame.K_d,
'up':pygame.K_w,
'down':pygame.K_s,
'skill':pygame.K_SPACE,
'dash':pygame.K_LSHIFT,
'pause': pygame.K_p,
... | true |
9563ec2d98a89c81d8aeba712bfebb555be92cad | forrestjan/Labos-MCT-19-20 | /2019-prog-labooefeningen-forrestjan/week10/oefening1/model/PersoonRepository.py | UTF-8 | 898 | 3.03125 | 3 | [] | no_license | import json
from .Student import Student
from .Ouder import Ouder
class PersoonRepository:
# waar staat de json file?
_filename = 'week10/doc/personen.json'
# _ (private) = is enkel bruikbaar in deze klasse
@staticmethod
def _read_local_json_file(bestandsnaam):
fo = open(bestandsnaam, enco... | true |
e8131308dc74ca7d9ebc5a974e8fed01a0ce2bec | lesyuk/learning_python | /pythontutor/while_loop/sequence_lenght.py | UTF-8 | 88 | 3.015625 | 3 | [] | no_license | sl = 0
n = 1
while n != 0:
n = int(input())
if n != 0:
sl += 1
print(sl) | true |
01548a813d77ffecd4eef57c0eb932f3545db9bf | lvjingshu/btclipse | /addresses.py | UTF-8 | 713 | 2.96875 | 3 | [] | no_license | import numpy as np
class SimpleAddress(object):
def __init__(self, group, ip):
self._group = str(group)
self._ip = str(ip)
self._str = '%s:%s' % (self.group, self.ip)
@property
def group(self):
return self._group
@property
def ip(self):
return self._ip
... | true |
4da6431ab5711df0129edc8c0f176b4d4818ca86 | RoshanaMane/MyCapSubmission | /Re-submission task3.py | UTF-8 | 306 | 4.1875 | 4 | [] | no_license | #Write a Python program to print all positive numbers in a range.
list1= [12, -7, 5, 64, -14]
for i in list1:
if i >= 0:
print(i,end = ' ')
print('\nNow it will implement for second list')
list2 = [12, 14, -95, 3]
for value in list2:
if value >= 0:
print(value,end=' ') | true |
48ffbc80c4a79b2926af612fe2657c3fb76a0674 | zihuaweng/leetcode-solutions | /leetcode_python/140.Word_Break_II.py | UTF-8 | 1,278 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
# https://leetcode.com/problems/word-break-ii/
# dfs 解决,每次看开头是否符合,符合递归后面的s[len(word):]
# Time complexity: O(n*k*n)
# Space complexity: O()
class Solution:
def wordBreak(self, s: str, wordDict: List[str]) -> List[str]:
"""
pineapplepenapple
... | true |
97d97e26e60dd465592faf08dfcb8853f3ffba19 | andrewgait/advent_of_code | /adventofcode2019/advent16/advent16.py | UTF-8 | 4,037 | 3.25 | 3 | [] | no_license | # Advent of code, day 16
import numpy as np
# open file
input = open("advent16_input.txt", "r")
# input = open("advent16_test_input.txt", "r")
# input = open("advent16_test_input2.txt", "r")
# input = open("advent16_test_input3.txt", "r")
# input = open("advent16_test_input4.txt", "r")
# input = open("advent16_test_in... | true |
abdd6260d5d1b5cec2d5ed82623c44c939acc338 | tintinthong/algo-practice | /dailyInterviewPro/5sep19.py | UTF-8 | 854 | 3.53125 | 4 | [] | no_license | class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1, l2, c=0):
nodel1 , nodel2= l1 , l2
nodel3=ListNode(nodel1.val+nodel2.val)
result=nodel3
print(nodel1.val, nodel2.val, nodel3.val)
... | true |
6ecb9424bbd5caf83993ed7a172de6c5b8896ab5 | HPCargaisondeKiwi/Javascript-Python | /ProgrammeDecryptage.py | UTF-8 | 1,196 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Logiciel de cryptage en python par JSraveen
# Phase 2 : Déryptage par décalage (Algorithme de Cesar)
#DEBUT#
print ("Debut du programme:")
print ("Bonjour, ceci est un système de décodage par la méthode de césar (Déryptage par décalage). Il faut en connaitre la clé.")... | true |
9f0717c3fb4941e141bbec2bb6e5d99547a93a86 | prasannatuladhar/30DaysOfPython | /day19.py | UTF-8 | 1,698 | 4.90625 | 5 | [] | no_license | # Exercises
# 1) Create a short program that prompts the user for a list of grades separated by commas.
# Split the string into individual grades and use a list comprehension to convert each string to an integer.
# You should use a try statement to inform the user when the values they entered cannot be converted
# 2... | true |
338a9070fe554a3d126a91b2adbb9c13cbcbb091 | jaz888/dist_lang_reviews | /incoq/compiler/incast/util.py | UTF-8 | 4,472 | 2.734375 | 3 | [] | no_license | """Convenience tools."""
__all__ = [
'set_update',
'rel_update',
'insert_rel_maint',
'insert_rel_maint_call',
'set_update_name',
'apply_renamer',
'Unwrapper',
'is_injective',
'get_setunion',
]
from incoq.util.collections import OrderedSet
from . import nodes as L
from .pyconv im... | true |
738828c42f6b35e018a107da01107c4da57f5cca | Yukikazari/kyoupuro | /.提出一覧/AtCoder/エイシンク2020/AIS2020_C.py | UTF-8 | 368 | 3.265625 | 3 | [] | no_license | N = int(input())
res = [0] * N
for x in range(1, 102):
for y in range(1, 102):
for z in range(1, 102):
t1 = (x + y + z) ** 2
if t1 > 15000:
break
n = t1 - x * y - y * z - z * x - 1
if n >= N or n < 0:
break
... | true |
9c66d575eda303c582c1b36468dd50e3df37d852 | wesenu/coreset | /experiment.py | UTF-8 | 7,990 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import os
import time
from dataset import DataSet
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
class Experiment:
def __init__(self, model, dataset_name):
self.model = model
self.dataset_name = dataset_name
if dataset_name=="mnist":
self.width=28
self.n_channels=1
... | true |
56a2aa2ddfb75c2ea61f8337309b9a7a3ec4a21b | feilong/zdic | /all_char.py | UTF-8 | 741 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import time
import codecs
import os
with codecs.open('fetched.txt', 'r', 'utf-8') as f:
fetched = f.read()
with codecs.open('fetched.txt', 'a', 'utf-8') as f:
for i in xrange(0x4e00, 0x9fff):
ch = unichr(i)
if ch in fetched:
print ch, 'in fetched list'
... | true |
847902cebcbaf243027a14266fbca15c977b2972 | conaldes20/Weather-Forecasting | /heat_index_forecasting_program.py | UTF-8 | 17,137 | 2.921875 | 3 | [] | no_license | import numpy as np
import csv
import math
#import predict as util
from datetime import datetime
class DeepNNetwork:
def __init__(self):
# load the dataset from the CSV file
reader = csv.reader(open("C:/Users/CONALDES/Documents/weather_features.csv", "r"), delimiter=",")
x = list(reader)
... | true |
2d6f48fc3a53c8b04e782a03a585db55a4ffd09e | parthnatekar/voc2012 | /image_import.py | UTF-8 | 627 | 2.6875 | 3 | [] | no_license | import numpy as np
import glob
import cv2
import pandas as pd
import os
#import images from given path using glob for navigation(some extra work for VOC2012)
def import_images(path , save_path, image_list):
images = []
for i in range(len(image_list)):
for img in glob.glob(path):
name, ext... | true |
3cf4e097d814b590175d2e6a52eaec4c4e5fa6f2 | myungbeans/aoc2020 | /day6/part2.py | UTF-8 | 498 | 3.046875 | 3 | [] | no_license | def countAllAnsweredYes():
file = open("input.txt", 'r')
allGroups = file.read().split('\n\n')
countYeses = 0
for groupAnswers in allGroups:
tmp = {}
for q in list(groupAnswers.replace('\n', '')):
tmp[q] = tmp[q]+1 if q in tmp else tmp.setdefault(q, 1)
for key in t... | true |
0a1ea657d61dd1809c9f1d3c1264fbea26659627 | stratosm/NLP_modules | /src/vocabulary.py | UTF-8 | 1,692 | 3.609375 | 4 | [] | no_license | # author: Stratos Mansalis
import pandas as pd
from nltk.tokenize import word_tokenize
from collections import Counter
def vocabulary_builder(df, sents):
"""
Description
------------
Creates the vocabulary and the corresponding index for the given dataset.
Arguments
... | true |
577d8a102dfe80789e54f573c6b881c2b6cda827 | rdnelson/Proxima | /cc3200/bootloader/tools/del.py | UTF-8 | 624 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
import serial
import sys
ser = serial.Serial('/dev/cc1', 921600)
ser.flushInput();
ser.setTimeout(2)
print "Waiting for response"
ser.write("d")
delConf = ser.readline()
if delConf == "":
print "No response, please ensure the device is in bootloader mode."
exit()
elif delConf != "delete O... | true |
b826796c36694fc3898ab3192459570d3a31f998 | fengye214214/PersonPythonStudy | /获取文件中的全部后缀/GetAllFileExtension.py | UTF-8 | 777 | 3.0625 | 3 | [] | no_license | import os
import shutil
class GetAllFileExtension:
def __init__(self):
global L
L = []
def file_extension(self):
file_dir = os.getcwd()
self.print_all_file_extension(file_dir)
print(set(L))
def print_all_file_extension(self, file_dir):
file_l... | true |
a002f8a9f90abf7e2088b9e95a98be579c7be6e7 | elizavetagordeyeva/myhomeworks | /Gordeyeva_PythonHW1.py | UTF-8 | 471 | 4.125 | 4 | [] | no_license | print ('Введите 3 числа')
a,b,c=input()
if int(a)/int(b) == int(c):
print ('Для этих чисел выполняется свойство 1')
else:
print ('Для этих чисел не выполняется свойство 1')
if int(a)**int(b)==int(c):
print ('Для этих чисел выполняется свойство 2')
else:
print ('Для этих чисел не выполняется сво... | true |
3859a40dc0e80e5a681893d63f2f7d525cd2c9fb | yama5/pythonLab-v3 | /sample/6/FileInOut.py | UTF-8 | 268 | 2.984375 | 3 | [] | no_license | try:
wfile = open('test.txt','w')
wfile.write('Hello')
wfile.flush()
except:
print('FileProcessError')
finally:
wfile.close()
try:
rfile = open('test.txt','r')
line = rfile.readline()
print(line)
except:
print('FileProcessError')
finally:
rfile.close()
| true |
ede10990c027c656fdc2071ee111103c7a27ca7a | yjh8806/python-2019-July | /11일/13.반복문for/17.로또만들기.py | UTF-8 | 951 | 3.625 | 4 | [] | no_license | import random
lotto = [] #내가 적을 로또 번호
lotto_answer = [] #정답 로또 번호
#1.lotto리스트에 1 ~ 45의 숫자 중 6개를 입력(중복되지 않은 6개)
#2.lotto_answer리스트에 1 ~ 45의 숫자 중 랜덤한 6개를 저장(중복되지 않은 6개)
#3.내가 몇개를 맞췄는지 출력
count = 1
while len(lotto) < 6:
lotto_num = int(input("%d번째 숫자 입력 : "%count))
if lotto_num >= 1 and lotto_num <= 45 ... | true |
2b2f1726f48f922a3b03e05082461f6f8aeeada9 | royadityak94/Interview | /Hired/test.py | UTF-8 | 818 | 3.46875 | 3 | [
"MIT"
] | permissive |
def findSubsequence(arr):
# Write your code here
totalRecords = 0
distinct_set = []
min_removal_arr = []
distinct_set_count = 0
flag=False
for ele in arr:
totalRecords += 1
if ele not in distinct_set:
distinct_set += ele,
distinct_set_count += 1
... | true |
615dbb6eeb9ddc1dcb320169509e3f8e638dc20e | Amri95/esnn | /esnn/esnn.py | UTF-8 | 3,019 | 2.890625 | 3 | [] | no_license | from collections import defaultdict
import numpy as np
from esnn.neuron import Neuron
class ESNN:
def __init__(self, encoder, m=0.9, c=0.7, s=0.6):
"""Creates a new Evolving Spiking Neural Network.
Args:
encoder: Instance of Encoder.
m: Modulation factor in the neuron model.
... | true |
5ca297f4e91ba5f28ff5e73cefde0fc95453d27f | Chenzf2018/pythonDataStructure | /ShellSort.py | UTF-8 | 891 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'Shell sort'
__author__ = 'lxp'
#《大话数据结构》392页
class SqList(object):
def __init__(self):
self.r = [None]
self.length = 0
def show(self):
a = True
for l in self.r:
if a == True:
a = False
continue
print(l, ',', end = '')
def ShellSort(L):
incr... | true |
51f2e2ab3aa453f896a425b155915564a05410c4 | selingok033/color-classification | /color_classify.py | UTF-8 | 916 | 2.8125 | 3 | [] | no_license | import cv2
import color_histogram_feature_extraction
import knn_classifier
import os.path
for dir in sorted(os.listdir('./test_dataset')):
correct = 0
fail = 0
if (dir == ".DS_Store"):
continue
for file in sorted(os.listdir("./test_dataset/" + dir)):
if (file == ".DS_Store"):
... | true |
f151e8badd6b1cb50965d9bd65e92835c2ea1db8 | vieirafrancisco/car-adventure | /display.py | UTF-8 | 407 | 3.109375 | 3 | [
"MIT"
] | permissive | import pygame
class DisplaySurface:
def __init__(self, width, height):
self.width = width
self.height = height
self._size = (self.width, self.height)
self._display_surface = pygame.display.set_mode(self._size, pygame.HWSURFACE | pygame.DOUBLEBUF)
def get_display_surface(self):
... | true |
fb1f3f11d2e03f7cc93f564d162f18e99c9ddb59 | Danang691/Euler.Py | /euler/solutions/euler34.py | UTF-8 | 1,740 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from euler.baseeuler import BaseEuler
'''
These type of numbers are referred to as factorions and it’s easy to learn that
only 4 exist: 1, 2, 145 & 40585. The problem description wants us to ignore 1 &
2 so the answer to this problem should become obvious.
But, let’s write a program anyway t... | true |
627034e1ff1c1a77b560725f638c0fbc84bb2dce | hanakamer/bioinformatics | /mirna_hesap_cerceve_kaydirma.py | UTF-8 | 2,086 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #analysis of possible mirna sequences using frame sliding method
#cerceve kaydirma yontemi ile olasi mirna sekanslarinin bulunmasi
from StringIO import StringIO
import operator
def gen_sozluk(dosya_adi):
x=open(dosya_adi,"r")
dosya=x.read()
x.close()
sio=StringIO(dosya)
sozluk={}
... | true |
7f400b8169295d73c48ca529de7289ee778de606 | Aasthaengg/IBMdataset | /Python_codes/p02923/s513824992.py | UTF-8 | 367 | 2.9375 | 3 | [] | no_license | def main():
n = int(input())
hlis = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n-1):
if hlis[i+1] <= hlis[i]:
tmp += 1
else:
if ans < tmp:
ans = tmp
tmp = 0
if ans < tmp:
ans = tmp
print(ans... | true |
86bdb0865403819352e8f12c7e2fa01241fa55cd | StephanH84/algorithmic_trading | /multiprocess/zmq/src/push_pull/tasksink.py | UTF-8 | 1,061 | 2.8125 | 3 | [
"MIT"
] | permissive | # Task sink
# Binds PULL socket to tcp://localhost:5558
# Collects results from workers via that socket
#
# Author: Lev Givon <lev(at)columbia(dot)edu>
import sys
import time
import zmq
context = zmq.Context()
# Socket to receive messages on
receiver = context.socket(zmq.PULL)
def bind():
success = False
p... | true |
8e845ac1d6e73711dc5a5723dcaf226bc7114c80 | tracholar/ml-homework-cz | /basic-keras/chenrenbing/DAE.py | UTF-8 | 2,735 | 2.53125 | 3 | [] | no_license |
import numpy as np
from keras.models import Sequential
from keras.layers import Dense,Activation,Conv2D,Conv2DTranspose
from util import *
class DAE_NN:
def __init__(self,n_itr=30,layer_shape=None,input_shape=(784,),
batch_size=64,optimizer='adam',loss='mse'):
self.layer_shape=layer_shap... | true |