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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ea97414950470cfe5df8f0dd014896cc7d6d4e7f | Python | skyfly874/magua | /filecreate_in_range.py | UTF-8 | 241 | 2.640625 | 3 | [] | no_license | def text_creator(name,msg):
pathe = 'E://ITfile/'
fullpath = pathe + name + '.txt'
file =open(fullpath,'w')
file.write(msg)
file.close()
print('ok')
for i in range(1,11):
text_creator(str(i),'hello')
print(i)
| true |
f900cbac70d52b7aabadf577f2b2bdec48ee2fb0 | Python | MichelangeloSorice/ermes-thesis | /dynamicSectionsDetectionTool/xxx_genericPlot.py | UTF-8 | 4,420 | 2.734375 | 3 | [] | no_license | import json
import shutil
import sys
from os import listdir, mkdir
from os.path import isfile, join, exists
from shutil import copy, rmtree
import matplotlib.pyplot as pyplot
xVar, yVar, xLabel, yLabel, multicurveVar = None, None, None, None, None
def setPlotData(plotConfig):
global xVar, yVar, xLabel, yLabel,... | true |
727e180ecda95b443dfdb761f1bfbca665fb96aa | Python | yingxingtianxia/python | /PycharmProjects/my_practice/test/6.py | UTF-8 | 2,165 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*-coding: utf8-*-
# 记账簿
import os
import pickle as p
import time
def save_money(wallet_file, record_file):
amount = int(input("amount: ")) #数额
comment = input("comment: ") #备注
date = time.strftime("%Y-%m-%d") #时间
with open(wallet_file) as fobj:
balance = p.load... | true |
17edc82c325d9d7944758933aaf107f9eec2e671 | Python | Bobbias/sumtype | /sumtype/sumtype.py | UTF-8 | 8,647 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | from typing import Tuple
from .sumtype_meta import sumtype_meta, _resolve_options
from .sumtype_slots import sumtype as make_sumtype
from .sumtype_slots import untyped_sumtype as make_untyped_sumtype
__all__ = ['sumtype']
import sys
from warnings import warn
class sumtype(metaclass=sumtype_meta, _process_cl... | true |
90a64b2c9aadca13c6d32742ca3f8af183b8c8be | Python | keshavkummari/pyproject02 | /20191003_DAY-4/string-dataTypes.py | UTF-8 | 391 | 3.84375 | 4 | [] | no_license | # Strings
'''
Note:
A string is an immutable sequence of characters.
Many characters are familiar from what you can type on a keyboard —
a letter, a number, a symbol, or a space.
The string with zero characters is called the empty string.
Example:
a_str = "Python 007 @ World"
a_str = 'Python 007 @ World'
'''
#a... | true |
0ae6ac013deee39b13ee33a62086636ef6cbfa1f | Python | brittanylindberg98/homework2 | /solution2.py | UTF-8 | 2,112 | 3.53125 | 4 | [] | no_license | Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> print("number\tsquare\tcube")
number square cube
>>> for i in range(6):
print(i,"\t",pow(i,2),"\t",pow(i,3))
0 0 0
1 1 1
2 4... | true |
4166e2161192040ea0aefb007a2d9290249af940 | Python | peggiefang/LeetCode | /66_Plus_One.py | UTF-8 | 879 | 3.6875 | 4 | [] | no_license | '''
Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer.
The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.
You may assume the integer does not contain any leading zero, e... | true |
d543ca31db5617464c3a5c58e5fbaa16ac25aa60 | Python | anfreshman/python- | /SIR/plot.py | UTF-8 | 2,159 | 3.34375 | 3 | [] | no_license | # 创建人:郭雨龙
# 创建时间:2021/5/15 9:26
"""画图相关的功能文件"""
from matplotlib import pyplot as plt
from matplotlib import animation
# 引入多进程库
import multiprocessing
# 将matplotlib调整为交互式窗口显示,不添加此行无法显示动图
plt.switch_backend('TkAgg')
# tkinter与matplotlib不能显示在同一个画布上,所以需要设计一个多进程编程
class Plot(multiprocessing.Process):
def __init__(self)... | true |
9c8fa5f5a77ea02c79fbb048d950efa5625887fe | Python | mjtraynor/user-signup | /main.py | UTF-8 | 3,078 | 2.6875 | 3 | [] | no_license | from flask import Flask, request, redirect
import cgi
import os
import jinja2
templates_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(templates_dir))
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route("/")
def display_form():
t... | true |
4e1dcf62094eb616994d6b89410f5b4f9a3e0df4 | Python | su-ram/Problem-Solving | /백준/기타/수리공 항승.py | UTF-8 | 384 | 2.875 | 3 | [] | no_license | n, l = map(int,input().split())
positions = list(map(int, input().split()))
index = 0
cnt = 0
positions.sort()
while index < n :
end = positions[index] + l
adds = 0
for i in range(l):
if i + index >= n : break
if positions[i+index] < end :
adds += 1
continue
e... | true |
2243fe2c0bb9e0396f5c83e3d02ae1550e0808a6 | Python | JeevanMahesha/python_program | /Webscraping/webscraping.py | UTF-8 | 1,645 | 2.78125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
URL = "https://economictimes.indiatimes.com/markets/expert-view/bottom-up-stock-picking-key-to-building-a-strong-portfolio-vetri-subramaniam/articleshow/75806794.cms"
page = requests.get(URL)
htmldata = BeautifulSoup(page.content,"html.parser")
meta_data =[i for ... | true |
91d7aaee0787605fee1640e34e789e4d62c73436 | Python | luketibbott/leetcode | /longest_palindrome.py | UTF-8 | 939 | 3.171875 | 3 | [] | no_license | letter_freqs = dict()
palindrome_length = 0
used_one = False
for char in s:
if letter_freqs.get(char):
letter_freqs[char] += 1
else:
letter_freqs[char] = 1
for letter in letter_freqs.keys():
... | true |
4c25a51af17688aa79bcfc1ee93fa195794725cb | Python | zeke13210/blackrock_backend | /taskthread.py | UTF-8 | 3,556 | 2.578125 | 3 | [] | no_license | import threading, logging, time
from models import StatusEnum
from app import Task
from datetime import datetime, timedelta
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
# filename='taskthread.log', filemode='w',
)
class... | true |
b4c6d1a44294e940cf663b217ec654720ccfa4e7 | Python | tgvoskuilen/pyHome | /pyHome/core/switch.py | UTF-8 | 2,340 | 2.78125 | 3 | [] | no_license | """
Copyright (c) 2012, Tyler Voskuilen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the foll... | true |
d3af49207badde7928a6aa0eb242fe15b3fb2074 | Python | KadrEfe/Flashcards | /user.py | UTF-8 | 1,978 | 3.40625 | 3 | [] | no_license | import json
from os import name
class Users:
def __init__(self, name="Name", level=1, totaltime=0):
self.name = name
self.level = level
self.totaltime = totaltime
@classmethod
def readjson_user(cls):
with open("users.json") as f:
cls.users_dict = json.load(f)
... | true |
bf4e9a2055631083d665b48726a498d5edc60dc1 | Python | boothresearch/puzzles-blue | /anagram/anagram.py | UTF-8 | 387 | 3.34375 | 3 | [] | no_license | def find_anagrams(word, candidates):
s = [i.lower() for i in word]
s.sort()
return_list = []
for candidate_word in candidates:
candidate_word_s = [i.lower() for i in candidate_word]
candidate_word_s.sort()
if (s == candidate_word_s) & (word.lower() != candidate_word.lower()):
... | true |
e189c63db2503f687d8821cad208b0d1b4532a0e | Python | Sergane/Labs | /207/s_from_log_v_is_c.py | UTF-8 | 1,107 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import math as m
from matplotlib import rc
font = {'family': 'Droid Sans',
'weight': 'normal',
'size': 14}
rc('font', **font)
p = [964.5,966.7,970.3,972.8,975.7,978.9,982.7,986.4]
T = [313.02,314.04,315.17,316,316.95,318.05,319... | true |
e2a77fb7030b5f8ab38410e27f52a868dbf6b2ee | Python | alexkiro/python-crypto | /secret_sharing/rsa.py | UTF-8 | 3,610 | 2.796875 | 3 | [] | no_license | from random import *
from fractions import *
import decimal
import math
class rsa:
def __init__(self,x=0,bits=1024):
self.bits=bits #set number of bits
if x==0:
pass
else:
self.generate_keys()
def get_keys(self): #return original keys
re... | true |
21d0b8323d02d227d3ec4e5e614c934972cd84f2 | Python | varun-deokar/Cipher-Algorithms | /affine_cypher.py | UTF-8 | 1,167 | 3.78125 | 4 | [] | no_license | import random
import math
def input_function():
coprime_arr = []
message = input("Enter a string\n")
for i in range(1, 10000):
if math.gcd(i, 95) == 1:
coprime_arr.append(i)
key1 = coprime_arr[random.randint(0, len(coprime_arr))]
key2 = random.randint(0, 10000)
print("\nRan... | true |
75c5001cdcc0e2769b8edaa6e519ee5ba4c60824 | Python | john157157/git_practice | /calc.py | UTF-8 | 402 | 3.3125 | 3 | [] | no_license | # I have now elevated this to jpSource/jp_slices.py
text = '0123456789'
print(text[0]) # prints 0
print(text[1:]) # prints 123456789
print(text[6:]) # prints 6789
print(text[-1]) # prints 9
print(text[-7]) # prints 3
print(text[-3:]) # prints 789
print(text[3:5]) # prints 34
print(text[1:-1]) # prints 123... | true |
cf2cfca579673b0d86a53d1501401be60b0c43bd | Python | eggrollofchaos/nyc-dc-ds-020121 | /Phase_3/Calculator_class/descriptive.py | UTF-8 | 1,585 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 4 14:25:52 2019
@author: swilson5
"""
class Calculator:
def __init__(self, dataList):
self.data = dataList
self.length = len(self.data)
self.mean = self.__calc_mean()
self.median = self.__calc_median()
... | true |
4c37ac6cf50e31fc8a9440763728aa81f1736da1 | Python | imran443/nn_lib_brock | /brocknet/network_master.py | UTF-8 | 4,628 | 3.015625 | 3 | [] | no_license | '''
Created on Apr 21, 2017
@author: Matthew Kirchhof, Imran Qureshi
The master class users will import into their projects. They will only call commands from this
class, where this class will manage the network and perform the desired actions
'''
from brocknet import network_data
from brocknet import network_trainer... | true |
4c79b24ee9e24ad17dcd4f18fc985a2b5e910d4d | Python | kapiecii/keras-test | /keras-sample.py | UTF-8 | 1,038 | 2.59375 | 3 | [] | no_license | from keras.preprocessing.image import load_img, img_to_array
from keras.preprocessing.image import ImageDataGenerator
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
# 入力ディレクトリを作成
input_dir = "image_input"
files = glob.glob(input_dir + '/*.jpg')
# 出力ディレクトリを作成
output_dir = "image_out"
if os.... | true |
36c036b19d4971d8842e030e12e9803f7bb91d22 | Python | leandron/steinlib | /test/test_parser.py | UTF-8 | 6,440 | 2.671875 | 3 | [
"MIT"
] | permissive | import unittest
from mock import MagicMock
from steinlib.exceptions import SteinlibParsingException
from steinlib.instance import SteinlibInstance
from steinlib.parser import SteinlibParser, RootHeaderParser
from steinlib.state import ParsingState
class TestSteinlibParser(unittest.TestCase):
HEADER = '33D32945 ... | true |
bd41d880c80c45125bef627811b0e1f992aeae07 | Python | david-l-anderson-dlande/text_counter2 | /new_wordcount_and_median.py | UTF-8 | 2,204 | 3.25 | 3 | [] | no_license | import os
import re
import csv
import sys
import bisect
from collections import Counter
from statistics import StatisticsError
class WordCounter:
def __init__(self, infolder='wc_input', outfolder='wc_output',
med_outfile='med_result.txt', wc_outfile='wc_result.txt'):
self.infolder, ... | true |
34438e09d979caa5497dfce81b5cf65b9ee7dab6 | Python | M-Quadra/LeetCode-problems | /Algorithms/854/bfs.py | UTF-8 | 891 | 2.890625 | 3 | [
"MIT"
] | permissive | from queue import Queue
from typing import Tuple
class Solution:
def kSimilarity(self, s1: str, s2: str) -> int:
dic = {s1: max(0, len(s1)-1)}
s2Ary = list(s2)
q:Queue[Tuple[str, int, int]] = Queue()
q.put((s1, 0, 0))
while not q.empty():
s1, i, c = q.get_nowait... | true |
2e28e40c903a2b9c06c65b430078c370b38b9b3a | Python | CapucineGARCON/sdia-python | /src/lab2/box_window.py | UTF-8 | 5,047 | 3.421875 | 3 | [
"MIT"
] | permissive | import numpy as np
from lab2.utils import get_random_number_generator
# todo make a pass on the docstrings
class BoxWindow:
"""This class BoxWindow create a box with dimension [a1, b1] x ... x [an, bn]."""
def __init__(self, bounds):
"""Create the attribute bounds of the class BoxWindow.
Ar... | true |
657feaa8a39b76baa1ba771a0aca90a88f360fc6 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3/SKAND/Coin_Jam.py | UTF-8 | 904 | 2.734375 | 3 | [] | no_license | a = input()
b = raw_input().split(' ')
N = int(b[0])
J = int(b[1])
num = 2**(N-1) + 1
print 'Case #1:'
def base_checker(numb):
out = str(numb)
for i in range(2,11):
act_numb = 0
for j in range(N):
act_numb = act_numb + int(str(numb)[j])*i**(N-j-1)
result... | true |
a448e8415a48d31585c6a765e5f88710afc1c96c | Python | gabriellaec/desoft-analise-exercicios | /backup/user_040/ch26_2020_03_09_19_58_29_651146.py | UTF-8 | 247 | 3.453125 | 3 | [] | no_license | valor=float(input("Qual o valor da casa: ")
salario=float(input("Qual o seu sálario: ")
anos=int(input("Quantos anos a pagar: ")
if ((valor/(anos*12))<=salario*0.3):
print ("Empréstimo aprovado")
else:
print ("Empréstimo não aprovado") | true |
53b67af23629ef99c0a2e9c3eb12937bc5c16ed8 | Python | lexuanvinh1967/example | /cnnngan_cifa10.py | UTF-8 | 4,035 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2... | true |
b6f8fbf0360265132d36047c7cb3905e9ecd72f4 | Python | luizlcezario/Processamento-da-Informacao-Ufabc | /aulas5/Prova1_maior_solucao.py | UTF-8 | 1,481 | 4.15625 | 4 | [
"MIT"
] | permissive | '''
Questão 3 (3 pontos) Faça um algoritmo que recebe dois números naturais m e n e determine todos os pares
de números naturais x e y, com x ≤ n e y ≤ m, para os quais o valor da expressão xy − x**2 + y
seja máximo e calcule também esse máximo.
pessoal, só para dar uma esclarecida na questão 3: quando você coloca um ... | true |
b53b37d0bebcdbc909c150ac32f6204efe067a3c | Python | tjr1/proprio | /python_codebase/archive/trainer_gui_v2.py | UTF-8 | 3,232 | 2.609375 | 3 | [] | no_license |
import matplotlib as mpl
mpl.rcParams['toolbar'] = 'None'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Button
import serial
import datetime
import time
from types import *
# GLOBAL DEFIINITIONS
MAX_TIME = 5.
# GLOBAL VARIABLES
fig, ax = ... | true |
d88664a9d2b92c7dc77fddd12d734d93d4697733 | Python | algot/python_selenium_stepik_final | /pages/basket_page.py | UTF-8 | 524 | 2.609375 | 3 | [] | no_license | from .base_page import BasePage
from .locators import BasketPageLocators
class BasketPage(BasePage):
def text_basket_is_empty_is_displayed(self):
expected_text = 'Your basket is empty.'
empty_basket_message = self.browser.find_element(*BasketPageLocators.EMPTY_BASKET_MESSAGE)
assert expect... | true |
620d008baf507e30364d3c12ebd68b60eae11a66 | Python | suko-ichaival/AirboneFDEM_Foward | /FD1dem.py | UTF-8 | 2,366 | 2.640625 | 3 | [] | no_license | #ライブラリのインポート
import matplotlib.pyplot as plt
import numpy as np
import scipy.io
import math
import pandas as pd
###パラメータ設定
#比抵抗
bRes = np.array([50,200])
#導電率
bReslength = len(bRes) #比抵抗配列長さ
lenarray = np.ones(bReslength) #1行列生成
sigma = lenarray /bRes #導電率
#層厚
dh = np.array([30])
#高度
z = 30
#送受信間距離
s = 7.86
#垂直磁気双極子モ... | true |
b28a335006fbfa27862f98405e4627c0c26b8dd8 | Python | thuanVo92/Pixel | /actions/home_steps.py | UTF-8 | 2,611 | 2.578125 | 3 | [] | no_license | '''
Created on Oct 7, 2021
@author: DELL
'''
from selenium.webdriver.common.by import By
from pages.page_home import *
from test.test_fileinput import BaseFileInputGlobalMethodsTest
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from selen... | true |
f81b2d9b14d2b926a788580145771889beb61e66 | Python | jjhelmus/pyfive | /tests/make_fillvalue.py | UTF-8 | 655 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | #! /usr/bin/env python
""" Create two HDF5 files with datasets with and without fillvalues. """
import h5py
import numpy as np
def make_fillvalue(f):
common_args = {
'shape': (4, ),
'data': np.arange(4),
'track_times': False,
}
f.create_dataset('dset1', dtype='<i1', fillvalue=42,... | true |
311009607be76512401825e73b7482e16d23d19e | Python | czqzju/leetcode | /June 2020/Reconstruct Itinerary.py | UTF-8 | 746 | 3.203125 | 3 | [] | no_license | import bisect
class Solution(object):
def findItinerary(self, tickets):
"""
:type tickets: List[List[str]]
:rtype: List[str]
"""
paths = dict()
for s, e in tickets:
if(s not in paths):
paths[s] = [e]
else:
bisec... | true |
96f357c15c65dbe36ab6c5308f952a0522b1b9d0 | Python | hugo-paiva/IntroducaoCienciasDaComputacao | /Lista7/Lista7ex8.py | UTF-8 | 825 | 2.90625 | 3 | [
"MIT"
] | permissive | frase = input()
for s in '.?,!:':
frase = frase.replace(s , '')
frase = frase.split()
contagem = {}
for idx, palavra in enumerate(frase):
frase[idx] = palavra.capitalize()
for palavra in frase:
contagem[palavra] = frase.count(palavra)
ordenado = sorted(contagem.items(), key=lambda x: x[1], reverse=True)
l... | true |
95075e414fea5a96897cbab1ae6f3f39b49a1040 | Python | Diogo65/python3-fundamentals | /src/CursoPython-Desafios/desafio008.py | UTF-8 | 236 | 4.125 | 4 | [] | no_license | # Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros
m = float(input('Digite um valor em metros: '))
cm = m * 100
mm = cm * 1000
print('Centímetros: {}, Milímetros: {}'.format(cm, mm))
| true |
6b7c0b12bae7353f189152b8ec527efb1f53dbf9 | Python | GHMan2021/python-project-lvl1 | /brain_games/games/games_prime.py | UTF-8 | 723 | 3.84375 | 4 | [] | no_license | from random import randint
from ..check_answer import f_check_answer
def is_prime():
print('Answer "yes" if given number is prime. Otherwise answer "no".')
counter = 1
result = True
while result is True and counter <= 3:
number = randint(0, 500)
print('Question:', number)
right... | true |
2e4c40acd722cf816a54f954ceed8836de3f55a0 | Python | 900116/py_study | /recognize_valid_code.py | UTF-8 | 7,319 | 3.375 | 3 | [] | no_license | #encoding:utf-8
import pytesseract
from PIL import Image
from PIL import ImageGrab
import os
#缩放
def resize_by_width(image, except_width):
"""
缩放图片,根据期望宽度,等比例缩放
:param image:图片
:param except_width:期望宽度
:returns: 处理后的图片
"""
x,y = image.size
except_height = int(y*float(except_width)/x)
out = image.resize((exc... | true |
3044467028adfe4654ba02457b0075aac0bc5cb2 | Python | nhatsmrt/AlgorithmPractice | /LeetCode/520. Detect Capital/Solution.py | UTF-8 | 334 | 3.171875 | 3 | [] | no_license | class Solution:
def detectCapitalUse(self, word: str) -> bool:
return self.is_lower(word) or self.is_upper(word) or (self.is_upper(word[0]) and self.is_lower(word[1:]))
def is_lower(self, word: str):
return word.lower() == word
def is_upper(self, word: str):
return word.upper() == ... | true |
442bc2eb156d5fff83a7e945a1aa98ab3e12c8a7 | Python | NIRVANALAN/TU_rcm | /geshi.py | UTF-8 | 2,087 | 3.15625 | 3 | [] | no_license | # coding=utf-8
import openslide
class geshi():
'''
当前视野参数
'''
def __init__(self, slide, iw, ih):
self.wa, self.ha = slide.dimensions # 原图宽和高
self.w = iw # 屏幕宽
self.h = ih # 屏幕高
self.x = int(iw * slide.level_downsamples[slide.level_count - 1] / 2) # 视野中心总横坐标
self.y = int(ih * slide.level_downsample... | true |
e02d645a7dd97d25bf149b337ada309602bb41f5 | Python | caiqinxiong/python | /day04/homeWork/3.装饰器.py | UTF-8 | 3,182 | 3.3125 | 3 | [] | no_license | import time # 时间模块
# 别人写好的一些功能,放在一个模块里
# 和时间相关的功能,就放在了time模块
# 格林威治时间 - 19700101 08:00:00 北京
# 格林威治时间 - 19700101 00:00:00 伦敦
# def timmer(funcname): # funcname就是"func的内存地址"
# def inner(*args,**kwargs):
# # (1000000,20) ()
# start = time.time()
# ret = funcname(*args,**kwargs)
# ... | true |
9efa25d28c66b9de4edccfbdbd4360fa0596b39e | Python | orlykor/intro2cs-ex1 | /HelloTurtle.py | UTF-8 | 1,985 | 4.1875 | 4 | [] | no_license | ######################################################
#FILE: HelloTurtle.py
#WRITER: orlykoren, orlykor12, 203595541
#EXERCISE: intro2cs ex1 2014-2015
#DESCRIPTION:
#A program that draws some simple geometric shapes on the screen
# and prints "HelloTurtle!", using Turtle graphics.
#####################################... | true |
3ca0f78cd6ed76d94d861d78338599c089052de4 | Python | Nimo014/Bigmart_Sale_Prediction | /code.py | UTF-8 | 1,567 | 2.953125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_squared_error
df = pd.read_csv('Boston_House.csv')
#PREPROCESSING
cols = ['crim','zn','t... | true |
39e28086b7c52d6e737fa86843333cb21ef0fd27 | Python | xis24/CC150 | /Python/bb/Island.py | UTF-8 | 9,393 | 3.640625 | 4 | [] | no_license | from typing import List
from collections import deque
class IslandPerimeters:
# For each of island (grid[i][j] == 1), we check four direction: if any of cell is also a island, we just denote as 1.
# we calculate the sum of up, down, left, right. For each island, 4 - sum(up, down, left, right) will be the per... | true |
4a90c26d6faf379a1abf1dbf2f50a61c501a0d4e | Python | TimothyGeissler/OpenAirplay_Python | /main.py | UTF-8 | 13,205 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Copyright (C) 2015-2016 Ben Klein. All rights reserved.
#
# This application is licensed under the GNU GPLv3 License, included with
# this application source.
import sys
global DEBUG
DEBUG = True
if DEBUG:
print("Debugging enabled.")
print("Called with system args: " + str(sys.ar... | true |
0f4c100c14b987e793f7754f00ff5184de600cc3 | Python | osamamohamedsoliman/Array-4 | /Problem-3.py | UTF-8 | 1,088 | 3.59375 | 4 | [] | no_license | # Time Complexity :O(n)
# Space Complexity :O(1)
# Did this code successfully run on Leetcode : yes
# Any problem you faced while coding this : no
class Solution(object):
# swap funct
def swap(self,nums,i,j):
temp = nums[i]
nums[i] = nums[j]
nums[j] = temp
# reverse fuct
def rev... | true |
d22bced632eed9374d6d1b40b49c3a23cd8fda08 | Python | Terrathaw/ba21_loma_2_py | /src/main/dsp/wrapper.py | UTF-8 | 4,409 | 3.109375 | 3 | [
"MIT"
] | permissive | import abc
from typing import List
import numpy as np
from main.common.track import Track
from main.dsp.transform import SignalProcessor
class Wrapper:
"""
Base class for dsp algorithm wrappers
Responsible for splitting data into processable chunks and piecing them back together
Provides utility fun... | true |
3f87e9ab5b07d935885f4bd92db4ea657b4b6dc7 | Python | joeyaj1302/streamlit | /trial.py | UTF-8 | 10,792 | 2.9375 | 3 | [] | no_license | #Using transfer learning to import pretrained yolo model and its weights to predict/detect objects on video in real time
import streamlit as st
import cv2
import numpy as np
import os
import time
import io
from PIL import Image
#import shutil
st.set_option('deprecation.showfileUploaderEncoding', False)
st.title("Welco... | true |
81464e8e360afc30474e34af82bc2ad5ee7b4fe8 | Python | ShannonBulloch/LuauYum | /player.py | UTF-8 | 7,682 | 3.265625 | 3 | [] | no_license | import random
from card import SpamMusubi, CoconutFlakes, PlateLunch, Fruit
def print_table_cards(table_cards):
for key, value in table_cards.items():
if key == SpamMusubi.SPAM_MUSUBI:
count = len(value[0])
print('\t{}x {}. Total rolls: {}'.format(count, key, value[1]))
el... | true |
fac4940c1da8221f1ca21dcee30460b41258815d | Python | jldm-upm/backmaceta | /cesped/controlador.py | UTF-8 | 2,914 | 2.703125 | 3 | [] | no_license | # -*- mode: python; coding: utf-8 -*-
#
###########################################################################
# Fichero: controlador.py
# -------------------------------------------------------------------------
# Proyecto: C.E.S.P.E.D.
# Autor: José L. Domenech
# Descripcion:
#
# Controla un sensor... | true |
fe21e1773c01a1df75d554ced54a463e314cf1f7 | Python | Hoeijmakers/StarRotator | /StarRotator.py | UTF-8 | 22,759 | 2.828125 | 3 | [
"MIT"
] | permissive | ######################
#authors: Jens Hoeijmakers and Julia Seidel
#Description: Calculates the stellar spectrum
#
#
#####################
#Call like: python3 main.py 586.0 592.0 110000.0 90.0 90.0 0.0 0.0 500
#import statements
import sys
import numpy as np
import argparse
import lib.test as test
import lib.vgrid as v... | true |
405c912f2a7596ddfe32e2e5dd52d88b7eaadf1c | Python | Aasthaengg/IBMdataset | /Python_codes/p03007/s057417892.py | UTF-8 | 331 | 2.859375 | 3 | [] | no_license | from collections import *
n=int(input())
a=list(map(int,input().split()))
a.sort()
a=deque(a)
ans=[]
aa=a.pop()
tmp=a.popleft()
while a:
t=a.popleft()
if t<=0:
ans.append((aa,t))
aa-=t
else:
ans.append((tmp,t))
tmp-=t
ans.append((aa,tmp))
print(aa-tmp)
for i in ans:
print... | true |
f7361d97d66066c3dcfae265ff74139cb25bd6ae | Python | 1998vishlanke/Face-Recognition-and-attendance | /main.py | UTF-8 | 1,077 | 2.578125 | 3 | [] | no_license | import cv2
import numpy as np
import face_recognition
imgVirat = face_recognition.load_image_file('image_attendance/virat kohli.jpg')
imgVirat = cv2.cvtColor(imgVirat,cv2.COLOR_BGR2RGB)
imgTest = face_recognition.load_image_file('image_attendance/sachine tendulkar.jpeg')
imgTest = cv2.cvtColor(imgTest,cv2.COLOR_BGR2RG... | true |
ce59eb61fec90961c7cbcf0b1159b27fe598065a | Python | mohmdio/message-counter | /Client.py | UTF-8 | 1,139 | 3.421875 | 3 | [
"MIT"
] | permissive | import datetime
import socket
def main():
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverIP = input("Enter server hostname or IP: ")
serverPort = int(input("Enter server port: "))
clientSocket.connect((serverIP, serverPort)) # connect to the server
message = input... | true |
3270406894a137654c31f512c30465c60ac545bb | Python | Zsailer/high-throughput | /highthroughput.py | UTF-8 | 4,002 | 3.453125 | 3 | [] | no_license | from matplotlib import *
from itertools import product as itp
from numpy import *
from math import *
import random as r
class HighThroughput(object):
def __init__(self, sequences, system_size, sequencing_size):
"""
Modules necessary to run a simulation of high through-put experiment
Param... | true |
f608021a28e31cda6e0d1a087fd996e23545fb55 | Python | alexandraback/datacollection | /solutions_1483485_0/Python/jyhuang/A.py | UTF-8 | 208 | 3.125 | 3 | [] | no_license | n = input()
tr = ''.join([chr(x) for x in range(256)]).replace('abcdefghijklmnopqrstuvwxyz', 'yhesocvxduiglbkrztnwjpfmaq')
for i in xrange(n):
print "Case #{0}: {1}".format(i + 1, raw_input().translate(tr))
| true |
f9e3bbf1fd12a2b2143349d185ed6bfdd3a3c0bf | Python | kryptocodes/college-projects | /competitive_program/sum_prime.py | UTF-8 | 482 | 3.34375 | 3 | [] | no_license | # code to print prime numbers
n=int(input())
t=[]
for i in range(2,n):
for j in range(2,i):
if(i%j==0):
break
else:
t.append(i)
print(t)
#to check the sum
z=len(t)
su=0
c=0
#for k in range(0,z):
# for m in range(1,z):
# su=su+t[k]
# print(su,t[m])
# if(... | true |
7f02544c8fc7766b8b8089d7f22f408c88e7f854 | Python | choiseongjun/pyAlgo | /Boj/Study/boj10845.py | UTF-8 | 1,194 | 3.65625 | 4 | [] | no_license | import sys
class ArrayQueue:
def __init__(self):
self.queue=[]
def add(self,n):
self.queue.append(n)
def pop(self):
if len(self.queue) == 0:
return -1
else:
return self.queue.pop(0)
def peek(self):
if len(self.queue)==0:
return... | true |
57eb45230c65a65782c96ca8505d58f1707a7965 | Python | Sportsfan77777/vortex | /code_fargo/compareGradientExcessMassesOverTime.py | UTF-8 | 2,140 | 2.6875 | 3 | [] | no_license | """
compares excess masses with different taper times
Usage:
python compareExcessMassesOverTime.py
"""
import sys
import os
import subprocess
import glob
import pickle
from multiprocessing import Pool
from multiprocessing import Array as mp_array
import math
import numpy as np
from scipy.ndimage import filters as ff... | true |
66e4c6c3feaeff3ba3c374a7cd95ac29a571e431 | Python | gsjje02/joseph-ca | /models.py | UTF-8 | 1,511 | 3.140625 | 3 | [] | no_license |
#---------+
# Imports |
#-----------------------------------------------------------------------------------------
from flask_sqlalchemy import SQLAlchemy
#from flask.ext.sqlalchemy
from werkzeug import generate_password_hash, check_password_hash
#-------------------------------------------------+
# Instantiate an... | true |
df8f6856542f2b23b099bbf257ff865f7ce9ed61 | Python | Aasthaengg/IBMdataset | /Python_codes/p03210/s409378034.py | UTF-8 | 56 | 2.90625 | 3 | [] | no_license | n=int(input())
print(['NO','YES'][n==3 or n==5 or n==7]) | true |
dc3313a68df3a7b1f5d0b03976c020a7692b2353 | Python | david-weir/Programming-3-Data-Struct-Alg- | /week4/even_count_list.py | UTF-8 | 172 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
def even_count(lst):
count = 0
while not lst.is_empty():
if lst.remove() % 2 == 0:
count = count + 1
return count
| true |
aa8ade7b631f2e4b0708fe98e18622cd45bdfd8a | Python | jacobdavidson/Summer2018-ComputationalModelingCourse | /hw3/HHmodelsim-solver.py | UTF-8 | 2,412 | 2.96875 | 3 | [] | no_license |
# coding: utf-8
# In[7]:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
# common parameters
Cap=1
GK=1.44
Eleak=-54
km=7
# define gating variables
def m_inf(V):
return 1/(1+np.exp((-40-V)/km))
def n_inf(V,Vn,kn):
return 1/(1+np.exp((Vn-V)/kn))
# # Scipy solver
... | true |
349073bb4fb80152d57e570915311dc9a380c99e | Python | ravila4/biothings.api | /biothings/hub/datarelease/releasenote.py | UTF-8 | 9,162 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from dateutil.parser import parse as dtparse
import locale
locale.setlocale(locale.LC_ALL, '')
class ReleaseNoteTxt(object):
def __init__(self, changes):
self.changes = changes
#pprint(self.changes)
def save(self, filepath):
try:
import prettytable
except ImportEr... | true |
a4cacbbcf3c44eaeafa0f1699d28f99e075884c4 | Python | BedirT/games-puzzles-algorithms | /simple/ttt/ttt_lines.py | UTF-8 | 1,634 | 3.375 | 3 | [] | permissive | # 2019 RBH started lines-based ttt program
import numpy as np
# Cells
# 0 1 2 <- row 0 R0
# 3 4 5 <- row 1 R1
# 6 7 8 <- row 2 R2
# / \
# / | | | \
# D0 C0 C1 C2 D1 three columns and two diagonals
Empty, Black, White, Num_Cells, Num... | true |
84f69c63525f1ab481bc3109a7dee5aa18b4f134 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/3061.py | UTF-8 | 775 | 3.421875 | 3 | [] | no_license | def deleteLeadingZeroes(leadingZeroNumber):
lzLoopLength = len(leadingZeroNumber)
for i in xrange(0, lzLoopLength):
if leadingZeroNumber[i] != "0":
return leadingZeroNumber[i:]
def constructNumber(unsortedNumber, n):
return unsortedNumber[:n] + str(int(unsortedNumber[n]) - 1) + ("9" * (len(unsortedNumber) - n ... | true |
f36a871270c85a672a3aa4e9e4a38b11cc3b3c77 | Python | gucoloradoc/AQForecasting | /Monterrey/code/data_generator.py | UTF-8 | 2,765 | 2.890625 | 3 | [] | no_license | """Script to generate the dataset of observations from air quality measures.
"""
def dataset_generator(data, lookback, delay, batch_size=64,
step=1, target=5):
#%% Generator redefinition
def generator(data, predictors, lookback, delay, min_index, max_index,
shuffle=False, batch_si... | true |
3d69be7e3346c01f2bb00195d094c9e458e254db | Python | josephharding/sample-imports | /gen6.py | UTF-8 | 1,335 | 2.734375 | 3 | [] | no_license |
import unittest
def _call_if_exists(parent, attr):
func = getattr(parent, attr, lambda: None)
func()
class _DebugResult(object):
"Used by the TestSuite to hold previous class when running in debug."
_previousTestClass = None
_moduleSetUpFailed = False
shouldStop = False
if __name__ == '__... | true |
2168cb2d1ec4a9ceb1103d8afc7492b42087e3de | Python | mustahsin/python-programming | /uglynumber.py | UTF-8 | 654 | 3.234375 | 3 | [] | no_license | __author__ = 'Siam'
prime =[2,3,5]
ugly =[1]
for i in xrange(2,100):
num =i
j=0
current =[]
flag =0
while(j<len(prime)):
if(num%prime[j]==0):
num = num/prime[j]
if prime[j] not in current:
current.append(prime[j])
continue
... | true |
f29f0679204d69cf226adbbcb291203236069ff2 | Python | bazycristi21/Problems | /Greedy/1.py | UTF-8 | 1,148 | 3.375 | 3 | [] | no_license | Par=[(10,2,31),(8,50,60),(7,50,60)]
maxim=0
Par=sorted(Par)
for i in range (0,len(Par)):
Par[i]=sorted(Par[i])
print(Par)
for pereche in Par:
if(min(pereche[0],pereche[1],pereche[2])>maxim):
maxim=min(pereche[0],pereche[1],pereche[2])
dict ={}
for pereche in Par:
a=(pereche[0],perec... | true |
d6006c5805dc251f4001f02dcbaafda1ef5c01fb | Python | mhaetinger/python_ex | /ex011.py | UTF-8 | 236 | 3.875 | 4 | [] | no_license | print('=====EXERCÍCIO 11=====')
la = float(input('Qual a largura da parede? '))
a = float(input('Qual a altura da parede? '))
area = la * a
print('Será necessário {} litros de tintas para pintar {}ms².'.format((area/2), area))
| true |
057f90b504c71f45eb2e766b9d663f5d767f20b8 | Python | santosh6171/pyScripts | /reverseSentence.py | UTF-8 | 246 | 4.09375 | 4 | [] | no_license |
def get_reverse_string(str):
liststr = str.split()
return " ".join(liststr[::-1])
string = input("Enter a sentence to be reversed\n")
reverseString = get_reverse_string(string)
print ("Reversed string is: {0}" .format(reverseString))
| true |
4605138399765591ffb10a2f6f077d1a541315b1 | Python | vikramjit-sidhu/algorithms | /hacker_rank/warmup/manasa_stones.py | UTF-8 | 755 | 3.96875 | 4 | [] | no_license | """
Hacker Rank - Manasa and Stones
https://www.hackerrank.com/challenges/manasa-and-stones
"""
def last_stone_values(n, a, b):
old_set = {0}
new_set = set()
for i in range(n-1):
for poss_val in old_set:
new_set.add(poss_val+a)
new_set.add(poss_val+b)
old... | true |
f090b6381fe2fd6ab9efd6c0c10a6750c204cdce | Python | richardtoller/1007-AD2 | /frtest/preamp_test_gui.py | UTF-8 | 12,196 | 2.515625 | 3 | [] | no_license | import datetime
import queue
import logging
import signal
import time
import os
import threading
import tkinter as tk
from tkinter import filedialog
import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter,
AutoMinorLocator)
import numpy as np
fro... | true |
6beb359ba3877b80d305354287c783c64e0d6636 | Python | henhhalpert/Image-Classifier-Pytorch | /predict.py | UTF-8 | 1,776 | 2.90625 | 3 | [] | no_license | import argparse
from model import load_model,predict
import numpy as np
import json
"""
Use a trained network to predict the class for an input image
2 arguments must be entered: <path to the image> and <path to the trained model>
Input format:
python predict.py <path to image> <path to model> --category_names <dicti... | true |
0c06e3a179ca016aa1b7eb5d12072d5cdaaca648 | Python | krshrimali/OpenCV-with-Flask | /opencv-canny/test_image.py | UTF-8 | 413 | 2.8125 | 3 | [] | no_license | import cv2
import sys
if(len(sys.argv) >= 2):
edge_count = int(sys.argv[1])
image_name = str(sys.argv[2])
image_path = "static/" + str(image_name)
else:
edge_count = 100
image_path = "static/Kushashwa.jpg"
# read an image
print("Path: ", image_path)
img = cv2.imread(image_path, 1)
edge = cv2.Canny(... | true |
8c7c5f7ba2e2fb5cdc38abc092850cbe84d5b4ac | Python | khanhtc3010/check-match | /modules/text_processor.py | UTF-8 | 499 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding:utf-8 -*-
from models.sentence import *
########################################
def check_match(src_sentence, check_sentence):
try:
print 'check_match func had been called...'
src_sentence_conv = Sentence.convert_hiratext(src_sentence.encode('utf-8'))
check_sentence_conv = Sentenc... | true |
a2eade8f13b5d7191dddc7a04d2a9a4bc5e2a8d7 | Python | helloava/make-blog | /apps/views.py | UTF-8 | 3,701 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from flask import render_template, request, render_template, url_for, redirect, flash
from apps import app, db
from sqlalchemy import desc
from apps.forms import ArticleForm, CommentForm
from apps.models import Article, Comment
@app.errorhandler(404)
def page_not_found(e):
return render_te... | true |
847d40ea5c667b91e07f82a10d08b8609d464f81 | Python | Gavinaa123aah/castle | /scrapy/michelin_get_restaurant_details.py | UTF-8 | 959 | 2.59375 | 3 | [] | no_license | import re
import requests
from bs4 import BeautifulSoup
with open('restaurants_details',r) as read_f:
while True:
line = read_f.readline()
if line:
print line
else:
break
# base_url = 'https://restaurant.michelin.fr/restaurants/france/page-'
# for i in range(1, 34... | true |
72dd5456d54c29121f37f7f795dc8b3b9e2cdba6 | Python | Vivekg95/Python-Tutorial | /listiclmport.py | UTF-8 | 167 | 3.046875 | 3 | [] | no_license | class List:
def name(self):
list1=["raj","rahul","goa"]
print(list1)
def main():
obj=List()
obj.name()
if __name__=="__main__":main()
| true |
6774ccecfa28de32f997c6fb2cf20b58c404085e | Python | hwngenius/leetcode | /hot_100/31.py | UTF-8 | 517 | 2.96875 | 3 | [] | no_license | from typing import List
class Solution:
def nextPermutation(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
n=len(nums)
if n>1:
for i in range(n-1):
if nums[i]>nums[i+1]:
break
... | true |
46fbb250c5d8fca0957f5aae1ac2ee001a803898 | Python | TheGuyMatt/EulerProblems | /Problem1/multiples.py | UTF-8 | 175 | 3.265625 | 3 | [] | no_license | def findSum():
num = 0
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
num += i
return num
if __name__ == "__main__":
print(findSum())
| true |
bc7e5c6ffe5fe434e5d3b046808a2b75b856c557 | Python | JackHung0111/FreeCodeCamp_Project | /Scientific Computing with Python/Probability Calculator/prob_calculator.py | UTF-8 | 1,024 | 3.359375 | 3 | [] | no_license | # https://replit.com/@JackHung0111/boilerplate-probability-calculator
import copy
import random
# Consider using the modules imported above.
class Hat:
def __init__(self,**kwargs):
self.contents = []
for k in kwargs:
for i in range(kwargs[k]):
self.contents.append(k)
... | true |
2aa4a2c9ce15f7af993ec5f40b431e2e65e48360 | Python | daichenji/androidchenji-code | /trunk/Leveling/src/Analyzer/__init__.py | UTF-8 | 1,562 | 2.71875 | 3 | [] | no_license | from multiprocessing import Queue
from Collector import DataCollector
from Analyzer.Calculator import LocationCalculator
from Analyzer.T01Command import T01
import threading
class LevelAnalyzer():
def __init__(self,resultQueue):
#super().__init__()
self.resultQueue = resultQueue
... | true |
b2593687404c46c371a019e11a8784ff2ff4a0ab | Python | andreim9816/Facultate | /Anul II/Sem 2/Inteligenta artificala/Knowledge representation/Lab4-6/a_star_complet/244_Manolache_Andrei_Lab4_Pb1.py | UTF-8 | 7,398 | 2.9375 | 3 | [] | no_license |
""" definirea problemei """
class Nod:
def __init__(self, info, h):
self.info = info
self.h = h
def __str__ (self):
return "({}, h={})".format(self.info, self.h)
def __repr__ (self):
return f"({self.info}, h={self.h})"
class Arc:
def __init__(self, capat, varf, cost):
self.capat = capat
self.varf = ... | true |
5c888dfe13bd3391a4ef7b86dad97234c2272152 | Python | flybetter/Life_is_short_you_need_python | /learn/test/sequence.py | UTF-8 | 493 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@project= Life_is_short_you_need_python
@file= sequence
@author= wubingyu
@create_time= 2017/12/21 下午1:36
"""
def order(attr):
if len(attr) <= 1:
return attr
point = attr[len(attr) / 2]
before = [x for x in attr if x < point]
middle = [x for x in a... | true |
13f1844c9a990e9a349bd9550ce2d38eeb790b5b | Python | dahaiyu/EEG-Data-for-Mental-State-Detection-Code | /CSV_to_Image.py | UTF-8 | 1,369 | 2.703125 | 3 | [] | no_license | # Converting .csv files to images to train CNN
# Researchers: Jeffrey Chau, Apala Thakur
import os
import numpy as np
import pandas as pd
from PIL import Image
import math
base_dir = './'
train_dir = os.path.join(base_dir, 'train')
validation_dir = os.path.join(base_dir, 'validation')
train_drowsy_dir = os.path.join... | true |
3a9b2ba95b2dc4a692e86b4c17ff61204a468778 | Python | liberty-askew/MainProjects | /MathModelling/TrafficJams/traffic_discrete_base.py | UTF-8 | 6,159 | 3.34375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
class TrafficDiscreteBase:
"""
A class with helper methods and storage set up to simulate traffic
behaviour in terms of N cars on a circular road in terms of a
discrete road model.
"""
def __init__(self, density=0.1, vmax = 3, road_len=200, p_... | true |
8909abd9c80f36eb5f0980eea25f6b18303938a2 | Python | MagicHatJo/AoC2020 | /03/01.py | UTF-8 | 313 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
def get_trees(projection, dr, dd):
count = 0
x = dr
y = dd
while (y < len(projection)):
count += projection[y][x % len(projection[0])] == '#'
x += dr
y += dd
return count
with open("input") as f:
projection = f.read().splitlines()
print(get_trees(projection, 3, 1)) | true |
545be8f78d438f754d14e42c5a4de6e8a458e994 | Python | BruceMJ128/Python_Code-Python_for_data_analysis | /Learn python the hard way/ex21.py | UTF-8 | 329 | 3.5 | 4 | [] | no_license | def add(a,b):
print "ADDING %d + %d" % (a,b)
return a+b
def substract(a,b):
print "SUBSTRACTING %d - %d" % (a,b)
return a-b
def divide(a,b):
print "DIVIDING %d / %d" % (a,b)
return a/b
def multiply(a,b):
print "MULTUPLYING %d * %d" % (a,b)
return a*b
result = add(24, substract(divide(34,100),1023))
pri... | true |
0219a1a31663533f168fb86552caba9d56d60fcf | Python | gorkemcaylak/machine-learning-models | /kernel_ridge_regression/kernel_ridge.py | UTF-8 | 12,513 | 2.75 | 3 | [] | no_license | # In[]
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
n = 30
x = np.sort(np.random.rand(n,1), axis = 0)
y = (4 * np.sin(np.pi * x) * np.cos(6 * np.pi * np.square(x))).ravel()
eps = np.random.normal(0,1,y.shape)
y = y + eps
print("random data generated")
# In[]
def tra... | true |
fbd1d0cc8a939584cbfceec5fc121a25460799ac | Python | apshah92/Python-Programs-and-Games | /Trophyshelf.py | UTF-8 | 560 | 3.71875 | 4 | [] | no_license | def countVisible(trophies):
left_visible=0
right_visible=0
length=len(trophies)
for i in range(0,length):
if trophies[i]==max(trophies[0:i+1]) and trophies[0:i+1].count(trophies[i])==1:
left_visible+=1
for i in range(length-1,-1,-1):
if trophies[i]==max(trophies[i... | true |
77a317f29fba85e574c875386cd78c34330ec0a5 | Python | LachlanMarnham/PartitaDesktop | /core.py | UTF-8 | 904 | 2.578125 | 3 | [] | no_license | import sys
from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtWidgets import QApplication, QWidget, QToolTip, QPushButton
WINDOW_HEIGHT = 600
WINDOW_WIDTH = 971
class HomeScreen(QWidget):
def __init__(self, app):
super().__init__()
self.anchor = get_window_anchor(ap... | true |
2e92212ad3a45eee902d16478a5173155a9e0e9f | Python | Pelhans/2-lnn-el | /scripts/aida/test.py | UTF-8 | 769 | 2.6875 | 3 | [] | no_license | import multiprocessing
import tqdm
import concurrent.futures
manager = multiprocessing.Manager()
shared_dict = manager.dict()
num = 10000
def worker1(pack):
try:
(key, v) = pack
shared_dict[key] = v
except:
print(pack, 'error')
def threaded_work(l):
with concurrent.futures.ThreadPoolExecutor(max_workers=2) ... | true |
9d76785ae3c0483f47b565154189c3961367b47d | Python | xlwang123/Exercises | /image_classification/image_classification_with_5_methods/src_code/machine_learning/ML.py | UTF-8 | 5,157 | 3.078125 | 3 | [] | no_license | # python ML.py --dataset "set_name" --neighbors "# of neighbors"
# import the necessary packages
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
from imutils import paths
import numpy a... | true |
2edbcfce572e07f66ba8c3d3f971ff84bc7580d9 | Python | Diko741/Trazo-de-Pol-gono-de-N-lados-por-Algoritmo-DDA-Bresenham-s | /TrazoDePolígonoDDA_OraliaVianeyOsornioArce_3601.py | UTF-8 | 2,256 | 3.328125 | 3 | [] | no_license | import math
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from PIL import Image
plt.imshow(Image.open('fondo.png'))
coordenadas = []
def DDA(x1, y1, x2, y2):
dx = x2 - x1
dy = y2 - y1
xinc = 1 if dx > 0 else -1
yinc = 1 if dy > 0 else -1
if dx > dy:
... | true |
4ea21e70793b5635d0a50900c5721e7429e51732 | Python | Mome/watson | /watson/tree_patterns.py | UTF-8 | 8,137 | 2.78125 | 3 | [] | no_license | # The idea is to have a language to match certain patterns in parse trees
# and translate them to some kind of a semantic structure
from copy import copy
from nltk.tree import Tree, ParentedTree
from configurations import tree_patterns_path, pattern_semantic_separator
import find_answers
import recources as res
d... | true |