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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a2854ca86c223495622a9f50021dcae7cafab0ca | Python | anu43/vrije_universiteit | /dmt/assignment2/explore.py | UTF-8 | 7,304 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 14:33:14 2020
@author: anu
"""
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
import xgboost as xgb
import seaborn as sns
import pandas as pd
import numpy as np... | true |
c7cc85ccee59887a87b1f6741a0afe45f13266cc | Python | project-sarai/weather-data-maintenance | /seams_data.py | UTF-8 | 3,444 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
from pymongo import MongoClient
import urllib3
import json
import reverse_geocoder as rg
mongodb_host = 'localhost'
mongodb_port = '3001' #change port depending on database
client = MongoClient(mongodb_host + ':' + mongodb_port)
db = client['meteor'] #change according to the db name
collection = db... | true |
4b7faa2bc0c034a2e2f2ec66b13282dc33676262 | Python | Tklassen1999/Shortest-Path | /LoadMap.py | UTF-8 | 699 | 2.875 | 3 | [] | no_license | #LoadMap
from BuildMap import buildMap
import numpy as np
import os.path
from os import path
def loadMap(cityCount):
loadMapGreeting = f"Hello, we will have {cityCount} cities"
print(loadMapGreeting)
fileName = f"spp{cityCount}.bin"
print("We want to open file:", fileName)
if(path.exists... | true |
002f79b96a59efa97fc322751c80e0bc9897d33e | Python | antony008/mysite | /myself/old/python_class_2.py | UTF-8 | 197 | 2.90625 | 3 | [] | no_license |
def read():
cnt=int(input())
i=1
for count in range(cnt):
cnt_2=int(input())
print('input',i,': ',cnt_2,' sprt',i,': ',round(cnt_2**0.5*1000)/1000)
i=i+1
read() | true |
5237360052d759e38e9d88b24255c109c37d72cb | Python | khaniqshahid/Boto3_aws | /list_ec2_instances.py | UTF-8 | 5,725 | 2.859375 | 3 | [] | no_license | import boto3
import pprint
import random
import time
initial = time.time()
# Following credentials can be covered up in a another hidden function or use encryption or .. Folowing is for new to understand.
session=boto3.Session(aws_access_key_id="XXXXXXXXXXXXXXXXXX",aws_secret_access_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx... | true |
f68ad7e8693328b5c6cf4ca3f06d35877e042947 | Python | albertalrisa/slc-ann-training-1730 | /Session 2.2 - Recurrent Neural Network/2.2.1 - Recurrent Neural Network.py | UTF-8 | 4,170 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
class RNNModel:
def __init__(self, batch_size, unroll_count, context_count, training=True):
if not training:
batch_size = 1
unroll_count = 1
self.cell = tf.nn.rnn_cell.BasicRNNCell(context_count)
self.in... | true |
718acf7e14de6847f889681340d51393ed39fbb2 | Python | AlexTMallen/spectral-spectrum-sparse-analysis | /HW4/image_classify.py | UTF-8 | 14,327 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
from mnist import MNIST
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from sklearn import svm
from sklearn import tree
# I first used torchvision to... | true |
8544f6a3dd037d6569a4c294886fcad4426e4490 | Python | brendanmaguire/python_basics | /examples/20_mutable_collections_lists.py | UTF-8 | 124 | 3.609375 | 4 | [] | no_license | l = [2,4,6]
# Append 7 to the end of the list
l.append(7)
# Insert 77 at the start of the list
l.insert(0, 77)
print(l)
| true |
db03881ec2de4a6be552729a5afcfa676a6f9920 | Python | marjana155/basic-python-programs | /class/class.py | UTF-8 | 428 | 3.6875 | 4 | [] | no_license | class Point:
color = "red"
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return f"({self.x},{self.y})"
@classmethod
def zero(cls):
return cls(0, 0)
def draw(self):
print(f"pont({self.x},{self.y})")
Point.color = "yellow"
p = Poin... | true |
e0b8a8f00731380fc3fe468fefa317a66f400e59 | Python | AntonKulik1980/itea_october | /Lesson5/thread_class.py | UTF-8 | 312 | 3.28125 | 3 | [] | no_license | from threading import Thread
import time
class Sleeping_thread(Thread):
def __init__(self,seconds):
super().__init__()
self._seconds = seconds
def run(self):
print('Sleeping')
time.sleep(self._seconds)
t1 = Sleeping_thread(3)
t2 = Sleeping_thread(3)
t1.start()
| true |
791a0b2b8eb188f335fa5bfe1ed5979864f7d1e7 | Python | SyedMohamedHyder/Tkinter_Python | /calculator.py | UTF-8 | 8,367 | 2.703125 | 3 | [] | no_license | #!/c/Users/SYED/AppData/Local/Programs/Python/Python38-32/python
from tkinter import *
operation=None
check=True
def number(num):
global check
if check:
screen_label["text"]=""
check=False
screen_label["text"]=screen_label["text"]+str(num)
def add():
global operation
if not screen_... | true |
b00a160c767448c9c523d418a415486396ad8f37 | Python | mingyangShang/ImgJointShape | /src/pca.py | UTF-8 | 2,338 | 2.6875 | 3 | [] | no_license | import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
def pca_reduction(feature, to_dim, save_path=''):
print("feature reshaping")
feature = np.reshape(feature, newshape=[-1, feature.shape[-1]])
pca = PCA(n_components=to_dim)
print("fitting")
pca.fit(feature)
... | true |
d0ffdf9c810becf46925fbb17441eed4919f4e59 | Python | jestarjokin/RobinPacker | /robinpacker/script/ast/elements.py | UTF-8 | 1,286 | 2.75 | 3 | [] | no_license | #! /usr/bin/python
# Use, distribution, and modification of the RobinPacker binaries, source code,
# or documentation, is subject to the terms of the MIT license.
#
# Copyright (c) 2013 Laurence Dougal Myers
#
# http://opensource.org/licenses/MIT
class RootNode(object):
def __init__(self):
self.rules = []
... | true |
900861b3746312eda2e7b41335184a4b6549756d | Python | ItsMrTurtle/PythonChris | /Unit 5 Functions/LessonQ22.1 Nested Functions.py | UTF-8 | 385 | 3.984375 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu May 7 18:14:22 2020
@author: Christopher Cheng
"""
# No need for an if statement, the shape variable takes the name of the function
def area(shape,n):
return shape(n)
def circle(radius):
return 3.14*radius**2
def square(length):
return length**2
print(area(cir... | true |
eb488b0615642978f9d3093803b7844e3337107c | Python | rrgalvan/freefem-tests | /keller-segel/attr_repul/run_freefem_test.py | UTF-8 | 3,212 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python3
# This program run FreeFem++ test and filter its result.
# Lines starting with characters "->" are assumed to be followed by yaml
# statements. This yaml data is processed and stored in a file.
from subprocess import Popen, PIPE, check_output
import sys
import re
import time
import yaml
freefem_i... | true |
2d9ac89f420d4ad6b4af9fa1e9190ae9f7d96bf9 | Python | capstone-ii-group-2/project | /src/train.py | UTF-8 | 2,182 | 2.625 | 3 | [] | no_license | import torch
from torch import nn
from torch import optim
from torchvision import datasets, models
import project_globals
# tutorial for some of this https://towardsdatascience.com/how-to-train-an-image-classifier-in-pytorch-and-use-it-to-perform-basic-inference-on-single-images-99465a1e9bf5
model: any
device: any
tr... | true |
db3f74abfcf2b0174ecc5dafc05a92a4b65254e2 | Python | theoliao1998/si671proj | /response.py | UTF-8 | 5,499 | 2.5625 | 3 | [
"MIT"
] | permissive | import sqlite3 as sqlite
from history import get_history
import numpy as np
import math
from collections import defaultdict
DBNAME = 'data.db'
N = 20
n = 5
rate = 0.8
num = 5
cache = {}
cats = {}
def query(statement):
conn = sqlite.connect(DBNAME)
cur = conn.cursor()
cur.execute(statement)
res = cur.... | true |
aa292f08455acde35c1343191f424539df4f2477 | Python | TheoHarri/Web-Scrapping-Thedora-Harrington | /waitbutwhy.py | UTF-8 | 3,058 | 2.546875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from datetime import date
import pandas as pd
import time
import re... | true |
8b84ee6c840db613a6a0066fa3e80d3c767e7b88 | Python | shennian/job_hunter | /html_template.py | UTF-8 | 1,420 | 2.703125 | 3 | [] | no_license | html_template = \
"""
<html>
<head>
<title> job search </title>
</head>
# for (i) in (list) #
<p><a href = (i.url) > (i.content) </a></p>
# endfor #
</html>
"""
def template(html_list, url_list, start_index, end_index):
perv_string = "\n".join(html_list[:start_index])
next_string = "\n".join(html_list[end_inde... | true |
e6dafa865ba4de9feec0aa5f9c9a3e7bc7d8ec89 | Python | HarryIsSecured/zookeper-python-hyperskill | /Problems/Divide nuts equally between squirrels/task.py | UTF-8 | 169 | 3.484375 | 3 | [] | no_license | # put your python code here
number_of_squirrels = abs(int(input()))
number_of_nuts = abs(int(input()))
total = int(number_of_nuts / number_of_squirrels)
print(total)
| true |
c1910e2be8c315297cfa7370514821d4788e63ab | Python | Fhwang0926/class | /python/basic/class_study_for.py | UTF-8 | 2,118 | 3.984375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python // 파이썬을 위한 파일임을 선언
# -*- coding: utf8 -*- // 인코딩 방식 지정 => 한글 주석으로 인한 실행 에러 방지
# 반복문 : for : 반복 횟수 예측 가능
# while : 반복 횟수 예측 불가능
# for : 사전에 또는 특정 상황에 맞춰서 미리 반복횟수 설정
# while : 특정 조건에 도달할 때까지 반복한다.
# for (초기값;조건식;증감값) --> for : 예측가능
# 파이썬 : 향상된 for문을 사용한다.
# for 변수 in 수열(리스트, 튜플)
# 파이썬... | true |
582d15a32f014e46609cbc5755d9279ae61bc62d | Python | alexandraback/datacollection | /solutions_2692487_1/Python/karolx/solve.py | UTF-8 | 927 | 2.9375 | 3 | [] | no_license | import sys
def solve_single_case():
A, N = sys.stdin.readline().split()
A, N = int(A), int(N)
moles = [int(x) for x in sys.stdin.readline().split()]
assert len(moles) == N
if A == 1:
return N
moles = sorted(moles)
player = A
min_changes = N
current_changes = 0
i = 0
... | true |
0b49bf4d2f442596ef000b519a8b2f7bd0af6d43 | Python | renarfreitas/Python | /aula17.py | UTF-8 | 812 | 4.03125 | 4 | [] | no_license | #Dictionary - Curso de Python #17
carro = {
"Fabricante":"Honda",
"Modelo":"HRV",
"Ano":"2016",
"Cor":"Prata"
}
#inserir items ao dicionário
carro["Cor"] = "Preto"
carro["Cambio"] = "Automatico"
#removoer items do dicionário
#carro.pop[]
#del carro[]
print("Tamanho do Dictionary: "+ str(len(carro)))
... | true |
110ffab2f32d6102ab869d6a9e8569a9f89812d6 | Python | mknln/Hello-World | /code.py | UTF-8 | 106 | 3.265625 | 3 | [] | no_license |
def f(x, y):
if x == 0:
return 1
else:
return y * x * f(x - 1, y)
return 0
print f(5, 2)
| true |
4d435be5aef5cdce921952e4ccf61d3f80b455d4 | Python | yawtalkstechs/Python-stocks-indicators | /sma.py | UTF-8 | 1,528 | 3.34375 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from pandas_datareader import data
import matplotlib.pyplot as plt
'''
The Simple Moving Average (SMA) is calculated
by adding the price of an instrument over a number of time periods
and then dividing the sum by the number of time periods. The SMA
is basically the average price ... | true |
b00b719106eb3bc7bf93327fa8a10fbc0b7d0f44 | Python | ElectronicBabylonianLiterature/ebl-api | /ebl/corpus/domain/dictionary_display.py | UTF-8 | 961 | 2.546875 | 3 | [
"MIT"
] | permissive | import attr
from ebl.corpus.domain.dictionary_line import DictionaryLine
from ebl.corpus.domain.line import Line
from ebl.corpus.web.display_schemas import LineDetailsDisplay
from ebl.transliteration.domain.stage import Stage
from ebl.transliteration.domain.text_id import TextId
@attr.s(frozen=True, auto_attribs=Tru... | true |
93db291140960cd4982c21924080501b841badd4 | Python | xiaojie2018/nlp_study | /kg/Corona_Virus_Disease_2019/competition_1/get_tfidf.py | UTF-8 | 1,306 | 3.109375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# author: xiaojie
# datetime: 2020/6/10 17:56
# software: PyCharm
corpus = [
"帮我 查下 明天 北京 天气 怎么样",
"帮我 查下 今天 北京 天气 好不好",
"帮我 查询 去 北京 的 火车",
"帮我 查看 到 上海 的 火车",
"帮我 查看 特朗普 的 新闻",
"帮我 看看 有没有 北京 的 新闻",
"帮我 搜索 上海 有 什么 好玩的",
"帮我 找找 上海 东方明珠 在哪"
]
from sklearn.feature_extraction.text i... | true |
cf60b7449b9de2f6082ed6d45b2d59867f3c25ea | Python | mr6r4y/pltools | /tests/test-struct.py | UTF-8 | 929 | 2.640625 | 3 | [] | no_license | import graphviz as gv
from pltools.graph import struct_to_label, xdot
TestStructA = ("TestStructA",
[("a", "TestA"), ("b", "TestB"), ("c", "TestC")])
TestStructB = ("TestStructB",
[TestStructA, ("d", "TestD")])
def main():
d_structs = gv.Digraph(name="cluster_structs")
d_structs.... | true |
327bbd98035a8ebf7603a64063a3146dbfff0a21 | Python | orhanvegs/2019_spring_week1 | /if_conditions_orhan.py | UTF-8 | 3,261 | 3.609375 | 4 | [] | no_license | # a = 3
# b = 5
# if a==2:
# print(f"yes the value of a is: {a}")
# else:
# print(f"the value of a is not equal to 2, it is :{a}")
# if b==5:
# print(f"yes you are correct. the value is a {b}")
# else:
# print(f"no you make a mistake. the value must be {b}")
# age = 31
# if age<50:
# print("rig... | true |
33cd7e37824f96cdbf05123e6e44e0ddeece7432 | Python | apenasisso/abba | /tools/psycopg2_experiment.py | UTF-8 | 2,001 | 3.140625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
'''
A CLI tool for formulating an Abba url using data from PostgreSQL
'''
from __future__ import print_function
import argparse
import psycopg2
import sys
TOOL_DESCRIPTION = '''
Formulates an Abba url using data from PostgreSQL
The query passed to this tool should return three columns, which ... | true |
ad7c3b7f4a8a13e03b9401487cdf153843c24ee0 | Python | south-coast-science/scs_osio | /src/scs_osio/cmd/cmd_organisation.py | UTF-8 | 3,387 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Created on 14 May 2017
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
import optparse
# --------------------------------------------------------------------------------------------------------------------
class CmdOrganisation(object):
"""
unix command line handler
"""
def __in... | true |
64534776bd2a59275b3be383ee8b1459ea870e8d | Python | saransh2405/winning-and-scoring-percentage | /playmatch.py | UTF-8 | 2,872 | 2.515625 | 3 | [] | no_license | import random
import dbHandler
def out(p):
return 1 if random.random() < p else 0
def inning(matchid,teamid):
outs=0
score = 0
outini = 0.08
query = str(matchid)+","
for i in range(0,30):
if outs<10:
num = random.randrange(0,7)
if out(outini) == 1:... | true |
8cba93fd349fb30f8c39441d39163df9bc5af6ba | Python | CSSERVERDEV/MyPythonDemo | /Mathematics.py | UTF-8 | 1,190 | 4.375 | 4 | [] | no_license | """数学题:好事好 + 要做好 = 要做好事,求 “好、事、做、要”的值分别是多少?"""
list1=[0,1,2,3,4,5,6,7,8,9]
for h in list1:
for s in list1:
for z in list1:
for y in list1:
if (h*100+s*10+h)+(y*100+z*10+h)==(y*1000+z*100+h*10+s):
print(h,s,y,z)
def func(i):
# 可以把h(好),s(事),z(做),y(要)看作是000... | true |
e4e97e0b858a58fd589945bc43a7f1a077a3919a | Python | paul-hyun/sem_20201203 | /nlp/01-01-Encoding.py | UTF-8 | 3,859 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
import os
import numpy as np
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
#
# 말뭉치
#
corpus = """나는 책을 샀다
나는 책을 본다
나는 책을 팔았다
너는 책을 샀다
너는 책을 본다
너는 책을 팔았다
나는 책을 서점에서 샀다
나는 책을 도서관에서 본다
나는 책을 책방에 팔았다 너는 책을 도서관에서 본다
너는 책을 도서관에서 본다 너는 책을 서점에서 샀다"""
#
# Vocabulary
#
# unique wor... | true |
2821b0c5cd9ad814aa20403ca3f78506f00c61f8 | Python | childsish/dynamic-yaml | /tests/test_representations.py | UTF-8 | 1,164 | 2.625 | 3 | [
"MIT"
] | permissive | import yaml
from unittest import TestCase, main
from dynamic_yaml import load, dump
class TestDynamicYaml(TestCase):
def test_json_dump(self):
config = '''
project_name: hello-world
dirs:
home_dir: /home/user
project_dir: "{dirs.home_dir}/projects/{project_name}"
... | true |
ac02bf19a508536a9eb138bad3334e59f7895f73 | Python | arturbs/Programacao_1 | /uni7/Afinidade_Musical/afinidade_musical.py | UTF-8 | 275 | 2.796875 | 3 | [] | no_license | #coding:utf-8
#Artur Brito Souza - 118210056
#Laboratorio de Progamacao 1, 2018.2
#Conta Alertas do Açude
def tem_afinidade(l1, l2):
cont = 0
for n in range(len(l1)):
for e in range(len(l2)):
if l1[n] == l2[e]:
cont += 1
if cont >= 3:
return True
else:
return False
| true |
37d233eca821a1bb3d17b495d400954952c48143 | Python | camunda-guru/rps_cgi_ml_2018 | /dictionarydemo.py | UTF-8 | 756 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 29 14:45:09 2018
@author: Balasubramaniam
"""
customerInfo={"customerId":37473,"customerName":"HCL"}
#extract keys
print(customerInfo.keys())
#extract values
print(customerInfo.values())
for (key,value) in customerInfo.items():
print(key,'-->',value)
... | true |
cec1e29ae2e249ba9d7b43dea61e8aba2f77323f | Python | eboyce452/django_conf | /startapp.py | UTF-8 | 9,781 | 2.53125 | 3 | [
"MIT"
] | permissive | from importlib import import_module
import os
import re
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
class Command(TemplateCommand):
help = (
"Creates a Django app directory structure for the given app name in "
"the current dir... | true |
b8ba9338ccb7e832da25a2b41dc010e6a7b8e86b | Python | xiao-bo/leetcode | /medium/search2Dmatrix.py | UTF-8 | 3,180 | 3.8125 | 4 | [] | no_license | class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
## linear search + binary search
## Runtime: 52 ms, faster than 65.16% of Python online submissions for Search a 2D Matrix.
... | true |
523a5ff37564cf0461556f937bc72f6989378b15 | Python | sreytouchmoch/py.1 | /exam/home1.py | UTF-8 | 586 | 3.75 | 4 | [] | no_license | import tkinter as tk
import random
from random import randrange
# Create an empty window
root = tk.Tk()
# Set TK window size to width 600 px and height 200 px
root.geometry("550x200")
canvas = tk.Canvas(root)
# Your code
randomNumber=randrange(0,10)
for index in range(0,10):
if index==randomNumber:
... | true |
e5e4075f1a9565754171cda72dbdf219d8fb125c | Python | YikangGui/leetcode | /amazon/ood/elevator/deploy.py | UTF-8 | 658 | 2.90625 | 3 | [] | no_license | import threading
from elevator import elevator
def init_elevator(building_layers):
e = elevator(building_layers)
t = threading.Thread(target = e.run)
t.setDaemon(True)
t.start()
return (e,t)
def main():
myelevator,ctl_thread = init_elevator(17)
while True:
str=raw_input("Input valid layer :")
try:... | true |
5ff7574455ca6a7eaaf1c095501ebaf121c7c179 | Python | manasa1463/program | /p18.py | UTF-8 | 303 | 3.046875 | 3 | [] | no_license | n1,n2=map(int,input().split())
for i in range(n1+1,n2):
rev=i
k=0
sum1=0
rev1=i
digit=0
while(rev1):
rev1=rev1//10
digit=digit+1
while(i):
k=i%10
sum1=sum1+k**digit
i=i//10
if(rev==sum1):
print(rev)
| true |
eb9320faf95456cd8f721a6bd86725c058d439e2 | Python | allwak/British-Informatics-Olympiad-Solutions-1 | /2012/bio2012q3.py | UTF-8 | 2,515 | 3.5625 | 4 | [] | no_license | from collections import deque
# import time
digit_words = {1: "ONE", 2: "TWO", 3: "THREE", 4: "FOUR", 5: "FIVE", 6: "SIX",
7: "SEVEN", 8: "EIGHT", 9: "NINE", 0: "ZERO"}
words = {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "ZERO"}
letters = ["O", "N", "E", "T", "W", "H", "R", ... | true |
5f1551d8ee1cee0954936a6ee97ec25dad85db7d | Python | huyngopt1994/python-Algorithm | /bigo/day-9-mid-sem/solutionE.py | UTF-8 | 181 | 3.109375 | 3 | [] | no_license | number_of_array = int(input())
my_list = list(map(int, input().split()))
my_list = sorted(my_list)
the_index_of_median = number_of_array // 2
print(my_list[the_index_of_median])
| true |
291530637b0caf511f9b503ccbbb64f62c6767a6 | Python | spesavento/Python | /Beginner_Python/recursion.py | UTF-8 | 2,896 | 5 | 5 | [] | no_license | #Recursion = where a function calls itself one or more times in order to solve a problem
#Example:
#n! n factorial
#Does n * (n-1)! work to explain it? Only sometimes. 5*4! works but 0*(-1)! does not
# n! {n*(n-1)! if n >= 1 or 1 if n = 0}
#By this definition, for 3!:
#3 >= 1 so 3*2!
#2 >= 1 so 2*1!
#1 >= 1 so 1*0!
#... | true |
03ce71c09d6c19dacc3f386b7ccb7e15b8568fdb | Python | LarisaOvchinnikova/python_codewars | /Say hello.py | UTF-8 | 153 | 3.171875 | 3 | [] | no_license | # https://www.codewars.com/kata/55955a48a4e9c1a77500005a
def greet(name):
if not name:
return None
else:
return f"hello {name}!" | true |
9281747cd7f713ef6fec226c24fa4700d3dc386f | Python | rahulmr/VWAP-ITCH-5.0 | /ITCH parser.py | UTF-8 | 14,436 | 2.796875 | 3 | [] | no_license | #Importing packages ...
import gzip
import struct
import datetime
import pandas as pd
import os
import csv
#Created a class which parses through the ITCH 5.0 file and calculates VSAP.
class parser():
def __init__(self):
self.temp = [... | true |
577fcdeb8c7409dc51c5b7ece564feed1cbe7f19 | Python | insideaayush/ml-recipe-google | /iris.py | UTF-8 | 1,111 | 2.984375 | 3 | [
"MIT"
] | permissive | from sklearn.datasets import load_iris
import numpy as np
from sklearn import tree
iris = load_iris()
testing_idx = [0,50,100]
'''
print(iris.feature_names)
print(iris.target_names)
print(iris.data[0])
print(iris.target[0])
for i in range(len(iris.data))
print("example %d: features: %s label: %s" %(i,iris.data[i],i... | true |
6fdc248bbfb7c3fccb984d9da5e2d30848522df1 | Python | Mundhey/Python-3-Sentex | /lec6.py | UTF-8 | 202 | 3.09375 | 3 | [] | no_license | game=[[0,0,0],
[0,0,0],
[0,0,0]]
def game_board():
print(" a b c")
for count, abc in enumerate(game):
print(count, abc)
game_board()
game[0][1]=1
game_board()
| true |
bf1b73923d35616c86d7b9a8db3a10f59f43e29c | Python | xtinaushakova/ITMO_programming | /homework02/sudoku.py | UTF-8 | 7,415 | 3.765625 | 4 | [] | no_license | from random import randint
from typing import *
Digit = str
Row = List[Digit]
Col = List[Digit]
Block = List[Digit]
Grid = List[Row]
Pos = Tuple[int,int]
def read_sudoku(filename: str) -> Grid:
""" Прочитать Судоку из указанного файла """
digits = [c for c in open(filename).read() if c in '123456789.']
gr... | true |
e985ade179bf6c65abac43033e67b856030c2350 | Python | tbenthompson/tbenthompson.github.io | /images/converttopng.py | UTF-8 | 566 | 2.765625 | 3 | [] | no_license | import sys
import subprocess
import os
def convert(file):
filename, ext = os.path.splitext(file)
if ext == '.pdf':
print('converting ' + str(file))
subprocess.call(['pdftoppm', '-singlefile', '-r', '300', '-png', file, filename])
subprocess.call(['convert', filename + '.png', '-trim', f... | true |
881d7b1e1832a85386feabe6d941dc26c8e7faa2 | Python | kfields/community-rpg | /rpg/views/loading_view.py | UTF-8 | 2,102 | 2.65625 | 3 | [
"MIT"
] | permissive | """
Loading screen
"""
import arcade
from rpg.draw_bar import draw_bar
from rpg.load_game_map import load_maps
from rpg.views.battle_view import BattleView
from rpg.views.game_view import GameView
from rpg.views.inventory_view import InventoryView
from rpg.views.main_menu_view import MainMenuView
from rpg.views.setting... | true |
d0c8c16e325af23216d4503570dfc396584e1675 | Python | tushshah10/AIMyCaptain | /Positivelist.py | UTF-8 | 194 | 3.796875 | 4 | [] | no_license | list1=[]
print("enter 10 elements")
for i in range(0,9):
ele=int(input())
list1.append(ele)
print("The positive elements are:\n")
for i in list1:
if (i>0):
print(i)
| true |
126fbf8430298925716d267aa3dc999143c05f84 | Python | vmuzikar/PV248-2017-exercises | /equations.py | UTF-8 | 133 | 2.828125 | 3 | [] | no_license | import numpy as np
a = np.array([[3, 2, -1], [2, -2, 4], [-1, 1/2, -1]])
b = np.array([1, -2, 0])
x = np.linalg.solve(a,b)
print(x) | true |
ecdde54975c3fcaa335325f0958b1777b0efc4ba | Python | opensmartmesh/osmesh-logger | /translator/osmesh-server-receiver.py | UTF-8 | 2,925 | 3.125 | 3 | [
"MIT"
] | permissive | import serial
import sys
import pandas as pd
import datetime
class Server():
def __init__(self, serial_port):
'''Constructor with default values only
TODO have default values and user values as input
'''
self.serial_port = serial_port
self.serial_baudrate = 115200
... | true |
2245262bdd45f577a92cf3ad4024e6165c9470bb | Python | nagyist/GraphiniusJS | /data/results/centralities/pagerank/networkX_pagerank_performance.py | UTF-8 | 8,246 | 2.609375 | 3 | [
"MIT"
] | permissive | import networkx as nx
from networkx import pagerank, pagerank_numpy, pagerank_scipy
import time
import json
output_folder = 'comparison_selected'
'''
Unweighted graphs
'''
print("========================================")
print("========== UNWEIGHTED GRAPHS ===========")
print("======================================... | true |
06b82a0e4066aefa2479d509750e895b1e303341 | Python | chapman-cpsc-230/hw2-nguye612 | /cooling.py | UTF-8 | 318 | 3.125 | 3 | [
"MIT"
] | permissive | """
File: <cooling.py>
Copyright (c) 2016 <Stephanie Nguyen>
License: MIT
<Determining temperature of tea sitting at 20C after x minutes. >
"""
T_Tea = 100.0
T_Air = 20.0 #ambienttemp
t = 0 #mins
while t<= T_Air:
print t,T_Tea
T_Tea -= 0.055 * (T_Tea - T_Air)
t = t + 1 ##everytime it loops it adds one ... | true |
144dfe022f3698ac38558d02fb52a191b6bbc752 | Python | Marceloprime/Bot_feira-do-livro | /new.py | UTF-8 | 930 | 2.59375 | 3 | [] | no_license | import tabula
#the pd is the standard shorthand for pandas
import pandas as pd
import os
#declare the path of your file
# file_path = "./catalogo/Alameda.pdf"#Convert your file
# df = tabula.read_pdf(file_path, pages='all')
errors = []
for pdf in os.listdir('catalogo'):
try:
file_path = './catalogo/' + ... | true |
096958ade3408dd93892083701a8894ef63e8196 | Python | Ganesh-oft/sample-heroku-webapp | /model.py | UTF-8 | 3,743 | 2.890625 | 3 | [] | no_license | import pickle
from xgboost import XGBClassifier
from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
import numpy as np
import sys
import time
model = None
user_final_rating = None
max_recomms = 20
product_feature_dict = None
initialized = None
def load_product_feature(filename='word_vecto... | true |
43ada1a251935308c980c3fd742542c1405cc0e3 | Python | HannahPadd/PLS-analysis | /PLS/User.py | UTF-8 | 981 | 2.84375 | 3 | [] | no_license | import json
import csv
class User:
def __init__(self, Gender, NameSet, GivenName, Surname, StreetAdress, ZipCode, City, EmailAdress, Username, TelephoneNumber):
self.gender = Gender
self.nameSet = NameSet
self.givenName = GivenName
self.Surname = Surname
self.streetAdress =... | true |
53d4f1f2f993fe5f5b31ae35be59783cf3007813 | Python | Harsh-jot/SentimentalAnalyzer | /analyzer.py | UTF-8 | 932 | 3 | 3 | [] | no_license | # Load and prepare the dataset
import nltk
from nltk.corpus import movie_reviews
import random
documents = [(list(movie_reviews.word(fileid)), category)
for category in movie_reviews.categories()
for fileid in movie_reviews.fileids(category)]
random.shuffle(documents)
# Define the feature e... | true |
a7d32d54ead6b8bb434de16f514f099340ea6c46 | Python | cenonn/resample | /resample/utility.py | UTF-8 | 2,588 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | """This module contains various utility functions"""
import matplotlib.pyplot as plt
from scipy.stats import norm
def group_res(data, group_cols, statistic):
"""Splits dataframe into dictionary based on grouping
:param data: input data to be split
:param group_cols: group columns for data
... | true |
9eee256225a6afdaf67b577b254c9d169594965f | Python | ClaraAravecchia/Probabilidade-e-Estatistica | /distribuicao_probabilidade.py | UTF-8 | 784 | 3.453125 | 3 | [
"MIT"
] | permissive | import math as m
import matplotlib.pyplot as plt
def combinacao(N, P):
c = ( m.factorial(N) ) / ( m.factorial(N-P) * m.factorial(P) )
return c
def p_binomial(N, P, Q, K):
binomial = 0
for i in K:
binomial += combinacao(N, i) * ( P**i ) * ( Q ** (N-i) )
return binomial
def graph(x, px):
plt.figure(fi... | true |
06f12b2378b3b45d4588e27a38ddaf83c6e43b82 | Python | GabCh/Gringo-design3 | /design3-backend-h18/src/atlas/game/tasks/rotate_task.py | UTF-8 | 477 | 3.140625 | 3 | [] | no_license | from atlas.game.Task import Task
from atlas.logging import LoggerFactory
from atlas.motor.motor_control import MotorControl
class RotateTask(Task):
LOGGER = LoggerFactory.get_logger("RotateTask")
def __init__(self, motor_control: MotorControl, angle: int):
self.motor_control = motor_control
s... | true |
efa41fdc41ee5f28cb154c56b29e7170bec91b71 | Python | neoprez/sockets-py | /server.py | UTF-8 | 1,740 | 2.953125 | 3 | [] | no_license | #import socket module
from socket import *
import sys
try:
serverSocket = socket(AF_INET, SOCK_STREAM)
except Exception as ex:
code, msg = ex.args
print("Connection error. code: " + str(code) + " message: " + msg)
#Prepare a sever socket
#Fill in start
HOST = 'localhost'
PORT = 8000
try:
serverSocket.bind((HOST... | true |
f948eac9458c3b66ce360ae8ff221db1a1d470c7 | Python | DibyojyotiS/Audio-Event-Detection | /helper_funcs.py | UTF-8 | 8,176 | 2.53125 | 3 | [] | no_license | import os
import librosa
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
def single_bar_plot(x, h, plot_dir, title):
if not os.path.exists(plot_dir): os.makedirs(plot_dir)
fig = plt.figure(figsize=[16,5]); ax = fig.add_subplot()
ax.bar(x, h)
ax.set_title(title)
... | true |
c92cd68fb87c7b327b8890f3609eefbf5699ec50 | Python | toomuchmath/advent_of_code_2020 | /day18/day18.py | UTF-8 | 3,925 | 3.375 | 3 | [] | no_license | import re
def get_input(filename):
with open(filename) as f:
lines = f.read().split('\n')
without_spaces = list(map(lambda s: s.replace(' ', ''), lines))
return without_spaces
def satisfy(condition):
def parser(string):
if len(string) == 0:
return None
... | true |
aef8e5db2a056c8f0fd134c91994608efd23d967 | Python | Mezgrman/K8055 | /keypad.py | UTF-8 | 641 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# K8055 Keypad reader
# © 2013 Mezgrman
from k8055_classes import K8055MatrixKeypad
import pyk8055
import sys
KEYMAP = (
("7", "8", "9"),
("4", "5", "6"),
("1", "2", "3"),
("+", "0", "."),
)
class Keypad(K8055MatrixKeypad):
def on_keys(self, keys):
for key in keys... | true |
0555258fa3975e21fc38b7ef9beae69bd013753e | Python | MoyTW/7DRL2016_Rewrite | /unittests/utils.py | UTF-8 | 1,884 | 2.6875 | 3 | [
"MIT"
] | permissive | from dodge.constants import ComponentType
from dodge.stack import Stack
from dodge.paths import Path
class EntityStub:
def __init__(self):
self.handled = False
def handle_event(self, _):
self.handled = True
return True
def has_component(self, _):
return True
class Compo... | true |
ae370e15f09f83febcd17eb9799b77069508e00c | Python | scikit-hep/cabinetry | /tests/test_cabinetry.py | UTF-8 | 482 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
import cabinetry
def test___dir__():
assert dir(cabinetry) == sorted(cabinetry.__all__)
def test_set_logging(caplog):
log = logging.getLogger("cabinetry")
# message not recorded by default
log.debug("log message")
assert len(caplog.records) == 0
caplog.clear()
# set cus... | true |
762ca6136ce14f9a15f5c59017696f2a4345fb71 | Python | Tifinity/LeetCodeOJ | /145.二叉树的后序遍历.py | UTF-8 | 624 | 3.046875 | 3 | [] | no_license | class Solution(object):
def postorderTraversal(self, root):
if not root: return []
res = []
stack = [root]
visit = set()
while len(stack) != 0:
tmp = stack[-1]
lv = rv = True
if tmp.right and tmp.right not in visit:
rv ... | true |
a270922cf66baa7dcc935ea5d5517e282b0c7e7a | Python | parapente/AoC2015 | /1a.py | UTF-8 | 184 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python3
with open('1.dat') as f:
data = f.read()
floor = 0
for char in data:
if char == '(':
floor += 1
if char == ')':
floor -= 1
print(floor)
| true |
6ede1e7f4781d24d203f60b5af459756cdbf1b79 | Python | influxiq1/pdftotext | /facebookLogin.py | UTF-8 | 425 | 2.78125 | 3 | [] | no_license | from selenium import webdriver
from getpass import getpass
usr = input('Enter your username or email : ')
pas = getpass('Enter your Password :')
driver = webdriver.Chrome()
driver.get('https://www.facebook.com/')
username = driver.find_element_by_id('email')
username.send_keys(usr)
pwd = driver.find_element_by_id('... | true |
30055f3727d30209ba333f3936ad6411d6db3f6d | Python | adnandossaji/interview_app | /interview.py | UTF-8 | 386 | 2.859375 | 3 | [] | no_license | class Interview():
def __init__(self,IntID,Title,NumQs):
self.intid = IntID
self.title = Title
self.numqs = NumQs
def __str__(self):
return 'ID: ' + str(self.intid) + ' Title: ' + str(self.title) + ' NumQs: ' + str(self.numqs)
def getIntID(self):
return self.intid
def getName(self):
... | true |
66772f7756a90793f69729cbf414cb3f3e1fac2e | Python | flinder/PDPbox | /pdpbox/info_plots.py | UTF-8 | 13,183 | 2.53125 | 3 | [
"MIT"
] | permissive |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from .info_plot_utils import _target_plot, _target_plot_interact, _prepare_data_x, _actual_plot, _actual_plot_title
from .other_utils import _check_feature, _check_percentile_range, _make_list, _expand_def... | true |
9685dd42deb55f9b69e3adc00f3d62f3686482be | Python | Dev-AviSingh/Election1 | /source code/reset.py | UTF-8 | 413 | 3.0625 | 3 | [] | no_license | def resetit():
for x in range(1, 12+1):
f = open("cand{}.txt".format(x), mode = 'w')
f.write("0")
f.close()
del f
for x in range(1, 12+1):
f = open("cand{}.txt".format(x), mode = 'r')
print(str(f.read()))
f.close()
del f
try:
resetit()
pr... | true |
544ea7c3cba525455ee5229c55b3f624e97741e3 | Python | bendev-cyber/Contact-list | /contact_test.py | UTF-8 | 1,922 | 3.3125 | 3 | [] | no_license | import unittest #importing the unittest module
from contact import Contact #importing the contact class
class TestContact(unittest.TestCase): #inherits from unittest.testcase
def setUp(self): #setup method allows us to defne instructions that will be executed before each method test
'''
Se... | true |
f7b8334a686e7736959c413a4e6a7d02f30b6b1f | Python | ameily/cincoconfig | /cincoconfig/fields/list_field.py | UTF-8 | 6,998 | 2.921875 | 3 | [
"ISC"
] | permissive | #
# Copyright (C) 2021 Adam Meily
#
# This file is subject to the terms and conditions defined in the file 'LICENSE', which is part of
# this source code package.
#
"""
List field
"""
import inspect
from typing import Any, Iterable, List, Optional, Type, Union
from ..core import (
AnyField,
BaseField,
Conf... | true |
b3c918efea966badd1c67123842766d8d2b58c87 | Python | alaypatel07/dmbi | /data_extraction/test_csv_extractor.py | UTF-8 | 813 | 3.1875 | 3 | [] | no_license | from data_extraction import csv_extractor
from unittest import TestCase
class TestCsvExtractor(TestCase):
test_file = "test_data.csv"
expected_init_out = [dict(foo=str(i), bar=str(i + 1), zoo=str(i + 2)) for i in range(1, 10, 3)]
def setUp(self):
self.data = csv_extractor.Extractor(TestCsvExtract... | true |
9c24aa52c408070328de10d70e6e0f02b1d19937 | Python | ivnalxv/DiscreteMathematics | /First Year/Lab-03/task_F.py | UTF-8 | 445 | 2.75 | 3 | [] | no_license | n = int(input())
code = list(map(int, input().split()))
n = len(code)
mp = []
for c in range(ord('a'), ord('z') + 1):
mp.append(chr(c))
x = code[0]
res = str(mp[x])
mp.append(mp[x])
for i in range(1, n):
y = code[i]
if y < len(mp):
mp[-1] = mp[-1] + mp[y][0]
mp.append(mp[y])
res ... | true |
cc244dac90249c2feb9ca6136e99c8b56be1a6be | Python | DarlanNoetzold/Estrutura_de_Dados | /Pilha/aula3/ed/ed/pilha.py | UTF-8 | 417 | 2.703125 | 3 | [] | no_license | from ed.lista_ligada import ListaLigada
class Pilha:
def __init__(self):
self.pilha = ListaLigada()
def empilhar(self, conteudo):
self.pilha.inserir_no_inicio(conteudo)
def desempilhar(self):
return self.pilha.remover_do_inicio()
@property
def topo(self):
return... | true |
4c0656e31c54b6ca2b66a3e7fd2f7885b4d1a27f | Python | PiotrDataSceince/ZaliczeniePython | /Zadanie 21 (Średnia arytmetyczna).py | UTF-8 | 217 | 3.265625 | 3 | [] | no_license | import numpy as np
lista = [0.5, 0.4, 0.3, 1.3, 1.4]
def srednia_arytmetyczna(x):
aryt = sum(x) / len(x)
return aryt
a = srednia_arytmetyczna(lista)
print(a)
print (np.mean(lista))
| true |
05cff2d64adabee56f44e231ed2b799485798c36 | Python | Maninaa/SimulatedAnnealing-VRPTW-implementation | /controller/ui.py | UTF-8 | 4,387 | 3.359375 | 3 | [] | no_license | from datetime import datetime, date
def user_menu(packages_hash, trucks):
"""
The user interface of the program.
Time Complexity: O(1)
Space Complexity: O(1)
:param trucks: list of trucks
:param packages_hash:
"""
exit_words = ['exit', 'x', 'close', 'bye', 'end']
print('{:*^50}'... | true |
6937b3342eb3fa456222b381b925b2083310b9ee | Python | neuxxm/leetcode | /contest/contest.0524/5417/test.py | UTF-8 | 760 | 3.015625 | 3 | [] | no_license | class Solution(object):
def maxVowels(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
need = {}
cnt = {}
str1 = 'aeiou'
for c in str1:
need[c] = 1
cnt[c] = 0
n = len(s)
l = 0
r = 0
... | true |
97b4176a57f4ca066ee7bd38ede8daa2ff76213a | Python | adnan007d/Calculator | /main.py | UTF-8 | 6,271 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.uic import loadUi
import sys
class Calculator(QMainWindow):
def __init__(self):
super(Calculator,self).__init__()
loadUi('Calculator.ui',self) # Loading UI
self.Calc_Li... | true |
c322fe06128b4ce5ece9dc6de9baedccb7495e07 | Python | TheAlgorithms/Python | /maths/nevilles_method.py | UTF-8 | 1,855 | 3.796875 | 4 | [
"MIT"
] | permissive | """
Python program to show how to interpolate and evaluate a polynomial
using Neville's method.
Neville’s method evaluates a polynomial that passes through a
given set of x and y points for a particular x value (x0) using the
Newton polynomial form.
Reference:
https://rpubs.com/aaronsc32... | true |
2c03a7af92aabeb0de1d9541eee7d29b95335c0e | Python | glaunay/pyCouch | /src/pycouch/utility.py | UTF-8 | 1,239 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import re, json, os, random
# Utility function to check the content of a previous insert log file
reFile=re.compile('^globing.+\/([^\/]+) #items [\d]+$')
reError=re.compile('^Error here ==> (.*)$')
'''
Returns pickle files along with words that failed insertion
{'Candidatus Moranella endobia PCIT GCF_000219175.1.p':... | true |
f3f06388e9be6ceba700d164d327f52bf983d4da | Python | Hoyin7123/2048 | /src/gameview.py | UTF-8 | 5,384 | 2.71875 | 3 | [] | no_license | import arcade
import random
import math
import sys
import time
import numpy as np
from .tile import Tile
from .utils.tile_image_gen import generate_image
DEFAULT_TILE_LEN = 100
class GameView(arcade.View):
def __init__(self, window: arcade.Window, tiles: int):
super().__init__(window=window)
se... | true |
529721a0bd6a0fda2a664b7cd2b9a322c2bf8f84 | Python | cog-imperial/min_matches_heuristics | /lib/problem_classes/stream.py | UTF-8 | 397 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | # A stream of the problem is associated with the following parameters:
# 1. an inlet (initial) temperature Tin and an outlet (target) temperature Tout
# 2. a flow rate heat capacity FCp
class Stream:
def __init__(self, Tin, Tout, FCp):
self.Tin=Tin
self.Tout=Tout
self.FCp=FCp
def __repr__(self):
return '... | true |
0ff2d96254487e16996d421e513e624e62426ed5 | Python | Neytrinoo/async_learn | /3_generators.py | UTF-8 | 1,072 | 3.3125 | 3 | [] | no_license | from time import time
def gen(s):
for i in s:
yield i # передает контроль выполнения, сохраняя момент итерации
def gen_filename():
while True:
pattern = 'file-{}.jpeg'
t = int(time() * 1000)
yield pattern.format(str(t))
sum = 234 + 234
print(sum)
g = gen('D... | true |
c8a0acea80d76fad23438fc87a6e848f2d7ff915 | Python | wolfhesse/ase-game_py_mod | /src/ase_game_py_mod/monsters.py | UTF-8 | 319 | 2.9375 | 3 | [] | no_license | class Monster:
sound = 'roaring'
color = 'blue'
def __init__(self, hit_points=20):
self.action_count = 0
self.hit_points = hit_points
def battle_cry(self):
return self.sound.upper() + '!'
def action(self):
self.action_count += 1
return f'was {self.sound}'
| true |
67a66ca960cc13ab3a48d411a3cdb7df6b124001 | Python | ImaneYASSIRI/Distributed-Computing-HPC-Assignments | /notebooks/MPI/Serial_pimontecarlo.py | UTF-8 | 1,152 | 3.8125 | 4 | [] | no_license | import random
import timeit
INTERVAL= 1000
random.seed(42)
def compute_points():
random.seed(42)
circle_points= 0
# Total Random numbers generated= possible x
# values* possible y values
for i in range(INTERVAL**2):
# Randomly generated x and y values from a
... | true |
f1ec6346e6f26d2bb8cf03ff7524961ea558f097 | Python | justgolikeme/My_MachineLearning | /Base_On_Scikit-Learn_TensorFlow/Chapter_3/Demo_3/the_confusion_matrix.py | UTF-8 | 977 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/12/22 15:01
# @Author : Mr.Lin
'''
'''
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import cross_val_predict
from Chapter_3.Demo_3.create_test_data import y_train, y_test, X_train
y_train_5 = (y_tra... | true |
e5286259cfb8598b5ddbd84dc4beee86720b9621 | Python | DayGitH/Python-Challenges | /DailyProgrammer/DP20180122A.py | UTF-8 | 2,344 | 3.671875 | 4 | [
"MIT"
] | permissive | """
[2018-01-22] Challenge #348 [Easy] The rabbit problem
https://www.reddit.com/r/dailyprogrammer/comments/7s888w/20180122_challenge_348_easy_the_rabbit_problem/
**Description**
Rabbits are known for their fast breeding, but how soon will they dominate the earth?
Starting with a small population of male and female r... | true |
40e29f1bc6823a860774649a4c6868c3549cf7e0 | Python | yixun-h/igdiscover_anaysis | /barcode_remove2.py | UTF-8 | 1,922 | 2.953125 | 3 | [] | no_license | #!/Users/apple/anaconda3/bin/python3
#!/usr/bin/env python3
'''
Title: barcode_remove
Author:Yixun Huang
Description:
This program will remove the barcodes & nucletide acid before barcode and
print filtered sequence into a new fastq file. And calculate the number of sequences
which are not printed in the ou... | true |
e8d713195afe1a952503337e39895a05ee53649d | Python | gluckzhang/wasp_autonomous_systems_1 | /module1_final_a3/cifar10_read.py | UTF-8 | 10,804 | 2.6875 | 3 | [] | no_license | #class written based on and replicating input_data from tensorflow.examples.tutorials.mnist for CIFAR-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import cPickle
import numpy as np
#uncomment this line if you want to be able to save a numpy ... | true |
71dcc988b9251402bcef40ebf1312464596007e9 | Python | bradykim7/Algorithm | /exitMP/programmers_code_17682.py | UTF-8 | 242 | 2.75 | 3 | [] | no_license | import re
def solution(dartResult):
answer = 0
l = re.findall("[0-9]{1,2}[SDT][*#]?", dartResult)
for i in l :
if re.search('[*#]', i) :
print("KMS")
return answer
kms = solution("10S2D*3T") | true |
416c2690e394372c9560d4e15b3beb70b9ed7bb8 | Python | JeevanMahesha/python_program | /pattern/ALPHA_pattern.py | UTF-8 | 659 | 3.390625 | 3 | [] | no_license | n = 7
for i in range(n+1):
c = 65
for j in range(n-i-1+1):
print(end=" ")
for j in range(i+1):
print(chr(c),end=" ")
c+=1
print()
for i in range(n,-1,-1):
for j in range(n-i+1):
print(end=" ")
for j in range(i):
print(chr(c),end=" ")
... | true |
372247b62d4d50c6aecfcb1ac05440cec3cc9ff0 | Python | RW21/CS | /algorithms/tests/test_binary_tree_traversal.py | UTF-8 | 1,400 | 3.578125 | 4 | [] | no_license | from unittest import TestCase
from algorithms.binary_tree_traversal import *
from data_structures.binary_tree import Node
root = Node(1)
left = Node(2)
right = Node(3)
left_left = Node(4)
left_right = Node(5)
right_left = Node(6)
right_right = Node(7)
root.left = left
root.right = right
left.left = left_l... | true |
accff5d0689dc6ecafbfdc0e89d124ea9146dc9a | Python | sonnenfeld269/item-catalog | /database_service.py | UTF-8 | 4,544 | 2.765625 | 3 | [] | no_license | import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from database_setup import Base, Item, Category
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
""" TODO How to create a doc reference to Base?"""
engine = create_... | true |