blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
df86df7d384a36162fda55975c6ada4c068a770e | Python | zuobangbang/workspace | /SKearn/recommend/merge_matrix.py | UTF-8 | 337 | 2.546875 | 3 | [] | no_license | import csv
import pandas as pd
matrix_one='/Users/zuobangbang/Desktop/result11.csv'
matrix_two='/Users/zuobangbang/Desktop/result111.csv'
path='/Users/zuobangbang/Desktop/finall.csv'
a=0.5
df1=pd.read_csv(matrix_one)
df2=pd.read_csv(matrix_two)
for index in df1.columns[1:]:
df1[index]=df1[index]*a+df2[index]*(1-a)... | true |
83db201910fcdf9e7f66d79ec29ccfd7ee5a4279 | Python | MengdiWang124/thinkcspy | /Chap_6/17_drawSprite.py | UTF-8 | 452 | 3.140625 | 3 | [] | no_license | import turtle
def drawSprite(someturtle,legnumber,leglength):
someturtle.shape("circle")
someturtle.speed(10)
someturtle.stamp()
someturtle.down()
for i in range(legnumber):
someturtle.forward(leglength)
someturtle.left(180)
someturtle.forward(leglength)
someturtle.le... | true |
dfdc352ae6ab5d9539c25e0f25aae67e41e0f202 | Python | epcm/2020_Summer_School_Python | /Day5/mandelbrot.py | UTF-8 | 515 | 3.671875 | 4 | [] | no_license | import turtle
turtle.setworldcoordinates(-2, -1.5, 1, 1.5)
t = turtle.Turtle()
turtle.tracer(0)
def fun(c):
z = 0
for _ in range(1000):
z = z**2 + c
if(abs(z) > 2):
return False
return True
for x in range(-200, 100):
for y in range(-150, 150):
c = complex(x/10... | true |
101eb0c810e6ceed85f2f27251a26fcca2d341e3 | Python | M-Kuklin/eulerproject | /1.py | UTF-8 | 385 | 3.875 | 4 | [] | no_license | '''Если выписать все натуральные числа меньше 10, кратные 3 или 5, то получим 3, 5, 6 и 9. Сумма этих чисел равна 23.
Найдите сумму всех чисел меньше 1000, кратных 3 или 5.'''
summ = 0
for i in range(0,1001):
if i % 3 == 0 or i % 5 == 0:
summ += i
print (summ) | true |
36c062128f044f669698706a0298403ffdc5d793 | Python | Grand-zio/app-test | /app_test_linux/services/FindCase.py | UTF-8 | 2,717 | 2.75 | 3 | [] | no_license | import os
import re
from getpath import get_abs_path
from util.Log import Logger
log = Logger().logger
def findTestCases(path_name):
"""
查询待执行测试用例
输入:
1. 用例文件名 -- 执行指定用例文件
2. 用例目录 -- 执行目录下所有 test_开头文件
"""
root_path = get_abs_path()
base_path = os.path.join(root_path, 'testcase')
... | true |
5180392aa683bdd6f46d6952c5605a71c92eee91 | Python | SIOSlab/FuncComp | /FuncComp/Plotting.py | UTF-8 | 4,780 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
v1: Created on May 31, 2016
author: Daniel Garrett (dg622@cornell.edu)
"""
import numpy as np
import matplotlib.pyplot as plt
import FuncComp.Population as Population
import FuncComp.Functional as Functional
import FuncComp.MonteCarlo as MonteCarlo
import FuncComp.util as util
import time
... | true |
c6f1e863b719a1715ff627af93aea64c612aede3 | Python | aaroslanow/cryptoCalc | /hashes.py | UTF-8 | 305 | 2.671875 | 3 | [] | no_license | __author__ = 'Adam'
from Crypto.Hash import SHA as SHA1
def getSHA1_Text(input):
result = SHA1.new()
result.update(input)
return result.hexdigest()
def getSHA1_File(file_path):
file_content = open(file_path)
file_content= file_content.read()
return getSHA1_Text(file_content)
| true |
1982e5f7c27f4c73ee940d43561999b4e91bbded | Python | Liptonski/Python-Course | /Piatki 13.py | UTF-8 | 549 | 2.515625 | 3 | [] | no_license | miesiace=[31,28,31,30,31,30,31,31,30,31,30,31]
dzien_miesiaca=1
dzien_tygodnia=4
ile_13th=0
for i in range(2004, 2018):
miesiace[1]=28
if i%4==0:
miesiace[1]=29
nr_miesiaca=0
while nr_miesiaca<12:
dzien_miesiaca+=1
dzien_tygodnia+=1
if dzien_tygodnia==5 and dzien_miesiac... | true |
714b973bf2b6be74f8f73fe24abb8b50736e6698 | Python | kellegous/perfboard | /mocks/graphs.py | UTF-8 | 1,161 | 3.296875 | 3 | [] | no_license | import math
def decr_data(n = 100, base = 24000):
data = [base + 1000]
for i in xrange(n - 1):
if i % 2 == 0:
data.append(base)
else:
data.append(base - 500)
return data
def random_data(n = 100, base = 24000):
data = []
for i in xrange(n):
r = random()
if r > 0.8:
base = bas... | true |
3722b7cfd05b710cf22fbb282f4fa2f0bfd36645 | Python | epirevolve/workscheduler | /workscheduler/src/backend/domains/models/operator/relation.py | UTF-8 | 1,280 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.orm import validates
from sqlalchemy.types import String
from sqlalchemy.types import Float
from utils.uuid import UuidFactory
from .. import OrmBase
class Relation(OrmBase... | true |
156725aa9e7dc54ab61d7dd09c172324bcf1d9e7 | Python | Dpablook/Curso-de-Python3--Udemy | /Documentacion/Doctest.py | UTF-8 | 222 | 2.6875 | 3 | [] | no_license | #Prueba el archivo fuente verificando que den los resultados esperados
#es mas sensillo que lo que es Unitest
#
#
#
#
#
#
#
def function(a,b):
"""
>>> funcion(2,3)
5
"""
return a+b
# Luego seguir por consola
#
| true |
ca5a9c8ebd88c7940c144b131bbea65957d9b0c2 | Python | samuelchen105/expenses_tracker | /api/outgo_cmd.py | UTF-8 | 1,611 | 2.703125 | 3 | [] | no_license | import logging
from telegram import (
Update,
)
from telegram.ext import(
CallbackContext,
CommandHandler,
)
from api import database
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
logger = logging.getLogger(__name__)
# /outgo command
def... | true |
068aac3c665282e83d4d91907a99baed36ec98ca | Python | Gogo-lao/GuangdongUniversityofFinance-Economics | /airplaneWar/王晓锋/飞机大战.py | UTF-8 | 12,955 | 3.015625 | 3 | [] | no_license | import pygame
import random
import time
# 飞机大战
# 手机上,单手操作
# 长条形
# 鼠标操作模拟触屏操作
pygame.init()
pygame.mixer.init()
# pygame.mixer
class Plane(object):
# 父类飞机
def __init__(self, _screen, _str, _bullet, _bullet_pd, _blood_pd):
self.screen = _screen
self.image = pygame.image.load(_str[0])
... | true |
cb5b0222ad2441b72584a58376d2dc867c12dea8 | Python | iamsjn/CodeKata | /graph/kruskal.py | UTF-8 | 4,074 | 3.46875 | 3 | [] | no_license | from typing import List, Optional
class Edge:
def __init__(self) -> None:
self.node1 = None
self.node2 = None
self.weight = None
class GraphNode:
def __init__(self, value: int) -> None:
self.value: int = value
self.next: int = None
self.cost: Node = None
cla... | true |
bac79435d4d087858061d0c5fc5079b384debf48 | Python | davidmacc/serverless-sushi-train | /functions/orders/record_dish_served/app.py | UTF-8 | 639 | 2.53125 | 3 | [] | no_license | import os
import json
import boto3
dynamodb = boto3.resource('dynamodb')
meals_table = dynamodb.Table(os.environ['MEALS_TABLE'])
def lambda_handler(event, context):
print(event)
return record_items_served(event['Records'])
def record_items_served(item_messages):
for item_message in item_messages:
... | true |
e91c0c995bbbf344cbc774ad1c5cc1ff60d5497d | Python | Jeong-Kyu/A_study | /keras2/keras78_04_cifar10_ResNet101.py | UTF-8 | 1,677 | 2.859375 | 3 | [] | no_license | #실습
# cifar10으로 vgg16만들기
#결과치 비교
import numpy as np
from tensorflow.keras.datasets import cifar10
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
print(x_train.shape)# (50000,32,32,3)
print(x_test.shape) # (50000,1)
from tensorflow.keras.applications import ResNet101
from tensorflow.keras.layers import Den... | true |
5a67fdd612bd5d09f4c14a2c23d5416b54b81c39 | Python | muziceci/Python-learning | /fourth/Joseph.py | UTF-8 | 1,081 | 3.734375 | 4 | [] | no_license | #实现约瑟夫环类
class Joseph(object):
def __init__(self):
self._people = []
self.kill = []
self.step = 0
self.current_num = 0
def set_step(self, step):
self.step = step
def append(self, person):
self._people.append(person)
def get_survive_number(self):
... | true |
7e2849632a36ab2d25f34393048b89889e925866 | Python | 99003758/Python_Mini_Project-1 | /3_Implementation/src/main.py | UTF-8 | 2,746 | 3.140625 | 3 | [] | no_license | # importing necessary modules
# for checking execution time
import time
# for working with excel files
import openpyxl
# for multiple inputs,workbooks
import multinput as inp
# for getting paths of workbooks
import workbook_loading as wl
if __name__ == "__main__":
start_time = time.time()
print("En... | true |
61d0ea77a4776f0bff1cfd08a62010b0fc150b16 | Python | tchapeaux/advent_of_code_2018 | /04_1.py | UTF-8 | 2,739 | 3.078125 | 3 | [] | no_license | import re
from collections import namedtuple
with open('inputs/day4_1.txt') as f:
parsedInput = f.readlines()
parsedInput = [x.strip() for x in parsedInput if len(x.strip()) > 0]
recordRegex = r"^\[(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{02})\] (.*)"
beginShiftRegex = r".*#(\d*).*"
dates = []
# First ... | true |
169165ff8cd296362a5f1ba150976901d27e69a2 | Python | NMGRL/pychron | /pychron/core/geometry/geometry.py | UTF-8 | 11,987 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # ===============================================================================
# Copyright 2012 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | true |
7bf64385e81b6364e5573a608d8437d0be5ae0ec | Python | ariannagavioli/PNG | /Test Material/couple_stat.py | UTF-8 | 633 | 3.15625 | 3 | [] | no_license | file = open("bit_stream.txt",'r')
oneone = 0
zerozero = 0
zeroone = 0
onezero = 0
step = 0
for line in file:
values = line.split(" ")
if(step == 0):
previous = int(values[1])
step = step + 1
continue
if(int(values[1]) == 1):
if(previous == 1):
oneone = oneone + 1
else:
onezero = onezero + 1
i... | true |
8b48cdd3c9f79f29f007870db430af0348b7ec02 | Python | TsukasaShirai/FileEncrypter | /aes.py | UTF-8 | 1,045 | 3.296875 | 3 | [] | no_license |
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
from Crypto import Random
class FileEncrypter:
def encryptFile(self, inputFile, outputFile, password):
with open(inputFile, "rb") as target:
contents = target.read()
data = self.encrypt(contents, password)
with open(outputFile, "wb") as... | true |
ecc6d00d22d8a924ac43fc64a6b9260b266e4d8d | Python | wadda/Bari | /live_bari.py | UTF-8 | 503 | 2.71875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from time import sleep
import ms5637
__author__ = 'Moe'
__copyright__ = 'Copyright 2017 Moe'
__license__ = 'MIT'
__version__ = '0.0.2'
# Bari sensor of MS5637
sensor = ms5637.Chip()
plt.axis([0.0, 600.0, 100000, 102000])
# plt.axis([0.0, 600.0, 15.0, 45.0]) # Temp... | true |
3189c105ca11b6ba7065c3b3c254dfe456aff4d5 | Python | hungnd11111984/DataCamp | /Program/Dictionary.py | UTF-8 | 633 | 3.8125 | 4 | [] | no_license | # Key and value pair
student = {'name': 'John','age':25,'course':['Math','ComSci']}
#student['phone'] = '5555-555'
#student['name'] = 'James'
#print (student['name'])
#print (student['course'][0])
#print(student.get('phone','Not Found')) # Get value in case of not exist.
# student.update({'name':'James','age':26,'pho... | true |
918693e73e567e521f085ffd5dfaff8b885cbe57 | Python | jacekku/PP3 | /Python/02/zadanie38.py | UTF-8 | 142 | 2.78125 | 3 | [] | no_license | from random import randint as r
def print_IP():
print(f'{r(0,255)}.{r(0,255)}.{r(0,255)}.{r(0,255)}')
for _ in range(20):
print_IP() | true |
5bea59357a13dea069ffeebbe853ea2f8b61c5d9 | Python | vicky299/praktikum-10 | /7.py | UTF-8 | 528 | 3.78125 | 4 | [] | no_license | import string
word1 = input('MASUKKAN TEKS : ')
count = 2
word2 = ''
for i in range(len(word1)):
char = word1[i]
if(char.isupper()):
word2 = word2 + chr((ord(char)+ count - 65)%26+65)
else:
word2 = word2 + chr((ord(char)+ count - 97)%26+97)
print("TEKS BARU:", word2)
word3 = ''
for i in r... | true |
29a5278fa118cca916544d90aa069bef4db01c92 | Python | David15117/A-an-lise-emp-rica---Algoritmos-de-ordena-o | /selectionSort/Graficos/GrafoTrocaAleatorio.py | UTF-8 | 462 | 3.578125 | 4 | [] | no_license | import matplotlib.pyplot
# movimentações realizadas
valores = [990,4990,9982,188646,49990,99985]
tempo = [0.041917,1.933661,5.393574,18.694997,120.043913,462.315930]
matplotlib.pyplot.title('Selection-sort - Movimentações realizadas com vetor de valores aleatórios ')
matplotlib.pyplot.xlabel('Movimentações realizada... | true |
fe9c6f7555f2242b72d171252452e1c2d5a051cc | Python | onism7/spider | /YM影视/YM_movie.py | UTF-8 | 5,393 | 2.765625 | 3 | [] | no_license | import requests
import threading
import sys
import time
from bs4 import BeautifulSoup
from urllib import parse
def get_video_content():
"""
得到匹配到的相关电影(或者电视剧)的名称、链接、简介的列表
"""
video = input("请输入你想看的电影或者电视剧名称:")
keyword = parse.urlencode({'k': video})[2:] # 对输入的名称进行编码
url = 'http://ymystv.com/se... | true |
199101dadc57610a03865f0933dc1a689762f179 | Python | thuyle2810/MathSo | /notebooks/scripts/functions.py | UTF-8 | 1,386 | 3.609375 | 4 | [
"MIT"
] | permissive | import math
import numpy as np
def interest1(b, p, n):
"""
INTEREST1(b, p, n) computes the new balance after n years for an initial
balance b and an annual interest rate p in per cent
"""
return b*(1 + p/100)**n
def gauss3(x, mu, sigma):
"""
GAUSS3 Evaluates Gaussian normal distribution wit... | true |
6074e3c1841c255aff779696347ed37423a0c0b5 | Python | hdengg/machine_learning | /a2/code/random_forest.py | UTF-8 | 737 | 2.90625 | 3 | [] | no_license |
import numpy as np
from random_tree import RandomTree
from scipy import stats
class RandomForest:
def __init__(self, max_depth, num_trees):
self.max_depth = max_depth
self.num_trees = num_trees
self.stats = []
def fit(self, X, y):
self.X = X
self.y = y
... | true |
58d4493e7e22bcb204db090dab949941174ac49f | Python | mr-yoon/Python_Basics | /while循环语句/Demo04.py | UTF-8 | 1,456 | 4.65625 | 5 | [] | no_license | """
学习目标:
While语法(***)
循环通常有for循环和while循环
While循环语法
while 条件:
条件成立重复执行的代码1
条件成立重复执行的代码2
......
"""
# 简单的循环语句实现方式
num = 1
while 5 >= num:
print("我错了")
num += 1
print("原谅你了")
# 计算1-100累加法
num = 1
sum = 0
while num <= 100:
sum += num
num += 1
print(sum)
# 计算1-10... | true |
83c16bf1152d1a3542837ebbf8a005707c6fabc2 | Python | hammond756/hashcode2018 | /Scenario.py | UTF-8 | 438 | 3.328125 | 3 | [] | no_license |
class Scenario:
def __init__ (self, line):
things = line.split()
self.rows = int(things[0])
self.cols = int(things[1])
self.cars = int(things[2])
self.rides = int(things[3])
self.bonus = int(things[4])
self.steps = int(things[5])
def __str__ (self):
return "Scenario: field({},{}) with {} cars and {}... | true |
b56aa47f50a3e59f9eed4b670cbb75e293f929b7 | Python | jidongyang1996/python_stu | /web自动化.py | UTF-8 | 4,816 | 3.046875 | 3 | [] | no_license | #!/user/bin/python
# -*- coding:utf-8 -*-
# from selenium import webdriver
# from time import sleep
#
# 定义使用什么浏览器
# dr = webdriver.Firefox()
# 打开网址
# dr.get('https://www.ctrip.com/?sid=155952&allianceid=4897&ouid=index')
# sleep(2)
# # #获取网址的标题
# # print(dr.title)
# # #获取打开网页的网址
# # print(dr.current_url)
# dr.get('http... | true |
a5437a9f035b3e1f50a587f592ec01c24c35497c | Python | turquetti/learningPython | /Curso_em_Video/Mundo 2/desafio049.py | UTF-8 | 172 | 3.96875 | 4 | [] | no_license | #Refaça o desaio 9 mostrando a tabuada de um numero com o loop
n = int(input('Digite um número: '))
for c in range(1,11):
print('{} x {} = {}'.format(n, c, n*c))
| true |
a432af2ccde651f59ac6851ac6327cec84076db8 | Python | qzhou0/SoftDevWS | /17_db-nmcrnch/bad/db_builder.py | UTF-8 | 1,416 | 2.546875 | 3 | [] | no_license | # Maggie Zhao & Qian Zhou
# SoftDev1 pd7
# K16-- No Trouble
# 2018-10-04
import sqlite3 #enable control of an sqlite database
import csv #facilitates CSV I/O
#==========================================================
DB_FILE="discobandit.db"
db = sqlite3.connect(DB_FILE) #open if file exists, otherwise cre... | true |
925a0904096b09c1d9e509c2f515407712ef96de | Python | spelteam/spel | /src/python/plotFrameErrors.py | UTF-8 | 2,256 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python2.7
import glob
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import argparse
import numpy as np
import matplotlib.image as mpimg
from matplotlib.lines import Line2D
from pylab import figure, show
import math
import os
import re
def usage():
print("Author: Mykyta Fast... | true |
b98e4f0561cba1c78740457d096d3899b04bf929 | Python | xonic789/python_algorithm | /programmers/number_k.py | UTF-8 | 260 | 3.109375 | 3 | [] | no_license | def solution(array, commands):
answer = []
for command in commands:
s = array[command[0]-1:command[1]]
s = sorted(s)
answer.append(s)
return answer
solution([1, 5, 2, 6, 3, 7, 4],[[2, 5, 3], [4, 4, 1], [1, 7, 3]]) | true |
dd56692ed2f1bd445524677821b428570aa34ee1 | Python | junly917/Learn-Python | /zkyg_TM/Server/Server_core/main.py | UTF-8 | 1,783 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
#encoding:utf-8
import os,sys,socket
#运行软件时输出的内容
class run_display(object):
info = '''
--------Welcome to Transfer Machine --------
Auth:Junly
'''
print info
while True:
send_data = raw_input('==>: ').strip()
if len(send_data) =... | true |
05f4b71a71a009d9ceefc226f8e1333f936e1b9b | Python | opizarro/visnavml | /match_labels_sentry.py | UTF-8 | 2,800 | 3.0625 | 3 | [] | no_license | #! /usr/bin/env python
# Helper script for matching cluster labels to a renav solution.
#
# Author: Daniel Steinberg
# Australian Centre for Field Robotics
# Date: 25/07/2013
import sys, csv, argparse
import renavutils as rutil
def main():
""" Helper function for matching cluster labels to a r... | true |
5099a09f1cf35ef193ca627000111880203aa80f | Python | noah7597/Google-Maps-Web-Scraping | /GoogleMapsWebScraping.py | UTF-8 | 3,966 | 2.5625 | 3 | [] | no_license | from bs4 import BeautifulSoup
from selenium import webdriver
import time
import csv
def get_url(search_term):
template = 'https://www.google.com/maps/search/{}/data=!3m1!4b1'
search_term = search_term.replace(' ', "+")
return template.format(search_term)
def extract_data(item):
#atag = item.div.a
... | true |
a452b24aa5ce4ba1a85defad5f15b70d9f34f32b | Python | github-hrithik/stringl1-py | /Q22level1.py | UTF-8 | 347 | 3.5625 | 4 | [] | no_license | #WAP to accept a sentence and display the words having double sequences.(eq- I Like Rabbit----rabbit)
lst=input("Enter Sentence-").strip().split()
last= ""
lst1=[]
for i in lst:
for char in i:
if char == last:
lst1.append(i)
last=char
continue
else:
... | true |
247ea52150e729162d271199ac9d58e150945702 | Python | jesservillines/Wildfire_Classifier | /1.1_streamlit_firemap.py | UTF-8 | 5,366 | 2.8125 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
from scipy.stats import linregress
import sqlite3
from urllib.request import urlopen
import json
import plotly.express as px
import plotly.graph_objects as go
from mpl_toolkits.basemap i... | true |
58859f70962a78e0dfa200d1b791cd41b28c509c | Python | daniyaltariq/clipboard | /clipboard.py | UTF-8 | 2,577 | 2.71875 | 3 | [] | no_license | import sys
from PyQt5 import Qt, QtCore
from PyQt5.QtWidgets import QMessageBox, QHeaderView, QMainWindow, QApplication, QWidget, QAction, QTableWidget, QTableWidgetItem, QVBoxLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
class App(QWidget):
def __init__(self, app):
super().__init__()
s... | true |
3eca94f426a05251f88172294c0ab6f0e8ff2b7d | Python | TingliangZhang/VR_Robot | /Python/Pythonpa/ch03/for_fibonacci.py | UTF-8 | 227 | 3.109375 | 3 | [] | no_license | f1 = 1; f2 = 1
for i in range(1, 11):
print(str.format("{0:6}{1:6}", f1, f2), end=" ") #输出2个数,每个占6位
if i % 2 == 0: print() #每行输出2次,即2*2=4个数
f1 += f2; f2 += f1
input()
| true |
018327a3fca07e7de875003191b569d708b1fb0c | Python | CinthiaS/long_text_summarization | /src/evaluate.py | UTF-8 | 3,452 | 2.5625 | 3 | [] | no_license | import os
from xml.etree import ElementTree
from xml.dom import minidom
from xml.etree.ElementTree import Element, SubElement, Comment
import numpy as np
from sumeval.metrics.rouge import RougeCalculator
from nltk.translate.bleu_score import sentence_bleu
from nltk.translate.bleu_score import SmoothingFunction
smooth... | true |
c5104ef280d2cdba2f19b09866e0932442fca389 | Python | 00mjk/vispy-experiments | /vispy/app/tests/test_app.py | UTF-8 | 8,395 | 2.609375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_equal, assert_true, assert_raises
from vispy.app import (Application, Canvas, Timer, ApplicationBackend,
MouseEvent, KeyEvent)
from vispy.app.backends import (requires_pyglet, requires_qt, requires_glfw... | true |
281ae528c0fa3a054565ad8710c6cd45b01df656 | Python | zhoulittletail/test_note | /page/page.py | UTF-8 | 414 | 2.671875 | 3 | [] | no_license | from page.display_page import DisPlayPage
from page.network_page import NetWorkPage
class Page():
def __init__(self,driver):
self.driver = driver
@property # 可以把一个函数当作属性来使用(调用的时候直接.就可以不需要加括号)
def display(self):
return DisPlayPage(self.driver)
@property
def network(self):
r... | true |
24c7cee66583dc86fd1053c83fb35c3e0e563ee5 | Python | 703hardik/python-4-everybody | /ass1.py | UTF-8 | 296 | 3.390625 | 3 | [] | no_license | import re
file=open(input("enter a file name:"))
# ex=re.compile('[0-9]+')
sum=0
count=0
for line in file:
f=re.findall('[0-9]+',line)
for num in f:
if int(num)>=0:
count+=1
sum+=int(num)
print("there are ",count,"values with a sum =",sum)
| true |
dd340d88ecd37e3d7914d1189efb0935a65fd13a | Python | stnguyenn/learnpy | /3_2_string.py | UTF-8 | 2,661 | 3.96875 | 4 | [
"MIT"
] | permissive |
'spam eggs' # single quotes
'spam eggs'
'doesn\'t' # use \' to escape the single quote...
"doesn't"
"doesn't" # ...or use double quotes instead
"doesn't"
'"Yes," they said.'
'"Yes," they said.'
"\"Yes,\" they said."
'"Yes," they said.'
'"Isn\'t," they said.'
'"Isn\'t," they said.'
'"Isn\'t," they said.'
'"Isn\'t,... | true |
e9ea76b87142d58964a6fb6be73f4491d40bcffb | Python | ziyuan-shen/leetcode_algorithm_python_solution | /easy/ex70.py | UTF-8 | 408 | 3.0625 | 3 | [] | no_license | class Solution:
def climbStairs(self, n: int) -> int:
if n == 1:
return 1
if n == 2:
return 2
else:
prev2_step = 1
prev_step = 2
for i in range(3, n + 1):
current_step = prev2_step + prev_step
prev2_s... | true |
4062d03d8064fa80268b3b9126e37ba843e9117c | Python | 0xKirito/cryptohack | /encoding_challenge.py | UTF-8 | 1,187 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
from pwn import *
import pwnlib, pwnlib.util # for fiddling module
from Crypto.Util.number import long_to_bytes
import json
import codecs
from pwnlib.util import fiddling
r = remote("socket.cryptohack.org", 13377)
def json_recv():
line = r.recvline()
return json.loads(line.decode())... | true |
1014a8778e250df16acf8f44e6c2e2c90dcbca27 | Python | yawor/heatshrinkpy | /heatshrinkpy/core/__init__.py | UTF-8 | 2,693 | 2.75 | 3 | [
"ISC"
] | permissive | import array
from .consts import *
from .decoder import Reader
from .encoder import Writer
__all__ = ["Writer", "Reader", "Encoder", "encode", "decode"]
class Encoder:
"""High level interface to the Heatshrink encoders/decoders."""
def __init__(self, encoder):
self._encoder = encoder
self._... | true |
d770e86d5a4512cfcf64c65185959e674aba66ed | Python | henrylin2015/scrapy | /js_images/js_images/spiders/js_image.py | UTF-8 | 652 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from selenium import webdriver
import time
class JsImageSpider(scrapy.Spider):
name = "js-image"
allowed_domains = ["douban.com"]
start_urls = [
'https://movie.douban.com/',
]
def parse(self, response):
print("ddddd:", response.xpath("//title/... | true |
579076348ac7ec343f46a37f7610845ca4752dd4 | Python | jpicasso/LessonSummary3 | /4Python/8IntroToFlask/2FirstApp/app.py | UTF-8 | 3,011 | 3.609375 | 4 | [] | no_license | #jsonify is used to convert strings to JSON and back and forth
# render_template is used in flask to pull up html files in your templates folder
# request ; note that this is different from requests
# Flask is a class in the flask library. It is used to let your python code talk to your html and js code
from flask impo... | true |
3f47d8f23fd15f3bb863f5842a2ca711736335b6 | Python | llyq/SimpleApiTest | /samples/conftest.py | UTF-8 | 580 | 2.65625 | 3 | [
"MIT"
] | permissive | import pytest
from core.data_reader import JsonTemplateReader
@pytest.fixture(scope="function")
def json_template(request):
"""
this fixture is to use the json template reader to read the template and render it.
the kwargs
:param request: it is the pytest fixture request, contains the test name we nee... | true |
ecd72f589dd07dce7546e124ef916507d6ec446f | Python | yukato7/vectrizing_tweet_system | /word2vec-ave.py | UTF-8 | 1,132 | 2.59375 | 3 | [] | no_license | # coding: utf-8
import MeCab
import numpy as np
import glob
from gensim.models.word2vec import Word2Vec
from utils.cos_sim import cos_sim
# load model
model_path = 'model/wiki.model'
model = Word2Vec.load(model_path)
mecab = MeCab.Tagger('-d /usr/local/lib/mecab/dic/mecab-ipadic-neologd')
test_folder = glob.glob('te... | true |
c79c325917a174c3e8d4d6d01305eeb4a51b3243 | Python | RajaAyyanar/Practice_Codes | /Pattern_Recognition/PartB_final.py | UTF-8 | 2,362 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 1 23:33:46 2018
@author: raja
"""
import numpy as np
import read_dir
import calc_HOG
X_train,X_test,y_train,y_test = read_dir.tex_data()
#CREATING Blocks of datasets for Training
max_X_train=[]
max_y_train=[]
for k in range(0,len(X_train)):
p... | true |
c483eddd5e5de7730274791cffb11490ca6afd5e | Python | anhpt1997/variational-continual-learning | /variational-continual-learning-master/ddm/test_neural_mxtrix_factorize.py | UTF-8 | 1,551 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
import numpy as np
s = tf.Session()
M , N, K = 1000, 1000 ,3
U = tf.Variable(tf.random.normal(shape = [M,K]))
V= tf.Variable(tf.random.normal(shape = [N,K]))
w1= tf.Variable(tf.random.normal(shape=[2*K , K]))
b1 = tf.Variable(tf.random.normal(shape =[K]))
w2 = tf.Variable(tf.random.... | true |
8577ebfcd5e938b85deb9c8b51f0132a4b6a48f3 | Python | daesy13/Practicing-Python-HackerRank | /intro.py | UTF-8 | 95 | 3.296875 | 3 | [] | no_license | greeting = "Hello"
name = "Michael"
message = f"{greeting}, {name}. Welcome!"
print(message)
| true |
a231c8179a7ab83a0d2aa97fdf69bcc80eef3f4d | Python | buddseye/tourist-spot | /main.py | UTF-8 | 3,756 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from itertools import chain
from functools import reduce, partial
import urllib.parse
import urllib.request
import json
from copy import deepcopy
import csv
import sys
HOST_NAME = 'www.chiikinogennki.soumu.go.jp'
VERSION_NAME = 'v001'
FILE_EXT_NAME = 'json'
THIRD_CATEGORY_LIST = [
'温泉'
]
... | true |
8a4b97648733a74b5e6485d526dd68e7f7a30e11 | Python | muskanmi/Data-Structures-Python | /decreasing_frequency_wise_sorting.py | UTF-8 | 392 | 3.296875 | 3 | [] | no_license | from collections import Counter
a = list(map(int, input("Enter an array: ").split()))
# counts = Counter(a)
# n = sorted(a, key=lambda x: -counts[x])
# n = sorted(a, key=counts.get, reverse=True)
# n = sorted(a, key= lambda x:(counts[x], x), reverse=True)
d = {}
for i in a:
if i in d:
d[i] += 1
else:... | true |
f873af459f1563d5d51dc860b52930b18b551570 | Python | koshihkari/discordpy-startup | /cog/search.py | UTF-8 | 2,744 | 2.984375 | 3 | [
"MIT"
] | permissive | import urllib.parse
import discord
from discord.ext import commands
import wikipedia
import requests
class SearchCog(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.command()
async def wiki(self,ctx,*,search_word):
"""
指定単語をWikipediaで検索します。
... | true |
13034fc0a46ad1f6d13c23595db66132c5344dba | Python | charlesfoster/useful_scripts | /best_concatenate.py | UTF-8 | 673 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python2.7
# Usage: ./best_concatenate.py concatenated_filename.nex
# This script will concatenate all nexus files within your directory
# All nexus files must end with '.nex'
# If taxa are missing any genes, the gene sequence will be filled with '?'
# Requires biopython (and its dependencies)
from os im... | true |
4d43571e353a5ef1434e347fb1d9b1a776ef4b12 | Python | sdliaidong/deeptest | /第一期/无锡-慕兮/Task3/day_7/yaml_parse.py | UTF-8 | 909 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding:utf-8 -*-
__author__ = 'Lakisha'
import yaml
import codecs
if __name__ == "__main__":
print("python yaml基础示例")
# document = '''
# 公众号: 开源优测
# 基本信息:
# 创建人: 苦叶子
# id: DeepTest
# '''
# load = yaml.load(document)
# print(type(load))
# print(load)
#
# p... | true |
54087553d710b49b21e2712a4e26846c8b0ee573 | Python | idhant/DistributedTaskAllocation | /Thesis/Latex Files/Task_Class_Display.py | UTF-8 | 1,778 | 2.765625 | 3 | [] | no_license | from datetime import datetime
import time
class Task:
'''Base class to represent the task object type in the experiment.'''
def __init__(self, taskID, taskQuality, taskLocation, taskType):
self.taskID = taskID
self.taskQuality = taskQuality
self.taskLocation = taskLocation
... | true |
7cdcee04351634880f2028b6bef907ad0ba17fe0 | Python | grashidi/aml_project | /code/util/covid_dataset.py | UTF-8 | 7,029 | 2.78125 | 3 | [] | no_license | from torch.utils.data import Dataset
import torchvision.transforms as transforms
import os
import torch
from PIL import Image, ImageEnhance
import glob
from numpy import random
import torchvision.transforms.functional as TF
from tqdm import tqdm
def read_txt(txt_path):
with open(txt_path) as f:
lines = f.... | true |
39d4415730c32190d55bfe3579d1d9ec426e8a9d | Python | 999Hans/SWE-Academy | /2. 자료구조/19. 사전순 전달.py | UTF-8 | 358 | 3.796875 | 4 | [] | no_license | # 단어를 콤마(,)로 구분해 입력하면 그 단어들을 사전순으로 정렬해 출력하는 프로그램을 작성하시시오.
# python, hello, world, hi
lista = list(input().split(', '))
listb = sorted(lista)
for i in listb:
if i == listb[-1]:
print(i)
else:
print("{0}, ".format(i), end="") | true |
e2d8ff3fd88e276fdb515a861209dee0ed0e6244 | Python | robert1794/advent_of_code2020 | /day_06_Custom_Customs/day_06_Custom_Customs_part1.py | UTF-8 | 945 | 4.0625 | 4 | [] | no_license |
# Remove any duplicate characters in a string
# e.g. "abbbc" -> "abc"
def filter_unique_characters(in_string):
out_string = ""
for char in in_string:
if char not in out_string:
out_string += char
return out_string
# The main loop in its natural habitat
def main():
file_entri... | true |
dd83ac59e9adf021ad82fec979cb79fe3ad16eb7 | Python | vandorAdam/music-generator | /triangles.py | UTF-8 | 3,138 | 2.84375 | 3 | [] | no_license | from constants import *
from utils import melody_to_sheet, random_choice, get_num_notes, equalize
from rhythm import generate_length_sequence, get_shift
def get_next_diminished_note(previous_note, max_step_interval):
if previous_note == None:
previous_note = 0
next_note = random_choice(CONST.diminishe... | true |
9849d502c32ed465ed28a1736e266ab7b77d1e77 | Python | beth2005-cmis/beth2005-cmis-cs2 | /cs2quiz2.py | UTF-8 | 1,982 | 4.75 | 5 | [
"CC0-1.0"
] | permissive | #PART 1: Terminology
#1) Give 3 examples of boolean expressions.
#a) not 1=1
#b) 1<2 or 4>5
#c) 2=2 and 2<1
#3
#2) What does 'return' do?
# In computer programming, the 'return' executes the input of the function.
#1
#3) What are 2 ways indentation is important in python code?
#a) tells you where the function end
#... | true |
d5b6241e7c90d822eb5d2d9c5f3d90e50985ac9c | Python | krisjin/dodo | /src/lr_im.py | UTF-8 | 777 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import imread
# 生成数据,以0.1为单位,生成0到6的数据
x = np.arange(0, 19, 1)
y1 = np.sin(x) # sin函数
print(x)
y2 = np.cos(x)
# 绘制图形
plt.plot(x, [0.394894,0.409681,0.401056,0.405406,0.398342,0.405719,0.415794,0.400387,0.396646,0.401527,0.403123,0.431539,0.401... | true |
325a229bb13942473418d59142bdb66d80fabf4d | Python | arkanalexei/kattis-solutions | /thelastproblem.py | UTF-8 | 68 | 3.078125 | 3 | [
"MIT"
] | permissive | name = str(input())
print("Thank you, " + name + ", and farewell!") | true |
7d570f2c57cb61efe391b3c68d8eb689a523c2ab | Python | winlp4ever/algos | /coinchange2.py | UTF-8 | 338 | 2.765625 | 3 | [] | no_license | from typing import List
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
dp = [0 for i in range(0, amount+1)]
dp[0] = 1
for coin in coins:
for a in range(1, amount+1):
if coin <= a:
dp[a] += dp[a - coin]
... | true |
44528ff2a56bb6982795231386900f343823e759 | Python | debug8421/spider | /slave.py | GB18030 | 2,517 | 2.6875 | 3 | [] | no_license | #!usr/bin/python
#coding=gbk
# URLù˹ץȡURL
# URLϹϴURL
# ֪վ ҳеURLӣҪӻֶ---a. äЧʽϵͣͨǿb.ȡԹijģʽַ
# ӻֶΣȡhtmlݴ洢ݿ
# xpathʽ洢ݿ
#
from socket import *
import struct
import ZHIHUSpider as zhihu
import json
spider = zhihu.ZHIHUSpider()
#masterȡurl =>request
def request_from_master():
request_json = js... | true |
8bf640559d7995736c6e20b6267f071fe7910fd3 | Python | leriou/galadriel | /middleware/py_pulsar_test.py | UTF-8 | 433 | 2.546875 | 3 | [] | no_license | import pulsar
client = pulsar.Client('pulsar://localhost:6650')
producer = client.create_producer('test-pulsar')
consumer = client.subscribe('test-pulsar', subscription_name='test-pulsar-sub')
for i in range(1000):
producer.send(('hello-pulsar-%d' % i).encode('utf-8'))
n = 0
while n < 999:
msg = consumer.re... | true |
37e31368c283c9d0c66143aa4e135ef9b2d7ae0e | Python | LilianBour/Projet_TER | /Kmeans_LogisticRegression/Kmeans.py | UTF-8 | 3,214 | 3.015625 | 3 | [] | no_license | import pandas as pd
import random
import math
import matplotlib.pyplot as plt
import statistics
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
data=pd.read_excel('C:/Users/lilia/github/Projet_ter/data_0_1.xlsx',error_bad_lines=False)
#Descriptive... | true |
67bfedf615186daab526fb49583e53056d4cd18a | Python | Shubham-Pujan/Python-Practice | /ML_assign2.py | UTF-8 | 939 | 3.90625 | 4 | [] | no_license | # program to shift the letters of word "
alpha = {'1' :'a', '2' :'b', '3' :'c', '4' :'d', '5' :'e', '6' :'f', '7' :'g', '8' :'h', '9' :'i','10' :'j', '11' :'k', '12' :'l', '13' :'m', '14' :'n', '15' :'o', '16' :'p', '17':'q', '18' :'r', '19' :'s', '20' :'t', '21' :'u', '22' :'v', '23':'w', '24' :'x','25' :'y', '26' :... | true |
700d8b44d04e4aed1471b1c55889814da9eccb3d | Python | stevej2608/dash-spa | /dash_spa/plugins/dash_logging.py | UTF-8 | 5,820 | 2.90625 | 3 | [
"MIT"
] | permissive | import sys
from flask import request
import re
import json
from enum import IntEnum
def printf(format, *args):
sys.stdout.write(format % args)
from ..utils.time import time_ms
class DEBUG_LEVEL(IntEnum):
NONE = 0
REQUESTS = 1
VERBOSE = 2
class DashLogger:
"""Adds request/response logging to Das... | true |
e782b3e3f34c8b42438b7a341f40179a9aec046d | Python | wlj2100/EECS349_MachineLearning | /eecs349-fall16-hw1/note.py | UTF-8 | 3,480 | 3.546875 | 4 | [] | no_license | def create_decision_tree(data, attributes, target_attr, fitness_func):
"""
Returns a new decision tree based on the examples given.
"""
data = data[:]
vals = [record[target_attr] for record in data]
default = majority_value(data, target_attr)
# If the dataset is empty or the a... | true |
4663d769b1a12a981de13fe958e9f40e5ebc0f3b | Python | yumesaka/CheckiO_jungwoo | /Scientific Expedition/10.Double Substring.py | UTF-8 | 675 | 3.8125 | 4 | [] | no_license | def double_substring(line):
sameword_list = []
for i in range(len(line)-1):
for j in range(i, len(line)):
if line[i:j] in line[j:]:
sameword_list.append(line[i:j])
if len(sameword_list) >0 :
print(max(sameword_list, key=len))
return len(max(sameword_list,... | true |
bb59d1d4934b72bcce9d613959e1f17be93ce4da | Python | JhonesBR/python-exercises | /1 - Basic Exercise for Beginners/ex07.py | UTF-8 | 227 | 4.03125 | 4 | [] | no_license | # Return the count of sub-string “Emma” appears in the given string
# Solution: https://github.com/JhonesBR
def countEmma(s):
count = s.count("Emma")
print(f"Emma appeared {count} times")
s = input()
countEmma(s) | true |
938b6c050718d7862355e6d8d03feeca025da173 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/CJ/16_0_1_alleHella_solution.py | UTF-8 | 603 | 3.296875 | 3 | [] | no_license | def Appeared(listA):
for i in listA:
if i == 10:
return True
return False
T = input()
for i in range (int(T)):
N = input()
N = int(N)
if(i!=0):
print()
checkV = [10,10,10,10,10,10,10,10,10,10]
if N!=0:
x = 0
while(Appeared(checkV)):
... | true |
69525644e6116e3d075a599482e6a2d7515aaf2f | Python | cjw531/data_structure_python | /deque.py | UTF-8 | 3,217 | 4.15625 | 4 | [] | no_license | from doubly_linked_list import *
class Deque:
def __init__ (self):
self.deque = DoublyLinkedList()
self.size = 0
def add_first (self, element):
e = Node(element, None, None)
self.deque.insert(0, e)
self.size += 1
def add_last (self, element):
e = No... | true |
98d1f01500ee4038a2acba3d39b3e820b0af7f21 | Python | bjday655/CS110H | /901815697-Q1.py | UTF-8 | 1,651 | 4.65625 | 5 | [] | no_license | '''
Benjamin Day
9/18/2017
Quiz 1
'''
'''
Q1
'''
#input 3 values and assign them to 'A','B', and 'C'
A=float(input('First Number: '))
B=float(input('Second Number: '))
C=float(input('Third Number: '))
#check if the numbers are in increasing order and if so print 'the numbers are in increasing order'
if A<B<C:
pr... | true |
f1ae928e474f60dffcb9829da578d1274c51330e | Python | DianaLuca/Algorithms | /LeetcodePython/MaxConsecutiveOnes485.py | UTF-8 | 686 | 3.703125 | 4 | [] | no_license | # Given a binary array, find the maximum number of consecutive 1s in this array.
# Input: [1,1,0,1,1,1]
# Output: 3
class Solution(object):
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
i = 0
maxones, nrone =... | true |
c1dbae965d3900f8ed3d904ca81d680cb34ab9ee | Python | mholtmanns/VGAPlanets | /api/academy/analyse_csv.py | UTF-8 | 3,928 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 Markus Hoff-Holtmanns
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | true |
16e02216c2e7320a34e1e29570ebcb9d7c853bbf | Python | BXBaskershu/mini_tale | /utils/time_util.py | UTF-8 | 291 | 3.078125 | 3 | [] | no_license | import time
from datetime import datetime
def get_current_timestamp():
current_timestamp = int(time.time())
return current_timestamp
def timestamp_to_datetime(timestamp):
""" 将时间戳转化成datetime时间类型的数据 """
return datetime.fromtimestamp(timestamp)
| true |
c738b95b95b5ca8bafa10f0a80fd9e0f3fec03e9 | Python | lukezhang2000/Via-Diet | /Via-Diet/testapp.py | UTF-8 | 6,605 | 2.734375 | 3 | [] | no_license | from flask import Flask, render_template, request, json, g, session
import re
import sqlite3
app = Flask(__name__)
app.secret_key = "super secret key"
def get_db():
"""
Establish connection to database and store results in sqlite3.Row
since these are iterable and an easier data structure to use
"""
... | true |
c483d972ab4997802f2f74b8eda9ed5fab808321 | Python | zibrankhan/python | /practice.py | UTF-8 | 653 | 4.21875 | 4 | [] | no_license | #x = input("Enter first number: ")
#y = input("Enter second number: ")
#z = input("Enter third number: ")
#print(max(x,y,z))
lists = [1,2,[3,4],5,6,7,8,9]
print(lists[4:8])
l1 = ["a","b","c","d","e"]
print (l1[2:3])
lists[2][1]=10
print (lists)
num = int(input("enter the number? "))
if num%2 == 0:
... | true |
737a2b108631315265ea659bc1840adf9a6dcac0 | Python | binchen15/leet-python | /arrays/prob1337.py | UTF-8 | 1,700 | 3.390625 | 3 | [] | no_license | # 1337 The K weakest rows in a matrix
class Solution(object):
def heightChecker(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
hc = {}
for h in heights:
hc[h] = hc.get(h, 0) + 1
hp = sorted(hc.items(), key=lambda x: x[0])
... | true |
3a80376211c8ea7b5ec7564965b5bc45be391d55 | Python | maoweixy/AI | /43RS/cug_server/TensorFlow/test.py | UTF-8 | 912 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime
import os
import tensorflow as tf
from tensorflow import keras
class Linear(keras.layers.Layer):
def __init__(self, units=32):
super(Linear, self).__init__()
self.units = units
def build(self, input_shape):... | true |
d614f0fe09cf41b03c33e6fc944a15587d17e783 | Python | Ponkiruthika112/Guvi | /lcm2.py | UTF-8 | 260 | 3.34375 | 3 | [] | no_license | n1=int(input("Enter the 1st number:"))
n2=int(input("Enter the 2nd number:"))
a=[]
b=[]
c=[]
for x in range(1,n1):
if n1%x==0:
a.append(x)
for x in range(1,n2):
if n2%x==0:
b.append(x)
for x in a:
if x in b:
c.append(x)
lcm=(n1*n2)//max(c)
print(lcm)
| true |
3f008691350bfa33c81b9fade8f04ea45c6a06f5 | Python | ewanhowell5195/ewanhowell5195.github.io | /programs/ctmSplitter.py | UTF-8 | 958 | 2.90625 | 3 | [] | no_license | from tkinter.filedialog import askopenfilename
from os import getenv, path
from tkinter import Tk
from PIL import Image
def check(n):
if (n == 0):
return False
while (n != 1):
if (n % 2 != 0):
return False
n = n // 2
return True
passed = False
while not passed:
tr... | true |
d65f7acc74e29193f5f4862a465f5df86b1771fd | Python | PythonCHB/Sp2018-Accelerated | /students/jayjohnson/lesson02/notes.py | UTF-8 | 2,121 | 3.78125 | 4 | [] | no_license | '''
Jay Johnson lesson 02 notes
'''
# functions make programs
def addOne(x):
result = x + 1
return result
# key word arguments or qwards
# positional arguments
# you can leave off the return statement
# you can return multiple values
#def add():
# return 1, 2, "blah"
# will return it as a tuple
# local var... | true |
893bf43f78645ec813aeeac493fc8d84db6d0a71 | Python | dev-ycy/python_practices | /practice01/03.py | UTF-8 | 145 | 3.5625 | 4 | [] | no_license | # 다음과 같은 출력이 되도록 이중 for~in 문을 사용한 코드를 작성하세요.
for i in range(11):
print('*'*i,''*(11-i))
| true |
a1f6846fb1310f85ae006bafe4033afcaa621d50 | Python | Mivinguy/EyesTech | /doubleBuff.py | UTF-8 | 1,850 | 3.578125 | 4 | [] | no_license | import numpy as np
class doubleBuffer(object):
def __init__(self, size):
# Initialization of double buffer
self.writeIndex = 0
self.readIndex = 0
self.size = size
self._data = []
def insert(self, value):
# Add frame to double buffer
if len(se... | true |
1ac33c95811270d155cb1c00281aa76291ec9808 | Python | Sefaria/Sefaria-Data | /sources/Noah-Santacruz-rashiPosting/commentaryPoster.py | UTF-8 | 40,311 | 2.90625 | 3 | [] | no_license | #By Noah Santacruz 2014
#github username: nsantacruz
import urllib.request
from urllib.parse import urlencode
from urllib.error import HTTPError,URLError
from bs4 import BeautifulSoup
from collections import OrderedDict
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
import os
import json
import re
import l... | true |
59af611a35546c5155aa8824a33e4cbd9f892bb5 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2489/59018/265518.py | UTF-8 | 494 | 2.984375 | 3 | [] | no_license | def between(a,lower,upper):
c=a
if len(a)==2:
c.append(sum(a))
else:
for i in range(len(a)-1):
for j in range(i,len(a)-1):
c.append(sum(a[i:j+1]))
c.append(sum(a[i:]))
count=0
for k in c:
if lower... | true |
a47c1fb45e45e7ad4e90ea1a3c2628b216cad367 | Python | cburge3/DeltaV_Tools | /utilities.py | UTF-8 | 760 | 3.1875 | 3 | [] | no_license | def populatenamedset(named_set_root):
d = dict()
entries = named_set_root.findall('.//entry')
for e in entries:
d[int(e.attrib['value'])] = e.attrib['name']
return d
def format_number(num_digits, number):
str_digit = ''
for d in range(0, num_digits):
if number < 10**d:
... | true |
0ac573f4a1cbde66270ad5e32437477eb453975d | Python | yasir-satti/exercises | /python/http-requests-task/app1/application/routes.py | UTF-8 | 694 | 2.65625 | 3 | [] | no_license | # import render_template function from the flask module
from flask import render_template
# import the app object from the ./application/__init__.py
from application import app
# import APIs requests
import requests
# define routes for / & /home, this function will be called when these are accessed
@app.route('/', m... | true |