blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
7e14f3164b0fa87aa0e89b5ec636c8e46f025636 | tsbxmw/leetcode | /01.09.py | UTF-8 | 747 | 4.28125 | 4 | [
"MIT"
] | permissive | # 面试题 01.09. 字符串轮转
# 字符串轮转。给定两个字符串s1和s2,请编写代码检查s2是否为s1旋转而成(比如,waterbottle是erbottlewat旋转后的字符串)。
# 示例1:
# 输入:s1 = "waterbottle", s2 = "erbottlewat"
# 输出:True
# 示例2:
# 输入:s1 = "aa", "aba"
# 输出:False
# 提示:
# 字符串长度在[0, 100000]范围内。
# 说明:
# 你能只调用一次检查子串的方法吗?
class Solution:
def isFlipedString(self, s1: str, s2: ... | true |
2c97fe54a5866ba2362985cf2a6a694f2aababb3 | heyyou3/atcoder | /abc178/a/main.py | UTF-8 | 168 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def resolve():
n = int(input())
if n == 0:
return 1
else:
return 0
def main():
print(resolve())
main()
| true |
f9cec7d5e8a28bd651cf0a1a154b1a2f57f7f55f | kylin0925/leetcode | /765_CouplesHoldingHands.py | UTF-8 | 1,506 | 3.140625 | 3 | [] | no_license | class Solution2:
def minSwapsCouples(self, row):
"""
:type row: List[int]
:rtype: int
"""
lenrow = len(row) >> 1
pos = [x for x in range(lenrow)]
def dfs(i):
print("intput i",i)
if pos[i] == i:
return i
else... | true |
27d618fd9ae008feb130ec8512f7f77bcc49515c | KwickSilver/Stalker | /stock_analyzer.py | UTF-8 | 2,732 | 2.59375 | 3 | [] | no_license | from techpaisa_adapter import TPExtractor
from time import time
from stock_analyzer_helper import StockAnalyzerHelper
from analyzer_constants import AnalyzerConstants
tp_ext = TPExtractor()
helper = StockAnalyzerHelper()
constants = AnalyzerConstants()
comparison_criterias = constants.get_comparison_criterias()
def... | true |
e62d3c4aeb7eac63ae8af023ea21e3e354e481ff | Shobhit05/imageprocessing- | /face_eye_detection.py | UTF-8 | 1,050 | 2.96875 | 3 | [] | no_license | #BEFORE THIS U MAKE SURE THAT U HAVE HAARCASCADE FILES(EYE AND FACE THIS TIME) AND IMAGE IN YOUR CURRENT DIRECTORY
import numpy as np
import cv2
face = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye = cv2.CascadeClassifier('haarcascade_eye.xml')
image = cv2.imread('nit.jpg')
gray = cv2.cvtCo... | true |
710a621f3f014a1abf1fd6bb438e7800c7773f33 | pberczi/advent-of-code | /2015/21/21.py | UTF-8 | 2,151 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
import argparse
from copy import deepcopy as dc
import itertools as it
from math import ceil
# parse command line args
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--problem', metavar='n', type=int, default=1,
help='part of the question to solve')
parser.add_argu... | true |
a8798c4292821fbbcae72b60a6b0297d3c263835 | clebercarmo/BancoImobiliario | /test_propriedade.py | UTF-8 | 1,335 | 3.21875 | 3 | [
"MIT"
] | permissive | import unittest
from propriedade import Propriedade
from impulsivo import Impulsivo
class PropriedadeTest(unittest.TestCase):
def setUp(self):
self.nome = "Savassi"
self.valorDaVenda = 250
self.valorDoAluguel = 25
self.propriedade = Propriedade(self.nome, self.valorDaVenda, self.va... | true |
ee5de5b8200293caf6caeee8ae9b4bcf0670a434 | fabiands97/BotDetection | /BotDetect.py | UTF-8 | 1,276 | 3.09375 | 3 | [] | no_license | import csv
import datetime as dt
from datetime import datetime
#mengimpor file .csv sebagai Input data awal
with open('deteksibot.csv','r') as readFile:
reader = csv.reader(readFile)
baris = list(reader)
#iterasi tiap baris / username
for i in range(1, len(baris)):
#mengecek isi biodata user
bio=baris[i][3]... | true |
67b9199066d42ab001e46e0627637cf7aef715a2 | n33t1/jeopardy-spider | /src/jeopardyParser/RoundParser.py | UTF-8 | 6,752 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python -OO
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup as soup
import re
from collections import defaultdict
from Clue import Clue
from answerParser import parse_answer
import logging
logger = logging.getLogger(__name__)
class RoundParser:
def __init__(self, game, contestants):
self.gam... | true |
269fa009aa276117349dcb1616ca1d6391e35323 | yindashan/vongfong | /scripts/check_load.py | UTF-8 | 781 | 2.59375 | 3 | [] | no_license | #!/opt/virtual_python/bin/python
# -*- coding: utf-8 -*-
import sys
def error_handler(error_message=""):
# print error_message
print "HOST_STATUS | CPU_LOAD1=-1, CPU_LOAD5=-1, CPU_LOAD15=-1"
sys.exit(1)
def success_handler(load1, load5, load15):
print "HOST_STATUS | CPU_LOAD1=%s, CPU_LOAD5=%s, CPU_LO... | true |
38c691313561736e5fab868f42095e00d11c97f1 | h2oai/h2o-3 | /h2o-py/tests/testdir_algos/uplift/pyunit_uplift_rf_saveload.py | UTF-8 | 3,289 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import sys, os
sys.path.insert(1, os.path.join("..", "..", ".."))
import h2o
from tests import pyunit_utils, assert_equals
from h2o.estimators import H2OUpliftRandomForestEstimator
def uplift_random_forest_save_and_load():
print("Uplift Distributed Random Forest Save Load Test")
seed = 12345
treatment_c... | true |
20e3896232bbf26af8de9c86a7f4a20f6fe6b242 | yangyang0106/study | /day_20201228.py | UTF-8 | 1,512 | 3.703125 | 4 | [] | no_license | # list1 = [1,3,5,9,7,0]
# list2 = list1
# list1.remove(5)
# print(list2)
# def add(name,*args):
# sum = 0
# if len(args) > 0:
# for i in args:
# sum += i
# print('%s累加和是:sum:%s' % (name,sum))
# else:
# print("没有元素可计算,sum:" , sum)
#
# add('狒狒',5,8,6,9)
# def add(a,b=10):... | true |
ff9b3f16101bf13557a5f3ccff09096671b2c721 | MDU-PHL/mdu-pytools | /mdu_pytools/merge_ngs_lanes.py | UTF-8 | 3,211 | 3.0625 | 3 | [] | no_license | """
A script to merge lanes from an Illumina run
"""
import os
import collections
import pathlib
import re
import click
from loguru import logger
import tqdm
def cat_fastq(fastq_list, sample_id, read_number, outfolder):
"""
Generate a cat command line to join the lanes
"""
outfile = sample_id + "_" +... | true |
9bfd1d7be506cbe699f176823a42b9bfdd3609f3 | asilva111/CS3_Lab_6_DSF-Maze | /drawMaze.py | UTF-8 | 2,797 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 8 22:29:30 2019
@author: andre
"""
# Starting point for program to build and draw a maze
# Modify program using disjoint set forest to ensure there is exactly one
# simple path joiniung any two cells
# Programmed by Olac Fuentes
# Last modified March 28, 2019... | true |
21086429485375b51e7f8ab3d96aec7afe40d283 | vegito11/Data_Structure | /Data-Structure-Algorithm-Python3/09-Binary-Tree/08-Views-of-Tree/30-Diagonal-Sum.py | UTF-8 | 4,230 | 3.71875 | 4 | [] | no_license | from Queue import Queue
class Node:
# constructor take name and age as argument and create new Node
def __init__(self,data):
self.key=data
self.left=None
self.right=None
def __str__(self):
return f'{self.key}'
class Tree:
# it will initiallize root variable which point to ROOT of Tree
def ... | true |
ce924c625ad07273fcf1d2a5616f763ea0c4ae52 | akanksha33/Data-Visualization-using-Python | /_Day 1.py | UTF-8 | 1,524 | 3.75 | 4 | [] | no_license |
# coding: utf-8
# # DAY 1 Assignment : Line Graph
#
# Question 1
# In[1]:
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
x = np.arange(0,10)
y = x*x
# In[3]:
x
# In[4]:
y
# In[5]:
plt.ti... | true |
adbe08110c2dfb40dd8d2e01a6bc1350542ef469 | uoiah/gitLearn | /plottest.py | UTF-8 | 379 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['DejaVu Sans']
keys = mpl.rcParams.keys()
for key in keys:
if key ==
print(key)
x = np.linspace(-1, 1, 50)
print(x)
y1 = 2 * x + 1
y2 = 2 ** x + 1
#plt.figure()
plt.plot(x, y1)
#plt.figure()
plt.plot(x... | true |
f2e2a98855467b5a189dc0ee5d1db42f5cffcc62 | youmeb-lab/ptt-project | /tools/fetch-list | UTF-8 | 650 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
抓取文章連結
Options:
--stop=<string> 終止文章網址/ID
'''
from puppet import puppet
from ptt_crawler import Board
puppet('fetch-list', '0.1.0')
def main(program):
argc = len(program.args)
if argc > 0:
board_name = program.args[0]
boa... | true |
866b3b530b29b22ada2d7c70498392587c6a9a54 | anandvardhanmishra/datavis | /testing_basics/mpl_cubes.py | UTF-8 | 452 | 3.40625 | 3 | [] | no_license | import matplotlib.pyplot as plt
input_values = [1, 2, 3, 4, 5]
squares = [1, 8, 27, 64, 125]
plt.style.use('Solarize_Light2')
fig, ax = plt.subplots()
ax.scatter(3, 27)
ax.plot(input_values, squares, linewidth=3)
# Set chart title and label axes
ax.set_title("Cube Numbers", fontsize=24)
ax.set_xlabel("Value", fontsi... | true |
04c798a2b5bb252bce6bbfbfde58f71a75adad25 | JUNYOUNG31/TIL | /day1/dict_test.py | UTF-8 | 224 | 2.9375 | 3 | [] | no_license | student = {'강동옥':28, '김도훈':27}
student['양명균'] = 99
print(student)
print(student['김도훈'])
print(student['이상엽']) # 이렇게 쓰면 에러
print(student.get('문찬솔')) # 요건 에러 안남
| true |
2a4980337e767600dae536eea25caa5a8af169d9 | sanjitk7/ImageSpacialIntensityTransformations | /contrast_stretching.py | UTF-8 | 468 | 2.6875 | 3 | [] | no_license | def contrast_stretching(im,r1,s1,r2,s2):
pixelMapIn = im.load()
out1 = im.copy()
pixelMapOut = out1.load()
for i in range(im.size[0]):
for j in range (im.size[1]):
r = pixelMapIn[i,j][0]
if (r1!=r2):
pixelMapOut[i,j] = (int((r-r1)*(s2-s1)/(r2-r1))+s1,pixel... | true |
3cfdafb3bed1a2a934d1569fba0687d8bd8710d1 | lgblkb/lgblkb_tools2 | /lgblkb_tools/pathify.py | UTF-8 | 15,337 | 2.5625 | 3 | [
"MIT"
] | permissive | import functools
import glob
import os
import shutil
import tempfile
import zipfile
from datetime import datetime
from pathlib import Path, PosixPath
from typing import Callable
from box import Box
from checksumdir import dirhash
from . import logger
get_name = lambda some_path: os.path.splitext(os.path.basename(som... | true |
3bfe710d6b382b63c8e65a42482a9f92791d7607 | Heasummn/advent-2020 | /day4/main.py | UTF-8 | 2,330 | 3.1875 | 3 | [] | no_license | def read_file(filename):
with open(filename) as f:
lines = f.read().splitlines()
passports = []
last_i = 0
for i, line in enumerate(lines):
if line == '':
passports.append(" ".join(lines[last_i:i]))
last_i = i+1
# last line gets le... | true |
2e810934dd3845b81cf5dec530c363f96dae5809 | Livit/Labster.OAuth2Client | /tests/test_fetcher.py | UTF-8 | 2,527 | 2.6875 | 3 | [
"MIT"
] | permissive | """
Test Fetcher module functionality that was not tested anywhere else
"""
from datetime import timedelta
import six
from ddt import data, ddt
from django.utils import timezone
from testfixtures import LogCapture
from oauth2_client.fetcher import Fetcher, expiry_date
from tests.factories import ApplicationFactory
fr... | true |
9c1c360bf9350145823abc8ee8768ce1eb4df147 | brianbecker4/170project | /tspdp.py | UTF-8 | 1,603 | 3.015625 | 3 | [] | no_license |
import sys
import copy
class TSP():
def __init__(self, adjacency_matrix, locations):
self.matrix = adjacency_matrix
self.data = locations
self.n = len(self.data)
self.all_sets = []
self.g = {}
self.p = []
def main(self):
for x in range(1, self.n):
... | true |
0dd302caefb53b416537b05258b13d1b0a68511d | hsalih94/BioinformaticScraps | /pamlize.py | UTF-8 | 1,151 | 3 | 3 | [] | no_license | #! /usr/bin/env python
# pamlize.py
"""
Adds an 'I' for 'Interleaved' to the end of the first line of a phylip formatted alignment. The package paml requires that interleaved phylip alignnments be tagged with an 'I' but biopython doesn't place one and will not read an alignment that has one. I don't know if Biopytho... | true |
53ff620bc7f663cad7cc36f485d5902f293c0971 | daniilgaltsev/Neural-Style-Transfer | /style_transfer/models/style_transfer_model.py | UTF-8 | 6,431 | 2.9375 | 3 | [
"MIT"
] | permissive | import torch
import torchvision
import torch.nn as nn
import pytorch_lightning as pl
from ..data.image_triplet import ImageTriplet
from .neural_style_losses import ContentLoss, StyleLoss, TotalVariationLoss
from collections import defaultdict
from typing import List
class NeuralStyleTransferModel(pl.LightningModule):... | true |
8811732f84e4478b4b3d5c4364535a358e4e6d28 | bradselb/examples | /rpi/echo_serial.py | UTF-8 | 435 | 2.875 | 3 | [] | no_license | #! /usr/bin/python
import serial
import time
import sys
import os
line = str()
with serial.Serial(port="/dev/ttyAMA0", baudrate=9600) as in_port:
with serial.Serial(port="/dev/ttyACM0", baudrate=9600) as out_port:
while True:
ch = in_port.read()
out_port.write(ch)
if (... | true |
f660053ed04de4be72dfd666d119c3dbad4dcc97 | bkleynhans/PyMono | /gui/forms/modules/templates/module_template/template_frame/template_sub_frames/template2_frame.py | UTF-8 | 1,617 | 2.65625 | 3 | [] | no_license | ###
#
#
#
# Program Description :
# Created By : Benjamin Kleynhans
# Creation Date : February 18, 2020
# Authors : Benjamin Kleynhans
#
# Last Modified By : Benjamin Kleynhans
# Last Modified Date : February 18, 2020
# Filename : template2_frame.py
#
###
# Imports
from tkinte... | true |
cfdc84fee231a16174fe4f27d11f53382a6e28fb | IlyaKryukov/selenium_tensor | /Yandex_Search.py | UTF-8 | 2,136 | 2.9375 | 3 | [] | no_license | from BaseApp import BasePage
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
class YandexSearchLocators:
LOCATOR_YANDEX_SEARCH_FIELD = "//input[@name='text']"
class SearchHelper (BasePage):
def search_field(self):
"""
Поиск ... | true |
66bf61a9c743fb89c506050802c064478ab8e8e1 | SchrodengerY/Python-Programming | /Chapter5/C5.py | UTF-8 | 2,371 | 3.765625 | 4 | [] | no_license | # 文件和异常
# Read It
# 读取文件
print("Open and close the file.")
text_file = open("read_it.txt","r")
text_file.close()
print("\nReading characters from the file.")
text_file = open("read_it.txt","r")
print(text_file.read(1))
print(text_file.read(5))
text_file.close()
print("\nReading the entire file at once.")
text_file ... | true |
16fccd8bc93bea32a7fce3f802a3a95104aaa7e8 | gsudarshan1990/PythonSampleProjects | /StringExercise3.py | UTF-8 | 384 | 3.921875 | 4 | [] | no_license | """
Exercise 5: Take the following Python code that stores a string:str = 'X-DSPAM-Confidence:0.8475' Use
find and string slicing to extract the portion of the string after the
colon character and then use thefloatfunction to convert the extractedstring into a floating point number
"""
str='X-DSPAM-Confidence:0.8475'
... | true |
212df8f5f12dd32839142695e6e00b4b93d1198a | ppaille/ppaille.github.io | /optimize_SARIMAX.py | UTF-8 | 1,601 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 1 19:43:08 2019
@author: ppail_000
"""
import warnings
import itertools
import pandas as pd
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
# Define the p, d and q parameters to take any ... | true |
4d84de75c423d0b1da175230a335072a24984243 | 0Magnetix0/GeeksForGeeksCode | /Algorithms/Divide_and_Conquer/006TillingProblem.py | UTF-8 | 511 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python2.7
count = 0
def tileProblem(n,x):
global count
if n == 2:
print("Place the tile at the center of {0}".format(x))
count += 1
return ;
print("Place the tile at the center of {0}".format(x))
count += 1
a = x + "1"
tileProblem(n//2,a)
b = x + "2"
ti... | true |
9667d13de1090b3960be581a7e46e46963776bc9 | AllMyChanges/allmychanges.com | /allmychanges/management/commands/dev_guess_source.py | UTF-8 | 1,520 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | # coding: utf-8
from django.core.management.base import BaseCommand
from twiggy_goodies.django import LogMixin
from allmychanges.source_guesser import guess_source
from allmychanges.models import Changelog
class Command(LogMixin, BaseCommand):
help = u"""Command to test how well we are able to guess source by na... | true |
abcf15f2abd4564a7af517084c7e75383addd020 | lucoo01/Python_scrapy | /s_demo/gitchat/pipelines.py | UTF-8 | 2,276 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
import scrapy
from scrapy.pipelines.images import ImagesPipeline
from scrapy.exceptions import DropItem
from... | true |
611108886b72b64985775bed77a7ba802e592e1d | matinajafi/CryptoBitCoinPredict | /training.py | UTF-8 | 2,295 | 2.734375 | 3 | [] | no_license | from tensorflow import keras
from tensorflow.keras.layers import Bidirectional, Dropout, Activation, Dense
from tensorflow.python.keras.layers import LSTM
from parameters import WINDOW_SIZE, DROPOUT, ACTIVATION, LOSS, OPTIMIZER, BATCH_SIZE, EPOCHS
import matplotlib.pyplot as plt
def create_model(train_data_shape):
... | true |
c2dc22ad22ae21f79625b9f2136c54f332dfb1fe | jeamya1105/Python_DL | /TF+Keras sample code/(0722)DP學習紀錄 ch16.py | BIG5 | 3,173 | 3.15625 | 3 | [] | no_license | """[Matrix operation simulate Neural network operation]"""
#Y_output = activation(X_input * Weight + bias)
X = tf.Variable([[0.4, 0.2, 0.4]])
W = tf.Variable([[-0.5, -0.2],
[-0.3, 0.4],
[-0.5, 0.2]])
b = tf.Variable([[0.1, 0.2]])
XWb = tf.matmul(X, W) + b
Y1 = tf.nn.relu(tf.matmul(X,W)... | true |
1741897a8f64ab4a91ce7690099490ceb1b7aad5 | hulaoan/homework-arch-5 | /6/kangcunhua/MtImgServer.py | UTF-8 | 5,320 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Kang.Cunhua
# @Date: 2015-11-15 16:40:02
# @Last Modified by: Kang.Cunhua
# @Last Modified time: 2015-11-19 17:29:15
"""
第六次作业:将socket实现的通过http协议响应的图片服务器,将响应请求的处理改成多线程。
已知问题:
此处涉及到的守护进程继承,并没有起作用;
如果不拆分成两个类,多重继承的初始化比较复杂;
而且,起多线... | true |
80ac9ac8610c17bfa0bcc8532dd5f2ad050462d2 | cheapkai/MSU_Net | /solver.py | UTF-8 | 9,707 | 2.640625 | 3 | [] | no_license | import os
import csv
import Loss
from models import *
from torch import optim
from evaluation import *
class Solver(object):
def __init__(self, config, train_loader, valid_loader, test_loader):
# Data loader
self.train_loader = train_loader
self.valid_loader = valid_loader
self.test_loader = test_loader
#... | true |
2e797ce834c6f4e7af38e8580e6ad4a15469d1ef | wepods/annotation | /common/io.py | UTF-8 | 5,392 | 2.71875 | 3 | [
"MIT"
] | permissive | import os
import numpy as np
import matplotlib.pylab as plt
import yaml
import cv2
import glob
str2arr = lambda label, x1, y1, x2, y2, conf, freq: [int(label), int(x1), int(y1), int(x2), int(y2), float(conf),
int(freq)]
def read_detections_from_file(detection_file... | true |
e68e8335af91e55e47d182efc5ba3983fb45889a | amritinterest/amrit-interest | /python/democli/utils/log_util.py | UTF-8 | 648 | 2.96875 | 3 | [] | no_license | import coloredlogs
from verboselogs import VerboseLogger
class Color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
def create_logger... | true |
7225696c3667800246dbb5ede016cd442608b4e0 | GaryZ700/QM_UCI | /1dfock.py | UTF-8 | 5,098 | 3.125 | 3 | [] | no_license | #creates fock matrix for 1d particle in a box
import math
import numpy as np
###########################################
#init main variables
#number of particles
N = 2
#alphas and sigmas for each particles
basisGaus = {
"mus":[0.5,0.0],
"sigmas":[0.5,0.6],
"alphas":[0.0,0.0]
}
#size of gr... | true |
b6faaf61fc2ed26c05aadc89f8e41607f046ecca | Kapil-1729/Codechef | /chefst.py | UTF-8 | 150 | 2.84375 | 3 | [] | no_license | def stones():
n1,n2,m=map(int,input().split())
print(max(n1+n2-m*(m+1),abs(n1-n2)))
t=int(input())
for loop in range(t):
stones()
| true |
8158d1d6b822e67fd7d4861d68c26ac1333b395b | marcosihe/Metodos_Numericos | /newton_raphson_method.py | UTF-8 | 3,017 | 3.890625 | 4 | [] | no_license | import numpy as np
def f(x):
return x**3 - x**2
def derivative(x):
return 3*(x**2) - 2*x
def h(x):
return x**10 - 1
def derivative_of_h(x):
return 10*(x**9)
def f_2(x):
if x >= 0:
return np.sin(x) - 0.5*np.sqrt(x)
else:
print("\nEl valor pasado por parámetro no pertenec... | true |
47c4a09e57a6c7ab11ef3282e4772cc1e5a86f30 | tiilt-lab/Custom_SSI_Sensors | /TobiiEyeTracker/gaze_visual_consumer.py | UTF-8 | 1,208 | 2.578125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import math
MONITOR_HEIGHT = 1080
MONITOR_WIDTH = 1090
fig = ""
ax = []
hits_array = np.empty((MONITOR_WIDTH, MONITOR_HEIGHT))
flag = True
monitor_size = [1080, 1920]
def getOptions(opts, vars):
opts['monitor_size'] = [MONITOR_WI... | true |
cd859a286ce1c0190f2eebfa36e64a9ba75044ef | severinb/ChIPseq-pipeline | /components/zCutOff_byFDR/zCutOff_byFDR.py | UTF-8 | 1,480 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os
from string import *
import component_skeleton.main
from pylab import *
def get_zco(sorted_z_p, FDR):
z_co = 2
# loop downwards the list
for i in arange(len(sorted_z_p)):
fdr = (i+1. - sum(sorted_z_p[:i+1,1])) / (i+1.)
if fdr >= FDR:
z_co ... | true |
42b821dce082e05cc524fd2309a249b45df7bca0 | dannielgloria/pyhtonWebbApp | /basura/V1/services/shortner_url.py | UTF-8 | 1,167 | 3.25 | 3 | [] | no_license | import random
class id_generator:
# numero de supuestos registros existentes
id = random.randrange(100000000000, 10000000000000)
# Almacena el order_id en como identificador para no tener una url_id duplicado
order2id = {}
def url_id(self, order_id):
if order_id in self.order2... | true |
18827970d4dc8a2df444790aef5116835114d302 | llgeek/leetcode | /1197_MinimumKnightMoves/solution.py | UTF-8 | 937 | 3.375 | 3 | [] | no_license | class Solution:
def knightMoves(self, x, y):
x, y = abs(x), abs(y)
dx = [-2, -1, 1, 2, 2, 1, -1, -2]
dy = [1, 2, 2, 1, -1, -2, -2, -1]
visited = set()
queue = [(0, 0)]
# visited.add((0, 0))
step = 0
while queue:
nextlevel = []
s... | true |
df7ab22bb9432b0dd1c358b33bea51ced95b89b1 | raj4learn/CompareMigData | /venv/Lib/site-packages/pyexcelerate/Alignment.py | UTF-8 | 3,375 | 2.734375 | 3 | [] | no_license | import six
from . import Utility
from . import Color
class Alignment(object):
__slots__ = ('_horizontal', '_vertical', '_rotation', '_wrap_text', 'id')
def __init__(self,
horizontal='left',
vertical='bottom',
rotation=0,
wrap_text=False):
... | true |
4e27fa61a25a5bf39fad5ec4c02a561988b27b48 | TakuroKato/AtCoder | /agc014_A.py | UTF-8 | 517 | 3.046875 | 3 | [] | no_license | #! -*- coding:utf-8 -*-
a,b,c = map(int,input().split())
count = 0
flag = 0
while True:
at = (b+c)/2
bt = (a+c)/2
ct = (b+a)/2
if flag == 0 and (a % 2 == 1 or b % 2 == 1 or c % 2 == 1):
flag = 1
break
if flag == 1 and at == a and bt == b and ct == c:
flag = 0
break
... | true |
722923242812699c60b21c9f10e9edb5a52fcc99 | MrHamdulay/csc3-capstone | /examples/data/Assignment_2/bllkat005/question3.py | UTF-8 | 295 | 3.46875 | 3 | [] | no_license | #BLLKAT005
#Kate Bell
#11 March 2014
import math
x=math.sqrt(2)
pi_approx=2
while(x<2):
pi_approx=pi_approx*(2/x)
x=math.sqrt(2+x)
print("Approximation of pi:",round(pi_approx,3))
r= eval(input("Enter the radius:\n"))
print("Area:",round(pi_approx*r*r,3))
| true |
723f8b728b73cdc34bc2a8ff0aa5169a01da645d | lewi0332/python-object-relations-one-to-many-lab-nyc-ds-career-012819 | /test/index_test.py | UTF-8 | 2,835 | 2.921875 | 3 | [] | no_license | import unittest2 as unittest
import sys
sys.path.insert(0, '..')
from driver import Driver
from trip import Trip
from owner import Owner
from car import Car
class TestOneToManyRelationships(unittest.TestCase):
global driver_1
driver_1 = Driver("Dwight Schrute")
global trip_1
trip_1 = Trip("11 Broadway... | true |
fe7df5fc390134043e3a83e2a0074a9a453cb946 | Nurullah1313/GitHub | /python _geometric_shape_dedection/geo-shape-ded.py | UTF-8 | 1,089 | 2.515625 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("girilmez.jpg")
img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret,thrash = cv2.threshold(img,180,255,cv2.THRESH_BINARY)
contours, _ = cv2.findContours(thrash,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
for contour in contours:
approax = cv2.approxPolyDP(contour,0.01*cv2.arcLengt... | true |
4fc48db21556bbcc39e0c8c10b5f920f0aebc2ed | zywh/waterlooccc | /2015/Junior/J5.py | UTF-8 | 2,511 | 3.859375 | 4 | [] | no_license | # CCC 2015 Junior 5: Pie Day
#
# This is a recursion problem (or possibliy a Dynamic Programming problem)
#
# This is the recursive solution.
#
# Given n (number of pieces of pie) and k (number of people) and the minimum
# number of pieces that can be taken, the number of ways the pie can be destributed
# is:
# 1... | true |
3eb1f0438e683408e201bbdd12304d4a8656d30f | VRER1997/leetcode_python | /easy/171 Excel Sheet Colum Number.py | UTF-8 | 222 | 3.09375 | 3 | [] | no_license | class Solution:
def titleToNumber(self, s):
"""
:type s: str
:rtype: int
"""
ans = 0
for s_l in s:
ans = ans * 26 + ord(s_l) - ord('A') + 1
return ans | true |
83dd4c5fe2d57dc86cde08fc990777576d7365ab | jtlai0921/BU1919_- | /code/chapter9/case_9_2.py | UTF-8 | 169 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""this is a example for chapter 9 """
try:
print 'I am in try block'
f = open(r'C:\Python26\3x.py')
finally:
print 'End of programm' | true |
2c5e3a81667a8e8fb4640e343841040982881dad | IsaacDiaz09/Python-repo | /Networking/webScrapping.py | UTF-8 | 862 | 2.546875 | 3 | [] | no_license | # https://stackoverflow.com/questions/16627227/problem-http-error-403-in-python-3-web-scraping
# https://stackoverflow.com/questions/45086383/python-requests-403-forbidden-despite-setting-user-agent-headers
# https://docs.python.org/es/3/library/urllib.html
import urllib.request
import urllib.error
import ssl
ctx = s... | true |
bab5c55010f0c1438f8f56a14f65e45b362a2342 | amirhdre/DigitalImageProcessing---Spring2021 | /HW1/HW1_9733023_Code_Q04.py | UTF-8 | 3,831 | 3.546875 | 4 | [] | no_license | '''
___OVERVIEW___
CODE FOR QUESTION 4 - HW 1
___SUMMARY___
Image quantization and thresholding
___AUTHOR___
Amirhossein Daraie — 9733023
___DATE___
25/03/2021
05/01/1400
'''
import numpy as np
import matplotlib.pyplot as plt
import cv2
def print_img_data(img,title='Image'):
"""This function prints some essen... | true |
33b86b25d581503977a19dc4523ac06757dcdb09 | fishcat7/age | /age.py | UTF-8 | 280 | 3.625 | 4 | [] | no_license | car = input('請問你有沒有開過車?')
age = input('請輸入你的年齡:')
age = int(age)
if age < 18 and car == '有':
print('你才', age, '怎麼會開過車???')
elif age >= 18 and car == '沒有':
print('可以去考駕照喔')
else:
print('很好,沒有問題')
| true |
15eee729417f55951621ea7a49bf790a0b57e4a9 | virresh/ANTLR4-Example | /main.py | UTF-8 | 1,384 | 3.046875 | 3 | [] | no_license | import antlr4
from antlr4.InputStream import InputStream
from arithmeticLexer import arithmeticLexer
from arithmeticParser import arithmeticParser
import sys
def handleMultiply(expr):
multiplying = True
value = 1
for child in expr.getChildren():
if isinstance(child, antlr4.tree.Tree.TerminalNode):
... | true |
931dfd6b8a9a3950e81ffb2f01947024cc06043e | akash682/Natural-Language-Processing_UDEMY | /Lesson8/Lesson8.py | UTF-8 | 442 | 4.5 | 4 | [] | no_license | print("HelloWorld")
a = 12
b = "This is a string"
c = 12.5
print(a, b, c)
#Mathmatical Operation
num1 = 12
num2 = 2
result = num1 + num2
print(result)
result = num1 - num2
print(result)
result = num1 * num2
print(result)
result = num1 / num2
print(result)
result = num1 % num2
print(resu... | true |
86bf2532d9ed1fbf2631f6bcb4b7a8bfcf4d85f1 | seoninja13/Algo_DataStructures | /Interviewcake/findStPr.py | UTF-8 | 811 | 3.671875 | 4 | [] | no_license | # def stockPriceYesterday(myList):
def findMin(myList):
min=myList[0]
max=myList[0]
lenList=len(myList)
minPos,maxPos=0,0
diff=max-min
for i in range(0,lenList):
if myList[i]< min:
min=myList[i]
minPos +=1
if myList[i] > max:
max= myLis... | true |
671654a27ae9a75d7e401e517b387f7ae985160a | dudfo2347924/pyworks | /ch.08/tryexcept/raise_error.py | UTF-8 | 226 | 2.953125 | 3 | [] | no_license | class Bird:
def fly(self):
print("새가 날아감니다.")
raise NotImplementedError
0
class Eagle(Bird):
def fly(self):
print("독수리가 하늘 높이 난다.")
eagle = Eagle()
eagle.fly() | true |
af6ae035d782fd4856c7d1e1d16f99d4437782ec | wangleiliugang/data | /aid1805/pbase/83_student_exercise.py | UTF-8 | 357 | 2.71875 | 3 | [] | no_license | # 练习:修改之前的学生管理系统
# 原学生数据使用字典存储,现改为用对象进行存储,要求自定义Student类来封装学生的信息和行为
# file: student_exercise.py
class Student:
def __init__(self, n, a, s):
self.name = n
self.age = a
self.score = s
# 详解见student_.._83.py
| true |
c3c0c84b8ad9f0f9a4330344d451838061178f77 | Sene68/python_study | /introduction/helloworld.py | UTF-8 | 586 | 4.5625 | 5 | [] | no_license | #Here is a sample line of code that can be executed in Python:
#print("Hello, World!")
#You can just as easily store a string as a variable and then print it to stdout:
#my_string = "Hello, World!"
#print(my_string)
#The above code will print Hello, World! on your screen. Try it yourself in the editor below!
def pri... | true |
b100862e40ec3ba2be079d1b09b909b96d643aa9 | Shamoonmohd/ALGONOMIC-FLUX | /compiledata.py | UTF-8 | 1,487 | 2.953125 | 3 | [] | no_license | ##_____________________________
## import the desired libraries
import bs4 as bs
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import numpy as np
import os
import pandas as pd
import pandas_datareader.data as web
import pickle
import requests
import time
##_______... | true |
04446e76ddcf7c176967014c4df8b0775ec038e6 | robintw/sqlalchemy-units-example | /model_basic.py | UTF-8 | 851 | 2.671875 | 3 | [] | no_license | #
# Example code from 'Pint + SQLAlchemy = Unit consistency and enforcement in your database' poster
# at PyData Global 2020
# by Robin Wilson (robin@rtwilson.com)
#
# To understand this you will need to understand the basics of SQLAlchemy - try following
# this tutorial first if you're unsure: https://docs.sqlalchemy... | true |
dcfd3f100a95e3ea8fce33575b57a78f2cb42d78 | akshaydixi/spaceimpact | /Pygame/4-2.py | UTF-8 | 1,406 | 3.328125 | 3 | [
"Unlicense"
] | permissive | # Move Pikachu around with the keyboard
import pygame
import time
MAX_WIDTH = 600
MAX_HEIGHT = 600
class Sprite: # The basic building block of each entity
def __init__(self,xpos,ypos,filename): # This function will run each time a Sprite object is created
self.x = xpos
self.y = ypos
s... | true |
aab1388ba04a145a6c5a2610cf9bef807e69a828 | SJeliazkova/SoftUni | /Python-Fundamentals/Exercises-and-Labs/functions_exercises/09_factorial_division.py | UTF-8 | 229 | 3.84375 | 4 | [] | no_license | def factorial(num):
result = 1
for n in range(1, num + 1):
result *= n
return result
number_1 = int(input())
number_2 = int(input())
result = factorial(number_1) / factorial(number_2)
print(f"{result:.2f}") | true |
72d83f3272c2a794f1c38c9c1d74bb7797a3caf1 | zhanglid/EE500 | /ASAM-2D/testre.py | UTF-8 | 1,706 | 2.6875 | 3 | [] | no_license | import os
import re
PARTTEN_RULENUMBER = re.compile(r'int numRules = \d+;')
PARTTEN_NOISETYPE = re.compile(r'int noisetype = \d+;') #
PARTTEN_FUNCTION = re.compile(r'fxn1\(i,2\) = \S+ \+ n\[i\]')
PARTTEN_INPUTRANGE = re.compile(r'double min_x = [\d\.]+, max_x = [\d\.]+;') #
MY_FUNCTION = '(sin(fxn1(i,0))*cos(fxn1(i,1)... | true |
8f5eeaf79417f1a51876034c37eaf101954612c6 | Abhi098/weight-height-_prediction | /weight_predict.py | UTF-8 | 584 | 3.015625 | 3 | [] | no_license | import pandas as pd
from sklearn import preprocessing
from sklearn.linear_model import LinearRegression
from sklearn import model_selection
label_enc = preprocessing.LabelEncoder()
data=pd.read_csv("weight-height.csv")
print(data.columns)
data1=data['Gender']
label_enc.fit(data1)
data['Gender']=label_enc.trans... | true |
e6460de5d41caad1013631b2cca182aa96da3648 | crisfelip/programacion1 | /clases/juego1.py | UTF-8 | 785 | 3.359375 | 3 | [] | no_license | #constantes
MESNSAJE_SALUDO = "Bienvenido a este programa"
PREGUNTAR_NUMERO ="en este juego esta un numero del 1-10 intentalo tres veces maximo suerte,ingresa tu numero: "
PREGUNTA_FALLIDA = "no no no, fallaste, ingresa otro numero :"
MENSAJE_ganaste = "Felicitaciones ganaste "
MENSAJE_perdiste = "lo siento intentalo ... | true |
9a6a15b3b32a2b47dee2a2d34ffc4a5d58f0c19e | Omkommersind/arcana_server | /arcana_server/errors/errors.py | UTF-8 | 235 | 2.578125 | 3 | [] | no_license | from enum import IntEnum
def choices(em):
return [(e.value, e.name) for e in em]
class Errors(IntEnum):
NOT_AUTHORIZED = 401
BAD_REQUEST = 400
ACCESS_DENIED = 403
NOT_FOUND = 404
INTERNAL_SERVER_ERROR = 500
| true |
1707767eec00b8344baaa9efb42df9fbc126596a | KayckKenji/304-exercicios-python | /p.py | UTF-8 | 1,268 | 3.921875 | 4 | [] | no_license |
# como abrir e usar o terminal para python?
#abrir terminal>novo>digitar: python + nomedoarquivo.py > enter
#exercicio 1
# a = int(input("Digite um número"))
# b = int(input("Digite um número"))
# c = int(input("Digite um número"))
# d = int(input("Digite um número"))
# media = (a+b+c+d)/4
# print(media... | true |
ff2ca69a4c9954c2a29945430037e677c8bc74c9 | w3labkr/py-flask | /backend/middlewares/middleware.py | UTF-8 | 1,441 | 2.5625 | 3 | [
"MIT"
] | permissive | # Miscellaneous operating system interfaces
import os
# Basic date and time types
from datetime import date, datetime, timedelta
# Higher-order functions and operations on callable objects
from functools import wraps, update_wrapper
# The Python micro framework for building web applications.
from flask import make_r... | true |
0bbc415b1d032ea4882e8641f83a5371a3deb1bb | mkbera/utilities | /utilities/parallel_prog.py | UTF-8 | 2,200 | 2.921875 | 3 | [] | no_license | import os
import threading
from threading import Thread
from multiprocessing import Process, Array
import multiprocessing
import time
'''
TODO: the main thread keeps one core busy; resolve this issue
'''
def run_parallel_progs_in_threads(cmd_list, n_procs, verbose=False):
flag = [False for i in range(n_procs)]
thre... | true |
6a7ed0c7494ef8942105d235a7f3293237b9d7fd | m-shayanshafi/PoisoningDeepNLP | /src/plotResults.py | UTF-8 | 2,889 | 2.515625 | 3 | [] | no_license | import pdb
import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import re
colors = ['black', 'red', 'green', 'blue', 'yellow']
labels = ['30% poisones', 'RONI - Calibrated Centralized']
def plotResults(outputFile, inputFiles):
print outputFile
fig, ax ... | true |
e7ba1935584a09a1be81cab37314947c5ad8efbf | lukaszog/HadoopProjects | /WordCount/reducer.py | UTF-8 | 268 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import fileinput
last = None
count = 0
for line in fileinput.input():
word = line.split()[0]
if last != word:
if last:
print("%s\t%d" % (last, count))
last = word
count = 1
else:
count += 1
| true |
8deed8d35497f30dfed976a8e3b99d84130e7d0d | nkesquerda/idescat-py | /proves/onomastica.py | UTF-8 | 3,601 | 2.96875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from base import Base
from excepcions import *
import re
class OnomasticaBase(Base):
"Prepara la petició a l'API"
def setOperacio(self, op):
"Configura l'operació del servei"
if op in ['dades', 'cerca', 'sug']:
self.op = op
if self.op == 'dad... | true |
c302de392f57d2527d0f0de5ac548ff8fe50aee4 | Electromorphous/FlaskUnityApp | /app/__init__.py | UTF-8 | 2,597 | 2.859375 | 3 | [] | no_license | # this file tells python that this is a package and initializes the things we need
from flask import Flask, render_template, url_for, redirect, request, flash
from flask_bcrypt import Bcrypt
import os
import secrets
import zipfile
from werkzeug.utils import secure_filename
import sys
app = Flask(__name__)
app.config[... | true |
00bf20c9010b87307c4405481003157375902f29 | kangqiwang/myLeetcode | /Python/0146. LRU Cache.py | UTF-8 | 3,729 | 3.921875 | 4 | [
"MIT"
] | permissive | '''
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.
Implement the LRUCache class:
LRUCache(int capacity) Initialize the LRU cache with positive size capacity.
int get(int key) Return the value of the key if the key exists, otherwise return -1.
void put(int key, int value) Up... | true |
f4cb2484a958df8cfc88877ba3670eb07522c5c5 | scaraclette/pycode | /CtCI/week2.py | UTF-8 | 1,299 | 3.75 | 4 | [] | no_license | def twoSumBinary(arr, target):
first = 0
last = len(arr) - 1
while (first <= last):
print("first: ", first)
print("last: ", last)
comp = arr[first] + arr[last]
print("comp", comp)
if comp == target:
return [first, last]
elif comp > target:
last -= 1
else:
first += 1
... | true |
15c9758467e302c10f0843ae69a704665381b899 | errnox/some-python-things | /hashlib/hash.py | UTF-8 | 695 | 3.328125 | 3 | [] | no_license | import hashlib
class App(object):
def __init__(self, payload='abc', repetitions=10):
self.payload = payload
self.repetitions = repetitions
self.hashes = []
def run(self):
hash = self.generate_md5(self.payload)
for i in range(self.repetitions):
hash = self.generate_md5(hash)
self.h... | true |
a62478551530ccbb1495b4565832468f8ef4fe7d | chromium/chromium | /content/test/gpu/gold_inexact_matching/binary_search_parameter_optimizer.py | UTF-8 | 4,062 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import enum
import logging
from typing import Optional, Tuple
import gold_inexact_matching.base_parameter_optimizer as base_optimizer
from gold_inexact_matching import common_ty... | true |
16bf11fffe2ec2a00ceba0f86003876f3f9a92a5 | chrisxue815/leetcode_python | /problems/test_0209_binary_search.py | UTF-8 | 1,237 | 3.390625 | 3 | [
"Unlicense"
] | permissive | import unittest
class Solution:
def minSubArrayLen(self, s, nums):
"""
:type s: int
:type nums: List[int]
:rtype: int
"""
result = len(nums) + 1
sums = [0] * len(nums) # itertools.accumulate
sum_ = 0
for i, num in enumerate(nums):
... | true |
346c134957ed5af0407c165fa3015c4a13575401 | MichelPinho/exerc-cios | /Desafio_74_MaiorMenor_Tuplas.py | UTF-8 | 428 | 4.375 | 4 | [] | no_license | # Crie um programa de 5 números aleatórios e coloque em uma tupla . Após isso :
# mostre os números gerados :
# mostre o menor e o maior número da tupla :
from random import randint
n = (randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10))
print(f'\nOs números sorteados foram: {n}')
print(f... | true |
47781daddc87af45817788800adff4e5cc52d54e | cazgp/scrabble-solver | /models.py | UTF-8 | 1,361 | 2.828125 | 3 | [] | no_license | from sqlalchemy import Column, String, Integer, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Anagram(Base):
__tablename__ = "anagrams"
id = Column(Integer, primary_key=True)
sorted = Column(String)
words... | true |
9a774da7fafe833bde28cf9f9b82f944849a570f | xtreia/pythonBrasilExercicios | /01_EstruturaSequencial/13_peso_ideal_sexo.py | UTF-8 | 488 | 4.34375 | 4 | [] | no_license | sexo = raw_input('Informe seu sexo (M/F): ')
altura = float(raw_input('Informe sua altura (em metros): '))
peso = float(raw_input('Informe o seu peso (em kg): '))
if (sexo == 'M'):
pesoIdeal = (72.7 * altura) - 58
else:
pesoIdeal = (62.1 * altura) - 44.7
if (peso > pesoIdeal):
print 'Voce esta acima do se... | true |
7e4b078feb930506124ae0c8c1d54d766a787c3f | laurapulecio/proyectogrupo1 | /mcd.py | UTF-8 | 214 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 06:47:30 2020
@author: Usuario
"""
def MCD(n,d):
if n%d==0:
return d
else:
return MCD(d, n%d)
if __name__=="__main__":
print(MCD(40,100)) | true |
47922bf89c526472af25aea28c72ac97ae0aedb4 | grayjac/Test_Project | /scratch.py | UTF-8 | 93 | 3.390625 | 3 | [] | no_license | my_list = [1, 2, 3]
new_list = my_list.append(4)
for element in my_list:
print(element)
| true |
095319c5af5da82e7528aa31b96b484aebbdc992 | cong0158/MGMT190 | /MGMT190-Milestone_Project1.py | UTF-8 | 2,838 | 3.796875 | 4 | [] | no_license | import random
def display_board (board):
count = 0
print("-------------")
for i in board[1:]:
if count % 3 == 0:
print("|", end = "")
print(" " + i + " |",end = "")
count += 1
if count % 3 == 0:
print("\n-------------")
def player_input():
p_i = ... | true |
b86ea263bf95c05cff4fc1904d7ab6f1f8407cfd | ChangxingJiang/LeetCode | /1601-1700/1622/1622_Python_2.py | UTF-8 | 1,588 | 3.71875 | 4 | [] | no_license | class Fancy:
_MOD = 10 ** 9 + 7
class Node:
__slots__ = ["name", "val", "parent"]
def __init__(self, name, val, parent=None):
self.name = name # 节点的类型
self.val = val # 节点的值
self.parent = parent # 节点的父节点
def __init__(self):
self.lst = [] # 叶节... | true |
adc860e682bb914c674ba1597ebd4b4c297313e8 | mattbellis/Siena_College_Physics_Jess_Muenkel | /aps_stuff/read_files_high_pt_muon_jet.py | UTF-8 | 1,368 | 2.53125 | 3 | [] | no_license | import siena_cms_tools as cms
import numpy as np
import matplotlib.pylab as plt
import math
import sys
f = open(sys.argv[1])
pt1=[]
pt2=[]
jet_pt=[]
muon_pt=[]
collisions = cms.get_collisions(f)
for collision in collisions:
#cms.pretty_print(collision)
jets,topjets,muons,electrons,photons,met = collision... | true |
ca27ae043ad7d99f5c2fd3032fa512e795378f27 | iproduct/course-social-robotics | /07-numpy-pandas-lab/numpy02.py | UTF-8 | 1,089 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
if __name__ == '__main__':
a = np.array([[2,3,5], [7,3,13], [17,19,23]])
b = np.arange(1, 10).reshape((3,3))
print(a)
print(b)
print(a+b)
print(a-b)
print(a*b)
print(np.multiply(a, b))
print(np.dot(a, b))
print(a.dot(b))
print(np.sqrt(a))
# aggregati... | true |
852d0f54c765fdaf45b5851ca6f46f44f3f29df8 | Nithanaroy/kaggle-tensorflow-speech-recognition | /src/utils.py | UTF-8 | 21,258 | 2.546875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
from tensorflow.python.ops import io_ops
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import label_binarize
import numpy as np
import h5py
import gc
fro... | true |
21cff52b472fadc4f4c9443f76c498659be6bde1 | ari-gunawan/Desain-Analisis-Algoritma | /Minggu 9.py | UTF-8 | 1,032 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
myWeb = nx.DiGraph()
myPages = range(1,5)
# In[6]:
connections = [(1,2),(1,4),(1,5),(1,6),(2,1),(2,3),(3,2),(3,4),(4,1),(4,3),(... | true |
0521c0fe91130e255958e7a993286e27ea7ee621 | Chris-Johnston/Internet-Xmas-Tree | /lights/patterns/wipeup.py | UTF-8 | 1,213 | 3.296875 | 3 | [
"MIT"
] | permissive | """
Wipeup Pattern
"""
from .pattern import Pattern
import time
class WipeUp(Pattern):
"""
WipeUp pattern class
"""
def __init__(self):
super(Pattern, self).__init__()
@staticmethod
def __get_time():
return time.time() * 1000
@classmethod
def get_id(self):
""... | true |
32f324e1b031d763fb2d7fd92962f0cd7b3baff8 | ermeksnow/geekbrains-python-homework | /exaple06.py | UTF-8 | 366 | 3.5 | 4 | [] | no_license | start = int(input("сколько спортсмен пробежал в первый день тренировок?"))
finish = int(input("сколько спортсмену нужно пробежать для победы?"))
i = 1
while start < finish:
start = start + (start*0.1)
i+=1
else:
print('дни спортивных мытарств',i)
| true |
8c4c198b7169a0fbdbb1dc5a729758609b7d0b53 | fraware/MLMONDAYS | /2_ObjRecog/plot_funcs.py | UTF-8 | 2,991 | 2.71875 | 3 | [] | no_license |
#see mlmondays blog post:
import os
os.environ["TF_DETERMINISTIC_OPS"] = "1"
##calcs
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
##plots
import matplotlib.pyplot as plt
SEED=42
np.random.seed(SEED)
AUTO = tf.data.experimental.AUTOTUNE # used in tf.data.Dataset API
tf.random.set... | true |