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 |
|---|---|---|---|---|---|---|---|---|---|---|
e2201047aee28d945eb1e8bbb290d75f8e7a244c | sixfunctors/ProjectEuler | /30-39/euler33.py | UTF-8 | 1,053 | 3.53125 | 4 | [] | no_license | # Project Euler Problem 33
# by Connor Halleck-Dube
import time
t0 = time.clock()
## Solution 1: Check all pairs
pairs = []
for d in range(11, 99):
for n in range(11, d):
num = str(n)
den = str(d)
if (num[0] == den[1]):
if (num[1] == '0') or (den[0] == '0'):
co... | true |
88e5c7bbe741575aa99c8f41bdd929c8fd6abf49 | NZXGO/Crawler | /testcode/1/p18.py | UTF-8 | 495 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 21 16:14:51 2017
解析robot.txt文件,判断该用户代理是否合法
@author: 小甜甜
"""
import robotparser
rp = robotparser.RobotFileParser()
rp.set_url('http://example.webscraping.com/robots.txt')
rp.read()
url = 'http://example.webscraping.com'
user_agent = 'BadCrawler'
print( rp.can_fetch(user_a... | true |
85e96874aadcf535806968b172458a4c30f205fc | iorodeo/mct | /mct_active_target/src/mct_active_target/active_target_dev.py | UTF-8 | 2,555 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
import serial
import time
RESET_SLEEP_DT = 2
class ActiveTargetDev(serial.Serial):
"""
Provides a simple serial interface to the arduino controlled active calibration
target.
"""
def __init__(self,target_info):
port, baudrate, square, ledArraySize, m... | true |
1bd781350aa09d51274b89df794f308bf8580c56 | goldfrad/mobileye-project | /Phase1/find_red_and_green_lights.py | UTF-8 | 4,155 | 3.125 | 3 | [] | no_license | try:
print("Elementary imports: ")
import os
import json
import glob
import argparse
print("numpy/scipy imports:")
import numpy as np
from scipy import signal as sg
import scipy.ndimage as ndimage
from scipy.ndimage.filters import maximum_filter
print("PIL imports:")
fr... | true |
7a866f14af8853af7e2eaba9531831eb3ff2dc32 | birkin/barcode_id_code | /barcode_extractor.py | UTF-8 | 4,848 | 2.84375 | 3 | [] | no_license | """ Extracts barcodes. """
import json, logging, os, pprint, time
import requests
logging.basicConfig(
# filename=os.environ['zzz'],
level=logging.DEBUG,
format='[%(asctime)s] %(levelname)s [%(module)s-%(funcName)s()::%(lineno)d] %(message)s',
datefmt='%d/%b/%Y %H:%M:%S',
)
log = logging.getLogg... | true |
d8a26ac212d51613e1876c245cd4df1f65a15501 | pylover/pymlconf | /pymlconf/models.py | UTF-8 | 7,284 | 3.25 | 3 | [
"MIT"
] | permissive | import abc
import copy
from collections.abc import Iterable
from collections import OrderedDict
from os import path
from .errors import ConfigurationAlreadyInitializedError, \
ConfigurationNotInitializedError
from . import yamlhelper
def isiterable(o):
if isinstance(o, (bytes, str, type)):
return Fal... | true |
9faec8ede07ad551a4460f7c298c9a9e7eced8c3 | marcrobards/entracker | /server/race_scraper.py | UTF-8 | 31,114 | 2.546875 | 3 | [] | no_license | __author__ = 'Marc'
import urllib2
from bs4 import BeautifulSoup
import pymysql
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
import logging
from logging import handlers... | true |
704a16422d20c8fc903adc41df649f3e02df1a76 | jofrisch/simu_fourmis | /plot_evolution_std.py | UTF-8 | 1,413 | 2.515625 | 3 | [] | no_license | # coding:utf-8
import numpy as np
import matplotlib.pyplot as plt
from sys import argv
myp = { 'l' : 0.22, 'w' : 0.7, 'b' : 0.2, 'h' : 0.7, 'size': [5,3.5]}
params = {
'axes.labelsize' : 20,
'axes.titlesize' : 20,
'legend.fontsize' : 14,
'xtick.labelsize' : 14,
'xtick.major.pad' : 8,
'ytick.l... | true |
193a819fc192d27586b440ec1fe55c57dddab6a1 | Quantum-Cheese/reinforcement_learning_projects | /Unity-projects/Pro3.1_Tennis/tennis_main.py | UTF-8 | 4,423 | 2.640625 | 3 | [] | no_license | from unityagents import UnityEnvironment
import torch
import numpy as np
from collections import deque
from multi_agents import MultiAgents
import matplotlib.pyplot as plt
NUM_AGENTS=2
def train_agents(multi_agents,n_episodes):
all_scores = []
scores_window = deque(maxlen=100)
for i_episode in range(1, ... | true |
186bd24baf904bcbeed48cbfeaf80f7cf28e373b | bojack5/smartbender | /stepper/stepper.py.save | UTF-8 | 2,877 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
import pigpio
class Nema23(object):
"""docstring for Nema23"""
def __init__(self, pin_enable , pin_direccion , pin_pulse):
self.pin_direccion = pin_direccion
self.pin_pulse = pin_pulse
self.pin_enable = pin_enable
self.pi = pigpio.pi()
self.p... | true |
286f89fad95ba42b59afd6df8fb66086bdee153d | dogukangoksu/pdf_tools | /pdf_merger.py | UTF-8 | 277 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 00:25:06 2020
@author: Dogukan
"""
from PyPDF2 import PdfFileMerger
pdfs = ['file1.pdf', 'file2.pdf', 'file3.pdf']
merger = PdfFileMerger()
for pdf in pdfs:
merger.append(pdf)
merger.write("result.pdf")
merger.close() | true |
01f1f60c0303aaea3cfbfd6288e0f988baa07748 | CFN-softbio/SciStreams | /SciStreams/processing/geometry.py | UTF-8 | 3,244 | 3.3125 | 3 | [] | no_license | import numpy as np
# import pint
# geometry stuff
def find_rotation_center(r1, alpha1, r2, alpha2):
''' Find the rotation center of the beam stop (in coordinates of r1 and r2)
for two points r1 and r2.
r1 and r2 assumed (x,y) pairs
alpha1, and alpha2 assumed degrees
Constraints:
(... | true |
c618a03a83d7a9fe0b7294f19105b238de0dc96c | ValeriaBega/SI | /Lab1_SI/clientUDP.py | UTF-8 | 305 | 2.828125 | 3 | [] | no_license | import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
MESSAGE = "This is a UDP message!"
print "UDP target IP:", UDP_IP
print "UDP targer port:", UDP_PORT
print "message:", MESSAGE
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #UDP
s.sendto(MESSAGE.encode('utf-8'), (UDP_IP, UDP_PORT))
| true |
b2cc2e8544d75354167a5a37afaa8b43239421fc | danbi5228/Algorithm | /20200905/programmers_이상한문자만들기.py | UTF-8 | 308 | 3.421875 | 3 | [] | no_license | def solution(s):
answer = ''
s = s.lower()
s_arr = s.split(' ')
for word in s_arr:
for i in range(len(word)):
if i%2 == 0:
answer += word[i].upper()
else:
answer += word[i]
answer += ' '
return answer[:-1]
| true |
8055b007ba8922c14876e0b367cef405e82cae48 | romanticair/python | /basis/Boston-University-Files/AllAnswer/Assignment_1_Answer/altask0.py | UTF-8 | 935 | 3.40625 | 3 | [] | no_license | ########################
# Assignment 1, Task 1 #
########################
pi = [3, 1, 4, 1, 5, 9]
e = [2, 7, 1]
# First half of Puzzle:
# Creating the list [ whatNumber, whatNumber ] from pi and e
answer0 = [e[0]] + pi[-2 :]
# print(answer0)
answer1 = e[0 : 2]
# print(answer1)
answer2 = pi[-2 : : -2]
# print(answer... | true |
85c4914c012a6610c7dc14306af35a7f43fbfadf | frankier/apertium | /apertium-tools/webconcordancer/morphAnalysisConcordancer.py | UTF-8 | 8,000 | 2.5625 | 3 | [] | no_license | import re, pprint, subprocess, argparse
def analyze(fileName, moduleDir, strPair):
p1 = subprocess.Popen(["cat", fileName], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["apertium", "-d %s" % moduleDir, strPair], stdin = p1.stdout, stdout = subprocess.PIPE)
p1.stdout.close()
return p2.communicate()[0].deco... | true |
51942b007ff6352c16e59f835b238d2a916088f5 | lyubonko/detection | /src/utils/plot_utils.py | UTF-8 | 3,308 | 3.28125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from PIL import Image
def plot_boxes(ax, bboxes, bboxes_text, color_bbox, color_text,
text_pos='left_top', print_bboxes=False):
for i_box in range(len(bboxes)):
if print_bboxes:
print("box [#{}]: (x, y, w,... | true |
eb88f59695256b3397e2fda04ed9660839d911e8 | cofinoa/gridded | /gridded/gridded.py | UTF-8 | 4,406 | 2.8125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
# py2/3 compatibility
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import numpy as np
import netCDF4 as nc4
from gridded.grids import Grid
from gridded.variable import Variable
from gridded.utilities import asarraylike, get_dataset
"""
The ma... | true |
4dcf107fea55089f936b1a753b9646c6a5d66c28 | 1c3t0y/ProyFinOptiII | /Redes/Dijkstra.py | UTF-8 | 4,843 | 3.453125 | 3 | [] | no_license | from typing import List
import numpy as np
from queue import PriorityQueue
from utils.Functions import check_int, get_param, confirmacion, clear_screen
class MetodoDijkstra:
def __init__(self, matriz: List[List]):
self.matriz_pesos = matriz
self.dim = len(matriz)
self.visitados =... | true |
9ee77a7a3232043f240b04dc45614030bc58f09d | dngu7/Treasure-Hunt-AI | /agent/agent.py | UTF-8 | 44,240 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3.6
#---------------------------------------------------------------------------------------------------------------------------------------------------#
# COMP 3411/9414 Artificial Intelligence
# Project 3 (Option 1): Treasure Hunt
# Language: Python3.6
# Group 37
# David Nguyen (z5154591)
# Yong Yo... | true |
809fba41fe047c5fe87cc61fd8011b9892ec1843 | gormasab/thesis_public | /scrapyard/Combine.py | UTF-8 | 3,683 | 2.6875 | 3 | [] | no_license | # Reihaneh Shahmoradi
import json
import statistics
import cv2
import matplotlib.pyplot as plt
import numpy as np
from tabulate import tabulate
my_mean = []
""""
asasi5: RGB images
asasi5-result: keypoints JSON from OPENPOSE
asasi6: depth results (txt)
"""
for j in range(30, 31):
... | true |
bf602cc90f020a93222bb609d28cb0001ff50a7c | MachFour/info1110-2019 | /week5/W13B/consonants.py | UTF-8 | 564 | 3.84375 | 4 | [] | no_license | def consonant(ch):
# TO DO
if ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u':
return False
return True
def consonant_better(ch):
if not ch.isalpha():
return False
if len(ch) != 1:
return False
vowels = ['a', 'e', 'i', 'o', 'u']
i = 0
while i < le... | true |
9d3221c85395d4ec6407ecd0be4f2a356a5a71bf | ikspeto/ising-simulation | /Simulation 3 Hysteresis/extrapolate_values.py | UTF-8 | 1,071 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy
from numpy import linspace
import matplotlib.pyplot as plt
import h5py
import matplotlib.cm as cm
def extrapolate(N, n, T, J, trial):
h5f = h5py.File('data/Periodic-boundaries/N='+str(N)+'/Trial '+str(trial)+'/hysteresis,N='+str(N)+',n='+str(n)+',t='+str(t)+',j='+str(J)+'.h5', 'r')
Ms = h5f[... | true |
33120fe88c6134d330ad5b1048b735ce80374182 | DavidBykov/formal-lang-course | /project/__main__.py | UTF-8 | 1,814 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import sys
from project.graph_utils import *
if __name__ == "__main__":
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
"-get_graph_description",
... | true |
339a2481e050cb972a2bf73fdea9a94b59c8181f | Shivang42/stuff | /ensemble/ensemble1.py | UTF-8 | 2,498 | 2.59375 | 3 | [] | no_license | '''
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import comb
def ee(n,error):
start = int(math.ceil(n/2))
probs = [comb(n,k)*error**k*(1-error)**(n-k) for k in range(start,n+1)]
p = sum(probs)
return p
range1 = np.arange(0,1.01,0.01)
erc = [ee(11,e) for e in range1]
... | true |
9ecca4bf6175100580a3b8f0519e0119241d96f8 | milesjwinter/DECO_sandbox | /main_readtxt.py | UTF-8 | 21,170 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
"""Runs through a given folder of images and prints out the type of event for
each blob group in that event.
Stats: Weighted accuracy is roughly 90%, Processing rate is 2 sec/image
For ease of parsing I/O, Output is in the format: id:event_type.
Appends first letter of suspected event... | true |
983a8db54f28c29b92f021addf032df3d306595d | Lxy-hub987/CalculateImgArea | /app/src/main/python/test.py | UTF-8 | 1,244 | 2.609375 | 3 | [] | no_license | import cv2
import numpy as np
def getRedArea(img):
lower_red = np.array([160, 60, 60])
upper_red = np.array([180, 255, 255])
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask_r = cv2.inRange(hsv, lower_red, upper_red)
# binaryr = cv2.blur(mask_r, (3, 3))
binaryr = cv2.erode(mask_r, None, iteration... | true |
2cda6d7a59cdbf63733d4d0fe91e962f9876b4aa | weilai0980/newsQuant | /nlp_news/source_faws.py | UTF-8 | 3,358 | 2.609375 | 3 | [] | no_license | #coding: utf8
#!/usr/bin/python3
import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
from pymongo import DESCENDING
import sys
import os
import time
import urllib
import pprint
import datetime
import calendar
URL = 'https://faws.com/'
DEBUG = False
def unix_date_parser(weird_string):
... | true |
b7a4b6eabc1495eebd5890fa1bc860bf58853398 | smwCEH/accessing-netcdf-data-by-coordinates | /smw_shapefile_polygon_geometry.py | UTF-8 | 189 | 2.515625 | 3 | [] | no_license | import geopandas
def polygon(shapefile, dissolve_item):
shape = geopandas.read_file(shapefile)
shape_dissolved = shape.dissolve(by=dissolve_item)
return shape_dissolved.ix[0].geometry
| true |
43f89867d67a8e8750c35d3e490c5523873f3af5 | TSG405/SOLO_LEARN | /PYTHON-3 (CORE)/Exponentiation.py | UTF-8 | 818 | 4.21875 | 4 | [
"BSD-3-Clause"
] | permissive | '''
@Coded by TSG, 2021
Problem:
Exponentiation is the raising of one number to the power of another.
This operation is performed using two asterisks **.
Let's use exponentiation to solve a known problem.
You are offered a choice of either $1.000.000 or $0.01 (one penny) doubled every day for 30 days (the resulting... | true |
54f636d63bd37662011450c2c9e4a40983d8fd98 | smrcksve/18heur-2017 | /src/objfun.py | UTF-8 | 3,317 | 3.578125 | 4 | [] | no_license | import numpy as np
class ObjFun(object):
"""Generic objective function super-class."""
def __init__(self, fstar, a, b):
"""
Default initialization function (for discrete tasks) that sets:
* f* value to be reached (can be -inf)
* a: lower bound vector
* b: upper bound v... | true |
6d792a92b99d1bf4d033e33bb44eb9f53c299935 | rongle/nlp | /hongbao.py | UTF-8 | 1,142 | 3.3125 | 3 | [] | no_license | from queue import Queue
import random
from decimal import Decimal
from copy import copy
def hongbao(totalmoney, persons):
print("红包总金额为:"+str(totalmoney)+"元,红包个数为:"+str(persons)+"个")
q = Queue()
hongbao = Queue()
if totalmoney / persons <= 0.011:
print("红包太小,人太多了,不够抢!")
else:
overp... | true |
7e87f9d7cf51a5a693a688ffb3d79b964d147aef | weiserhase/blockchainMain | /pool/conversion.py | UTF-8 | 824 | 3.09375 | 3 | [] | no_license | class Conversion():
def __init__(self):
self.operations = []
def byteConversion(self, value, form, target):
value = int(value)
if(form == 'b'):
byte = value
elif(form == 'kb'):
byte = value*2**10
elif(form == 'mb'):
byte = value*2**20
... | true |
539b6fb81b654ed85dc2066545d873770173019a | keithio/practice-data-structures-and-algorithms | /algorithms/fast_fibonacci/fast_fibonacci.py | UTF-8 | 566 | 3.96875 | 4 | [
"MIT"
] | permissive | from __future__ import division
def fibonacci(n):
"""
Returns the nth Fibonacci numbers.
"""
if n < 1:
raise ValueError('Please specify the number of Fibonacci numbers to '
'generate.')
return _fibonacci(n)[0]
def _fibonacci(n):
"""
Computes the nth numbe... | true |
46e3a1f1047c2600bae74b3289234fffddf36e4b | xiaojiangzhang/algorithm010 | /Week06/Assignment/[120]三角形最小路径和.py | UTF-8 | 2,853 | 3.625 | 4 | [] | no_license | # 给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。
#
# 相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。
#
#
#
# 例如,给定三角形:
#
# [
# [2],
# [3,4],
# [6,5,7],
# [4,1,8,3]
# ]
#
#
# 自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。
#
#
#
# 说明:
#
# 如果你可以只使用 O(n) 的额外空间(n 为三角形的总行数)来解决这个问题,那么你的算法会很加分。
# ... | true |
8346abb70c8a38313ac61d1ba9c372d6a49a13d2 | Miaoshuai0677/SemiFlow | /SemiFlow/Model.py | UTF-8 | 7,678 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | """
@File : Model.py
@Author: Dong Wang
@Date : 2020/3/31
"""
from .engine.core import backend
from .layer.core import Layer
from .layer.input import InputLayer
from .activations import Activation
from .utils import DataShuffle, split_train_val
from . import optimizers
class Model(object):
def __init__(self):
... | true |
6028b3cbf7ecdf3041598f11689a18ecb6811f6c | SmartPracticeschool/llSPS-INT-2387-Predicting-Hospital-Readmission-for-Patients-with-Diabetics | /app.py | UTF-8 | 898 | 2.625 | 3 | [] | no_license | import pandas as pd
from flask import Flask, request, render_template
import pickle
from sklearn.preprocessing import LabelEncoder
app = Flask(__name__)
model = pickle.load(open('rfc.pkl', 'rb'))
lenc = LabelEncoder()
@app.route('/')
def home():
return render_template('index.html')
@app.route('/read... | true |
dc566f46541b88d6a5bdca41bce38274fdad4429 | Xsbd/algorithms | /Algorithms Specialization UCSD/graph/pa05/clustering.py | UTF-8 | 2,225 | 3.359375 | 3 | [] | no_license | #Uses python3
import sys
import math
def compute_edges(x, y):
# computes all possible undirected edges between as given set of points
# takes in lists of x values and y values
# returns undirected edges and their distances (weights)
edges, weights = [], []
for i in range(len(x)):
for j in r... | true |
d86edac3b45747092f01197b286ea706982fe605 | darylhjd/ctci | /arrays_and_strings/zero_matrix.py | UTF-8 | 2,517 | 3.671875 | 4 | [] | no_license | def zero_matrix_hash_set(m):
"""Make the entire row and column in which a zero appears all 0."""
# Solution: O(n^2) time to go through each element in the matrix, O(n) space to store zero-indexes.
# Check for invalid matrices
if len(m) == 0 or len(m[0]) == 0:
return
# Store any indexes whi... | true |
965203e968c14fcd1ead260a7ccc9ed7a19e23fa | zhangweiIOT/MicroPython_Examples | /pyBoard v1.1(STM32F405)/2.传感器实验/2.温湿度传感器DHT11/main.py | UTF-8 | 1,126 | 3.640625 | 4 | [
"MIT"
] | permissive | '''
实验名称:温湿度传感器实验DTH11
版本:v1.0
日期:2021.8
作者:01Studio
说明:通过编程采集温湿度数据,并在OLED上显示。。
'''
#引入相关模块
from pyb import delay
from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
from dht import DHT11
#初始化相关模块
i2c = I2C(sda=Pin("Y8"), scl=Pin("Y6"))
oled = SSD1306_I2C(128, 64, i2c, addr=0x3c)
#创建DTH11对象dt
dt=DHT11(Pin('X... | true |
61013692c3550e48ddab792998220a1a05bd9861 | xinmyname/ItemizedPy | /src/models.py | UTF-8 | 1,782 | 3.671875 | 4 | [
"MIT"
] | permissive | """All of the model objects"""
import pluralizer
class Descriptor():
"""Holds descriptor for item"""
pass
DEFAULT_DESCRIPTOR = Descriptor()
class Inventory:
"""Holds inventory"""
def __init__(self):
self.__slots = {}
def add_item(self, item):
"""Adds an item to the inventory"""... | true |
4c633e05e708acbe7f100f30ce2fd08656ba507e | fagan2888/PyAssignmentSolution | /Level1_BenjaminLiu/1.4_Solution/1.4_Main.py | UTF-8 | 5,714 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#!/usr/bin/env python
'''
Student name: Beier (Benjamin) Liu
Date: 2/10/2017
Exercise 1.4
Remark:
Python 2.7 is recommended
Before running please install packages *numpy
Using cmd line py -2.7 -m install [package_name]
'''
from Implementations.Implementation import *
'''======================... | true |
b6c5b3703cd1a1e32109af944c70c8b2cdf77e47 | xmac1/pycookbook | /stringsandtext/textformat.py | UTF-8 | 356 | 3.296875 | 3 | [] | no_license | if __name__ == '__main__':
import textwrap
s = "Look into my eyes, look into my eyes, the eyes, the eyes, \
the eyes, not around the eyes, don't look around the eyes, \
look into my eyes, you're under."
print(textwrap.fill(s, 70))
import os
print(textwrap.fill(s, os.get_terminal_si... | true |
47eb04afcd766603fea0c61f28f15dbd0a61edb6 | 4iar/lldb-write | /write.py | UTF-8 | 1,499 | 2.890625 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import lldb
import argparse
def parse_args(raw_args):
"""Parse the arguments given to write"""
args = raw_args.split(' ')
if len(args) < 2:
raise ValueError('write: too few arguments\nusage: write filename command [command ...]')
filename = args[0]
c... | true |
df7ffd61e95e3c6f14f15de9288a313cabb95c44 | Tobi-mmt/nltk-book | /chapter_4/exercise_16.py | UTF-8 | 1,197 | 3.46875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# 2, 10, 13, 14, 16, 17, 18, 19, 21, 23, 26, 31, 32, 35
# extra - 27: https://pdfs.semanticscholar.org/3973/ff27eb173412ce532c8684b950f4cd9b0dc8.pdf
##################
# 16 - Read up on Gematria, a method for assigning numbers to words, and for mapping
# between words having the same number to ... | true |
2de5c954357011120d8e1b2c47ce0932a8443e2e | VelocityFever/Obelisk | /Obelisk/plugins/race.py | UTF-8 | 6,806 | 3.0625 | 3 | [
"MIT"
] | permissive | from util import Events
import discord
import asyncio
import random
class Plugin(object):
def __init__(self, pm):
self.pm = pm
self.race = self.Race()
class Race(object):
class Participant(object):
# Field used to sort participants
position = 0
def... | true |
4e91a580cf74102bff038dcae02fb5c85c581f42 | Comrade-rn/RasPiBot202 | /robot.py | UTF-8 | 1,419 | 2.6875 | 3 | [
"MIT"
] | permissive | from astarRPB202 import AStar
from encoders import Encoders
from motioncontroller import MotionController
from motors import Motors
from odometer import Odometer
from pantilt import PanTilt
class Robot:
def __init__(self):
self.aStar = AStar()
self.encoders = Encoders(self.aStar)
self.odom... | true |
80837faf5e4e767378c30c54eb56931f167d7b1c | ben1post/kaweahcode | /phydra/components/fluxes/growth_multi_lim.py | UTF-8 | 5,254 | 2.578125 | 3 | [] | no_license | import phydra
@phydra.comp(init_stage=4)
class Growth_ML:
""" XXX
"""
resource = phydra.variable(foreign=True, flux='growth', negative=True)
consumer = phydra.variable(foreign=True, flux='growth', negative=False)
mu_max = phydra.parameter(description='maximum growth rate')
@phydra.flux(group... | true |
d3e59786d52607538eafd1fc7fbedd7c145ede5a | nimaafshar/HumpbackWhaleIdentification | /edge detector/EdgeDetector.py | UTF-8 | 2,450 | 3.03125 | 3 | [] | no_license | import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
for index in range(4, 5):
# Open the image
img = np.array(Image.open('../train/0000e88ab.jpg')).astype(np.uint8)
# Apply gray scale
if len(img.shape) == 3:
gray_img = np.round(0.299 * img[:, :, 0] + 0.587 * img[:, :, 1] +... | true |
6ef1c3d6055893814922b0ff4e2143048e4d3639 | lifangda01/ECE661-ComputerVision | /HW10/features.py | UTF-8 | 1,011 | 2.84375 | 3 | [] | no_license | import cv2
def get_sift_kp_des(image, nfeatures=0):
'''
Extract SIFT key points and descriptors from image.
@image: np.ndarray of input image, double type, gray scale
@return: tuple of key points and corresponding descriptors
'''
sift = cv2.xfeatures2d.SIFT_create(nfeatures=nfeatures)
kps, descs = sift.detec... | true |
66932c047e270282753a64245cac1c0031f3d5a9 | Ekeopara-Praise/python-challenge-solutions | /Ekeopara_Praise/Phase 2/LINKED LISTS/Day70 Tasks/Task3.py | UTF-8 | 1,678 | 4.65625 | 5 | [
"MIT"
] | permissive | '''3. Write a Python program to delete the first item from a singly linked list.'''
class Node:
# Singly linked node
def __init__(self, data=None):
self.data = data
self.next = None
class singly_linked_list:
def __init__(self):
# Createe an empty list
self.tail = None
... | true |
09c4d51ed0b2d6776d0f9091595ac79e8a57f83d | xiang525/my_leetcode | /word_pattern.py | UTF-8 | 707 | 3.234375 | 3 | [] | no_license | """
解法与Isomorphic Strings (205) 一样
"""
class Solution(object):
def wordPattern(self, pattern, str):
"""
:type pattern: str
:type str: str
:rtype: bool
"""
cur = str.split()# 这个必须放前面否则后面m, n不对
d = {};n = len(pattern); m = len(cur)
if n != m:return False... | true |
06423f5ed6087ef0d80807368b6a3c82ae464cd3 | michaeljoseph/advent_of_code | /2019/intcode.py | UTF-8 | 5,221 | 3.15625 | 3 | [] | no_license | import pytest
def int_code_v2(program):
opcodes = {
1: lambda x, y: x + y,
2: lambda x, y: x * y,
}
idx = 0
done = False
while not done:
parameters = program[idx:idx + 4]
done = parameters[0] == 99
if done:
break
opcode, input1, input2,... | true |
41d581be5a6a74ddb2969672ab6dbf468e63d134 | YaniLozanov/Software-University | /Python/PyCharm/02.Simple Calculations/07. 2D Rectangle Area.py | UTF-8 | 561 | 4.5 | 4 | [
"MIT"
] | permissive | # Problem:
# A rectangle is given with the coordinates of two of its opposite angles (x1, y1) - (x2, y2).
# Calculate its area and perimeter.
# The input is read from the console.
# The numbers x1, y1, x2 and y2 are given in one order.
# The output is output to the console and must contain two rows with one number each... | true |
97cfe39ef93414e1cb98aa98b59b1bdd81539ca9 | facu2279/holbertonschool-higher_level_programming | /0x03-python-data_structures/5-no_c.py | UTF-8 | 249 | 3.234375 | 3 | [] | no_license | #!/usr/bin/python3
def no_c(my_string):
my_list = ""
tope = len(my_string)
for i in range(0, tope):
if my_string[i] == "C" or my_string[i] == "c":
continue
my_list = my_list + my_string[i]
return(my_list)
| true |
098d662eeda977403515fbdca75f3a4c49f31df2 | Tilapiatsu/blender-custom_config | /scripts/addon_library/local/Poly_Source/utils/fill_mesh.py | UTF-8 | 21,569 | 3.203125 | 3 | [
"MIT"
] | permissive | ##
# A script to split simple, architectural geometry into convex pieces.
#
# This script makes use of Blender's built-in "Split Concave Faces" clean-up
# algorithm to break-up the faces of an object into convex pieces. The script
# attempts to identify all the edges that represent convex boundaries, and then
# it spli... | true |
336b23e55c76fe1b90a6c169c36cf339c1cfd374 | AllenAnZifeng/leetcode | /Leetcode/210. Course Schedule II.py | UTF-8 | 2,703 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: Allen(Zifeng) An
@course:
@contact: anz8@mcmaster.ca
@file: 210. Course Schedule II.py
@time: 2020/1/14 12:46
'''
from typing import List
import collections
class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:... | true |
1d1885f8c9bc6d2154eae6b4fdaed113b05c1a89 | smiler96/Image-Super-Resolution | /model/common.py | UTF-8 | 3,179 | 2.53125 | 3 | [] | no_license | import torch.nn as nn
import math
def conv_(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True):
return nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, stride=stride, padding=padding, bias=bias)
class BaseBlock(nn.Module):
def __init__(self, in_c, out_c, kernel_size=3, stri... | true |
f2c514c0883414c106751e5a8e64d756ad31e662 | 22p21s0045/my-opencv | /test1.py | UTF-8 | 988 | 2.546875 | 3 | [] | no_license | import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
cap = cv2.VideoCapture('steve.mp4')
while True:
_, img = cap.read()
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
... | true |
1774a04e537c2b1522d8def21a3bf54a9174e295 | jczeremuga/Flashcards-for-learning-russian-vocabulary | /flash_cards.py | UTF-8 | 2,703 | 3.21875 | 3 | [] | no_license | import pandas as pd
from tkinter import *
from random import randint
FONT = ('Arial', 50, 'normal')
BACKGROUND_COLOR = "#4AA47B"
MAX_RANGE = 997
#setting up a screen
screen = Tk()
screen.title('Russian Flashcards')
screen.configure(background = BACKGROUND_COLOR, padx = 50, pady = 50)
#imported images
fla... | true |
2130653ff6d8e27e0858ddb27e0ed2c9a88ca374 | lianghanwu1999/Python | /python基础部分/高级变量/拆分字符串.py | UTF-8 | 442 | 4.125 | 4 | [] | no_license | #假设:以下内容是从网络上抓取的文章
#要求 :
# 1.将字符串中的空白字符串全部去掉
# 2.再使用 " " 作为分隔符,拼接一个整齐的字符串
poem_str = "登鹳雀楼\t 王之涣\t 白日依山尽\t\n 黄河入海流\t\t 欲穷千里目\t\n 更上一层楼"
print(poem_str)
#1.拆分字符串
poem_list = poem_str.split()
print(poem_list)
#2.合并字符串
result = " ".join(poem_list)
print(result) | true |
d47e2c0b9be19790a939733c173dab85fc3aa983 | qira03/vcb | /backend/sliders/schema.py | UTF-8 | 4,381 | 2.890625 | 3 | [] | no_license | """
Definición del esquema GraphQL para los sliders.
Para más información sobre los esquemas de Graphene Django haga clic
`aquí <http://docs.graphene-python.org/projects/django/en/latest/>`_.
"""
import graphene
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionFiel... | true |
630422dae83e928e322bbbafcf059c3fa238c555 | notarobot767/dism_deployment_script | /tools/dism_wizzard/deploy/select_wim_source.py | UTF-8 | 987 | 2.65625 | 3 | [] | no_license | from ..system_functions import SysFun
import os.path
def findLocalWimSource(default):
for vol in SysFun().return_vol_list():
path = "{0}:\\{1}".format(vol, default.local_wim_dir)
if os.path.exists(path):
return path
SysFun().exit("could not find any local wim sources!")
def enterNetshare(default):
... | true |
2f480f6fc42973325a4bd45a3bb4417a61063139 | thecamo1509/restapichallenge | /api/v1/views/index.py | UTF-8 | 634 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
""" Index """
from flask import Flask, jsonify, request
from api.v1.views import app_views
from models import storage
@app_views.route('/status', methods=["GET"], strict_slashes=False)
def hello():
"""Hello"""
return jsonify({"status": "OK"})
@app_views.route('/stats', methods=["GET"])
de... | true |
8b8bb52e8e786a76da295afa4cb90e34fb7168f6 | shadiG/euler_project | /problem_5.py | UTF-8 | 174 | 3.671875 | 4 | [] | no_license | def is_divisible(n):
for i in range(1,21):
if n%i!=0:
return False
return True
n = 20
while not is_divisible(n):
n+=1
print(n) | true |
213962d552d1727ea990183d02e6a604559cf945 | EddyBautista-93/Hackerank-Exercises | /Python/if-else.py | UTF-8 | 647 | 4.375 | 4 | [] | no_license | # Given an integer, , perform the following conditional actions:
# If is odd, print Weird
# If is even and in the inclusive range of to , print Not Weird
# If is even and in the inclusive range of to , print Weird
# If is even and greater than , print Not Weird
# orignal way of doing it
def wierd(n):
if(n ... | true |
157663d48c5b006630c499e650b8426f00a791a3 | artofree/study | /hupai/opencv/二值化.py | UTF-8 | 1,663 | 2.96875 | 3 | [] | no_license | __author__ = 'guo'
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread(r'/Users/guo/Desktop/digit_recognition/code/16-01/5.png', 0)
# global thresholding
ret1,th1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY) # Otsu's thresholding
ret2,th2 = cv2.threshold(img... | true |
949ccd6e643f722ded10a063701735fbd117473d | kdoorley/AI-and-Robotics-Fall-2020-Class-Notebooks | /Sprint #3 - Probability and Robot Tasks/2020-10-14 Recursion.py | UTF-8 | 1,342 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Definition of factorial
#
# $$
# N! = 1 \cdot 2 \cdot 3 \cdots N
# $$
# $$
# N! = N\cdot (N-1)!
# $$
# In[3]:
def factorial(N):
if N==0:
return 1
return N*factorial(N-1)
# In[5]:
factorial(120)
# In[15]:
max_score=35
saved_p={}
saved_whethe... | true |
f54376a5f55b813cfeafa69368d22e511bd13dbc | forbidden-arts/public | /dna.py | UTF-8 | 1,547 | 3.34375 | 3 | [] | no_license | # Requires databases and sequences provided by CS50 (not included)
from sys import argv, exit
import re
import csv
# Global variables are suboptimal, but easy.
strs = []
match = []
seq = []
def main():
# Load CSV
db = load_csv(argv[1])
dna = load_txt(argv[2])
# Get DNA strs
for i in range(1, le... | true |
6ecb5c2f0e68eafe8ac177a83f2861eb1a9792ed | zmy20062010/20190820_beam_extension | /chebtst/test_log_3d.py | UTF-8 | 728 | 2.65625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
enablelog = True
snr=15
fig = plt.figure(figsize=(12,12))
ax = fig.gca(projection='3d')
realsnr = 10**(snr/10)
B,T = np.mgrid[100e3:10e6:100e3, 1:60:1]
C = .55 / (np.sqrt(2) * B * np.sqrt(B * T * realsnr) )
if enablelog: C = n... | true |
40edf7651b40186a28111ea227d801a465c7afb2 | ninchkn78/Dataset_Toolkit_Package | /extract_cluster.py | UTF-8 | 1,568 | 2.8125 | 3 | [] | no_license | import os
import sys
import csv
import time
import json
import pprint
import operator
def extract_cluster(args, nodes = 50, SCORE = 0.0001):
result = []
try:
result = sorted(set_nodes(get_intersected(SCORE, *args), nodes=nodes), key=operator.itemgetter('depth', 'root_symbol'))
except:
... | true |
e38caf4cc29f18e89313d81c750040e76f1a6ebd | cbzn/FirstPythonClientServer | /app.py | UTF-8 | 6,329 | 2.65625 | 3 | [] | no_license | from flask import Flask, request, render_template, flash, redirect, url_for, session
from wtforms import Form, StringField, PasswordField, validators
from passlib.hash import sha256_crypt
#from flaskext.mysql import MySQL
def start():
app = Flask(__name__)
#app.debug = True
#Config MySQL
#app.config... | true |
0c6de3afcf02f731d83be4d68604a5df1cc99be4 | kuarchi-programming-2018/181012attendance-a0170435 | /fibonacci.py | UTF-8 | 187 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyderエディタ
これは一時的なスクリプトファイルです
"""
def fib(n):
a,b=0,1
for i in range(n):
a,b=b,a+b
return b
| true |
01a6f74cae4d6ba6b863163478b818a20eae41d2 | hwolff00/structs_algo | /data_structure/linked_list.py | UTF-8 | 2,306 | 4.375 | 4 | [] | no_license | """Working with linked list data type."""
class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class LinkedList:
def __init__(self):
self.head = None
self.num_nodes = 0
def __str__(self):
lst = []
if not self.head:
re... | true |
a74a8f3e4f1f435db64c9009f77ec307e6a8b5ee | tachyon83/code-rhino | /DAY300~399/DAY303_BOJ14502-연구소/joohyuk.py | UTF-8 | 1,076 | 2.515625 | 3 | [] | no_license | import sys
import copy
from itertools import combinations as cb
from collections import deque
si = sys.stdin.readline
n, m = [int(e) for e in si().split()]
iboard, q, v, carr = [], deque(), [], []
dr, dc = [0, 1, 0, -1], [1, 0, -1, 0]
def bfs(n, m):
while q:
cr, cc = q.popleft()
for i in range(4)... | true |
df3ea4b77d63c79d3dc57691b71e8d2c1cc1ade0 | Fiskk/omurice | /SE_Scratch_File.py | UTF-8 | 223 | 2.65625 | 3 | [] | no_license | import ATR2
def test():
for i in range(0, 1):
for k in range(0, 10000):
a = ATR2.operand(i, k)
if a != ("["+str(i)+"]"):
print("{"+str(i)+","+str(k)+"} = " + a)
test()
| true |
32b56879a5798de334afe5049f70158ee876ce2e | webosce/chromium53 | /src/third_party/catapult/dashboard/dashboard/test_owner.py | UTF-8 | 5,816 | 2.609375 | 3 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Operations for updating test owners.
We want to allow editing test ownership through incoming chart metadata as well
as through dashboard UI, so we keep ... | true |
ebec76e66155490a8f0d7be82789f8c4c60b45c4 | yth/centaurgo | /src/GoPlay.py | UTF-8 | 369 | 3.015625 | 3 | [] | no_license | import sys
from CaptureGo import CaptureGo
def main():
n = len(sys.argv)
if n == 2:
game = CaptureGo(int(sys.argv[1]))
elif n == 3:
game = CaptureGo(int(sys.argv[1]), float(sys.argv[2]))
else:
game = CaptureGo()
while(game.has_won() == False):
game.display()
command = input(">>> ")
game.handle_com... | true |
d3d0d1ca096e691b555a4323190337037e513252 | Japroriple/Reconcile | /modules/seen.py | UTF-8 | 8,992 | 2.53125 | 3 | [
"MIT"
] | permissive | """
The MIT License (MIT)
Copyright (c) 2014 - 2015 Jos "Zarthus" Ahrens and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rig... | true |
35b6f4085cf796637f3a6d45743519793fc05dfc | possldypo/my_spider | /common/mongo.py | UTF-8 | 1,272 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pymongo
import sys
import traceback
MONGODB_CONFIG = {
'host': '127.0.0.1',
'port': 27017,
'db_name': 'spider_javabook',
'username': None,
'password': None
}
class MongoConn(object):
def __init__(self):
# connect db
try:
self.conn = ... | true |
d83464185f2613ae21f20154019e916499720afe | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_53/284.py | UTF-8 | 224 | 2.828125 | 3 | [] | no_license | import sys
t = int(sys.stdin.readline())
for c in xrange(t):
n, k = map(int, sys.stdin.readline().split())
if (k+1)%(2**n) == 0:
print "Case #%d: ON" % (c+1)
else:
print "Case #%d: OFF" % (c+1)
| true |
36f64d5aeecc479120a40a00474c79a1d83fba63 | chromebookbob/Python | /ex39a.py | UTF-8 | 235 | 3.109375 | 3 | [] | no_license | counties = {
'Sussex' : 'SUSX',
'Wiltshire' : 'WILT',
'Surrey' : 'SURY',
'Dorset' : 'DRST',
'Essex' : 'ESSX'
}
for counties, abbrev in counties.items():
print "The abbreviation of %s is %s" % (counties, abbrev)
print counties | true |
58befed506b95d0051697430c91fdbb2f5c109e7 | alparius/ai_sem4 | /lab5_ann/application.py | UTF-8 | 4,062 | 3.171875 | 3 | [] | no_license | """
TODO
2. Establish if a patient suffers of disk hernia, spondilose or if is healthy based on the information collected
from other patients (regarding the shape and the orientation of the pelvis and the lumbar section of the spine).
TODO
Each patient is represented in the data set by six biomechanical at... | true |
32b67f7f92e7a85f5a0747db267cec6b1d9ade06 | Aasthaengg/IBMdataset | /Python_codes/p02846/s468665115.py | UTF-8 | 646 | 2.8125 | 3 | [] | no_license | import sys
import math
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
T1, T2 = IL()
a1, a2 = IL()
b1, b2 = IL()
if a1*T1 + a2*T2 > ... | true |
1de5d73e154d5a5a3a6fafa20f5d4c626007706c | xy2333/Leetcode | /leetcode/Clone.py | UTF-8 | 1,942 | 3.421875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class RandomListNode:
def __init__(self, x, next_=None, random=None):
self.label = x
self.next = next_
self.random = random
class Solution:
# 返回 RandomListNode
def Clone(self, pHead):
# write code here
self.CloneNodes(pHead)
self.Conne... | true |
a9fc96c15435bf9127dd31aaafa313b582147ea1 | DistortedTopaz152/Python-2020-Progects-4-5 | /pages.py | UTF-8 | 13,025 | 3.890625 | 4 | [] | no_license | #Dyson Smith
#Code for Adventure Game
def page82():
print("""If there's a chance of making it," you say, I'd
like to try to get home."
"Then we must hurry," says Dr. Vivaldi. "Akpar, there is not much you can do but lead us to
the crater where we arrived."
The Grand Akpar speaks in his own to... | true |
9b2f29bba366260572d471457cf31360e5db65d8 | twzhou99/MyWheels | /htmlparse.py | UTF-8 | 872 | 3.1875 | 3 | [] | no_license | #HTML分析
import html.parser as h
class MyHTMLParser(h.HTMLParser):
a_t=False
b_t=False
def handle_starttag(self, tag, attrs):
if tag=='h3' and len(attrs) > 0 and attrs[0][1] == 'event-title':
self.a_t=True
if tag == 'span' and len(attrs) > 0 and attrs[0][1] == 'event-location'... | true |
03b24dcb3d1b55973c961786562abba207371a64 | statisticelle/bokeh_data_camp | /chapter3/app_setup.py | UTF-8 | 744 | 3.375 | 3 | [] | no_license | # Perform necessary imports
from bokeh.plotting import figure
from bokeh.io import curdoc
# Create a new plot: plot
plot = figure()
# Add a line to the plot
plot.line(x=[1,2,3,4,5], y=[2,5,4,6,7])
# Add the plot to the current document
curdoc().add_root(plot)
# Perform the necessary imports
from bokeh.io import cur... | true |
9606f5e7aa0774945d9e66da734b536a0c3dda82 | ElinaBukhanov/my_projects | /k-means_clustering_r-lagged_correlation_swap_rates_project/python_task_2/r-lagged_cor_3.py | UTF-8 | 2,698 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
question 2 gimmel
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#reading data
big = pd.read_csv(r"/home/elina/Документы/sadnat mumhim/stocks/big.csv", skiprows=2 )
hapoalim = pd.read_csv(r"/home/elina/Документы/sadnat mumhim/stocks/hapoa... | true |
0f75b91402831d3a87b0d2b7f46106ee7cf86f60 | sondrefl/Cubing | /plot_times.py | UTF-8 | 953 | 2.625 | 3 | [] | no_license | import sys
from scramblefromfile import (
times,
times_3x3,
times_4x4,
times_5x5,
times_6x6,
times_7x7,
all_times
)
import matplotlib.pyplot as plt
from math import ceil
import numpy as np
def plot_times(times):
m = min(times)
n = max(times)
x = np.linspace(1, len(times), len(... | true |
66bc949b93fbbfdf3483ee07785113c5e4949f0f | anysuy/simplifyAutomaton | /draw.py | UTF-8 | 11,726 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib
# generate postscript output by default
# use before 'import matplotlib.pyplot as plt'
matplotlib.use('ps')
import math
import queue as qu
import copy as cp
import matplotlib.pyplot as plt
import networkx as net
import pygraphviz as pgv
from urllib imp... | true |
1ea4a52e9f8edb2e8e26130f2f3f710c897ed14a | teckoo/interview_public | /coding/leetcode/121-best-time-to-buy-and-sell-stock/solution.py | UTF-8 | 392 | 3.171875 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices: List[int]) -> int:
if not prices or len(prices) == 0: return 0
lo = hi = prices[0]
ans = 0
for price in prices[1:]:
hi = max(hi, price)
if price < lo: # find a new low, check profit
ans = max(ans, hi... | true |
e4ac20e5758867bc7946843e02024bc6b7ed2b9d | mayosol/Algorithm | /BOJBeta1/210719.py | UTF-8 | 3,635 | 3.78125 | 4 | [] | no_license | # 9095 1, 2, 3 더하기, 실버 3 _ 난 itertools가 좋아요
from itertools import product # 그 중에서도 product가 좋다
for i in range(int(input())) : # 테스트케이스만큼 for문 돌리기
n = int(input()) # n이 1 ~ 11 중 하나이므로 모든 경우의 수를 다 구하기로 했다
ott = [1, 2, 3] ... | true |
52e065f8019aebe2d6951da8f1d8589e4773ba8b | modulabs/FaceImageRecognization | /gwansang/etc_source/ReplyCollector.py | UTF-8 | 17,222 | 3.328125 | 3 | [] | no_license |
# coding: utf-8
# In[24]:
#배열 설명 [gender, age, emotion, returnMessage]
#gender 0 남 , 1 여
#age 0 1살 , 1 5살, 2 10살, 3 16살, 4 28살, 5 51살, 6 75살
#emotion 0 Angry, 1 Disgust, 2 Fear, 3 Happy, 4 Sad, 5 Surprise, 6 Neutral
def callFortunesDataSet():
dataSet = [
(0,0,0,"""오!!! 난 알수 있어요! 레오나르도 다빈치가 일생에 걸쳐서 사용한것보... | true |
b4ba01d33ed63807c6c68aa55285cda9842173c5 | happyxianyu/icl | /inc/icl/itvset_rbtree.py | UTF-8 | 7,703 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | """
采用红黑树作为基础实现区间树
过于麻烦,暂时弃用
"""
from .itv import *
__all__ = [
'ItvSet'
]
# 每个节点的区间保证不相交
# 按照node.a构建二叉搜索树
# 使用红黑树为基础
class ItvNode:
def __init__(self, itv: Itv, red=True):
self.itv = itv
self.lch: 'ItvNode' = None # 左子节点
self.rch: 'ItvNode' = None # 右子节点
self.prnt: 'ItvN... | true |
6ca8e5df7b638b3af80892cd587ba991d4cf22a3 | akstt/LeetCode | /LeetCode/1-50/33.搜索旋转排序数组.py | UTF-8 | 1,582 | 3.546875 | 4 | [] | no_license | class Solution:
# 要求时间复杂度为O(logn),二分法解决
# 二分查找的部分不在赘述
# 可以把列表分为两部分
def search(self, nums: [int], target: int) -> int:
index_start, index_end = 0, len(nums) - 1
if not nums:
return -1
# 结果在左半部分
if target >= nums[0]:
while index_start <= index_end:
... | true |
0e831f582e337e338615324d11d2b07412e1954d | hpabst/KaggleTitanic | /2prong.py | UTF-8 | 2,588 | 2.796875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import math
from keras import backend, Input
from keras.layers import concatenate, Dense, BatchNormalization
from keras.utils import plot_model
#Code in this file is mostly taken from https://www.kaggle.com/yboris/keras-two-prong-model-80/notebook
pd.set_option("mo... | true |
a518e766a4a696c804a27cff57b6b02332aa87d2 | valentinsingularity/image-processing-physics | /laplace_filtering.py | UTF-8 | 470 | 2.78125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
img = plt.imread('venice.jpg')[:, :, 0] / 255.
plt.figure(1)
plt.imshow(img, cmap='gray')
plt.colorbar()
v = np.fft.fftfreq(img.shape[0])
u = np.fft.fftfreq(img.shape[1])
vv, uu = np.meshgrid(v, u, indexing='ij')
H = -4. * np.pi**2 * (vv**2 + uu**2)
... | true |
5ac041c38c7b010def588b4290fcfc2f799302a9 | YanZY97/LeetCode | /2.py | UTF-8 | 1,475 | 3.546875 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1, l2):
l1 = List2ListNode(l1)
l2 = List2ListNode(l2)
out = ListNode(0)
add = 0
result = []
while l1... | true |
96f9251a4098a991becfd597b1fd490815f707b3 | qorjiwon/LevelUp-Algorithm | /Implementation/Baek_2292.py | UTF-8 | 422 | 3.125 | 3 | [] | no_license | """
@ Baek 2292 벌집
@ Prob. https://www.acmicpc.net/problem/2292
Ref.
Ref Prob.
@ Algo: 구현
@ Start day: 20. 01. 15
@ End day: 20. 01. 15
"""
def solution(Num):
if Num == 1:
return 1
Num -= 1
idx = 1
while True:
Num -= (idx * 6)
if Num <= 0:
... | true |