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 |
|---|---|---|---|---|---|---|---|---|---|---|
118ff0fa9f5212f894749caa86362364de928288 | Shapboyz13/pythonchallenge | /ch03/ch03.py | UTF-8 | 472 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python3
# clue1
# recognize the characters. maybe they are in the book,
# but MAYBE they are in the page source.
# inspect webpage
# we need to find
# find rare characters in the mess below:
import re
search_pattern = re.compile('[^\w]{2}[a-z][^\w]{2}')
with open ('ocr.html') as f:
lines = f.read()
... | true |
5c23fdf5f7daadd1bec5b979f525213dd2404af5 | nickmagginas/NetMod | /NetMod/NetMod/Test/classDemo.py | UTF-8 | 3,142 | 3 | 3 | [] | no_license | '''
+++++++++++++++++++++++++++++++++++++++++
| Hello Folks, |
| Welcome to your Library Code Demo |
| Your Host is: |
| Vaginator |
| |
| ---- Nikolaos Manginas ---- |
| ---- UCL ---- |
| ----... | true |
6cb15e4b5b170eb4514e4887724fb88c690351f5 | aayushkabra1/algo_toolbox_UCSD | /week2_algorithmic_warmup/4_least_common_multiple/lcm.py | UTF-8 | 509 | 3.578125 | 4 | [] | no_license | # Uses python3
import sys
def lcm_naive(a, b):
for l in range(1, a*b + 1):
if l % a == 0 and l % b == 0:
return l
return a*b
def gcd(first_num, second_num):
big = max(first_num, second_num)
small = min(first_num, second_num)
while(small):
big, small = small, big%s... | true |
faa58caf5b1d864186db6f6826cf155ade0815a5 | bneb/collatz | /implementation_test.py | UTF-8 | 355 | 3.03125 | 3 | [] | no_license | #
# This serves as a unit test module for collatz implementations
#
from implementations import simple_collatz, collatz, quick_collatz, recursive_collatz
for t in range(100):
v1 = simple_collatz(t)
v2 = collatz(t)
v3 = quick_collatz(t)
v4 = recursive_collatz(t)
print(v1, v2, v3, v4)
assert(v... | true |
a4500eca19ffa12875a80766f7e851c9cf053414 | ashish-mj/Data_Science | /Numpy.py | UTF-8 | 4,080 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 17 18:03:47 2021
@author: ashish
"""
import numpy as np
####################################################### Basic operation
a= [10,2,3,4,10,6,7,8,9,10]
b=np.array(a,dtype=str,ndmin=3)
print(b)
b=np.array(a,dtype=float)
print(b)
b=np.array(... | true |
bc6f79a1378c264ed45a3a23db4abd2f6d336e22 | Laserbean/eyetrackingmouse | /Src/morejunk/test1.py | UTF-8 | 199 | 2.53125 | 3 | [] | no_license |
import torch.nn as nn
import torch
class test(torch.nn.Module):
def __init__(self):
test.fish = 3;
def forward(self,x):
print(x)
test1 = test()
test1(3) | true |
8d6107d2de917f30a80a79a9ac993afdb8fd263b | Samlzy/UCAS-MachineLearning-homework | /SVM.py | UTF-8 | 4,289 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 12:30:40 2020
@author: zhijiezheng
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
# 设置参数
C = 2 # 惩罚系数
kernel = 'rbf' # 核函数
epochs = 75 # 迭代次数
epsilon = 1e-8 # 精度
# 构造伪数据训练集
def load_data():
... | true |
46d6976eb65d88c55536593ebdf942e89ff6eae8 | grahm-zz-manley/pitchscrape | /pitchscrape/scraper.py | UTF-8 | 5,233 | 2.96875 | 3 | [] | no_license | import sys
import logging
import logging.config
from itertools import count
from datetime import datetime
import time
import requests
from bs4 import BeautifulSoup
from core.review import Review
from core.db_connection import DbConnection
from core import config
headers = {'User-Agent':'Mozilla/5.0'}
DATE_FORMAT = '%Y... | true |
362164e46a8b1dd730496dfa82171da82b1deda9 | ashcolecarr/Euler-in-Python | /Problems 1-50/problem007.py | UTF-8 | 890 | 3.890625 | 4 | [] | no_license | # Project Euler Problem 7
import time
startTime = time.clock()
POSITION = 10001
def isPrime(n):
if n < 2:
return False
elif n % 2 == 0:
return n == 2
p = 3
while p * p <= n:
if n % p == 0:
return False
p += 2
return True
# All primes have the form 6... | true |
bfe136b193963ac9529746f3170ce3afa7301846 | wade1990/cgat-apps | /cgat/tools/fasta2vcf.py | UTF-8 | 2,667 | 2.703125 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | """convert fasta to VCF
==========================
Output a file in VCF format with variants according
to a fasta file.
"""
import sys
import random
import cgatcore.experiment as E
import pysam
def main(argv=None):
parser = E.OptionParser(version="%prog version: $Id$",
usage=globa... | true |
bc76eba2c9007046082ef10053ed9178fe8ae903 | deleomike/Lyft-Resnet | /models/LyftNet/MNASBackbone.py | UTF-8 | 1,688 | 3.03125 | 3 | [] | no_license | import torch
import torch.nn as nn
from torchvision.models import mnasnet1_0
def trim_network_at_index(network: nn.Module, index: int = -1) -> nn.Module:
"""
Returns a new network with all layers up to index from the back.
:param network: Module to trim.
:param index: Where to trim the network. Counte... | true |
d7ac5830d0b3a344c485d5c3ed6e0ab453702202 | kbutler52/python_scripts | /williamHw/start_stop.py | UTF-8 | 143 | 3.046875 | 3 | [] | no_license |
#05-20-2020
start = 0#start the condition
while start <=5:#Stops the condition
print(start)
start=start+ 2# #Iteration/ Step function
| true |
0d1e1b7b83d6ee43b982ddd6f685bb2ea419a7cc | abhiramr/Everything_Python | /Random_Py_scripts/brackets.py | UTF-8 | 738 | 3.765625 | 4 | [] | no_license | # PEP-8 Compliant
# Program to validate parentheses
def bracket_checker(sentence):
li = []
left_indices = []
right_indices = []
k=0
for i in sentence:
if i == '(':
k += 1
left_indices.append(sentence.index(i))
if i == ')':
k -= 1
righ... | true |
1a47fdbbb13a2c7691a55af083f099daf9c8fbcb | neohack22/dataforgoodresp | /Partie_web/requetes.py | UTF-8 | 1,526 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 27 15:32:57 2018
@author: nisha
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 16:38:45 2018
@author: nisha
"""
from connectionBD import connection_BD
def insertion_commentaire(): #un select
com = connection_BD()
cursor = com.cursor()
select_bd = "... | true |
293bd3647085587a9df4836e6406fdf3cb17f4fa | TesterCC/Python3Scripts | /liaoxuefeng/oop/protected_student.py | UTF-8 | 1,861 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = 'TesterCC'
# __time__ = '17/11/13 22:54'
"""
https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/0014318650247930b1b21d7d3c64fe38c4b5a80d4469ad7000
访问限制
"""
# 如果要让内部属性不被外部访问,可以把属性的名称前加上两个下划线__,
# 在Python中,实例的变量名如果以__开头,就变成了一... | true |
0f0f3043cd5f4fd2653a259f60ddfa3db915a36f | sudhanshu-jha/python | /python3/Python-algorithm/Hard/wordTransformer/wordTransformer.py | UTF-8 | 2,269 | 3.96875 | 4 | [] | no_license | # Given two words of equal length that are in a dictionary, write a
# method to transform one word into another word by changing only
# one letter at a time. The new word you get in each step must be in
# a dictionary.
# EXAMPLE
# Input DAMP,LIKE
# DAMP->LAMP->LIMP->LIME->LIKE
# The main idea is to first get all valid... | true |
bedd061b6b4509b759f729840ac5b976060f210d | kakaacac/HubaoMS | /HubaoMS/views/common.py | UTF-8 | 2,192 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import hashlib
import os
from PIL import Image
from flask import make_response
from flask_login import login_required
from flask_restful import Resource, reqparse
from werkzeug.datastructures import FileStorage
from config import IMAGE_DIR, IMAGE_BASE_PATH
class ImageUpload(Resource):
def... | true |
08197a2db6c81e65d1f951887531606ab9bfea87 | Liyantian/pg2014_tian | /hw1/hw1-1.py | UTF-8 | 176 | 3.34375 | 3 | [] | no_license | def fib(n):
a=1
b=0
i=1
print('['),
while i<=n:
c=a+b
print(c),
if i<n:
print(','),
else:
print(']')
a=b
b=c
i=i+1
fib(1)
fib(2)
fib(6)
raw_input()
| true |
ea0a2298e53cd46de30c81703816992ce6a6d784 | dmitryzykovArtis/education | /29.py | UTF-8 | 583 | 3.546875 | 4 | [] | no_license | """
Задача о рюкзаке (дискретная)
"""
n = int(input())
m = int(input())
price = [0]*(n+1)
weight = [0]*(n+1)
value = [[0]*(n+1) for i in range(0, m+1)]
for i in range(1, n+1):
weight[i] = int(input())
price[i] = int(input())
for i in range(1, n+1):
for j in range(1, m+1):
if weight[i] > j:
... | true |
48e3acc8ba1da68bb88b651aacfd35fa93505903 | esterlinpol/fisica2python | /serv.py | UTF-8 | 849 | 2.671875 | 3 | [] | no_license | from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
valor = "hola"
valor2 = "40"
valor3 = "50"
valor4 = "20"
valor5 = "not found"
class Serv(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.path = '/index.html'
process = open(self.path[1:]).read()
... | true |
5798484a0f8dac6528e2abf65b3a77fa0fcded4a | onlyoneprogram/git-python | /python/miao/miao/spiders/miao.py | UTF-8 | 3,312 | 2.96875 | 3 | [] | no_license | # !/usr/bin/env python3
# -*- coding:utf-8 -*-
import scrapy
from scrapy import Selector
from scrapy import Request
from scrapy import Item, Field
class TopicItem(Item):
url = Field()
title = Field()
author = Field()
class ContentItem(Item):
url = Field()
content = Field()
author = Field()
... | true |
fce2a6b2a89f4f96496e64c67c5d6895d8be5a7d | seergenius/hathiadsdst4l | /reduceHathiFile.py | UTF-8 | 2,167 | 2.765625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | import csv
import sys
csv.field_size_limit(sys.maxint) #forces python to work with huge files
BIG_FILE='hathi_full_20130601.txt' #tab-separated hathi trust file. Retrieved from 'http://www.hathitrust.org/hathifiles'
SELECT_FILE='HathiIDs.csv' #csv with gathered IDs. This is what I want to compare to the... | true |
43526806c5339568343f920e72faea8859e0c295 | efrainc/project_euler | /problem22.py | UTF-8 | 682 | 3.53125 | 4 | [
"MIT"
] | permissive | #! /usr/bin/env python
def read_file():
"""Opens Project Euer Name file. Reads names, sorts and converts str into
a list object"""
a = open('names.txt', 'r')
data = a.read()
names = data.split(",")
a.close()
names.sort()
return names
def name_score():
"""Calculates the total nam... | true |
04a16d8fd848695ab8609a291c7e16de9628f2a4 | mooyeon-choi/TIL | /problemSolving/swExpertAcademy/python/sw_5110_수열합치기(미완).py | UTF-8 | 1,352 | 3.5 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
def __del__(self):
print(self.data, '삭제')
class List:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def printlist(self):
if self.head is None:
... | true |
32eb3d37bd6439ceb03b107a521b1afa4c2f63b9 | mbr-phys/cpviolation | /global/fitting.py | UTF-8 | 3,823 | 3.015625 | 3 | [] | no_license | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Delaunay
from scipy.special import gamma
from scipy.integrate import quad
def chisq_simp(obs,the,sige,sigt,sigma):
'''
chisq val, all parameters lists of values, simple
'''
N = len(obs)
... | true |
79f19b217b40a47352971caab4d6c70535a99c35 | eddie246/python-playground | /Week 1/day 1 - Variables/index.py | UTF-8 | 409 | 4.09375 | 4 | [
"MIT"
] | permissive | print('Hello World\nHello World Again')
city = input('What is the name of the city you grew up in?\n')
pet = input('What is the name of your first pet?\n')
band_name = city + ' ' + pet
print('Your band name is: ' + band_name)
# print('Hello ' + input('What is your name? ') + '!')
# name = input('What is your name? ... | true |
c14b6a7ea9a3d13568d0cf5de747b19278110207 | toma-ungureanu/FII-Python | /lab5/modul1.py | UTF-8 | 127 | 3.375 | 3 | [] | no_license | def suma(x, y):
return x + y
def power(x, y):
return x ** y
def sum_first_n_numbers(n):
return n * (n + 1) / 2
| true |
51bf1422093bd18eec2407e242535edfc558389b | githint/chp_trial | /agent2.py | UTF-8 | 7,555 | 2.625 | 3 | [] | no_license |
import random
import gym
import numpy as np
import pandas as pd
#import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
import time
target = 1000
timescale = 5
#
# self.max_points_space = 1000
# var_point = int(np.power(self.max_points_spa... | true |
7b3f6f46baab1018a38af70351fc734f0f0ada3b | Jackyzzk/Algorithms | /贪心思想-10-0053. 最大子序和-贪心.py | UTF-8 | 1,002 | 3.765625 | 4 | [] | no_license | class Solution(object):
"""
给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
输入: [-2,1,-3,4,-1,2,1,-5,4],
输出: 6
解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。
进阶:
如果你已经实现复杂度为 O(n) 的解法,尝试使用更为精妙的分治法求解。
链接:https://leetcode-cn.com/problems/maximum-subarray/
"""
def maxSubArray(self, nums):
"""
:type nums: Li... | true |
cf32f0789602ad78d48201636ea0b81b92e36154 | jenniferchandran/InteractionsBetweenClassesExample | /Fish.py | UTF-8 | 804 | 4.0625 | 4 | [] | no_license | class Fishy:
def __init__(self, name, type, strength):
self.name = name
self.type = type
self.strength = strength
def __str__(self):
return self.name + " is a " + self.type + " type fish, and has a strenght level of " + str(self.strength)
def __eq__(self, Fish2):
return self.name == Fish... | true |
cbd3328bf00943e92e074cf6fac3a9963a29bca1 | udubouski/PythonIBA | /lab3/task2.py | UTF-8 | 1,163 | 2.625 | 3 | [] | no_license | """
Задание 1. Наследование и полиморфизм
Определить иерархию и/или композицию классов/объектов (в соответствии с вариантом). Реализовать классы.
Написать демонстрационную программу, в которой создаются объекты различных классов. Определение классов, их реализацию, демонстрационную программу поместить в отдельные файлы... | true |
7fbfcde393f5cc5175aff532fa1becc324683dad | sriniviswa/openlab-py | /eval1/fruit_ninja.py | UTF-8 | 1,098 | 3.75 | 4 | [] | no_license | FRUIT_NAMES = ['apple', 'banana', 'orange']
print(FRUIT_NAMES)
fruits1 = []
fruit = ''
new = []
def cut_fruits(fruits):
for test in fruits:
if test in FRUIT_NAMES:
n = len(test)
va = ''
if n % 2 == 0:
for i in range(0, int(n / 2)):
va ... | true |
a7930d341cb33a9c0a56fb1cd98bcc187d23c8dc | GrayStrider/Playground | /static-class methods.py | UTF-8 | 497 | 4 | 4 | [] | no_license | class Test:
a = 10
def __init__(self):
self.a = 15
@staticmethod
def staticMethod(num: int):
a = 5
print(a + num)
@classmethod
def classMethod(cls, num: int):
print(cls.a + num)
print(Test.a + num)
def justMethod(self, num: int):
self.a = 5... | true |
d9ec38a211cbc85ad193212091b37dc5048dcd62 | nelson-liu/lexical-semantic-recognition | /scripts/analysis/count_lexlemma_oovs.py | UTF-8 | 4,939 | 3.015625 | 3 | [
"MIT"
] | permissive | import argparse
from collections import defaultdict, Counter
import itertools
import json
from tqdm import tqdm
def is_int(x):
try:
int(x)
return True
except ValueError:
return False
def _is_divider(line: str) -> bool:
return line.strip() == ""
def main(train_path, test_path):... | true |
cab0d0ec1eb87b69b6904ac042ff1c28a565f816 | xiaosanmeng/Taxi_Clustering | /gps_cluster.py | UTF-8 | 651 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from read_on_down_data import *
from sklearn.cluster import DBSCAN
import matplotlib.pyplot as plt
on_down_path = "./on_down_dataset"
def cluster(m_eps, m_samples, arr):
"""
:param m_eps:
:param m_samples:
:param arr:
:return:
"""
dbscan = DBSCAN(eps=m_eps, min_sam... | true |
498dc9fc2d1719498c7f1b4ae41a68d44f30c1e0 | nmanzini/google_coding_jam_2018 | /1A/pan.py | UTF-8 | 1,306 | 3 | 3 | [] | no_license | T = int(input())
for case in range(T):
R, C, H, V = [int(n) for n in input().split(" ")]
matrix = []
total = 0
result = "POSSIBLE"
for i in range(R):
matrix.append(input())
total += matrix[i].count('@')
each_choco = total /( H + 1) / (V + 1)
if each_choco % 1 != 0:
result = "IMPOSSIBLE"
somma = 0
per_ro... | true |
2f8873cbbda861ddb3c5094d348a728213e57823 | MirkoNardini/tomorrowdevs | /Workbook - cap3/Exercise 78 The Collatz Conjecture.py | UTF-8 | 194 | 3.890625 | 4 | [] | no_license | numero = int(input("Enter a number: "))
print(numero)
while numero != 1:
if numero %2 == 0:
numero = numero /2
else:
numero =(numero * 3)+1
print(numero)
| true |
21d863d050a7ce9c13e85823831580abd5fe1b41 | ivan-afonichkin/RayTracer | /camera.py | UTF-8 | 1,280 | 3.296875 | 3 | [] | no_license | __author__ = 'ivan'
import numpy as np
from primitives import Ray
class Camera:
def __init__(self, origin, direction, fov_angle, resolution_x, resolution_y, near_clip):
self.origin = origin
self.direction = direction
self.fov_angle = fov_angle
self.resolution_x = resolution_x
... | true |
b11280d212731227f6d851169bfbae85110048fa | michi7x7/python-deltasigma | /deltasigma/tests/test_ds_optzeros.py | UTF-8 | 1,493 | 2.671875 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
# test_ds_optzeros.py
# This module provides the tests for the ds_freq() function.
# Copyright 2014 Giuseppe Venturini & Shayne Hodge
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB delta sigma toolbox (aka "delsigma"), u... | true |
5f065d9759cf2859c08412e565cd8b7b78d2533a | Zloichist83361/Tasks-course | /astronauts.py | UTF-8 | 344 | 3.625 | 4 | [] | no_license | candidate = 0
min_candidate = 150
max_candidate = 190
a = input()
while a != '!':
a: int = int(a)
if a >= 150 and a <= 190:
candidate += 1
if a < min_candidate:
min_expectan = a
if a > max_candidate:
max_candidate = a
a = input()
print(candidate)
print(min_ca... | true |
3e563ebf7c96387e534d5019f74c2051351be8af | jmartin328/RaspberryPi | /backtrackplayer.py | UTF-8 | 1,486 | 2.609375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
from pygame import mixer
#Initialize pygame mixer
mixer.init()
#Load the sounds
soundC
soundG
soundD
soundA
sound = mixer.Sound('Soulful Atmospheric Groove Guitar Backing Track Jam in E.wav')
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.IN, pull_up_down=G... | true |
24c513f548f9116613976f61cd62dcb12992d453 | chainer/onnx-chainer | /onnx_chainer/onnx_helper.py | UTF-8 | 4,521 | 2.921875 | 3 | [
"MIT"
] | permissive | import onnx
__func_name = None # not care the name is unique on whole graph
def set_func_name(func_name):
"""Set the name of Chainer function being converted.
Args:
func_name (str): The name of Chainer function.
"""
global __func_name
__func_name = func_name
def get_func_name():
... | true |
e7c3337f56c0119a81008c28b11afd04de1b9dd6 | vsg/adventofcode | /Day2/advent_2_1.py | UTF-8 | 317 | 2.96875 | 3 | [
"MIT"
] | permissive | with open("day_2_input.txt") as f:
boxes = f.readlines()
ans = 0
def small(temp):
temp.remove(max(temp))
return temp[0] * temp[1]
for x in boxes:
temp = [ int(i) for i in x.rstrip().split('x') ]
ans += ( (2*temp[0]*temp[1]) + (2*temp[1]*temp[2]) + (2*temp[2]*temp[0])) + small(temp)
print ans
| true |
d28b390190aaabc5337d48153e746f12a78ebe77 | reacktor/RTR105 | /dgr_20181105.py | UTF-8 | 1,980 | 3.3125 | 3 | [] | no_license | Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "copyright", "credits" or "license()" for more information.
>>> str1 = "Hello"
>>> str2 = 'there'
>>> bob = str1 + str2
>>> print(bob)
Hellothere
>>> str3 = '123'
>>> str3 = str3 + 1
Traceback (most recent call last):
File "<pyshell#5>", line 1,... | true |
7dab9650b232f433e5a88eb7591aa3d69ee30deb | fivetwentyseven/freelancer | /theice/theice.py | UTF-8 | 3,014 | 2.6875 | 3 | [] | no_license |
import time
import calendar
from datetime import date, timedelta
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
def main():
url = 'https://www.theice.com/marketdata... | true |
d72702bf15bc3159faa4ef5fa93d3d66a17dfe22 | tony820315/telegram-bot-cwb-weather | /forecast_36hr.py | UTF-8 | 3,713 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import logging
import calendar
import datetime
import configparser
import requests
import sqlite3
config = configparser.ConfigParser()
config.read('config.ini')
CWB_URL = config['CWB']['CWB_URL']
CWB_DB_PATH = config['CWB']['CWB_DB_PATH']
logging.basicConfig(le... | true |
3049a6844d7d43b678dda16451088855e9a56aaa | osaleem303/Sahaara | /flask-backend/logic.py | UTF-8 | 1,535 | 2.75 | 3 | [] | no_license | import geopy.distance
from DB import DB
class Location:
def __init__(self, user):
self.current_user = user
self.guardians = None
self.users = None
self.candidates = None
def get_locations(self):
locations_table = DB.get_table('location')
locations = []
... | true |
cdd4864035cc828b4599268fb02e92dead8f6291 | Korea-noname/CodeUp_Python | /CodeUp_6052.py | UTF-8 | 104 | 3.46875 | 3 | [] | no_license | # 정수가 입력되었을 때, True/False로 평가
num1 = input()
num1 = int(num1)
print(bool(num1)) | true |
b76918bac96d01a7baba296c8594a86f7e6159a8 | adriaan90/bulb-vs-kettle | /cost.py | UTF-8 | 710 | 3.328125 | 3 | [
"MIT"
] | permissive | import datetime
bulbWattRating = 6 #Watt
kettleWattRating = 3000 #Watt
cupBoilDuration = datetime.time(0,1,30) #datetime.time object 00:01:30
kiloWattHourCost = 1.02 #kWhour electricity cost of utility provider in £
costOfBoiling = kiloWattHourCost*(cupBoilDuration.hour+cupBoilDuration.minute/60+cupBoilDuration.secon... | true |
34800365be822bce9e9221cb0b4c4e3b515dde42 | KokorinIlya/information_retrieval | /spellcheck/trie.py | UTF-8 | 4,154 | 3.28125 | 3 | [] | no_license | from spellcheck.editorial_actions import Match, Replacement, Removal, Insertion
class TrieNode:
def __init__(self, is_terminal=False):
self.is_terminal = is_terminal
self.children = {}
class Trie:
def __add_word(self, word):
cur_node = self.root
for cur_letter in word:
... | true |
fac9ede61734147107eceba9fad85e4307f5ea97 | gustcnn/PythonSenior | /com/processmulti_copy/mutiprocessing_queue.py | UTF-8 | 1,130 | 3.109375 | 3 | [] | no_license | # --*--coding:utf-8
# Author:cnn
import multiprocessing
# 多进程通信--queue,因为进程之间是独立的,通信需要使用queue,完成进程间数据共享
def download_from_web(q):
"""模拟下载数据"""
data = [11, 22, 33, 44]
# 循环列表,将数据放入队列中
for temp in data:
q.put(temp)
print("------数据下载完毕,放入队列中-------")
def analysis_data(q):
"""模拟处理数据"""
... | true |
77e3a762062ebc03cff4edb927eaeb84ccc97329 | scipp/scipp | /src/scipp/compat/dict.py | UTF-8 | 6,007 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# @author Neil Vaytet
from __future__ import annotations
from collections import defaultdict
import numpy as np
from ..core import vectors # NOQA
from ..core import DataArray, Dataset, DType, Variable, vector... | true |
8af46135de880c1f1ffcfea774f1888d2bc1bd27 | Sandy4321/corus | /corus/bio.py | UTF-8 | 1,798 | 2.84375 | 3 | [
"MIT"
] | permissive |
from .record import Record
B = 'B'
I = 'I'
O = 'O'
class Span(Record):
__attributes__ = ['start', 'stop', 'type']
def __init__(self, start, stop, type):
self.start = start
self.stop = stop
self.type = type
def parse_bio(tag):
if '-' in tag:
part, type = tag.split('-',... | true |
3f7c1efbd121f9b388012bc2eb45fb898301215d | jingxianWang9401/leetcode | /669pruning_binary_search_tree.py | UTF-8 | 2,256 | 4.125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 16 15:25:55 2020
@author: wangjingxian
"""
#669. 修剪二叉搜索树
'''
给定一个二叉搜索树,同时给定最小边界L和最大边界R。通过修剪二叉搜索树,使得所有节点的值在[L, R]中 (R>=L) 。
你可能需要改变树的根节点,所以结果应当返回修剪好的二叉搜索树的新的根节点。
示例 1:
输入:
1
/ \
0 2
L = 1
R = 2
输出:
1
\
2
示例 2:
输入:
3
/ \
... | true |
7e6205370178bd11c4fd192f69805b6417f5f587 | USTLZh/student-projects | /ablation-software/xyq_class/widgetutils/ComboBoxUtils.py | UTF-8 | 5,076 | 2.6875 | 3 | [] | no_license | """
# @author chrisxu
# @create 2020-08-15 9:57
# Ctrl + Alt + L:格式化代码
# ctrl + Alt + T:代码块包围
# ctrl + Y:删除行
# ctrl + D:复制行
# alt+上/下:移动光标到上/下方法
"""
import src.GlobalVar as gl
class ComboBoxUtils():
"""
ComboBox的工具类
"""
@staticmethod
def add_to_comboBox_schemes_auto2(auto2Pareto):
"""
... | true |
f3dc097dbf8817c2a86d9828b68874c6de685b52 | dagbarkraktar/itsm18-rest-api | /app/resources/backups_data.py | UTF-8 | 1,926 | 2.734375 | 3 | [] | no_license | from flask import jsonify
from flask_restful import Resource
import redis
import json
MAX_QTY = 10
class Backups(Resource):
""" Endpoint "/api/v1/backups" implementation """
def get(self):
try:
# Redis DB connection
redis_db = redis.Redis(host="192.168.10.210", ... | true |
e7f0ee69dd46b0a7ceee77a9f156eb07781a9301 | DataScience-TeamBadger/BadgerRepository | /bin/models/Model.py | UTF-8 | 993 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 19 11:13:37 2017
@author: Alex Kerzner
"""
# Import NumPy
import numpy as np
# Import PyQtGraph library
import pyqtgraph as pg
"""
An abstract Model type to be implemented by every model.
This contains <b>everything</b> needed by the GUI - it is up to the
implementation... | true |
e7153157e5d48eeda347bec19f849d327ca6d77c | eaglelandsonce/AZ-500 | /index.py | UTF-8 | 542 | 2.75 | 3 | [] | no_license | import glob
with open('index.md', 'a') as out:
for path in glob.glob('./Instructions/Labs/LAB_*.md'):
with open(path, 'r', encoding="utf8") as file:
file.readline()
file.readline()
lab = file.readline().split(':')[1].split('-')[1][1:-2]
module = file.readline... | true |
dbc031f846b6f5d5d3d2d44fb6c56e9312ca1a0b | jakobjohns/Python-Web-Server-Docker-Container | /webserver.py | UTF-8 | 1,029 | 2.578125 | 3 | [] | no_license | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import parse_qs
import cgi
class GP(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_HEAD(self):
self._set_h... | true |
30df66a209091bd69f6dc528955d8e6e4e0a4f23 | pbskrreddy/AWS_Lambda_boto3 | /json_s3_lambda_dynamodb.py | UTF-8 | 484 | 2.640625 | 3 | [] | no_license | # JSON--------->S3--------->LAMBDA-------->DynamoDB
# suppose a we have json and upload a json to s3 bucket, then lambda will trigger the s3 objects then store into dynamoDB.
import boto3
s3_client = boto3.client('s3')
def lambda_handler(event, context):
bucket = event['Records'][0]['s3'][bucket]['name']
... | true |
87a8fe13428401fd55a0aa6b8a64a605d974295a | knndnd/emphatic-lstd-experiments | /emphatic-lstd-experiments/algorithms/lstd.py | UTF-8 | 929 | 3.03125 | 3 | [] | no_license | """Least Squares Temporal Difference Learning."""
import numpy as np
class LSTD():
def __init__(self, n, epsilon=0):
self.n = n # number of features
self.t = 0 # timestep
self.z = np.zeros(n) # traces
self.A = np.e... | true |
ecd3b0c27bdd6dbcb337fd79814b341201f51455 | beatzunknown/AoC2020 | /14.py | UTF-8 | 1,365 | 3.078125 | 3 | [] | no_license | import re
import itertools
with open('14.txt', 'r') as f:
data = [l.rstrip() for l in f.readlines()]
pattern = re.compile(r'mem\[(\d+)\] = (\d+)')
mask = ''
mem1 = {}
for l in data:
if l[:4] == 'mask': mask = l.split()[-1]
else:
addr, val = pattern.search(l).groups()
val = b... | true |
8b0c4312cda26c4e78999dd0d4b4841713bdf30e | thomaspfeiffer-git/raspberry | /playground/ipc/SensorValue.py | UTF-8 | 1,706 | 2.71875 | 3 | [] | no_license | ################################################################################
# SensorValue.py #
# Class providing various data of sensors #
# (c) https://github.com/thomaspfeiffer-git 2016 ... | true |
9635eb918937e013ad7207fb85eb9f3f8ed7fcde | igem-fau/allerGEM | /implementations/allergennet_ImplementationLinkai.py | UTF-8 | 2,542 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # ResNet(30)
# In[ ]:
import tensorflow as tf
import numpy as np
from tensorflow.keras.models import Model
from tensorflow.keras.layers import (Input, Activation, Dense, Flatten, Reshape, Conv1D, Conv2D, Add, BatchNormalization, MaxPooling1D)
# ## Function and Co. definitio... | true |
e3b2319bf7267151a4a97546518473c1095b3048 | mat-1/repl-talk-api | /repltalk/graphql.py | UTF-8 | 2,839 | 2.890625 | 3 | [
"MIT"
] | permissive | def builtin_to_graphql(item):
if isinstance(item, list) or isinstance(item, tuple) or isinstance(item, set):
value = Field(*item)
elif isinstance(item, dict):
value = Field(item)
else:
value = str(item)
return value
class Alias():
def __init__(self, alias, field):
self.alias = alias
self.field = field
... | true |
f3d192059051a6168e0bbc00a7a464dc3b5c89df | MatejCerar/UVP-projekt | /vmesnik.py | UTF-8 | 579 | 2.515625 | 3 | [] | no_license | import bottle
from projekt_model import *
@bottle.get('/')
def osnovna_stran():
primer = Ploscina([[0,0], [1,1], [3,0], [2,-2]], 2)
return bottle.template('osnovna_stran.html', primer=primer)
@bottle.post('/izracun/')
def izracun():
tocke = bottle.request.forms['tocke'] #problem ker je to st... | true |
8f856bf2dbe3d6dc431d5119c9215a9d6f3fed37 | Michael78912/SMNW | /compiled.py | UTF-8 | 160,990 | 2.6875 | 3 | [
"MIT"
] | permissive | import zipfile
import tarfile
import gzip
import bz2
import os
import subprocess
import shutil
import glob
import json
GIT_SCRIPT = """
git clone https://michael78912/smnw-archives
cd smnw-archives
git init
echo copying archives...
cp ../Archives/* .
git add *
git push origin master
"""
def make_xz(file, dir='.'):
... | true |
ec04308109210540b03a7d33bdc9913ac16be40b | fsfrazao/DegDay | /linear_regression.py | UTF-8 | 2,053 | 3.25 | 3 | [] | no_license |
# coding: utf-8
# """""This function takes as argument the path to the directory containing all the input files and returns a the plotog the cummulative GDD over a period of time.
# it also takes the summary and stores it in a txt file called learnedmodel.txt""""
# In[1]:
import pandas as pd
import matplotlib.pyplo... | true |
74d5077202d4bca15a09b1e511c5bb44384fe50d | hbaromega/2D-Resistor-Network | /TRI/tri_Reff_vs_Ly_fixed_Lx.py | UTF-8 | 1,584 | 2.625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import time
from tri_find_Reff_routine import *
def main():
start = time.time()
V0=1.0; R=1.0
test_mode=1
if test_mode==0:
Lx,Ly = map(int, input('Enter Lx & Ly\n').split())
#Ly = int(input('Enter Ly\n'))
#V0 = float(inpu... | true |
a73a06a6985c6059231d879a5e3a6284d48fbc8f | mateuszsowinski/Spotify_Api | /download_data.py | UTF-8 | 642 | 2.65625 | 3 | [] | no_license | from libraries import *
albumsTab = []
def search_artist(artist):
search_artist = spotipy.search(q='artist:' + artist, type='artist')
items = search_artist['artists']['items']
if len(items) > 0:
artist = items[0]
artist_id = artist['id']
return artist_id
def search_albums(artist_id)... | true |
ad7485283fe6bfb5594079401e4f0b854e79ba2d | geophysics-ubonn/crtomo_tools | /src/td_correct_temperature.py | UTF-8 | 8,232 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Tool to add or substract the temperature effect on/of resistivity data.
The calculation is done after Hayley (2007):
rho_std_i = (m * (T_i - 25°) + 1) / (m * (T_std - 25°) + 1) * rho_i
Options:
* m: choose coeffcient m
* T_std: choose standard temperatur to which... | true |
2a28df6f5577413222e85b07988a1303be9a489b | Cat-Expert/lab | /lab2/lab2.py | UTF-8 | 231 | 3.109375 | 3 | [] | no_license | number_one = input()
number_two = input()
number_three = input()
number = max(number_one, number_two, number_three)
number2 = min(number_one, number_two, number_three)
print("highest number" , number, 'low_number' , number2)
| true |
5f4e71ff61cd7bfff3debd3f7c7478996e494ff1 | shehbazj/fslice | /visualize/post_processing/pathCounter/multipleSolver.py | UTF-8 | 1,048 | 2.96875 | 3 | [] | no_license | from z3 import *
from get_vars import *
def get(s,varStr):
ret = set()
for items in s.assertions():
ret = set(list(get_vars(items)) + list(ret))
for k in ret:
if str(k.n) == varStr:
print "found k", k
return k
# m = s.model()
# for c in m.decls():
# if(c... | true |
052a6d4d234b5b4a13208fa1f99463dd76d9ba36 | Nithanth/Graduate-Algorithm- | /DFS/257. Binary Tree Paths.py | UTF-8 | 918 | 3.921875 | 4 | [] | no_license | """
Given a binary tree, return all root-to-leaf paths.
Note: A leaf is a node with no children.
Example:
Input:
1
/ \
2 3
\
5
Output: ["1->2->5", "1->3"]
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
#... | true |
82e32f2ae63ca5cb2fb97de32683bae881ac5286 | Panfeihao/Python-Data-Science-Cookbook | /范例/Chapter_1/ex1.14.2.py | UTF-8 | 461 | 3.65625 | 4 | [] | no_license | # 1
def cylinder_vol(r):
pi = 3.1415926
def get_vol(h):
return pi * r**2 * h
return get_vol
# 2
radius = 10
find_volume = cylinder_vol(radius)
# 3
height = 10
print "Volume of cylinder of radius %d and height %d = %.2f cubic " \
"units" % (radius, height, find_volume(height))
... | true |
2d08f1a83b6371771cd648d7ddc12953cab0cf8b | Peeza/Python | /Assignment1.py | UTF-8 | 248 | 3.953125 | 4 | [] | no_license |
print("Hi, Dr.Bonamente!")
print("Lets add some numbers!")
print("Whats your first number? ")
number1 = float(input())
print("whats your second number? ")
number2 = float(input())
print("The sum of the numbers is",number1+number2) | true |
1fa1959163e2980fe1620539c48f9daa6e909bc6 | kimhyunkwang/algorithm-study-02 | /3주차/심재민/훌라후프.py | UTF-8 | 239 | 3.15625 | 3 | [] | no_license | # [수학] 훌라후프
N = int(input())
r = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
for i in range(1, N):
m = gcd(r[0], r[i])
print("%d/%d" % (r[0]//m, r[i]//m)) | true |
4ff7b2739b6fbb2b0c3fc7fcfaeb33007eb1bb69 | Omwitsa/BioTime | /Python26/Lib/site-packages/pypm/common/db.py | UTF-8 | 5,070 | 2.640625 | 3 | [] | no_license | # Copyright (c) 2009 ActiveState Software Inc.
# See http://www.activestate.com/activepython/license/ for licensing
# information.
import os
from os.path import exists, dirname
from contextlib import contextmanager
import sqlalchemy.types
from sqlalchemy import Table, Column, String, Text, MetaData
from sqlalchemy i... | true |
f642cf953ed95181ab76a7df60e8ce08560fdd32 | ISS-Kerui/python-algorithm | /题目/栈的压入、弹出序列/code.py | UTF-8 | 504 | 2.8125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
def IsPopOrder(self, pushV, popV):
# write code here
stack = []
if pushV == None or popV == None or len(pushV) != len(popV):
return False
else:
j = 0
for i in range(len(pushV)):
stack.append(p... | true |
d81efebe3e9f9a5a1685f458b82104cb4ebcd4d7 | 7Aishwarya/python | /assign30.3.py | UTF-8 | 529 | 3.828125 | 4 | [] | no_license | def is_palindrome(s):
if s == '':
return True
else:
if (ord(s[0]) - ord(s[len(s)-1])) == 0:
is_palindrome(s[1:len(s)-1])
else:
return False
print (is_palindrome(''))
#>>> True (expected = True)
print(is_palindrome('abab'))
#>>> False (expected... | true |
85400c6ba7a030aefb78a48f278f8c9151543f15 | sanath1975/Python2020 | /Operators_cls.py | UTF-8 | 5,076 | 3.765625 | 4 | [] | no_license | Sanjeev-Python-8:Am
Weekdays
24-07-2020 Class Recordings & Files
Sanjeev Classes March
•
10:00 AM
operators_cls.py
Text
Class comments
24-07-2020 Class Recordings & Files
# Operators -- Its a symbol which perform an operation between 2 or more operands....
# 3+5+6
# List of Operators:-
# 1) Arithemtic Operator... | true |
899172684872fc76f54ecd7e12cafea988f696ca | prksu/aws-mfa-plugin | /src/aws-mfa/credentials.py | UTF-8 | 3,657 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Copyright(c) 2021 Authors
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 rights
to use, copy, modify, merge, publish, distribute, sublicen... | true |
6eb6222b41286422fbd703412f952159d6711a15 | 21-Days/play | /UI/gui.py | UTF-8 | 1,659 | 2.59375 | 3 | [] | no_license | from tkinter import *
import menuc
import misc
import main
import function
from lib import webbrowser
def main(root):
function.clear(root)
file=open("menutitles.txt","r")
sub=file.readlines()
Label(root,text="21 Days",font=32).grid(0,0)
textn=random.randint(0,15)
txt=sub[textn]
if("EASTER" in txt):
Button(roo... | true |
17fe80c28baf5d57aabcaf21d3433729671dda0b | chao-shi/lclc | /684_redudant_conn_m/bfs_loop.py | UTF-8 | 1,831 | 2.96875 | 3 | [] | no_license | class Solution(object):
def findRedundantConnection(self, edges):
"""
:type edges: List[List[int]]
:rtype: List[int]
"""
N = len(edges)
root = 1
neigh_map = collections.defaultdict(set)
for e in edges:
neigh_map[e[0]].add(e[1])
... | true |
330554dec15dc548ac83d066bf4e19690cdc4d95 | ineq-lab/Nauka-ep-2 | /dalsza nauka.py | UTF-8 | 2,093 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
colours = ['red', 'blue', 'yellow', 'yellow', 'green', 'black', 'white']
plurals = ['sky', 'water', 'sea', 'T-shirt']
actors = ['Angelina Jolie', 'Jeniffer Lopez', 'Pamela Anderson', 'Megan Fox']
colours.pop(0)
print('Nr indeksu:', colours.index('white'))
print('lista:', colours)
print(... | true |
2a116fa64267cd455cb46286b928a967875d1800 | cyangiraffe/chickpea | /couplers.py | UTF-8 | 33,551 | 3.0625 | 3 | [] | no_license | # This file contains functions that will generate photonic couplers.
# It contains the following top-level functions:
#
# dir_coupler Generates a directional coupler
#
# dir_coupler_ports Calculates the coordinates of the ports of the
# directional coupler generated by d... | true |
e6b282d7b5856c1e10515e77b031041d11eb7960 | Qiguanyi/Coursera-Data-Structures-and-Algorithms-Specialization | /Part I - Algorithmic Toolbox/Week_4/4-6 Cloest Points.py | UTF-8 | 1,561 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 2 18:49:44 2020
@author: ThinkPadUser
"""
import math
import sys
def distance(point1, point2):
'''
point1 = [x1, y1]
point2 = [x2, y2]
'''
return math.sqrt((point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2)
def closest(... | true |
203f3b9073444f279ce7454ad4688e07a73405f9 | MarvelICY/LeetCode | /Solutions/largest_rectangle_in_histogram.py | UTF-8 | 1,653 | 3.53125 | 4 | [] | no_license | #!usr/bin/python
# -*- coding:UTF-8 -*-
'''
Introduction:
Solution of [Largest Rectangle in Histogram] in LeetCode.
Created on: Nov 24, 2014
@author: ICY
'''
#-------------------------FUNCTION---------------------------#
class Solution:
# @param height, a list of integer
# @return an integer
def larges... | true |
da696605b75c6bc77426dc54ff2900020e2569c4 | ifrozenwhale/bigdata-homework | /lab2/debug.py | UTF-8 | 4,470 | 2.609375 | 3 | [] | no_license | import pandas as pd
import numpy as np
def init_P_Q_set(K=5):
df = pd.read_table("data/ratings.dat", encoding='utf-8',
header=None, sep='::', engine='python')
df.columns = ['UserID', 'MovieID', 'Rating', 'TimeStamp']
# 打乱顺序
df = df.sample(frac=1)
n_User = df['UserID'].max... | true |
f72ee26a7f336095c00d9a02dbaa120e00626f5a | nens/serverscripts | /serverscripts/utils.py | UTF-8 | 835 | 2.890625 | 3 | [
"MIT"
] | permissive | import subprocess
def get_output(command, cwd=".", fail_on_exit_code=True):
"""Run command and return output.
``command`` is just a string like "cat something".
``cwd`` is the directory where to execute the command.
"""
process = subprocess.Popen(
command,
cwd=cwd,
shell... | true |
62e3fe44f0c318a200c67f91d20d7037ac14d199 | ZhaoXiaoYang17/Classification | /首字母小写分类.py.py | UTF-8 | 901 | 3.625 | 4 | [] | no_license | #首字母小写分类
#coding=utf-8
lexicons=["the","be","of","and","a","to","in","he","have","it","that","for","they","I","with","as","not","on","she","at","by","this","we","you","do","but","from","or","which","one","would","all","will","there","say","who","make","when","can"]
while True:
startLetter=raw_input("输入一个字母,列出所有... | true |
0c3c1e08226c23d68b250d6eafd4b2aa24dd9e53 | shahamran/intro2cs-test | /test_life_game.py | UTF-8 | 578 | 3.078125 | 3 | [] | no_license | from life_game import *
from random import randint
def generate_table(start = 7, end = 15):
rnd = randint(start,end)
table = []
row = []
for i in range(rnd):
for j in range(rnd):
row.append(True if randint(0,1) else False)
table.append(row)
row = []
return table
ONE = '*'
ZERO = '-'
SEP ... | true |
81b6d4e67c6eda29912d8d2b9d9f72b8fd69c6b2 | kravago/eye-of-rpi | /timelapse.py | UTF-8 | 2,327 | 3.21875 | 3 | [] | no_license | from time import sleep
from os import system
from picamera import PiCamera
import cv2
import numpy as np
def create_time_lapse(directory):
'''Creates a timelapse and saves all pictures to
a directory of choice'''
camera = PiCamera()
camera.resolution = (1024, 768)
camera.rotation = -90
# Pri... | true |
ce56b78abf0cc2cb05f499977ec9b1a753f082ba | roganovich/OpenCVCourse | /mask.py | UTF-8 | 486 | 2.84375 | 3 | [] | no_license | import cv2 as cv
import numpy as np
file = 'images/1.jpg'
img = cv.imread(file)
cv.imshow('Test Image', img)
#ValueError: could not broadcast input array from shape (3,) into shape (300,300,1)
window = np.zeros(img.shape[:2], dtype='uint8')
#mask = cv.circle(window, (420,100), 50, 255, thickness=-1)
mask = cv.rectan... | true |
d546cd921f434487cf356dc5a1180a97f743e0c4 | chrisngan24/spectacle | /python/spectacle/spectacle/etl.py | UTF-8 | 327 | 3.140625 | 3 | [] | no_license | import pandas as pd
def encode_categorical_features(df, col):
'''
df - the dataframe to manipulate
col - the categorical column that will be encoded
'''
categ_mat = pd.get_dummies(df[col])
categ_mat.columns = ['encoded_%s_%s' %(col, c) for c in categ_mat.columns.values]
return df.join(cate... | true |
30ecb8a1525cdaa409fa6a3062fd1868b52903aa | NatalyTinoco/Trabajo-de-grado_Artefactos | /GUI/ventanIDEA.py | UTF-8 | 3,335 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 15:28:45 2019
@author:Daniela y Nataly
Descripción del código: Función de la umbralización de posibles reflejos especualres, basada en el calculo del histograma en el canal G (RGB), toma como umbral el punto donde la derivada
del histograma cambia de un valor grande a... | true |
cf8cb8d7598c1e02d3032a78f6e01743616769b7 | JSNavas/CursoPython2.7 | /15. funciones locales.py | UTF-8 | 425 | 4.21875 | 4 | [
"MIT"
] | permissive | # Para declarar una funcion local se utiliza la palabra reservada"def"
# luego el nombre de la funcion, entre parentesis "()" losdatos que se
# le van a pasar a la funcion y para cerrar la declaracion ":".
# Declaracion de la funcion local pasandole un parametro
def saludo(elnombre):
print "Bienvenido",elnombre
nom... | true |
b92b76338dd4ece973d578961f88e904c18572fa | iceknc/python_study_note | /cn/iceknc/study/d_python_net/a_socket.py | UTF-8 | 767 | 2.765625 | 3 | [] | no_license | """
linux 查看ip ipconfig
window查看ip ipconfig/all
socket
import socket
socket.socket(AddressFamily, Type)
Address Family:可以选择 AF_INET(用于 Internet 进程间通信)
或者 AF_UNIX(用于同一台机器进程间通信),实际工作中常用AF_INET
Type:套接字类型,可以是 SOCK_STREAM(流式套接字,主要用于 TCP 协议)
或者 SOCK_DGRAM(数据报套接字,主要用于 UDP 协议)
... | true |
1576910cd4d33a9b36aa2390203d2be78db89bc7 | FlameFractal/CSD343-Data-And-Knowledge-Engg | /Lab 4/wumpy-master/wumpy-master/lib/Arena.py | UTF-8 | 4,125 | 3.296875 | 3 | [] | no_license | from random import randint
# HERO = 'H'
# GOLD = 'G'
# WUMPUS = '3'
# PIT = 'P'
# GLITTER = 'GL'
# STENCH = 'S'
# BREEZE = 'B'
class _NOTATIONS:
EMPTY = 0
HERO = 1
GOLD = 2
WUMPUS = 3
PIT = 4
GLITTER = 5
STENCH = 6
BREEZE = 7
def makeBoard(N):
board = []
for i in range(0, N)... | true |
07d19c222bd6630e7e426e2f945993ff2a654e20 | natianbenitach/Pcolor---Camera | /camera_tracker.py | UTF-8 | 3,998 | 2.546875 | 3 | [] | no_license | import numpy as np
import cv2
import os
import pickle
LOWER_IR = np.array([0,20,200])
UPPER_IR = np.array([180,255,255])
FILENAME = 'calMatrix.p'
BASE_DIR = os.path.dirname(os.path.realpath(__name__))
class CameraTracker:
cx = None
cy = None
def __init__(self, com_object, video_input=0):
self.cap... | true |