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 |
|---|---|---|---|---|---|---|---|---|---|---|
851b0e3a08be05e8e22124fa20fe7a1655fba97e | CTPUG/pyconza2020-bbb-record-manip | /scripts/list_data_urls.py | UTF-8 | 1,628 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
#
# Crude script to download all the files from a BBB presenation
#
import sys
import requests
def usage():
print(f'{sys.argv[0]} <url>')
print('Where url is the link the BBB presentation playback')
print('i.e. https://<host>/playback/presentation/2.0/playback.html?meetingId=<meetingId>... | true |
ad08324426e746c2c6eed0f62e97f281893c7045 | JoppeBoekestijn/Segregation_c30 | /simulation/plot_experiments.py | UTF-8 | 1,184 | 3.109375 | 3 | [] | no_license | import glob
import os
import pandas as pd
from matplotlib import pyplot as plt
# NOTE: If plot_experiments is run it will find all the csv files
# in the simulation directory and compare scores.
# If you want the mean of a subset of experiments, store them
# in a subfolder and change glob.glob('*.csv') to:
# glob.glob... | true |
aefd8fcc888a3bad94ecc2b0f86e2c0e1e8be2ad | JosueGauthier/Start-Kit-RaspberryPi- | /Servo Motor/Servo_Motor.py | UTF-8 | 577 | 2.828125 | 3 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.OUT)
pwm=GPIO.PWM(17,50)
pwm.start(0)
def setAngle(angle):
duty= angle/18 +2
GPIO.output(17,True)
pwm.ChangeDutyCycle(duty)
sleep(0.5)
GPIO.output(17,False)
... | true |
bb3c5c2c3b4ea4e0010207a037316e62505fdd37 | anitanavgurukul/ifelsepython | /a.py | UTF-8 | 1,670 | 2.59375 | 3 | [] | no_license | inform=input("mam of the hotle informed")
if inform=="course":
print("software engiger depaloma")
exam=input("to take exam")
if exam=="algebra paper":
print("paper submit")
result=input("show result")
if result=="38/40":
print("pass")
interview=input("to take ... | true |
43920b8cc21f4585984f5d883b540486d8ee9157 | Princewjh/pythonAlgorithm | /递归求数组和.py | UTF-8 | 163 | 3.578125 | 4 | [] | no_license | #递归方法求数组的和
def sumlist(arr):
if arr == []:
return 0
else:
return arr[0] + sumlist(arr[1:])
print(sumlist([2,3,4,6,7]))
| true |
0f418776789d44da32f8bb514f4e7ec992ad2509 | mihirbhatia999/information_systems | /WebCrawler/web_crawler.py | UTF-8 | 1,711 | 3.078125 | 3 | [] | no_license |
import os
from bs4 import BeautifulSoup
import urllib.request
import requests
import validators
import urllib
#function to extract links from url
def extract_links(link):
try:
resp = urllib.request.urlopen(link)
soup = BeautifulSoup(resp, from_encoding=resp.info().get_param(... | true |
6ef7da85b0a0c432dc79b1e7eb32b6731c4f4808 | sidmah342t/LearnPy | /tupllist.py | UTF-8 | 1,236 | 4.34375 | 4 | [] | no_license | fruits = ['Apples','Bananas','Oranges']
#List called fruits
print(fruits)
print(fruits[0])
#String called icecream
#A list value is a mutable data type: It can have values added, removed, or changed. However, a string is immutable
icecream = 'vannila'
print(icecream[0:3])
print(icecream[-3])
fruits.append('Peaches')... | true |
5ef065dc96cafb201e6e80a29ea4fb6054d4ad11 | flywheel-apps/custom-curator | /tests/test_reporters.py | UTF-8 | 2,346 | 2.828125 | 3 | [] | no_license | import csv
import tempfile
import pytest
from custom_curator.reporters import CuratorErrorReporter, CuratorReporter
def test_CuratorReporter_can_write_data():
with tempfile.TemporaryDirectory() as tmpdir:
reporter = CuratorReporter(output_dir=tmpdir, project_label="test_project")
reporter.append... | true |
02b5cf256d6284525562ec92e2631fb6672bf7ae | giginet/PatternMatch | /src/assignment2/no1.py | UTF-8 | 1,362 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# assignment2.no1
# Created by 25090335 Kohki Miki on 2011/07/20
#
import numpy
from matplotlib import pyplot
N = 2000
class Perceptron(object):
def __init__(self, x):
self.x = x
n = N
self.j_star = numpy.matrix([1/numpy.sqrt(n)] * n)
self.y = self.... | true |
7fc0c35881b8b9f106d815b8291aff4492d1b959 | EoinDavey/Competitive | /AIPO/2018-Finals/p4.py | UTF-8 | 227 | 3.21875 | 3 | [] | no_license | N = int(input())+1
sieve = [False]*N
for i in range(3,N,2):
if not sieve[i]:
for j in range(i*i,N,i):
sieve[j] = True
print(len(list(filter(lambda x: (not sieve[x]) and str(x)[0]=="1",range(3,N,2)))))
| true |
05a5443020c29a64e46db8fdd53eed3b7fc984b3 | sdfs1231/P4 | /read_image.py | UTF-8 | 1,295 | 2.546875 | 3 | [] | no_license | from PIL import Image
import torch
import torch.nn
import torchvision
import torchvision.transforms as transforms
import numpy as np
import matplotlib.pyplot as plt
cnn_normalization_mean = [0.485, 0.456, 0.406]
cnn_normalization_std = [0.229, 0.224, 0.225]
tensor_normalizer = transforms.Normalize(mean=cnn_normalizat... | true |
925da51827804ffc080d3f37ce60e611b7f071f4 | PariaEsmatloo/Robonuts_lightning_demo | /qlearning.py | UTF-8 | 4,747 | 2.5625 | 3 | [] | no_license |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 19:15:46 2021
@author: Robonuts Team, Paria Esmatloo (p.esmatloo@utexas.edu)
This code was a modification of the code for the Qlearning tutorial for
simplified Frozen Lake problem by "The Computer Scientist" developed in 2018
which is linked ... | true |
0bcbdda25cbba0eb5e3dc39eb25508005200ab68 | alexcoda/covidcast-indicators | /_delphi_utils_python/tests/validator/test_report.py | UTF-8 | 2,770 | 2.828125 | 3 | [
"MIT"
] | permissive | """Tests for delphi_utils.validator.report."""
import mock
from delphi_utils.validator.errors import ValidationFailure
from delphi_utils.validator.report import ValidationReport
class TestValidationReport:
"""Tests for ValidationReport class."""
ERROR_1 = ValidationFailure("good",
... | true |
5c02be5b5e626a7cb44ac916b3b14d6b102af492 | JoaoMFerreira/lorecrawler | /tibiaBooks/indice.py | UTF-8 | 2,535 | 2.875 | 3 | [] | no_license | import re
import json
from collections import defaultdict, Counter
def bold(txt):
return '\x1b[1m%s\x1b[0m' % txt
DATA = []
with open("/home/joao-marcos/myWorkspace/tibiaBooks/tibiaBooks/booksRaw.txt") as f:
for line in f:
DATA.append(json.loads(line))
SPLIT_RE = re.compile(r'[^a-zA-Z0-9]')
def toke... | true |
e6b29d5f7a7371168b75b01313ef7490d44128ae | kashikakhatri08/Python_Poc | /python_poc/python_strings_program/string_less_frequency.py | UTF-8 | 531 | 3.3125 | 3 | [] | no_license | from collections import Counter
def naive_method():
string_container = "kashikakhatri"
dict_string = {}
for i in str(string_container):
if i in dict_string:
dict_string[i] += 1
else:
dict_string[i] = 1
count= min(dict_string,key =dict_string.get)
print(cou... | true |
85dd80255a94c8a073dbdc67f3be38be7789d2b3 | doddydad/python-for-the-absolute-beginner-3rd-ed | /Chapter 1-4/Counter.py | UTF-8 | 302 | 3.828125 | 4 | [] | no_license | #counter
START_POINT = int(input("Where do you want to start counting from?:"))
END_POINT = int(input("Where do you want to finish counting?:"))
INCREMENT = int(input("By how much should this count each time?:"))
for i in range(START_POINT, END_POINT+1, INCREMENT):
print(i, end = " ")
input()
| true |
f7bd509304679edcb747a17c455cb2973f3cefbf | gabrielleevaristo/algo-practice | /trees/binary trees/binarytreepractice.py | UTF-8 | 5,636 | 4 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
# Inserts an element in level order iteratively
def insert(node,element):
if not node: return
newNode = Node(element)
q = [node]
while q:
cur = q.pop(0)
# If left ch... | true |
ccbf32de9c845ec2991c061a45912c40606e15c5 | holdenweb/elite_school | /busyoffice.py | UTF-8 | 3,131 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 5 14:30:35 2017
Modified April 5, 2018
Modified May 24, 2018
Modified June 5, 2021
@author: Kirby Urner
alice = Secretary("Alice") # implements Descriptor protocol
(data descriptor = full service)
The idea being, self.secretary knows the self t... | true |
d4c2ec1e3028845e2a3270161af7f5441acf72dd | timbailey74/python_estimation | /tests/old/oldtest_utilities.py | UTF-8 | 424 | 3.203125 | 3 | [] | no_license | #
#
def test_pi2pi():
x = 6.7
xl = [-32.1, -6.7, -1.2, 1.2, 6.7, 32.1]
xa = 30*(np.random.rand(1,5)-0.5)
print("x = ", x, "\np = ", pi2pi(x),\
"\nxa = ", xa, "\npa = ", pi2pi(xa), "\nda = ", xa-pi2pi(xa), "\n")
@static_vars(a=0, b='hello')
def foo(c):
foo.a += c
print('a: {0}, b: {1}... | true |
a79cb20a751e01439fbe97ef1432c1cfcd17fe73 | Ayyappan97/may13python | /exception.py | UTF-8 | 260 | 3.84375 | 4 | [] | no_license | # exception handling
'''
try:
age = int(input("whats your age:"))
print(f'your age is {age}')
except ValueError:
print('invalid format')
'''
"""
try:
age=0
salary=2000
total = salary/age
except ZeroDivisionError:
print('invalid')
""" | true |
9588b4907ca37e788784610a9b4a0a0e8e13da61 | kevinwing/coderbyte-solutions-python | /easy/simple_adding.py | UTF-8 | 595 | 4.1875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Challenge:
Have the function SimpleAdding(num) add up all the numbers from 1 to num.
For example: if the input is 4 then your program should return 10 because
1 + 2 + 3 + 4 = 10. For the test cases, the parameter num will be any number
from 1 to 1000.
Sample Test Cases:
Case 1:
... | true |
3d6cbef951a499fda98b7a7f65effce9026d17db | graemeglass/adventofcode | /4/part1.py | UTF-8 | 295 | 2.890625 | 3 | [
"MIT"
] | permissive | #http://adventofcode.com/day/4
from hashlib import md5
puzzle_input = 'bgvyzdsv'
not_found = True
number_value = 0
while not_found:
if md5('{}{}'.format('bgvyzdsv', str(number_value))).hexdigest()[:5] == '00000':
print number_value
not_found = False
number_value += 1 | true |
bd31b8baf74421f1f62d3987ed2d6b6e8fd65431 | scizen9/sedmpy | /drpifu/RunSnid.py | UTF-8 | 11,808 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 11 11:23:00 2016
@author: nblago
"""
import os
import glob
import argparse
import subprocess
import re
import astropy.io.fits as pf
def find_line_match(lines, match_dict):
"""
Returns the line number of first line matching the position-word pairs
provided w... | true |
e66b9b88cd1bd640f1a985fe659552574cd4da7d | schehata/address_resolver | /test_resolve.py | UTF-8 | 2,267 | 3.328125 | 3 | [] | no_license | import unittest
from address_resolver import resolve
class AddressTest(unittest.TestCase):
def test_simplist_case(self):
result = {'street': 'Winterallee', 'housenumber': '3'}
self.assertEqual(resolve('Winterallee 3'), result)
def test_double_number(self):
result = {'street': 'Muster... | true |
53af205794c5bb2966c2f80de3e0833f8ef09e7e | Yupti/cs299 | /other/quiz3q2.py | UTF-8 | 482 | 4 | 4 | [] | no_license | class Animal:
def __init__(self):
print("A new animal has been created.")
def sleep(self):
print("An animal sleeps.")
def eat(self):
print("An animal eats.")
class Bird(Animal):
def __init__(self):
Animal.__init__(self)
print("A new bird has been created.")
def sleep(self):
print("A bird sleeps.")
de... | true |
f32cccbfb2bfa359aa9ec45d02cfccd1d3f9a9f9 | alicebarthel/model2roms | /datetimeFunctions.py | UTF-8 | 2,894 | 2.953125 | 3 | [
"MIT"
] | permissive | from netCDF4 import Dataset, datetime, date2num,num2date
import os
import calendar
__author__ = 'Trond Kristiansen'
__email__ = 'me@trondkristiansen.com'
__created__ = datetime(2015, 8, 11)
__modified__ = datetime(2015, 8, 11)
__version__ = "1.5"
__status__ = "Development, modified on 11.08.2015"
# Methods for return... | true |
3a9edb8e650f8d9b7dee15f5281df65f37d680c6 | alexandrafreccero/project_dec | /project_utils/save_date_folder.py | UTF-8 | 597 | 3.25 | 3 | [] | no_license |
def save_date_folder():
# Importerar lokalt, för att unvika circular imports
from project_utils import get_date
from project_utils import create_folder_from_path
from project_utils import WikipediaHandler
today = get_date()
summary = WikipediaHandler().get_summary(today)
pat... | true |
114f4f4c659b7c361f9ca2730c2d2e29d422ccc6 | ericduericdu/Survey | /survey.py | UTF-8 | 3,512 | 3.34375 | 3 | [] | no_license | """Problem A Homework 2 ECS145
Group Members:
John Nguyen 998808398
Eric Du 913327304
Joanne Wang
Jeffrey Tai 998935915
Todo:
*Finish calcfreqs
*Handle NA in the input
*Generate all the combinations
*
"""
import fnmatch
def calcfreqs(infile, nqs, maxrat):
""" Calculates the frequenc... | true |
b3d67b6cfb40774297a146da35d7b77e47c13dd9 | asterix135/algorithm_design | /merge_sort_quiz.py | UTF-8 | 1,535 | 4.1875 | 4 | [] | no_license | '''Functions to implement Merge/sort algorithm'''
def merge_sort(lst, idx = 0):
'''Main merge/sort function to call
takes a list as input and sorts in numerical order
can take an optional idx parameter, if the elements of the list are iterable - will sort on index position'''
if len(lst) == 2:
... | true |
5c75f3d3c01ee575c138d3dac505fb9c0b3f35a6 | bvattikonda/twitter-advertising | /analysis/accounts_using_marketing_tools.py | UTF-8 | 3,187 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# Identify the accounts that use any of the marketing tools
import sys
import datetime
import string
import optparse
import os
import json
import ast
from urlparse import urlparse
from collections import defaultdict
from HTMLParser import HTMLParser
from analysis import *
class HREFParser(HTMLP... | true |
06de1a8490be312309727563fb925dfd94887cbe | MNafekh/DarkPoolVolume | /darkpools.py | UTF-8 | 2,375 | 2.9375 | 3 | [] | no_license | import urllib
import statistics
import holidays
import numpy as np
from datetime import date, datetime, timedelta
from prettytable import PrettyTable
dts = datetime.today().strftime('%Y%m%d')
weekago = (datetime.today() - timedelta(days=7)).strftime('%Y%m%d')
hdays = []
dayrange = 28
# consolidated file: ... | true |
2e4ccb82436f27c06a0a5b99c335910bea8a469e | nabillarahmani/ABCRaspberry | /haha.py | UTF-8 | 126 | 2.65625 | 3 | [] | no_license | import time
import datetime
ts = time.time()
ts = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d-%H:%M:%S')
print(ts) | true |
426b012458a12870b4a106837f836d9b0b14faa0 | quantbruce/leetcode_test | /数据结构相关/数组和矩阵/769. 最多能完成排序的块.py | UTF-8 | 1,533 | 3.671875 | 4 | [] | no_license | 数组arr是[0, 1, ..., arr.length - 1]的一种排列,我们将这个数组分割成几个“块”,并将这些块分别进行排序。之后再连接起来,使得连接的结果和按升序排序后的原数组相同。
我们最多能将数组分成多少块?
示例 1:
输入: arr = [4,3,2,1,0]
输出: 1
解释:
将数组分成2块或者更多块,都无法得到所需的结果。
例如,分成 [4, 3], [2, 1, 0] 的结果是 [3, 4, 0, 1, 2],这不是有序的数组。
示例 2:
输入: arr = [1,0,2,3,4]
输出: 4
解释:
我们可以把它分成两块,例如 [1, 0], [2, 3, 4]。
然而,分成 [1, 0], [... | true |
2db3c44c8b9134a4f464c39dd2ec080e16cfab24 | Tanuka-Mondal/function-for-gross-pay | /function.py | UTF-8 | 631 | 4.1875 | 4 | [] | no_license | #Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay should be the normal rate for hours up to 40 and time-and-a-half for the hourly rate for all hours worked above 40 hours. Put the logic to do the computation of pay in a function called computepay() and use the functio... | true |
8e53a1782e0c3ef908296814dd9d742cd2e7d41e | mikeyrichardson/khan_infection | /infection.py | UTF-8 | 8,189 | 3.140625 | 3 | [] | no_license | import graph
import random
import os
# Assume user data is stored in a database and that
# all active userids, along with coach relationships
# can be extracted.
def total_infection(file_name, userid, version):
"""Change the website version of a user along with all related users.
This function changes a user... | true |
6ecee98d6d209f54f81769504090725f57c6c80a | Gonz8088/ITEC3312 | /Homework/Homework01.py | UTF-8 | 1,708 | 3.953125 | 4 | [] | no_license | # PROGRAMMER: Paul Gonzales
# DATE: February 7, 2019
# ASSIGNMENT: Homework 01 (Financial application: loan amortization schedule)
# ALGORITHM: 1) prompt user to input Principal, Rate, Term;
# 2) convert annual interest into monthly interest, and convert term from years to months;
# caclulate monthly payment using data... | true |
75df6fa334749233df5618bb103a802ad0b588d9 | ashang/videm | /plugin/omnicxx/omnicxx/CxxParser.py | UTF-8 | 13,537 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import re
import json
import traceback
import CppTokenizer
# 必须在这个作用域 import libCxxParser,否则 sys.argv 无法用于传参数给 libCxxParser
# 外部可能不需要使用 libCxxParser,这时候,libCxxParser 很可能会在 import 的时候出错
# 外部如果不需要使用 libCxxParser 的时候,不应该调用 CxxGetScopeStack,否则会出错
try:
import li... | true |
46b1964b14021f1f045994384665eae50b301b71 | BatiDyDx/MathiPy | /mathipy/functions/linearithmic.py | UTF-8 | 1,087 | 3.4375 | 3 | [
"MIT"
] | permissive | import math
import numpy as np
from mathipy.math import calculus
class Linearithmic(calculus.Function):
"""
f(x) = (mx + h)log_b(kx + a)
"""
function_type = 'Linearithmic'
def __init__(self, m = 1, h = 0, b = 10, a = 0, k = 1):
self.m = m
self.h = h
self.b = b
self.... | true |
cad17518fa1c31b7ddea4f9ef723434ade6aa2bb | shaunbarney/DDQN-Keras | /main.py | UTF-8 | 1,238 | 2.828125 | 3 | [] | no_license | import gym
import numpy as np
from ddqn import Agent
from envs.cartpole.setup import CartPoleSetup
def train_setup(agent: Agent, env: gym.Env):
num_games = 150
n_step = 0
best_score = 0
scores = []
for i in range(num_games):
done = False
state = env.reset()
score = 0
... | true |
1089e755592fb167372a81dda9d540d149a9e91f | AyushKS11/Joy-of-Computing-Using-Python | /Week 4 Q3.py | UTF-8 | 426 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 24 22:21:36 2020
@author: Ayush
"""
r,c=input().split(" ")
r=int(r)
c=int(c)
mat=[[0 for i in range(c)]for j in range(r)]
val=1
for i in range(r):
for j in range(c):
mat[i][j]=val
val=val+1
for i in range(r):
for j in range(c):
if j!=(c-... | true |
097d64d72a7d192d500a5fad8f00f213916b09e2 | mfinkle/fennec-telemetry | /deprecated/tablet_breakdown.py | UTF-8 | 819 | 2.5625 | 3 | [] | no_license | import json
def map(key, dimensions, value, map_context):
try:
j = json.loads(value)
# The structure of this json object is designated in
# toolkit/components/telemetry/TelemetryPing.jsm#assemblePayloadWithMeasurements
if not "info" in j:
return
# This will be an array of events and sessio... | true |
c8d6d64c052209c9ffbf9c26ca94c895db2d00d1 | Programmer-Admin/binarysearch-editorials | /Line of People.py | UTF-8 | 322 | 3.328125 | 3 | [] | no_license | """
Line of People
If there are at most b people behind you, your position can vary between 0 and b+1 (+1 because you are at the position after the bth person). If at least a people are in front of you, your position varies between 0 and n-a.
"""
class Solution:
def solve(self, n, a, b):
return min(n-a,b+1... | true |
0c986a93eb549e58fc60e72811cb6f374b5e60d4 | mauriciovieira/Python_studies | /udacity/turtle_helena.py | UTF-8 | 502 | 3.1875 | 3 | [] | no_license | import turtle
window = turtle.Screen()
window.bgcolor("red")
def draw_helena():
turtle.color("blue")
astamp = turtle.stamp()
turtle.fd(50)
turtle.position()
(200.00,-0.00)
turtle.clearstamp(astamp)
turtle.position()
(200.00,-0.00)
for i in range(1,38):
for i in range(1... | true |
d1e7ada826bdddc4d40523041d4f4fc4172e12df | abhoi/absa-tests | /sjoshi/utils/mask_util.py | UTF-8 | 8,849 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import csv
import nltk
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import... | true |
988c578164763a8e615a07d617c54a8e9450cee5 | johngilbert2000/nested_lookahead | /experiment_cifar10.py | UTF-8 | 7,441 | 2.515625 | 3 | [] | no_license | # Imports
import torch
import torch.optim as optim
import torchvision as tv
from NestedLookahead import NestedLookahead
import os
import time
import datetime
import pandas as pd
import argparse
import gc
gc.collect() # run garbage collection just in case
# Settings
device = 'cuda' if torch.cuda.is_available() else ... | true |
152acf70798df1de3fb34f1ccd4870d3b61433af | AdamZhouSE/pythonHomework | /Code/CodeRecords/2250/60723/286347.py | UTF-8 | 970 | 2.75 | 3 | [] | no_license | import sys
def count_num(array,i,T):
result=[[1 for _ in range(2)] for _ in range(T-1)]
for j in range(i):
if (array[i][0]-array[j][0])==0:
result[j][0]=sys.maxsize
else:
result[j][0]=(array[i][1]-array[j][1])/(array[i][0]-array[j][0])
for j in range(i+1,T):
i... | true |
065ff4b351ff1e4dc4f917e9767f81161b98be61 | arjun921/Python-TIL | /misc/classPracticals/15LongestWord.py | UTF-8 | 432 | 3.78125 | 4 | [] | no_license | def max_in_list(ls):
largest = ls[0]
for x in ls:
if x>largest:
largest = x
return largest
def find_longest_word(a):
return max_in_list(a)
#reads words
lis = []
n = int(input('Enter Number of elements in list:'))
for x in range(n):
lis.append(input('Enter Values:'))
#lengths of ... | true |
eacdb0435570651f9d6ce44b843e37541e4ef0ee | nasif25/digital_handwritten_digit_recognition | /training.py | UTF-8 | 1,089 | 2.953125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 4 08:38:40 2018
@author: Nasif
"""
from sklearn import datasets
from sklearn.svm import SVC
from scipy import misc
from PIL import Image
import PIL.ImageOps
digits = datasets.load_digits()
features = digits.data
labels = digits.target
clf = SVC(gam... | true |
548db9bd02e258112aab1664c0d8715ec5819ed1 | gregor0607/bootcamp | /b_test_seq_features.py | UTF-8 | 5,152 | 2.828125 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | import pytest
import seq_features
def test_number_negatives_single_E_or_D():
"""Perform unit tests on number_negative for single AA"""
assert seq_features.number_negatives('E') == 1
assert seq_features.number_negatives('D') == 1
def test_number_negatives_for_empty():
"""Perform unit tests on number_ne... | true |
e68097b7001208cf65a51ffb9e4a7238120f3388 | otsaloma/dataiter | /data/listings.py | UTF-8 | 1,006 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import dataiter as di
# Same as for documentation.
di.PRINT_MAX_WIDTH = 72
def parse_price(price):
return int(float(price.lstrip("$").replace(",", "")))
data = (
di.read_csv("orig/listings.csv")
.select("id",
"neighbourhood_group_cleansed",
"zipcode",
... | true |
20c8ef7a08bb07ccf822e571204bddec31d4345a | athletejuan/TIL | /Algorithm/BOJ/10833.py | UTF-8 | 115 | 2.984375 | 3 | [] | no_license | N = int(input())
remain = 0
for _ in range(N):
S,A = map(int, input().split())
remain += A%S
print(remain) | true |
9cad905dc6aaa8289efd65d43a881e5fa8ad8972 | Rapaix/Lego | /sorting.py | UTF-8 | 1,659 | 3.046875 | 3 | [] | no_license | import numpy as np
import cv2 as cv
def sort_contours(cnts, method="left-to-right"):
reverse = False
i = 0
if method == "right-to-left" or method =="botto-to-top":
reverse = True
if method == "top-to-bottom" or method =="bottom-to-top":
i =1
#pesquisar boundingRect()
boundingBox... | true |
37d086b1fc4bea478d43cd45588d6597c9ca99dd | Museu-da-Pessoa-XP/backend | /museu/tests/utils.py | UTF-8 | 1,730 | 2.640625 | 3 | [] | no_license | import string
import random
from io import BytesIO
from museu.models import Tag
from museu.validators import ALLOWED_TYPES
TEST_PATH = 'tests/'
EMAIL_DOMAIN = 'email.com'
def get_random_string(length):
letters = string.ascii_lowercase
result_str = ''.join(random.choice(letters) for i in range(length))
r... | true |
33343c2d9002005816e6a65cf98860c15f601143 | chensheng1/ML_train | /linear_regression/LinearRegression/readdata.py | UTF-8 | 1,783 | 2.984375 | 3 | [] | no_license | #-*- coding: UTF-8 -*-
from __future__ import absolute_import, division, print_function
# 引入各项扩展库
import pathlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
def read(path):
column_name... | true |
6f2f4e2d16ad035b8500994fe37269a3292c285f | setyongr/linear-regression-sample | /MultipleLinearRegression.py | UTF-8 | 1,043 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 2 21:29:32 2019
@author: setyongr
"""
import pandas as pd
df = pd.read_csv('50_Startups.csv')
# Pisahkan Independent dan Dependent variable
X = df.iloc[:, :-1].values
Y = df.iloc[:, 4].values
# Transoform State
from sklearn.preprocessing import... | true |
d186eaa8bc9535de8f3de236a27585860a13426c | learningequality/sushi-chef-khan-academy | /tsvtopics.py | UTF-8 | 4,296 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
This script can be used to extract the main menu info from the KA website.
Usage:
./tsvtopics.py --lang=bg
./tsvtopics.py --lang=es --curriculum=mx-eb
"""
import argparse
from tsvkhan import get_khan_tsv
from tsvkhan import TOPIC_LIKE_KINDS
from tsvkhan import DOMAINS_SORT_ORDER
... | true |
b19e29ae7e73637c73090fa105338f3afb61e102 | Arwen0905/Python_Test | /0617/a0617_06_大量圖片下載_os-urllib-requ.py | UTF-8 | 1,398 | 2.875 | 3 | [
"MIT"
] | permissive | import requests
import os
from bs4 import BeautifulSoup
from urllib.request import urlretrieve
from datetime import datetime
time = datetime.now()
url = 'https://www.monster-strike.com.tw/news/20200212_ky.html'
os.makedirs('./img/',exist_ok=True) #建立目錄存放檔案
html = requests.get(url).text #獲取網頁html
soup = BeautifulSoup(ht... | true |
4dd124ec84c46f1efcbc129a8d38bac1b8ee027f | AndersonMoncayo/P_final | /src/models/materias.py | UTF-8 | 1,352 | 2.53125 | 3 | [] | no_license |
from src.config.db import DB
class MateriasModelo():
def insertar_materia(self, nombre, semestre):
cursor = DB.cursor()
cursor.execute('INSERT INTO materias(nombre, semestre) VALUES(?,?)',(nombre, semestre,))
cursor.close()
def traer_materias(self):
cursor = DB.cursor()
... | true |
e92af5e1dd49e56f5b7ee920a92512813a8b6c8e | vaborza/bmif6310 | /scripts/parse_vcf.py | UTF-8 | 1,846 | 2.671875 | 3 | [] | no_license | # Victor Borza
# Sep 17, 2021
#
# Parse VCF data per variant
import pandas as pd
import time
import numpy as np
import pickle
start_t = time.time() # Start timer
# Desired parameters
N_VARIANTS = 1000
# with 10 var, 2.94s; with 100 var, 12.24s and 17 MB, with 300 var, 35.34s and 50.72 MB
demo_df = pd.read_csv('../... | true |
0babcd72a1e2407718b30d5f861955dbb6d1e21b | LukaszMichalSimbiga/my_python_game | /arcade_game.py | UTF-8 | 21,862 | 2.828125 | 3 | [] | no_license | import pygame
from pygame.locals import *
import pygame_menu
import random
from pygame_menu import sound
# rows of blocks
tab = [[], [],
[], []]
def arcade_ball_movement():
"""A function which defines the behavior of the ball when you touch the edge of the screen"""
global arcade_ball_spe... | true |
0e2a3e826db3dba43aacc66892fea25e6b90879e | HarshitDolu/Angle-finder-using-OpenCV | /angle finder.py | UTF-8 | 1,122 | 2.796875 | 3 | [] | no_license | import cv2
import math
path='Resources/test.png'
img=cv2.imread(path)
img=cv2.resize(img,(512,512))
pointsList = []
def mousePoints(event,x,y,flags,params):
if event == cv2.EVENT_LBUTTONDOWN:
size=len(pointsList)
if size!=0 and size%3 !=0:
cv2.line(img,tuple(pointsList[roun... | true |
14e3782233f6a17eb599b1468c15e8c1e0c58fd6 | tztex/self_taught2 | /selftaught2/html_scraping_assignment.py | UTF-8 | 848 | 2.890625 | 3 | [] | no_license | # To run this, you can install BeautifulSoup
# https://pypi.python.org/pypi/beautifulsoup4
# Or download the file
# http://www.py4e.com/code3/bs4.zip
# and unzip it in the same directory as this file
from urllib.request import urlopen
import ssl
import bs4
# Ignore SSL certificate errors
ctx = ssl.create_default_cont... | true |
906b2865ed9ccc12d40e896cca35ea99afe6a450 | zhou-jia-ming/leetcode-py | /problem_543.py | UTF-8 | 1,280 | 3.78125 | 4 | [] | no_license | # coding:utf-8
# Created by: Jiaming
# Created at: 2020-03-10
# 给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。这条路径可能穿过根结点。
# 题目地址: https://leetcode-cn.com/problems/diameter-of-binary-tree/
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
... | true |
339bfe10ecefac7523fd2ac760e3dd44b1be3949 | joshivivek67/Python_pratice | /capture3.py | UTF-8 | 754 | 4.125 | 4 | [] | no_license | def sort_and_print_the_data(list_with_10_number,lower_than_this):
modified_list = [int(x) for x in list_with_10_number]
#sorted_list = sorted(modified_list)
list_less_then_ten = [number_in_list for number_in_list in modified_list if number_in_list < int(lower_than_this)]
return list_less_then_ten
... | true |
61caa42918d1515e9e09bd4fcc193243efc26cdf | dundunmao/LeetCode2019 | /642. Design Search Autocomplete System.py | UTF-8 | 2,480 | 3.71875 | 4 | [] | no_license | class AutocompleteSystem:
def __init__(self, sentences, times):
self.root = TrieNode()
self.cur = self.root
self.sb = []
# 把 sentences和times,加入trie里
for i in range(len(times)):
self.add(sentences[i], times[i])
# 建trie
def add(self, sentence, t):
#... | true |
83077fd019db4232506f117a39718b9e5c8728b9 | Jonastuhh/facial_emotion | /Code/showtrainingimages.py | UTF-8 | 603 | 3.265625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
trainingdata = open("2915trainingimages.txt","r")
trainingdata.readline() #skip first line
emotions=["Angry","Disgust","Fear","Happy","Sad","Surprise","Neutral"]
for i in range(10):
data=trainingdata.readline() #read one image
emotion=emotions[int(data[... | true |
c6111dc7e704d33bd9eac0f4ee164a553ed4da9e | LaurenJWeber/PythonTwelveDays | /print_n_days_lyrics.py | UTF-8 | 1,304 | 3.484375 | 3 | [] | no_license | ###############################################################################
# Description: Print the lyrics for The Twelve Days of Christmas
# All data read from a Json file.
###############################################################################
import argparse
import json
def generate_lyri... | true |
0fd6aa7e077b60bc520ac1987ad7a52c10374c9e | xgi-org/xgi | /tests/stats/test_dinodestats.py | UTF-8 | 7,824 | 2.703125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
import pandas as pd
import pytest
import xgi
def test_filterby_wrong_stat():
H = xgi.DiHypergraph()
with pytest.raises(AttributeError):
H.nodes.filterby("__I_DO_NOT_EXIST__", None)
def test_filterby(diedgelist1, diedgelist2):
H = xgi.DiHypergraph(diedgelist2)
assert H.nod... | true |
1b9a15b7082d977b6101c6a2cfdb16d05bfdcd8e | yubo56/191sim | /examples/testprob.py | UTF-8 | 644 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# 02/12/16 -- tests a system with multiple allowed branching reactions,
# two-decay possibilities.
# Also shows off new syntax parsing for reagants, reactions
from lib.simulation import *
if __name__ == '__main__':
stoch = StochasticSim(2)
# same init, reagan... | true |
05d4ccafd1c18aa0a31af52d18ca0b64f1e5be08 | isweluiz/verba_indenizatoria__cldf | /04 - Analises/projeto-cldf-gastos.py | UTF-8 | 6,382 | 3.421875 | 3 | [] | no_license |
# coding: utf-8
# 
#
# Análise de Gastos públicos dos deputados da CLDF [Trabalho de Data Science]
# -----------------------------------------
# #### @author: Luiz Eduardo
# ### [Linkedin](www.linkedin.com/in/isweluiz)
# #### Professor: Sergio Côrtes
# ----------------... | true |
bb4d5ef8a51f4e2f05ac7aabd9d1ae4fa9a1b3d6 | shirangi/DCA | /Reporting.py | UTF-8 | 263 | 2.875 | 3 | [] | no_license | #Preparing final spreadsheet
def Final_Report():
workbook=xlwt.Workbook()
excel_sheet=workbook.add_sheet(Folder_Name,True)
excel_sheet.write(0,1,'Well Name')
excel_sheet.write(0,2,'Arps B Factor')
excel_sheet.write(0,3,'EUR')
excel_sheet.write(0,4,'Error')
| true |
54d73c8f89321190973e9a8e03e37db5b8de0f1b | sahiljain11/HACKTX19 | /modeltesting2.py | UTF-8 | 2,607 | 2.796875 | 3 | [] | no_license | import os
from PIL import Image, ImageDraw
from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient
from io import BytesIO
endpoint = 'https://image-classification.cognitiveservices.azure.com/'
prediction_key = 'ba8e403c3f904d85adf408928b13fa90'
predictor = CustomVisionPredictionC... | true |
c408c6f5ed257b081a144eecf9435e42c2d5c1f9 | siroken3/serverdoctor | /example/create_spec.py | UTF-8 | 1,425 | 2.5625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from __future__ import print_function
import json
def flatten(structure, key="", path="", flattened=None):
if flattened is None:
flattened = {}
if type(structure) is not dict:
flattened[((path + " ") if path else "") + key] = structure
else:
for new_key, val... | true |
996820665df813fd90b14dbd2c7d0d627cc7b4a5 | PlumpMath/TheAmazeingRace | /.svn/pristine/99/996820665df813fd90b14dbd2c7d0d627cc7b4a5.svn-base | UTF-8 | 21,580 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# Author: Ryan Myers
# Models: Jeff Styers, Reagan Heller
#
# Last Updated: 2015-03-13
#
# This tutorial provides an example of creating a character
# and having it walk around on uneven terrain, as well
# as implementing a fully rotatable camera.
from direct.showbase.ShowBase import ShowBase
fr... | true |
fed54fa820c5e1e77113e87d86ae61a59b54afb4 | engineer-heng/pefc | /pefc/xltab.py | UTF-8 | 36,221 | 3.15625 | 3 | [
"MIT"
] | permissive | # Python Engineering Foundation Class Library (pefc)
# xltab Library
# Copyright(C) 2017-2023 Heng Swee Ngee
#
# Released under the MIT License - https://opensource.org/licenses/MIT
#
"""
xltab Library - Tabulate data from MS Excel forms. MS Excel workbooks
typically contains data arranged in form layout used for data... | true |
0ea36ca23d3e810f70c021503bb4fc7e24ba4354 | tejalvs/leetcode | /solutions/maxMeeting.py | UTF-8 | 668 | 3.1875 | 3 | [] | no_license | class meeting:
def __init__(self, start, end, pos):
self.start = start
self.end = end
self.pos = pos
def maxMeeting(l,n):
finalMettings=[]
l.sort(key=lambda x:x.end)
finalMettings.append(l[0].pos)
time_limit = l[0].end
for i in range(1, n):
if l[i].start > time_l... | true |
64e1b84a2d64ee9b677d3e4e699896a423bd23ca | MacHu-GWU/learn_mongoengine-project | /tests/s2_crud/p1_create/test_01_create.py | UTF-8 | 1,212 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Create即创建新文档, 在MongoDB中叫Insert。
"""
import pytest
import mongoengine as me
from learn_mongoengine.tests import client, db, reset_before_and_after
class User(me.Document):
_id = me.IntField(primary_key=True)
name = me.StringField()
def __repr__(self):
... | true |
fc7a384e2d25daab294a543bc000b6e28480eb4b | MBTimY/python_comile_exampe_A | /libs/inter/_if.py | UTF-8 | 519 | 2.921875 | 3 | [] | no_license | # coding:utf-8
'''
@AUTHOR: TimY
@FILENAME: if.py
@DESC: If express
'''
from libs.inter.stmt import Stmt
from libs.symbols.type import Types
class If(Stmt):
def __init__(self, x, s):
super(If, self).__init__()
self.expr = x
self.stmt = s
if self.expr.type != Types.Bool:
... | true |
5ea17d65fd5895b873f3e2dcc58297e8ab54111b | swat199538/LeranPython | /datatype.py | UTF-8 | 291 | 2.8125 | 3 | [] | no_license | # coding:utf-8
print 45678 + 0x12fd2
print 100 < 99
print '你好世界'
print """
静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。
"""
print 11/4
a = 'python'
print 'hello', a or 'world'
b = ''
print 'hello', b or 'world'
L = ['a', 'b', 'a']
print L
| true |
6cd8ea800e81fd1a27100fc2cae1ffca1e6d7011 | shabbir22/Learn-to-Code | /ch4.2/pg-236/bubble_sort_report.py | UTF-8 | 2,373 | 4.125 | 4 | [] | no_license | #Sorting the bubble scores in descending order and printing the top 5 solution's scores along with their number
def bubble_sort(scores,numbers): #Defining the bubble_sort function with parameter 'scores' and 'numbers'
swapped = True #Setting a global variable 'swapped' to 'True'
while swapped: ... | true |
52dfc34f0a56a3d983dea8f59b7699367321048e | JameelNabbo/PHP-Parsers | /src/modules/php/base.py | UTF-8 | 1,440 | 3.390625 | 3 | [
"MIT"
] | permissive | """Base Classes for Different Components"""
class Traverser():
def register_visitor(self, new_visitor) -> None:
"""called when a new Visitor is added to the traverser
Should call the visitor's register_with method
"""
pass
def traverse(self, current_node) -> None:
"""Pe... | true |
fd87c85625732e91bbbd848a2da9ba2fe2a64bb8 | iamNCJ/ZKCup-2019 | /upper computer code/zkcup_upper/Pi_upper/upper_main.py | UTF-8 | 1,908 | 2.671875 | 3 | [
"MIT"
] | permissive | import with_Android as Android
import with_LeArm as Arm
import with_Mega_Base as Base
import with_Uno_Dis as Dis
import time
def init():
Android.init_socket()
Arm.init_Arm()
Base.init_Base()
Dis.init_Uno()
recognize_res = [[], [], [], []] # DS: 'place'([num]), [res, confidence]
position = [
[(0... | true |
39313d4a3b538eb54292d21ce3c424f9af39b9f0 | andycavatorta/oratio | /Common/osc_server_wrapper.py | UTF-8 | 838 | 2.59375 | 3 | [
"MIT"
] | permissive | import OSC
class OSCServerWrapper():
def __init__(self, hostname, port):
self.receive_address = hostname, port
self.server = OSC.OSCServer(self.receive_address)
# this registers a 'default' handler (for unmatched messages),
# an /'error' handler, an '/info' handler.
# And, if the client supports it, a '/su... | true |
f9f0df688cd09269c5657764c3daae249eaf25bf | xy12138/TheNextQuant | /quant/utils/decorator.py | UTF-8 | 2,840 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
"""
装饰器
Author: HuangTao
Date: 2018/08/03
Update: None
"""
import time
import asyncio
import functools
from quant.utils import tools
from quant.utils.redis import exec_redis_cmd
from quant.utils.exceptions import GlobalLockerException
# 协程间加锁,锁名对应的锁对象 {"locker_name": locker}
METHOD_LOCKER... | true |
95043111485f0ee5f6ace32fd2451d76454ba28d | jepetolee/rA9 | /rA9/optim/adam.py | UTF-8 | 2,290 | 2.6875 | 3 | [
"GPL-3.0-only"
] | permissive | import math
from .optimizer import Optimizer
import jax.numpy as jnp
import jax.lax as jmath
class Adam(Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8,
weight_decay=0):
defaults = dict(lr=lr, betas=betas, eps=eps,
weight_decay=weight_... | true |
fa3defa1a70a6a8aec2838f3468d8f3186cbf4e5 | somupalai/m_tech_work | /secondary_consolidation_defn.py | UTF-8 | 127 | 2.515625 | 3 | [] | no_license | import math as m
def sc(Cs,Ho,eo,t1,t2):
return float((Cs*Ho*(m.log((t2/t1),10)))/(1+eo))
print sc(12.0,45.0,6.0,12.0,4.0)
| true |
8d7e2e81a87be3caf1f3248a400e6cd857a84667 | 21lucasmessias/CursoEmVideo-Python | /ex089.py | UTF-8 | 1,252 | 3.046875 | 3 | [] | no_license | alunos = list()
aluno = list()
notas = list()
media = 0
op0 = ''
while op0 != 'n':
while op0 != 'n':
try:
aluno.append(str(input('Nome: ')).strip().title())
notas.append(float(input('Nota 1: ').strip()))
notas.append(float(input('Nota 2: ').strip()))
ex... | true |
41f0252d1884840a76cc51a850ac4829709787d9 | lnwwinner/BitkubAndBinance | /GUIBitkub.py | UTF-8 | 3,504 | 2.828125 | 3 | [
"MIT"
] | permissive | # bitkubchecker.py
import requests
from pprint import pprint
import time
from songline import Sendline
# pip install songline
token = 'bgClpKkgX4c4o0k0pAMLmd7pfSgSotcGpHAF0tT8N43'
messenger = Sendline(token)
line_condition = True
API_HOST = 'https://api.bitkub.com'
mycoin = ['THB_BTC',
'THB_E... | true |
6dd94a25c725cba6ae5d011538fee8f10f5aeff1 | lchi/blimp | /blimp/commands/ssh.py | UTF-8 | 781 | 2.546875 | 3 | [
"MIT"
] | permissive | import subprocess
import shlex
from helpers.aws import get_single_instance_by_name_tag
def ssh(args, config):
instance = get_single_instance_by_name_tag(args.hostname)
ssh_user_arg = "{}@".format(args.ssh_user) if args.ssh_user else ''
command = "ssh {}{}".format(ssh_user_arg, instance.public_ip_address)... | true |
61a76cf9379573f4437e7bcd1a964a65286dd852 | Kamikoto-sama/NetBookShop | /dbProvider.py | UTF-8 | 508 | 2.84375 | 3 | [] | no_license | import os
import sqlite3
allowedDbFormats = (".db",)
class DataBaseProvider:
def __init__(self):
self.dataBaseName = None
def getDbConnection(self):
if self.dataBaseName is None:
self.dataBaseName = self.__getDbName()
connection = sqlite3.connect(self.dataBaseName)
... | true |
b28dcd30e3d75340f2f50b8ae4b98f3881a7ad7a | erwinlambert/alphabeta | /draftplot_reference.py | UTF-8 | 2,680 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | from utils2 import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
#Define input parameters
dx = 1.
L = 5.e6
x = np.arange(0.,L,dx)
R = .02+0.*x
#Solve equations
Hsg,S2,Msg = solvePW(x,R)
Hth,T1,FTint,T0 = solveAW(x,Msg)
#Get plotcolors
red,blu,pur = getcols()
#Make variable plot
pret... | true |
8a5ec6d501a9b09a8725c3bad235f63ab4c224d3 | nimra/module_gen | /nodes/Geron17Hands/C_PartII/G_Chapter15/C_StackedAutoencoders/C_TrainingOne/index.py | UTF-8 | 7,821 | 3.5625 | 4 | [] | no_license | # Lawrence McAfee
# ~~~~~~~~ import ~~~~~~~~
from modules.node.HierNode import HierNode
from modules.node.LeafNode import LeafNode
from modules.node.Stage import Stage
from modules.node.block.CodeBlock import CodeBlock as cbk
from modules.node.block.HierBlock import HierBlock as hbk
from modules.node.block.ImageBlock ... | true |
a579b66a9c4a4724eddaa9f553e39fb2e6434428 | MAYA-MUYI/Python | /image_text/one.py | UTF-8 | 673 | 3.21875 | 3 | [] | no_license | from PIL import Image, ImageDraw, ImageFont
def img_addnum(img_name, num):
#打开一个图像文件
im = Image.open(img_name)
#创建一个可以在给定图像上绘图的对象。
draw = ImageDraw.Draw(im)
#获得图像尺寸,也可以使用w,h = im.size
w = im.width
h = im.height
#创建Font对象
fnt = ImageFont.truetype('arial.ttf', int(h * 0.15))
#输... | true |
5bcacb8921f5350bbd18446a606a4857f0280200 | chromatices/Rotate_box_mAP | /utils/average_precision.py | UTF-8 | 2,129 | 3.828125 | 4 | [] | no_license | """
Calculate the AP given the recall and precision array
1st) We compute a version of the measured precision/recall curve with
precision monotonically decreasing
2nd) We compute the AP as the area under this curve by numerical integration.
"""
def voc_ap(rec: list, prec: list):
"""
--- Offi... | true |
fb79cf84c980ef442fbef4999ddd46360d69f486 | dipayandutta/python | /odd-even.py | UTF-8 | 446 | 4.40625 | 4 | [] | no_license | '''
Purpose :- get more familier with odd even number calculation
using if-else conditional logic of python!
Author :- Dipayan Dutta
'''
#reading a number to check if it is odd or even
number = input ("Enter a numbre to check it is odd or even")
#put a check if user entering a negative number
if... | true |
f14d913592004d0cf9a1f3859735dcbe0efb3e6e | tiwanari/deep-learning-from-scratch | /ompugao/ch05/layer_naive.py | UTF-8 | 2,015 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
class MulLayer(object):
def __init__(self, ):
self.x = None
self.y = None
def forward(self, x, y):
self.x = x
self.y = y
return x*y
def backward(self, dout):
# z = xy
# d: partial differential
# dz/dy = x
# dz... | true |
003e6fb70c994cd01b0546475a266b841e571496 | EmilHernvall/projecteuler | /122.py | UTF-8 | 392 | 3.46875 | 3 | [] | no_license | import math
def Power(n):
if n == 0:
return 0
elif n % 2 == 1:
print "n * n^" + str(n-1)
return 1 + Power(n-1)
elif n % 2 == 0:
print "n^" + str(n/2) + " * n^" + str(n/2)
return Power(n/2)
else:
return 1
count = 0
for i in range(1,200+1):
c = int(math.ceil(math.log(i, 2)))
if i % 2 == 1:
c += 1
... | true |
57149c288480930a9e30c681443e7190b15ce584 | x670783915/ml-learning-practice | /PCA/PCA.py | UTF-8 | 2,064 | 3.3125 | 3 | [] | no_license | import numpy as np
def normalize(X):
m, n = X.shape
# 每个特征维度的均值
X_mean = np.mean(X, axis=1)
S = [0 for _ in range(n)]
for i in range(m):
# 特征为均值方差
S[i] = (1 / (n-1) * np.sum(np.square(X[i] - X_mean[i])))
for j in range(n):
X[i][j] = (np.float(X[i][j]) - X_mean[... | true |
5bbadd0ebbbd72ed9c5f2e95c990a18c2b3959be | durakmuhammetyasir/ProjectCampsJune | /YapayZekaBootCamp/Ders3/Day3YapayZekaPythonGiris/day3_secondpart_firstmin.py | UTF-8 | 1,281 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 00:10:52 2021
@author: Yasir
"""
def basitfonksiyon():
print("Merhaba, ilk fonksiyonum")
basitfonksiyon()
def degeralan(kullaniciadi, sifre):
print("kullanici adi " + kullaniciadi + " sifrem " + sifre)
print("kullanici adi" , kullaniciadi, "sifrem", sifr... | true |
23f4192241d86b0c93094938a60cf7ec9941e56d | sanakhanbano/api | /api/Helpers.py | UTF-8 | 2,063 | 2.90625 | 3 | [] | no_license | from collections import defaultdict
import requests
import json
import DBFunctions
def LooksLikeInt(s):
try:
int(s)
return True
except ValueError:
return False
def base36encode(number, alphabet='0123456789abcdefghijklmnopqrstuvwxyz'):
"""Converts an integer to a base36 string."""
... | true |