blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
74e1299da442e8d0bbb5f0ae96cb5af513be3d4e | Python | cgerardo/U3 | /patrones/composite.py | UTF-8 | 701 | 3.296875 | 3 | [] | no_license | from abc import ABC, abstractmethod
class Tareas(ABC):
@abstractmethod
def realizar(self):
pass
class Usuario(Tareas):
print('Preparado para realizar tarea')
class ListaTareas(Tareas):
def __init__(self):
self._tarea = set()
def realizacion(self):
for tar in self._... | true |
335c812d6e2434f1452adf3e84a1693689fe5d59 | Python | vikasontech/python-automation | /gist-utils/gist_format_converter.py | UTF-8 | 2,408 | 2.828125 | 3 | [
"MIT"
] | permissive | import pyperclip
def gist_function():
# sample url
#https://gist.github.com/vikasontech/6246993ca66c85b8f0773ce7351b38a2#file-getuserresources-sh
inp = pyperclip.paste()
print("==============================================")
print("your copied value is as below ")
print(inp)
print("===... | true |
956d1134cf73faeb36539b4040ecbdeeb4fdb670 | Python | clburks9/ProjectEuler | /problems/Euler4.py | UTF-8 | 215 | 2.90625 | 3 | [] | no_license | from EulerHelpers import *
ans = 0;
for i in xrange(999,900,-1):
for j in xrange(999,900,-1):
if(isPalli(i*j)):
ans = i*j;
print(i,j);
break;
if(ans!=0):
break;
print("Answer: {}".format(ans)); | true |
016725d935c53a8842ff4131a182a7c2025e7d13 | Python | L0ganhowlett/Python_workbook-Ben_Stephenson | /66 Compute a Grade Point Average.py | UTF-8 | 312 | 4.03125 | 4 | [
"MIT"
] | permissive | #66: Compute a Grade Point Average
a={'A+':4.0,'A':4.0,'A-':3.7,'B+':3.3,'B':3.0,'B-':2.7,'C+':2.3,'C':2.0,'C-':1.7,'D+':1.3,'D':1.0,'F':0}
add=lambda x,y:x+y
c=0
d=0
while True:
b=input("Enter the grade:")
if b=="":
break
c=add(c,a[b])
d+=1
print("Average grade point:",c/d)
| true |
b62188fd2411f0de7b3dcaeeff5214831c83d080 | Python | mattkoler/istanbul | /source/gen_boardv2.py | UTF-8 | 6,194 | 3.53125 | 4 | [] | no_license | import random
import tile as t
def generate_board(num_players, order):
"""Generates a board based on the order specified
Default - Ascending order
Shortest - Tiles with synergies placed close together
Farthest - Tiles with synergies placed far apart
Random - Random layout that follows book rules
... | true |
0d0d0d86b128366c743c5bd6f380199c9bac177f | Python | SuriyaMohan89/HB--Park-N-Play | /server.py | UTF-8 | 8,908 | 2.671875 | 3 | [] | no_license | """ Locate Children's park and rate"""
from jinja2 import StrictUndefined
from flask import(Flask,render_template, redirect, request, flash, session, url_for)
from flask_debugtoolbar import DebugToolbarExtension
from model_db import User,Park,Rating,Favorite,Schedule,connect_to_db,db
from sqlalchemy import update
from... | true |
d4297e5d6a38cdb2c92dbfb82d2d2cc1d6a50c35 | Python | sainihimanshu1999/Greedy-Algorithm | /CinemaSeatAllocation.py | UTF-8 | 493 | 3.28125 | 3 | [] | no_license | '''
Every row can have at max 2 adjacent 4 seats
'''
import collections
def cinema(self,n,reservedSeats):
seats = collections.defaultdict(set)
for i,j in reservedSeats:
if j in [2,3,4,5]:
seats[i].add(0)
if j in [4,5,6,7]:
seats[i].add(1)
if j in [6,7,8,9]:
... | true |
941a8e7e26680f9a7f9e4c1d8268cbf15d42dce5 | Python | hakiri/panta_rhei | /server/TimeSeriesJoiner/LocalStreamBuffer/local_stream_buffer.py | UTF-8 | 22,320 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# script to test the algorithm for the local stream buffering approach.
import sys
import time
import random
import pytz
from datetime import datetime
try:
from .doublylinkedlist import Node, LinkedList
except ImportError:
from doublylinkedlist import Node, LinkedList
# import impor... | true |
025faac062c87f1308a1ff42e48d76ecf8265a39 | Python | alfg/tera-query | /teraQuery.py | UTF-8 | 4,077 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
'''
#### teraQuery.py ####
A simple script to query Tera data by webscraping teracodex.com (and soon others).
Why? Because I was bored one day.
Installation (Ubuntu/Debian):
# apt-get install python-setuptools
# pip install prettytable==0.5 BeautifulSoup
# python teraQuery.py
'''
import re
im... | true |
91d96252da6c3c21761e662c2a7417ae2cd9ac46 | Python | gabimelo/AnDS-examples-python | /intro to comp science/assignment1/construct_list.py | UTF-8 | 282 | 3.765625 | 4 | [] | no_license | """
@author Gabriela Melo
@since 04/03/2015
@modified 04/03/2015
@pre inputs are integers
@post the_list is list containing all input values
"""
size = int(input("Enter number of values: "))
the_list = []
for i in range(size):
the_list.append(int(input("Value: ")))
print(the_list)
| true |
f498f77de699032d693816966b1c7067c29d4d57 | Python | michael21910/harvest-moon-recipe-web-crawler | /HM DS-recipe web crawler.py | UTF-8 | 2,973 | 3.03125 | 3 | [
"MIT"
] | permissive | #version 2.2
import requests
from bs4 import BeautifulSoup
import pandas as pd
pd.set_option("display.max_rows", None, "display.max_columns", None)
urls = ["https://leomoon173.pixnet.net/blog/post/6777691",
"https://leomoon173.pixnet.net/blog/post/27331605",
"https://leomoon173.pixnet.net/blog/post/6... | true |
2458fc20f77bc8fe65e62a6e6e86592fb125bf91 | Python | quq99/MachineLearning_InAction | /chapter3-DecisionTree/trees.py | UTF-8 | 3,941 | 3.21875 | 3 | [] | no_license | #caculate the entropy of the given dataset
import operator
from math import log
def calcShannonEnt(dataSet):
numEntries = len(dataSet)#number of the samples
labelCounts = {}#key: the name of different categories;
# value:number of each category.
for featVec in dataSet:
currentLabel = featVec[-1]
if current... | true |
262ae7d2579c4e8bb8d9cb569494d7a4a9eab5d8 | Python | codeshef/SummerInternship | /ticTacStart/tictac.py | UTF-8 | 5,668 | 2.796875 | 3 | [] | no_license | import tkinter as t
from tkinter import E
from tkinter import N
from tkinter import S
from tkinter import W
from tkinter import messagebox
import ctypes
# from gtts import gTTS
root = t.Tk()
root.title("Tic Tac Toe")
global bClick
bClick = True
def close():
exit()
def reset():
... | true |
45404236d6e4196dd3c03d8422c1f7ae52ec8b9a | Python | xy008areshsu/Leetcode_complete | /python_version/linkedlist_reverse.py | UTF-8 | 341 | 3.40625 | 3 | [] | no_license | def reverse_linked_list(head): # More practice, compare this with reverse linkedlist in a range
if head is None or head.next is None:
return head
prev = None
cur = head
while cur is not None:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
head = ... | true |
87d5d113a15e5ae941bfa539044f0b296f93b08e | Python | caiofov/Controle-Passageiros | /arquivos/pipeline_relatorio.py | UTF-8 | 10,584 | 2.953125 | 3 | [] | no_license | import json
import datetime
with open('teste.json') as file:
dados = json.load(file)
#a função recebe como parâmetro o dicionário, no qual estão as reservas, e o mês escolhido para fazer o relatório
def quantas_meias_por_linha(dados = list, nome_da_linha = str, mes_escolhido = int, ano = int):
qtd_meias = 0
... | true |
1ad3cabf0d4330013ab0a8650ad7ce52e38801a8 | Python | goruma/CTI110 | /P5T2_FeetToInches_AdrianGorum.py | UTF-8 | 751 | 4.25 | 4 | [] | no_license | # A brief description of the project
# 4-2-2019
# CTI-110 P5T2_FeetToInches
# Adrian Gorum
#
#Initialize global INCHES_IN_FOOT variable
INCHES_IN_FOOT = 12
#Main Function gets input from user for feet and calls feet_To_Inches function
def main():
#Gather input from user for feet variable
feet = f... | true |
3ed8297e39562e8a47f10234e0b6318f79b9b351 | Python | pambot/histmod-paper | /plot_lin_compare.py | UTF-8 | 3,497 | 2.515625 | 3 | [
"MIT"
] | permissive | # load modules
import sys
import glob
import numpy as np
import pandas as pd
import scipy.stats
from statsmodels.sandbox.stats.multicomp import multipletests
from statsmodels.stats.multicomp import pairwise_tukeyhsd
import seaborn as sns
import matplotlib.pyplot as plt
import cPickle as pickle
cells = ['Gm12878', 'H1h... | true |
b8e91a603719a63a9ef53795f920e9a7955993ce | Python | sharang1996/python-code-dump | /copy.py | UTF-8 | 342 | 2.96875 | 3 | [] | no_license | from sys import argv
from os.path import exists
script,fromfile,tofile=argv
infile=open(fromfile)
text=infile.read()
print "Does the output file exist?? %r"%exists(tofile)
print "Ready ,hit CTRL-C to exit and RETURN to continue..."
raw_input()
outfile=open(tofile,'w')
outfile.write(text)
print "Done!!!"
infile.cl... | true |
d27ef2dd300a4cbd20c85384b63e3cb9af5d69c6 | Python | M0673N/Programming-Fundamentals-with-Python | /08_text_processing/exercise/03_extract_file.py | UTF-8 | 143 | 3.390625 | 3 | [] | no_license | data = input().split("\\")
item = data[-1]
file, extension = item.split(".")
print(f"File name: {file}")
print(f"File extension: {extension}")
| true |
47aae320c16f24670f3fcb6b92351cdfc3660c72 | Python | gkarp/cr_cm | /sr_scraper.py | UTF-8 | 963 | 3.046875 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
def createDataFile(html_doc):
soup = BeautifulSoup(html_doc, "html.parser")
data = soup.find_all("div", class_="clan__rowContainer")
# Each member of the clan will have a seperate dictionary within the members dictionary
clan_data = {}
# Define keys for each individ... | true |
44d88c734c9b36be124d0ce5dce2b6c1d708f00e | Python | Aakanshakowerjani/Competitive-Programming | /walk or train.py | UTF-8 | 1,170 | 3.171875 | 3 | [] | no_license | """
# cook your dish here
t = int(input())
while t:
t -= 1
l = list(map(int, input().split()))
n = l[0]
a = l[1]
b = l[2]
c = l[3]
d = l[4]
p = l[5]
q = l[6]
y = l[7]
t1 = 0
l1 = list(map(int, input().split()))
if c >= a and d <= b:
if t1 == y:
t1 ... | true |
951c61263b0e694bcfc6e6d4941fab0b59b67adb | Python | ShifaZaman/IntroToPython | /ArraysLists.py | UTF-8 | 538 | 4.8125 | 5 | [] | no_license | #Introduction to arrays/lists
values=["Bananas","Apples","Mangoes","Pomelo"] #List contains multiple values and starts at position 0
print(values[2])
numbers = [1,3,5,7]
for x in range(0,4): #x is the first number in the bracket and counts up to the last number but doesn't include the last number. The number is saved... | true |
642ff7bbf33798c94ca4c06cb2e978c9c95fee4d | Python | 1ayushgoyal007/extension-directory-maker | /project.py | UTF-8 | 1,347 | 3.046875 | 3 | [] | no_license | import os, shutil
folders = {
'videos':['.mp4'],
'audios':['.wav','.mp3'],
'images':['.jpg','.png'],
'documents':['.doc','.xlsx','.xls','.pdf','.zip','.docx']
}
def rename():
for i in os.listdir(directory):
if os.path.isdir(os.path.join(directory,i))== True:
... | true |
abde4da43715e13601944980d49e4305ca27ddd6 | Python | famooe/Leetcode | /single_number.py | UTF-8 | 268 | 2.859375 | 3 | [] | no_license | class Solution(object):
def singleNumber(self, nums):
nums_count = {}
for i in nums:
nums_count[i] = nums_count.get(i, 0) + 1
for i in nums_count:
if nums_count[i] == 1:
return i
| true |
7166dea44e028f9fba0d498201cd3096ebcfcfa3 | Python | Jem-alchemist/MicroPython | /mi_codigo/cliente-servidor/servidor_tm1638.py | UTF-8 | 1,493 | 2.984375 | 3 | [] | no_license | # Jesus Manuel Escobar Muñoz
# 30 de Septiembre de 2019
# Ejemplo de un servidor conectado a un modulo TM1638
import usocket as socket
import tm1638
from time import sleep_ms
import machine
import dht
d = dht.DHT22(machine.Pin(16))
adc = machine.ADC(0)
tm = tm1638.TM1638(stb=machine.Pin(13), clk=machine.Pin(14), dio=m... | true |
4b4ba14b7280e1399f0352d1bcdd71ffc6ec5317 | Python | DJever23/Detection-PyTorch-Notebook | /chapter3/test/3.7-DetNet.py | UTF-8 | 3,734 | 2.71875 | 3 | [] | no_license | import torch
from torch import nn
# 实现DetNet的两个Bottleneck结构A和B
class DetBottleneck(nn.Module):
def __init__(self, inplanes, planes, srtide=1, extra=False):
super(DetBottleneck, self).__init__()
# 构建连续3个卷积层的Bottleneck
self.bottleneck = nn.Sequential(
nn.Conv2d(inplanes, planes, ... | true |
1b92548f3718f9ddd5a4dbc00fe40f03a698870f | Python | ezvone/advent_of_code_2019 | /python/src/solve7.py | UTF-8 | 1,287 | 2.921875 | 3 | [] | no_license | from itertools import permutations
from intcode import Intcode
from input_reader import read_comma_separated_integers
class Amplifier:
def __init__(self, phase_setting):
self.ic = Intcode(read_comma_separated_integers('day7input.txt'))
self.ic.start()
self.ic.write_input(phase_setting)
... | true |
68102f5a87ce1fb7256b8b8a45df5d1746ed3da8 | Python | Tiyasa41998/py_program | /list.py | UTF-8 | 157 | 3.34375 | 3 | [] | no_license | MyList=[1,2,3,4,2,5,3,7]
print(MyList)
NewList=[]
for i in (MyList):
if i not in NewList:
NewList.append(i)
print(NewList)
| true |
1122b5453ceaa9ff0aff2f6226f9af0483999cb3 | Python | ldunekac/Pandemic | /src/Level/Disease/Test/disease_test.py | UTF-8 | 11,684 | 3.28125 | 3 | [] | no_license | import unittest
from Level.level_settings import TheLevelSettings
from Level.City.city import City
from Level.Disease.disease import Disease
"""
Disease tests will make sure that when cities get infected or cured
that the corret desease amount is added or subtraced from the correct
desease.
the asserts for the city ... | true |
6b7e97e752c202c95498ec0105e08a278b49f29e | Python | yesu14/study | /day03/set.py | UTF-8 | 521 | 3.78125 | 4 | [] | no_license | # @Author :RG
# @Time :2020-04-17 下午 16:08
# @Note :
list = [1,2,3,4,2,3,4]
list = set(list)
list.add("9")
print(list,type(list))
list.update(["6,",7,8,9])
list2 = set([5,6,7,8,1,2,3,4])
# 交集
print(list.intersection(list2))
print(list & list2)
# 并集
print(list.union(list2))
# 差集
print(list.difference(list2))
... | true |
6cda6a8cd8ebdb6cef27b75e2fd11d013bd5a1b0 | Python | Harry212001/Cipher-Challenge-2018 | /Monoalphabetic Substitution with Alphabet.py | UTF-8 | 527 | 3.46875 | 3 | [] | no_license | sub = input('Input the substitution alphabet: ')
substitutionAlphabet = {"A":'',"B":'',"C":'',"D":'',"E":'',"F":'',"G":'',"H":'',"I":'',"J":'',"K":'',"L":'',"M":'',"N":'',"O":'',"P":'',"Q":'',"R":'',"S":'',"T":'',"U":'',"V":'',"W":'',"X":'',"Y":'',"Z":''}
for lett in substitutionAlphabet:
substitutionAlphabet[lett]... | true |
7d23c95056d5e5c1db26fb8d4f9aa1571fbe7b82 | Python | iefan/mygameEx | /ex12_hannuota.py | UTF-8 | 14,145 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import pygame, sys, random, math
from pygame.locals import *
import os
import pygame_textinput
import pygame.gfxdraw
pos_x = 100
pos_y = 100
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (pos_x,pos_y) #设置窗口起始位置
pygame.init()
FPS = 50
fpsClock = pygame.time.Clock()
#设置颜色
BLACK = (0, 0, 0)
BLU... | true |
a2655c8baa3b3b048e11a0afdcfadb6c92dcc3e0 | Python | eateren/advent-of-code-2020 | /12/aoc2020-12.py | UTF-8 | 3,012 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 17:10:38 2020
@author: eateren
"""
datafile = "data.txt"
def readData(datafile):
with open(datafile) as file:
list = file.readlines()
list = [line.strip() for line in list]
list = [[line[0], int(line[1:])] for line in ... | true |
47d95777410e7d6ff4731a0e3d5d00eca8ad692b | Python | cloudmesh/cloudmesh-pi | /camp/robot/distance_sensor.py | UTF-8 | 724 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#21cm = 26
#31cm = 36
#41cm = 49
#51cm = 62
#61cm = 75
#71cm = 86
#81cm = 99
#If value is smaller than 7 cm, take value.
import grovepi
class Distance(object):
def __init__(self, port=4):
# Connect the Grove Ultrasonic Ranger to digital port D4
# SIG,NC,VCC,GND
se... | true |
e7b1eee2763e270086139f2e93b3b18d7f8cede0 | Python | lpestl/SimpleTasks | /Task051/Yuliok_07/delivery_time.py | UTF-8 | 1,194 | 3.625 | 4 | [] | no_license | def sort_by_strange_min(a):
for i in range(len(a)):
for j in range(i + 1, len(a)):
m = min(min(a[i]), min(a[j])) #ищем наименьшее среди 4 значений
#если это упаковка первого или доставка последнего - все ок, иначе свап
#нужно потому что пока пакуют первый подарок - порос... | true |
7053fd304599dbc5cce6adb34e2fbff269cafb89 | Python | webdevajf/Learn-Python-The-Hard-Way | /ex33a.py | UTF-8 | 784 | 3.578125 | 4 | [] | no_license | numbers = []
i = 0
z = 6
x = 11
y = 19
def loop(itt, num, end):
while itt < end:
print(f"At the top itt is {itt}")
num.append(itt)
itt = itt + 1
print("Numbers now: ", num)
print(f"At the bottom itt is {itt}")
val_change = 2
def loop2(itt, num, v_c, end):
while itt ... | true |
9cde9aa7b5436c32f392ed4fb398388f97254b5d | Python | Rob0tMakers/3_search | /main.py | UTF-8 | 545 | 2.9375 | 3 | [] | no_license | from game import Game
from Player import Player
from box import Box
from map import Map
from algorithm import algorithm, translate
# For two cans (simplified, removed the walls)
PUZZLE_FILE = "competition_map_1b_e.txt"
# # For three cans (simplified map, walls removed.)
# PUZZLE_FILE = "competition_map_3_e.txt"
# # Fo... | true |
aa2e3e4f2447d22777a1da2b71a3fbfe39c28510 | Python | j40pl7llyccl/excel-word-html | /excel-word-v.3.py | UTF-8 | 3,116 | 2.859375 | 3 | [] | no_license |
# coding: utf-8
# ### 抬头式
# In[94]:
from docx import Document
from openpyxl import load_workbook
from docx import *
import time
import sys
import os
# ### 设置环境
# In[95]:
reload(sys)
sys.setdefaultencoding('utf8')
# ### 读取excel
# In[96]:
#把所有输入的当做是字符串
filename = raw_input("input filename:")
filenames = '... | true |
86be05ce2f734442ae29276616a7cdc09092aa55 | Python | Nextdoor/ndkale | /kale/utils.py | UTF-8 | 829 | 2.78125 | 3 | [
"BSD-2-Clause"
] | permissive | """Module containing utility functions for kale."""
import resource
import sys
def class_import_from_path(path_to_class):
"""Import a class from a path string.
:param str path_to_class: class path, e.g., kale.consumer.Consumer
:return: class object
:rtype: class
"""
components = path_to_clas... | true |
937494e912eab0f0c16260f3a17398718087f32a | Python | hab-spc/hab_rnd | /validate_exp/stat_fns.py | UTF-8 | 3,562 | 2.953125 | 3 | [] | no_license | import numpy as np
from scipy import stats
from scipy.spatial import distance
from scipy.stats import entropy
from sklearn.metrics import mean_absolute_error
def mae(x, y, n=None):
if n:
return 1 / n * np.sum(np.abs(x - y))
else:
return np.mean(np.abs(x - y))
def smape(y_true, y_pred, n=None... | true |
479dfde484bd2ae5c97dcef8df7884f61da2e269 | Python | dhyani21/Hackerrank-30-days-of-code | /Day 15: Linked List.py | UTF-8 | 1,402 | 4.28125 | 4 | [] | no_license | '''
A Node class is provided for you in the editor. A Node object has an integer data field, data, and a Node instance pointer,next , pointing to another node
(i.e.: the next node in the list).
A Node insert function is also declared in your editor. It has two parameters: a pointer, head, pointing to the first node of ... | true |
c2aab43f4950b7abed44913002170d68a2ebe20a | Python | oculusstorystudio/kraken | /Python/kraken/plugins/max_plugin/utils/curves.py | UTF-8 | 932 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive |
import logging
from kraken.plugins.max_plugin.utils import *
from kraken.log import getLogger
logger = getLogger('kraken')
def curveToKraken(curve):
"""Converts a curve in Maya to a valid definition for Kraken.
Args:
curve (obj): Maya nurbs curve Object.
Returns:
list: The curve defi... | true |
4254b1f43f471b14acfe564b6b007cfb293e5a99 | Python | JingkaiTang/github-play | /week/want_important_person/important_part/public_fact/find_person.py | UTF-8 | 213 | 2.53125 | 3 | [] | no_license |
#! /usr/bin/env python
def high_child(str_arg):
part_or_life(str_arg)
print('work_and_new_number')
def part_or_life(str_arg):
print(str_arg)
if __name__ == '__main__':
high_child('take_thing')
| true |
fc4e0610016fba0948f895beacc004a696fcbde4 | Python | rupran/adventofcode | /2020/7.py | UTF-8 | 2,354 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
import collections
import re
import lib.common as lib
def build_contained_in_graph(line_gen):
# Build a graph from right hand side to left hand side, i.e. outgoing
# edges denote a 'contained in' relationship
graph = collections.defaultdict(set)
for line in line_gen: # multi lin... | true |
f9cfc2397ccb6803aafba9df3ea6101039f14dc7 | Python | learningandgrowing/Data-structures-problems | /fizzz.py | UTF-8 | 73 | 3.421875 | 3 | [
"MIT"
] | permissive | T = int(input())
N = input().split()
for i in range(1, N+1):
print(i) | true |
bff0dc835b114ee6b9a28f4e129462042a3c6277 | Python | dunbr/GBpython | /lesson11/l11dz3.py | UTF-8 | 306 | 3.703125 | 4 | [] | no_license |
c = []
while True:
try:
v = input('Введите число')
if v == "stop":
print(c)
break
elif v.isdigit():
c.append(v)
else:
raise ValueError
except ValueError:
print('Вы ввели не число!')
| true |
4107b15b0924eacf5ac35fe0a71f06ce33a5e087 | Python | MungaiMuriu/mungai | /mp3player.py | UTF-8 | 957 | 3.25 | 3 | [] | no_license | from tkinter import *
import pygame, os, random
pygame.mixer.init()
songs = (pygame.mixer.music.load("A.mp3"),
pygame.mixer.music.load("B.mp3"),
pygame.mixer.music.load("C.mp3"),
pygame.mixer.music.load("D.mp3"))
window=Tk()
window.geometry("175x150")
class Player:
def __init__(self):
... | true |
b274019fdd0bff0b9d189a3692dbcca141d542ac | Python | guzvladimir/epam_homeworks | /homework_7/task02/task02.py | UTF-8 | 841 | 4.21875 | 4 | [] | no_license | """
Given two strings. Return if they are equal when both are typed into
empty text editors. # means a backspace character.
Note that after backspacing an empty text, the text will continue empty.
Examples:
Input: s = "ab#c", t = "ad#c"
Output: True
# Both s and t become "ac".
Input: s = "a##c", t = ... | true |
47bf38d231b2c35d574f5cd79f722a27993d3694 | Python | Omsala/iis2017 | /Ass 2 part 1/lab2.py | UTF-8 | 1,363 | 2.6875 | 3 | [] | no_license | from sklearn import datasets
import numpy as np
import cv2
from matplotlib import pyplot as plt
from sklearn import manifold
from sklearn import metrics
from sklearn import cross_validation
digits = datasets.load_digits()
# 0.1 Data Visualization
i = 0
for image in digits.images:
if(i < 10):
imMax = np.ma... | true |
45120d35d3e6e72a8f4c59cf8b97a064573385d5 | Python | subinmun1997/my_python | /for_iterable.py | UTF-8 | 167 | 3.5625 | 4 | [] | no_license | for i in [1,2,3]:
print(i, end=' ')
ir = iter([1,2,3])
while True:
try:
i = next(ir)
print(i, end=' ')
except StopIteration:
break | true |
e14e9ce796942d3fde432dee629b3b7d75643e68 | Python | DilipBDabahde/PythonExample | /Assignment_1/Print_N_Star.py | UTF-8 | 381 | 4.0625 | 4 | [] | no_license | """
8.Write a program which accept number from user and print that number of “*” on screen.
Input : 5
Output : * * * * *
"""
import sys;
def PrintStar(iNo):
while iNo > 0:
print("* ","",end="");
iNo -= 1;
def main():
ival = int(sys.argv[1]); #taking input from user using command line argument
PrintStar(i... | true |
91c52eb7c3e578f2ad58bbfea3c80ac528e657b8 | Python | AlyoshaS/codes | /startingPoint/01-EstruturasCondicionais/exercicios_resolvidos/04.py | UTF-8 | 2,472 | 4.8125 | 5 | [] | no_license | """ 04 - Faça um progama que receba dois números e execute as operações listadas a seguir, de acordo com a escolha do
usuário.
| ESCOLHA DO USUÁRIO | OPERAÇÃO |
|-------------------------------|--------------------------------------|
| 1 | Média ... | true |
b22abf84a66fb707520f0fc3888ce77bb0cfaf43 | Python | Guosmilesmile/pythonstudy | /wikitools/test3.py | UTF-8 | 2,585 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Draw a graph with matplotlib, color edges.
You must have matplotlib>=87.7 for this to work.
"""
__author__ = """Aric Hagberg (hagberg@lanl.gov)"""
try:
import matplotlib.pyplot as plt
except:
raise
import networkx as nx
import random
class GygraphAnalysis(object):
def __init__(self)... | true |
571912f4f0bc563c7f956bbdab8a696080e87771 | Python | LeviF1234/chooseAdventure | /home.py | UTF-8 | 28,198 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import Tkinter as tk
from random import randint
from Bestiary import *
import math
root = tk.Tk()
#Initialize the game interface
canvas = tk.Canvas(root, height=500, width=500, bg="white")
canvas.grid(row=0, column=0)
text = tk.Canvas(root, height=500, width=500, bg="white")
text.grid(row=0, c... | true |
e6c46d9e8a674cc6a6884fe96bf958f913bc7e96 | Python | ryanzhanghere/quiz-helper | /QuizHelper-master/question/models.py | UTF-8 | 1,529 | 2.5625 | 3 | [] | no_license | from django.db import models
from quiz.models import Quiz
# Create your models here.
class EssayQuestion(models.Model):
question_body = models.TextField(verbose_name='Question', blank=False, help_text='Description of the question.')
answer = models.TextField(verbose_name='Answer', blank=False, help_text='Answ... | true |
5c4c98a9a553595760833c3cda23f496e2b1c301 | Python | Rahat140404/CPD | /example/ResNet18/utils/train_util.py | UTF-8 | 10,452 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import os
import shutil
from datetime import datetime
import torch
from torch.utils.data.sampler import Sampler
import torch.distributed as dist
import math
import numpy as np
def simple_group_split(world_size, rank, num_groups):
groups = []
rank_list = np.split(np.arange(world_size), num_groups)
rank_lis... | true |
cb48c9059f695a5d49f47c88be61f77676256005 | Python | ElusiveByte/codedefectai | /cdppro/core/Parser/Json/TimelineJsonParser.py | UTF-8 | 1,383 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import json
from Parser.Json.IJsonParser import IJsonParser
class TimelineJsonParser(IJsonParser):
"""
class to parse json returned by github timeline API
"""
def __init__(self):
super().__init__()
def parse_id_listing(self, response_list):
pass
def parse_json(self, res_json, ... | true |
01c039bc78c76912334af936b7f29d2bf326f66a | Python | guangie88/airflow-pipeline | /test_db_conn.py | UTF-8 | 2,198 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
Setup password authentication for Airflow Admin UI
"""
import argparse
import os
from typing import Optional
from airflow.configuration import conf
import sqlalchemy
import sys
import time
DB_MAX_ATTEMPTS = 10
DB_RETRY_DELAY_SEC = 2
def test_db_conn(conn_str: str,
max_attempts: int,
... | true |
e343a5cf9cc5dda872265d917f719a92a8597bc2 | Python | AlpriElse/tensorflow-exploration | /tf-bitwise-AND.py | UTF-8 | 2,312 | 3.703125 | 4 | [] | no_license | # The following code follows a tutorial found at:
# https://towardsdatascience.com/tensorflow-for-absolute-beginners-28c1544fb0d6
import tensorflow as tf;
# Declare values and training data
T, F = 1.0, -1.0
bias = 1.0
training_input = [
[T, T, bias],
[T, F, bias],
[F, T, bias],
[F, F, bias]
]
traini... | true |
4f03eb784160ea3faea4b3b3589450758a3ade64 | Python | tliu57/Leetcode | /Easy/LongestUnivaluePath/test.py | UTF-8 | 818 | 3.53125 | 4 | [] | no_license | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def __init__(self):
self.max = 0
def longestUnivaluePath(self, root):
self.dfs(root)
return self.max
def dfs(self, node):
if not node:
return 0
left = 0
right = 0
if node... | true |
ade6ab4edbbcf0461b429c720c79d376defb4e56 | Python | lxzmads/XMQ-BackUp | /xmq/webdriver/expected_conditions.py | UTF-8 | 1,149 | 3.09375 | 3 | [
"MIT"
] | permissive | from selenium.webdriver.support.expected_conditions import _find_element
class element_is_complete(object):
"""
期望指定的元素加载完毕[1],并返回该元素
:param locator: 指定元素的选择器
References:
[1] http://www.w3school.com.cn/jsref/prop_img_complete.asp
[2] selenium.webdriver.support.expected_conditions
... | true |
82b20a7a9f72a39e3cfc8ecea3043ab4d0a6d05b | Python | lilywilliams/mbuild | /mbuild/bond_graph.py | UTF-8 | 3,705 | 3.453125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from collections import defaultdict
class BondGraph(object):
"""A graph-like object used to store and manipulate bonding information.
`BondGraph` is designed to mimic the API and partial functionality of
NetworkX's `Graph` data structure.
"""
def __init__(self):
self._data = defaultdict... | true |
aa4380519aacd456110c77ddc908aa06d9212594 | Python | liming7726/spiders | /day04/zhilian.py | UTF-8 | 2,891 | 2.53125 | 3 | [] | no_license | import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import ui
from selenium.webdriver.support import expected_conditions as EC
# from selenium.webdriver.chrome.options import Options
#
# chrome_options = Options()
# chrome_options.add_argument('--head... | true |
a78291c4ff74f140bfa482855d32f820f6c9a9bb | Python | kman0/cornac | /tests/cornac/eval_methods/test_base_method.py | UTF-8 | 3,369 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
@author: Quoc-Tuan Truong <tuantq.vnu@gmail.com>
"""
import unittest
from cornac.eval_methods import BaseMethod
from cornac.data import TextModule, ImageModule, GraphModule
from cornac.data import TrainSet, Reader
from cornac.metrics import MAE, AUC
from cornac.models import MF
class Tes... | true |
0d088519f8cc8770dd8739d3c67a8af00daba0f4 | Python | andymayers/autowiki-github | /statesearch.py | UTF-8 | 2,787 | 2.875 | 3 | [] | no_license | import webbrowser
import csv
import requests
def wiki(word1, word2='', word3='', word4='', state=' '):
if word2 <> '' and word3 <> '' and word4 <> '':
addr = 'https://en.wikipedia.org/w/index.php?title=Special:Search&search=%s+%s+%s+%s' % (word1, word2, word3, word4)
elif word2<> '' and word3 <> '':
addr = 'http... | true |
d3213d5649f77c9a4bc0de2896c6434bd2b0bf5a | Python | AkumaEX/MAC0317-EP1 | /synthesizer.py | UTF-8 | 3,595 | 2.890625 | 3 | [] | no_license | import re
import numpy as np
class Synthesizer:
def __init__(self, adsr, freq, part):
self._adsr = adsr
self._freq = freq
self._part = part
def C(octave):
return 16.352*2**int(octave)
def Db(octave):
return 17.324*2**int(octave)
def D(oct... | true |
966e323e5d93de75a3c2ed788e7ddd80b748cbca | Python | ChameleonCloud/portal | /chameleon/decorators.py | UTF-8 | 2,217 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | """View Decorators for termsandconditions module"""
import urllib.parse
from functools import wraps
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect, QueryDict
from termsandconditions.models import T... | true |
f633e2a79a041f4482177c8e37c272f2d28af0b5 | Python | matthew-brett/sphinxtesters | /sphinxtesters/tests/test_modified_pagebuilder.py | UTF-8 | 3,187 | 2.8125 | 3 | [
"BSD-2-Clause"
] | permissive | """ Test ModifiedPageBuilder
"""
from io import StringIO
from os.path import dirname, join as pjoin
from sphinxtesters.sphinxutils import ModifiedPageBuilder
from sphinxtesters.tmpdirs import in_dtemp
import pytest
HERE = dirname(__file__)
PROJ1 = pjoin(HERE, 'proj1')
class TestModifiedPageBuilder(ModifiedPageBui... | true |
ba16d003bdbc4c63c6302db3e8faa0caf8277118 | Python | Souzanderson/Python_codes | /RESOLUÇÃO DE SISTEMAS LINEARES/sistemas_lineares.py | UTF-8 | 713 | 3.09375 | 3 | [] | no_license | def resolve_sistema():
n=int(input('defina o tamanho do sistema: '))
a=[]
c=[0 for x in range(0,n)]
print("Entrada da matriz:")
for i in range(0,n):
a.append(input().split())
b=a[i]
a[i]=[int(x) for x in b]
for k in range(0,n-1):
for i in range(k+1,n):
... | true |
3cb96c676318409f329cf403fd937e6567bee167 | Python | sergei/ottopi | /bt_remote/rest_client.py | UTF-8 | 713 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import json
from json import JSONDecodeError
from urllib.parse import quote
import requests
class RestClient:
"""
Use this class to communicate with otto pi navigator
"""
def __init__(self, url=None):
self.end_point_url = 'http://localhost/' if url is None else url
def post(self, path, d... | true |
aca551c5a4e2d84b98deab705ff79a98a07782cb | Python | nkhoit/dcss.py | /dcss/player.py | UTF-8 | 6,928 | 2.84375 | 3 | [
"MIT"
] | permissive | from .screens import Screens
class Player():
def __init__(self):
self.current_health = None
self.max_health = None
self.total_health = None
self.current_mana = None
self.max_mana = None
self.race = None
self.title = None
self.armour_class = None
... | true |
4fc9f7aec898c9e6e1edd36cd85b1991cbfc6477 | Python | eyuparslana/library_microservice | /services/author/author_controller.py | UTF-8 | 4,041 | 2.546875 | 3 | [] | no_license | from datetime import datetime
from flask import Flask
from flask import request
from flask_expects_json import expects_json
from flask_api import status as response_status
import utils
from services.author.author_model import AuthorModel
from services.author import author_service
app = Flask(__name__)
schema = {
... | true |
6d1f19ce3f9e4d315c639703090b9014659929e9 | Python | Activity00/FAIS | /fa/utils/buketadd.py | UTF-8 | 1,867 | 2.734375 | 3 | [] | no_license | #-*-coding:utf-8-*-
#!usr/bin/env python
'''
Created on 2017年2月9日
@author: 武明辉
'''
import datetime
import django
django.setup()
import xlrd
from xlrd.xldate import xldate_as_tuple
from fa.models import EquipmentBasticInfo, EquipmentType, EquipmentPosition
def excel_table_by_name(file_excel='aaa.... | true |
aeadd2195a8f511fc611fdfd7688d61b27af1dc0 | Python | TheBreadGuy/sims4-ai-engine | /base/lib/urllib/robotparser.py | UTF-8 | 4,849 | 2.609375 | 3 | [] | no_license | import urllib.parse
import urllib.request
__all__ = ['RobotFileParser']
class RobotFileParser:
__qualname__ = 'RobotFileParser'
def __init__(self, url=''):
self.entries = []
self.default_entry = None
self.disallow_all = False
self.allow_all = False
self.set_url(url)
... | true |
7c7bef8d167a427bcd7cc938fc1842214af08f3c | Python | wayabi/brute_file | /a.py | UTF-8 | 1,506 | 2.65625 | 3 | [] | no_license | import sys
import os
import csv
import ntpath
prefix_ = "##"
suffix_ = "##"
out_dir_ = "./out"
def recursive_replace(base_file_name, base_content, brute, index_key, out_dir):
key = brute[index_key][0]
for brute0 in brute[index_key][1]:
r_content = brute0[0]
r_content_file = brute0[1]
file_name = base_file_nam... | true |
bd1eb436c1fbd6eb094d975f67887a588487e393 | Python | zkelly3/MLTD-Data | /fix_json.py | UTF-8 | 2,009 | 2.921875 | 3 | [] | no_license | import json
from config import connect
def get_idol_names():
sql_get_all_idols = "SELECT * FROM `Idol`"
connection = connect()
with connection.cursor() as cursor:
cursor.execute(sql_get_all_idols)
idols = cursor.fetchall()
connection.close()
idol_jp_names = [idol['jp_name'] for id... | true |
ef4aa6beb4d4722771a1c74773beaba11a995d5b | Python | diazfranj/Value-investing | /Mkt_Val_Model/Inv301.03_Generate_Charts_Of_Undervalued_Cos.V01VIDEO.py | UTF-8 | 1,038 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 23 09:43:19 2018
@author: russe
This prints out the charts of the current val investment ideas
"""
#functions
from os import chdir
import pandas as pd
import matplotlib.pyplot as plt
#change directory
chdir("C:\\Russell\\Investment\\Mkt_Val_Model\\FInDat")... | true |
839587a08738fd55c1a9aaf7357abc6791c4baf9 | Python | ArchibaldChain/python-workspace | /Workspace for Python/studying file/Error test/trytest.py | UTF-8 | 237 | 3.3125 | 3 | [
"MIT"
] | permissive | def testTry(index):
stulst = ["Jojn", "Jenny", "Tom"]
try :
astu = stulst[index]
print(astu)
except IndexError:
print("Indexerror")
finally:
print("end")
testTry(1)
testTry(4)
| true |
49661f38c22f2854ead17828a7808fe506fa31a7 | Python | locvx1234/Programming | /Lab Python/ucln.py | UTF-8 | 295 | 3.328125 | 3 | [] | no_license | # UCLN.py
# Written by LocVu
def ucln(a,b):
if a == 0 or b == 0:
return a + b
else:
return ucln(b, a%b)
if __name__=="__main__":
a = int(raw_input("nhap so thu nhat: "))
b = int(raw_input("nhap so thu hai: "))
print ("UCLN la: ", ucln(a,b))
| true |
21e8d5c5b97b4cf18fd500cf8813ddb545cbf009 | Python | capitalmarkettools/cmt | /src/bo/Date.py | UTF-8 | 3,131 | 3.0625 | 3 | [] | no_license | '''
Created on Oct 10, 2009
@author: capitalmarkettools
'''
import QuantLib
from datetime import date, timedelta
from src.bo import cmt
def createPythonDateFromQLDate(qlDate):
return date(year=qlDate.year(), month=qlDate.month(),day=qlDate.dayOfMonth())
def createQLDateFromPythonDate(pDate):
... | true |
ba767b6eb6d06b78ad5dbc47640dae980caa3750 | Python | Mathadon/modesto | /modesto/mass_flow_calculation.py | UTF-8 | 5,134 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive |
import networkx as nx
import numpy as np
import pandas as pd
import collections
class MfCalculation(object):
def __init__(self, graph, time_step, horizon):
self.graph = graph
self.time_step = time_step
self.horizon = horizon
self.time = range(0, int(self.horizon/self.time_step))
... | true |
e396d66af737dd7383d7fa75e2ad90ba55ef84e2 | Python | MiroVatov/Python-SoftUni | /Python Basic 2020/Exercixe - 03 - 04.py | UTF-8 | 1,181 | 3.609375 | 4 | [] | no_license | budget = int(input())
season = input()
fisherman_qty = int(input())
boat_price = 0
if season == 'Spring':
boat_price = 3000
if fisherman_qty <= 6:
boat_price = boat_price * 0.9
elif 7 < fisherman_qty <= 11:
boat_price = boat_price * 0.85
elif fisherman_qty > 12:
boat... | true |
35751fbb1d9df45f1c4a612de31ed833e9756f5a | Python | Circuit-killer/IoT_Frameworks | /raspi_mesh_server/py_net_gateway/rasp.py | UTF-8 | 1,338 | 2.65625 | 3 | [] | no_license | import os
# Return CPU temperature as a character string
def getCPUtemperature():
res = os.popen('vcgencmd measure_temp').readline()
return(res.replace("temp=","").replace("'C\n",""))
# Return RAM information (unit=kb)
# used RAM ... | true |
04133973417be17b6fc2f3dbad71b1bdecb81f5a | Python | Khaber-Sarra/flow-shop-scheduling | /core/opt/loader.py | UTF-8 | 784 | 3.484375 | 3 | [] | no_license |
import numpy as np
import pandas as pd
'''
a small confusion is that the problem presentation may varies
sometimes the jobs are presented by lines and other times by the columns
the default is Machine = 1 Col
if the representation you use is the inverse just pass
machines_in_rows=True instead of the default value... | true |
1a5143edb7b6a0d3f23d5a705727a0f3ff867bda | Python | xtuyaowu/huobi-autotrading | /app/triangle_main.py | UTF-8 | 27,045 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 设定账户 accountConfig
import traceback
import time
import logging
# import yaml
import multiprocessing
import math
from app.triangle_arbitrage import marketHelper
from app.triangle_arbitrage.utils.helper import *
# 设置logging
logger = logging.getLogger()
logger.setLevel(lo... | true |
4a29c122b65456c1a9128645af8739dff6bee18d | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2334/60620/261723.py | UTF-8 | 348 | 2.96875 | 3 | [] | no_license | s=list(map(int,input().split(',')))
def isT(x,y,z):
if(x+y>z):
return True
return False
s=sorted(s)
t=[]
for i in range(len(s)-2):
for j in range(i+1,len(s)-1):
for k in range(j+1,len(s)):
if(isT(s[i],s[j],s[k])):
t.append([s[i],s[j],s[k]])
if(t==[]):
print(0)... | true |
e80f28ead6e13a09a4fa7867ecf00bbb14d5c1b8 | Python | viadrew/NBAData | /sportvu/game/Game.py | UTF-8 | 1,819 | 3.015625 | 3 | [] | no_license | import pandas as pd
from .Event import Event
import sportvu.util.visualize as visualize
from sportvu.util.actions import get_actions
import random
import csv
class Game:
"""A class for keeping info about the games"""
def __init__(self, path_to_json):
# self.events = None
self.home_team = None
... | true |
e082ea456ba32d30227f494d75ff143023c5ab19 | Python | alexlimatds/objective_method | /other/extraction_rake.py | UTF-8 | 1,205 | 3.1875 | 3 | [] | no_license | # Code to perform keyword extraction based on the RAKE algorithm. It outputs a CSV file
# containing a keyword set for each input paper
import re
from nltk.corpus import stopwords
import pandas as pd
import preprocessing
from rake_nltk import Rake
### MAIN CODE ###
TOP_K_KEYWORDS = 10 # top k number of keywords to ret... | true |
365af81c58031f1a1efab8917982f52a237ea9b7 | Python | kevinpropdata/learning-web-frameworks | /server.py | UTF-8 | 5,341 | 2.875 | 3 | [] | no_license | from flask import Flask, request, session, redirect
# ===================================================================== #
# Initialize our application server
# ===================================================================== #
app = Flask(__name__)
# a security token - unique key to our app to ensure secure ... | true |
68cb801d770bf23fa9bb7c0923e66a1510a08841 | Python | JATIN-RATHI/7am-nit-python-6thDec2018 | /datatypes/sets/sets_examples.py | UTF-8 | 3,235 | 4.1875 | 4 | [] | no_license | """
Data Structures: Sets
A set is an unordered collection without duplicates.
When printed, iterated upon, or converted into a sequence,
its elements will appear in an arbitrary, implementation-dependent order.
"""
"""
1 Convert Iterable into Set = set()
2 Set Union = a_set.union()
3 Set Interse... | true |
18be4720d3ee0456de3acdf38313c10e94d51220 | Python | Gscsd8527/python | /面试题/超盟数据/二维列表复原.py | UTF-8 | 92 | 2.859375 | 3 | [] | no_license | import numpy as np
a = [[1, 2], [3, 4]]
b = np.array(a)
print(b)
c = b.reshape(1)
print(c)
| true |
43802ec0d60b24dca1acdc38ec0bc9f58c77d3d8 | Python | JoseDGarcia/RPAForm | /app/model/navigator.py | UTF-8 | 4,767 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions
from selenium.webdriver... | true |
49504fe1f0b076dc3b424e8b0f47febfd12c99b0 | Python | rzhang1654/pyco | /122.py | UTF-8 | 380 | 2.890625 | 3 | [
"LicenseRef-scancode-unicode",
"ICU",
"NAIST-2003",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
#create sqlite3 table
import sqlite3
conn=sqlite3.connect('test.db')
print "Opened database successfully";
conn.execute('''CREATE TABLE COMPANY
(ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY ... | true |
aba0efe86ece7479375ce76dabf9a899864bf5d4 | Python | sydneyjenkins/20600_final_project | /scripts/analyze_data.py | UTF-8 | 463 | 3.1875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from genetic_algorithm import GeneticAlgorithm
generation_count = 10
xs = range(generation_count)
ys = []
ga = GeneticAlgorithm(0, load=False)
for i in xs:
ga.load(i)
ys.append(ga.avg_capture_rate())
# make a plot of average capture rate for generations
plt.plot(xs, ys, colo... | true |
48f2cc5b6d53c7317ad882947cabbc367cda0fb7 | Python | GZHoffie/VE472-SU2021 | /datasets/h5/generate_dataset.py | UTF-8 | 1,856 | 3.15625 | 3 | [] | no_license | import random
import numpy as np
import pandas as pd
def linear_combination_plus_error(X, num_dependent_cols=5, parameter_mean=0, parameter_std=1, error_mean=0, error_std=1):
"""
Generate a column that is a random linear combination of
X1, X2 and X3 plus some random error
"""
length = X.shape[0]
... | true |
8dcf886b5ca7e09a986677ebe7eabcaedbdce390 | Python | pitchet2/Shortest-Knight-Path | /knightpath.py | UTF-8 | 1,388 | 3.6875 | 4 | [] | no_license | board = [['a8','b8','c8','d8','e8','f8','g8','h8'],
['a7','b7','c7','d7','e7','f7','g7','h7'],
['a6','b6','c6','d6','e6','f6','g6','h6'],
['a5','b5','c5','d5','e5','f5','g5','h5'],
['a4','b4','c4','d4','e4','f4','g4','h4'],
['a3','b3','c3','d3','e3','f3','g3','h3'],
... | true |
36b09dfe6874e134f7457ab49a9ad61af7716c2b | Python | gianfa/DLN_src-structures | /help_meee.py | UTF-8 | 590 | 3.1875 | 3 | [] | no_license | # Build the right sentence
# and help this program
# to run!
#
# Somebody left a message here..
ta = ['images.']
ea = [' the ']
t = ['left!']
k = ['line']
o = [' on t']
ri = ['google']
b = ['.com & ']
u = ['he ']
a = ['Go to http://']
r = ['search']
# hint:
# Look this list is called "vars"
# anda is made by other l... | true |
8bcbb28e353122c5cf7844494d969957a8ff57d0 | Python | simplifies/bann3r | /bann3r.py | UTF-8 | 1,586 | 3 | 3 | [] | no_license | # importing modules
from pyfiglet import Figlet
from termcolor import colored
# colors
gr = 'green'
rd = 'red'
bl = 'blue'
cn = 'cyan'
wt = 'white'
mn = 'magenta'
# Banner
print("")
print(colored(" __________ ________ Creator Tool",cn))
print(colored(" \______ \_____ ____ ____ \_____ \_... | true |
9c164da88f4b0dc91547ef7da7fd3d49dd02845a | Python | jeneigabor/github | /Túrázás.py | UTF-8 | 3,309 | 3.734375 | 4 | [] | no_license | #1. verzió
évszak = input('Nyár van, vagy ősz? (ny/ő) ')
esik = input('Esik? (i/n) ')
szél = input('Fúj a szél? (i/n) ')
if évszak == 'ny' and szél == 'n':
print('megyünk')
if évszak == 'ő' and esik == 'n' and szél == 'n':
print('megyünk')
#2. verzió
évszak = input('Nyár van, vagy ősz? (ny/ő) ... | true |
0502a289470c88817cfb12bcfcfe1ba3da23c560 | Python | catonis/Numerical-Methods | /pythagorean_triplets.py | UTF-8 | 638 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 22 04:29:57 2019
@author: Chris Mitchell
A Pythagorean triplet is a set of three natural numbers, a < b < c,
for which, a ** 2 + b ** 2 = c ** 2
For example, 3 ** 2 + 4 ** 2 = 9 + 16 = 25 = 5 ** 2.
The function getTriplets(limit) returns all Pythagorean triplets up to
... | true |