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 |
|---|---|---|---|---|---|---|---|---|---|---|
5083fd1c00d2f348b1ee4a39d5c20b0dea9a8b04 | tobyatgithub/gaze_tracker_python | /gazer_utils.py | UTF-8 | 796 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import pygame, os
from SimpleCV import Camera, Display
class GazerUtils:
def __init__(self):
self.fullscreen_size = None
self.title = None
def getCamera(self, properties = {"width": 1280, "height": 720}):
return Camera(prop_set=properties)
def __setupDisplayProperties(self):
# centeral... | true |
12df970d5cd43af3ee0f191c1f17f66c3c5b62ea | czeslawzalewski75/eko | /eko_v1.py | UTF-8 | 1,975 | 3.140625 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import random
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
import pickle
st.write("""
# Ekobilet Machine Learning
beta -v1
Prognoza **ceny biletu** wg: miasta, typu i dnia wydarzania
""")
st.write('---')
# Sidebar
# H... | true |
9131a5d547ad450403daafe80a133ac824ea3127 | kee-mun/pythonStudy | /DataStructure/Stack/stack.py | UTF-8 | 332 | 3.171875 | 3 | [] | no_license | class node:
def __init__(self, data):
self.data = data
self.downNode = None
class stackNode:
def __init__(self):
self.top = None
def push(self, data):
if self.top == None:
self.top = node(data)
else:
self.top.downNode, self.top = self.top... | true |
7353291aad58d786e553d87beeb6e0a69e373eb7 | MeghaSajeev26/Luminar-Python | /Advance Python/Regular Expression/Examples/pgm3.py | UTF-8 | 237 | 3.421875 | 3 | [] | no_license | #combination of upper case and lower case numbers ending with a number
import re
x="[a-zA-Z]+\d$" #or "[a-zA-Z]+[0-9]$"
n=input("Enter input")
match=re.fullmatch(x,n)
if match is not None:
print("valid")
else:
print("Invalid") | true |
f5aab095647270be6a5d4d6ad262492cc571f95a | vxl/vxl | /contrib/brl/bseg/bstm/pyscripts/bstm_adaptor.py | UTF-8 | 19,306 | 3.015625 | 3 | [] | no_license | import brl_init
import bstm_batch as batch
dbvalue = brl_init.register_batch(batch)
import os
#############################################################################
# PROVIDES higher level python functions to make bstm_batch
# code more readable/refactored
########################################################... | true |
b2a60e0af15acfc891d26f1d330e770fb2c6c508 | rpachauri/connect4 | /connect_four/evaluation/victor/rules/claimeven.py | UTF-8 | 4,367 | 3.28125 | 3 | [
"MIT"
] | permissive | from typing import List, Set, Optional
from connect_four.evaluation.victor.rules import Rule
from connect_four.game import Square
from connect_four.evaluation.board import Board
from connect_four.problem import Group
import warnings
class Claimeven(Rule):
def __init__(self, upper: Square, lower: Square):
... | true |
0431da939c2e64ab7634afc29cc0f7784edf8c66 | akv589/Fade-Out-Filter | /FadeOut.py | UTF-8 | 1,221 | 3.28125 | 3 | [] | no_license | # program: FadeOut.py
# author: Amarpreet Kaur
# credits: Trevor Tomesh
# course: CS 827
# date: November 19th 2018
# description: this program reads in mysteryTones.dat file, applies the Fade-Out effect and writes the output in the out.dat file.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as n... | true |
f8269da506726dc49cf5da44e987ffa86874d6d1 | candyhunterz/odin_project | /python games/pong.py | UTF-8 | 4,436 | 3.359375 | 3 | [] | no_license | # Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGHT = True
ball_... | true |
0fd610f1aee732f9197e0ef7b714587164311066 | tanli-haide/ecshop | /mytest_a.py | UTF-8 | 358 | 2.515625 | 3 | [] | no_license | import unittest
class MyTest(unittest.TestCase):
def setUp(self):
print("初始化")
def test_a(self):
print("我是测试用例1")
def test_b(self):
print("测试用例2")
def test_c(self):
print("测试用例3")
def tearDown(self):
print("清理")
if __name__ == '__main__':
unittest.main()
| true |
b920e36c357481d36f53cb9e7ae40aa720be1cbb | rohitpk/NaturalLanguageProcessing | /DDS/RE/ReDemo.py | UTF-8 | 958 | 4.1875 | 4 | [] | no_license |
import re
#Extracting Years pattern
sample_data = """ In the year 1526, first battle of Panipat was fought.
The second battle at the same place was fought in the year 1556.
In 1761, it was last battle fought at Panipat.
"""
def get_years_without_re(text):
number_list = ['0','1','... | true |
322d219e506abb29b3ba6e7b45386bda3bf066a5 | sbsanjaybharti/python-data-science | /Linear_Algebra/matrix.py | UTF-8 | 469 | 3.015625 | 3 | [] | no_license | class matrix:
def shape(self, a):
num_rows =len(a)
num_cols =len(a[0])
return num_rows, num_cols
def get_row(self, a, i):
return a[i]
def get_column(self, a, j):
return [a_i[j] for a_i in a]
def make_matrix(self, num_rows, num_cols, entry_fn):
return [[e... | true |
38902a6196bba43ab712492e1caba60a8f9ce32e | h4ck3r007/QuestionMe | /questionMe.py | UTF-8 | 3,374 | 3.109375 | 3 | [] | no_license | ###############################################################################
# Program Name : Question Me
# Version : 0.1
# Author : Anoop
# Created On : Jul 11, 2015
# Last Updated : Jul 11, 2015
#
# Change History
# [Anoop] Jul 11, 2015 : File Created
#
################################################... | true |
869d16cae1ebf8f06b62ccf9f8a9330bc360c199 | rmccampbell/PythonProjects | /tetris.pyw | UTF-8 | 8,431 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
import sys, os, pygame, random
from pygame import Color
from pygame.locals import *
DIR = os.path.dirname(sys.argv[0])
HSFILE = os.path.join(DIR, 'tetris_highscore.txt')
FONTFILE = os.path.join(DIR, 'bauhaus-93.ttf')
FPS = 60
FRAMECOLOR = (127, 127, 127)
BGCOLOR = (255, 255, 255)
SWIDTH = 280
SH... | true |
ff8cb4c1a93925f5860394dd6b2112efb57d07eb | Tobias-rv/skole | /Python/H02/Tvu003_H02.py | UTF-8 | 3,075 | 3.296875 | 3 | [] | no_license | #Ser om filene er tomme og lager en list/dictionary om nødvendig
import os
if open("karakterer.txt", "r") is False:
open("karakterer.txt", "w")
if open("emner.txt", "r") is False:
open("emner.txt", "w")
x = os.path.getsize("emner.txt")
z = os.path.getsize("karakterer.txt")
if x == 0:
open("emner.tx... | true |
fef89883c9af3d569dc66c3d069377a43c291eaf | nikhildg/CSharp-to-ARM-Compiler-CS335A | /ass4/src/parser.py | UTF-8 | 43,826 | 2.625 | 3 | [] | no_license | #!/usr/bin/python3
#http://www.cs.may.ie/~jpower/Research/csharp/csharp.y
###################################################################################################
import sys
import ply.yacc as yacc
from lexer import *
from sym_table import *
import copy
filename = sys.argv[1]
symbol_table = env()
#precede... | true |
21398ea8da54378d883bd6b85f280fde992482c1 | deepset-ai/haystack | /haystack/modeling/data_handler/dataloader.py | UTF-8 | 3,920 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | from typing import Optional, List
from math import ceil
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset, Sampler
from haystack.errors import ModelingError
class NamedDataLoader(DataLoader):
def __init__(
self,
dataset: Dataset,
batch_size: i... | true |
35e3f0d58f04b537137195d9fd7350527e079b75 | davidgarza01/prg1_homework | /Practice_code/while.py | UTF-8 | 214 | 3.71875 | 4 | [] | no_license | x = 0
times = int(input('how many times would yuo like to loop'))
stars = ""
'''
while(x < times):
stars += "*"
x=x+1
print(stars)
'''
while (x < times):
stars += "*"
x = x + 1
print(stars) | true |
309163fa64b347a9721f64c4d76bf36cdc0d2428 | afsana1210/python-learning | /append.py | UTF-8 | 810 | 4.03125 | 4 | [] | no_license | mystring='hello'
#append the string .that mean create empty list and add the string into that list.
mylist=[]
for letter in mystring:
mylist.append(letter)
print(mylist)
#list comprehension
#same as above code but simple one line cod .
#here letter is an element after for same element is use and then some obje... | true |
3d3593e3a9d668abf06ead7d06dbb47b8c768c72 | OleksandrNikitenko/CodeFights-Intro | /Island of Knowledge/areEquallyStrong.py | UTF-8 | 2,379 | 4.125 | 4 | [] | no_license | """
Call two arms equally strong if the heaviest weights they each are able to lift are equal.
Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms.
Given your and your friend's arms' lifting capabilities find o... | true |
7d466b116915fe3e14bca96a6cd300ae1d2f70e2 | Licho59/learning_python_eric_matthes_book | /ksiazka_zrob_to_sam/3.8_zwiedzaj_swiat.py | UTF-8 | 676 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 8 19:48:04 2017
@author: Leszek
"""
miejsca = ['argentyna', 'szkocja', 'mediolan', 'alaska', 'sydney']
print(miejsca)
print(sorted(miejsca)) #tymczasowa kolejnosc alfabetyczna
print(miejsca) #potwierdzenie że lista nie zmieniona
print(sorted(miejsca, reverse=True)) #tym... | true |
e0d2885b53da4ded1338c89246cfa102a97f4c74 | gitfuwu/jjh | /AC/AC.py | UTF-8 | 4,113 | 3.03125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
class Actor:
def __init__(self, env, sess, lr):
# init some parameters
self.state_dim = env.observation_space.shape[0]
self.action_dim = env.action_space.n
self.lr = lr
self.state_input = tf.placeholder(tf.float32, [None, self.sta... | true |
786c4567cbd581a569608b7aa35aeba69422ec11 | kundajelab/simdna | /simdna/synthetic/loadedmotifs.py | UTF-8 | 6,919 | 2.828125 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, division, print_function
from simdna.synthetic.core import DefaultNameMixin
from simdna.simdnautil import util, pwm
from collections import OrderedDict
import numpy as np
class AbstractLoadedMotifs(object):
"""Class representing loaded PWMs.
A class that contains instan... | true |
d020f9cd2aff2386f5aef936fde8e56e49061eff | mgiraldo/nsw-downloader | /run_summarizer.py | UTF-8 | 2,246 | 2.734375 | 3 | [] | no_license | import time
import pandas as pd
import subprocess
import multiprocessing
import tqdm
import argparse
import os
from pathlib import Path
"""
Assumes:
- a summarizer server running at: http://localhost:4567/ via Docker for Mac
- an image server running at: http://host.docker.internal:8000/
(the way Docker for... | true |
f9bb46f8838168ce0a5d0e0fc04562232e1456b9 | avinashdamania/the-last-word | /back-end/meta.py | UTF-8 | 3,075 | 2.8125 | 3 | [] | no_license | import json
from util import make_api_call
gitlab_api_base = 'https://gitlab.com/api/v4'
bios = {
"sghsri": "My name is Sriram Hariharan and I'm a sophomore this year at the University of Texas at Austin 🤘 studying Computer Science. I love to tinker around, but I'm especially interested in web and mobile developm... | true |
40f1e52649442ed76efb4db83d10a32fec4cf055 | AmberJBlue/aima-python | /submissions/Karman/puzzles.py | UTF-8 | 1,974 | 2.703125 | 3 | [
"MIT"
] | permissive | import search
from math import(cos, pi)
tuscany_map = search.UndirectedGraph(dict(
Florence=dict(Prato=24, Montevarchi=51, Sienna=75, Empoli=31),
Prato=dict(Pistoia=26, Florence=24, Empoli = 29.3),
Pistoia=dict(Prato=26, Lucca=43),
Lucca=dict(Pistoia=43, Pisa=18, Pontedera = 29, SanMiniato = 44.3),
Pisa=dict(Lucca=18... | true |
316bcc745ffd781f77d48a113e6db82a7c98d40c | ksitterle/AdventOfCode2020 | /src/Day12.py | UTF-8 | 2,331 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
inputfile = "input/Day12Input.txt"
waypoint_loc = []
def rotate_waypoint(direction,dist):
if dist==90 and direction=='R' or dist==270 and direction=='L':
tmp = waypoint_loc[0]
waypoint_loc[0]=-1*waypoint_loc[1]
waypoint_loc[1]=tmp ... | true |
be1ae0f97a100f672a4e1ce97216bc8379087976 | Jiajunwei/weiliang2 | /b_feature_load.py | UTF-8 | 1,028 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/12/20 0020 上午 11:08
# @Author : Lovin
# @Site :
# @File : load_feature.py
# @Software: PyCharm
import h5py
import numpy as np
from sklearn.utils import shuffle
np.random.seed(2017) #设置了 numpy 的随机数种子为2017,这样可以确保每个人跑这个代码,输出都能是一样的结果
"""
... | true |
6eb0f88e942e06627355d3cb3abafa88339ca343 | ArturVargas/Intro-a-Python3 | /01_Vars_and_Objects/vars.py | UTF-8 | 311 | 4.0625 | 4 | [] | no_license |
print('Hello to Python 3 bitches')
#print(3 + 4);
carName = 'VW'
print(carName)
carName = 90
print(carName * 2)
age = int(26)
name = str("Arturo Castañon")
height = float(1.70)
print("Hi %s you are %d and your height is: %f"%(name, age, height))
print(f"Hi {name} you are {age} years old and your height is {height}") | true |
0565223beda9c3ed7c4446c0e5192cf66c5a30d7 | caelanyang/LeetCode | /AddTwoNumbers.py | UTF-8 | 1,873 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | """问题地址: https://leetcode.com/problems/add-two-numbers/"""
import extend.extend as extend
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, new_data):
new_node = Node(new_data)... | true |
0a8ce69aaaff89b64f3042a2da79bd70bd01a160 | daniel-reich/ubiquitous-fiesta | /mJB9CYyGsADLQPjnx_24.py | UTF-8 | 249 | 3.453125 | 3 | [] | no_license |
def first_non_repeated_character(txt):
if len(txt) == 0: return False
txt = txt.lower()
cnt = {}
for c in txt:
if c in cnt:
cnt[c] += 1
else:
cnt[c] = 1
for c in txt:
if cnt[c] == 1:
return c
return False
| true |
a79b4e232510f99570a6db0c9c5a31ff7da239be | VictorCabPo/RainfallScripts | /2_CheckHyetographs_Optional_v01.py | UTF-8 | 1,485 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Spyder Editor
Author: Victor Caballero
Edenvale Young
03/10/2017
"""
import os, random, pandas, glob
import seaborn as sns
Path = input("Folder: ")
os.chdir(Path)
file = random.choice(os.listdir(Path))
print("****************************************************")
... | true |
68fdbaa550edd4b2f8e805fa7206f7ee6e6622bd | JJHung666/Github-Repository | /HW_9:15:2018.py | UTF-8 | 880 | 3.9375 | 4 | [] | no_license | # date: 9/15/2018
# description: this is a program that will tell you your grade depending on the number you input
# sources:
import sys
x = float(sys.argv[1])
if x>5 or x<=0:
print("your number is not within the range of the the grades")
if x>0 and x<1:
print("your grade is a F")
if x>=1 and x<1.5:
print("your g... | true |
0ff5a7e88db7b52abcae3980e099ad890321034b | wlizama/python-training | /turtle_graphic.py | UTF-8 | 279 | 3.640625 | 4 | [] | no_license | # Turtle graphic
import turtle
window = turtle.Screen()
colors = ['red', 'purple', 'blue', 'green', 'yellow', 'orange']
t = turtle.Pen()
t.speed(0)
for x in range(360):
t.pencolor(colors[x % 6])
t.width(x / 100 + 1)
t.forward(x)
t.left(59)
turtle.mainloop()
| true |
35c6e8de03853ac1216d101a03e675b1c8e77186 | compvision/archive | /18-19/mock-season/orange-team/TargetDetector.py | UTF-8 | 1,942 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
class TargetDetector:
def __init__(self):
self.threshed = None
self.contr = None
self.HSV = None
self.origImg = None
self.targetApprox = np.zeros((0,0,0))
self.approx = None
self.maxX = 0
self.minX = 1000
self.maxY = 0
self.minY = 1000
self.maxXReturn = 0
self.min... | true |
ad4000d736730871cd86c16f1e98f03f1420fde3 | bluebasil/StacksCardGame | /human.py | UTF-8 | 804 | 3.34375 | 3 | [] | no_license | import game
from copy import deepcopy
game.verbose = True
board = game.start()
state_list = []
change = True
while True:
if change:
game.print_board(board)
state_list.append(deepcopy(board))
change = False
move = input("awaiting move: ").split(" ")
if move[0] == 's':
game.shift(board)
change = True
elif... | true |
d46ac1712b65005655db0f768261d578ddc1d59c | gammapy/gammapy | /examples/models/temporal/plot_gaussian_temporal.py | UTF-8 | 1,022 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | r"""
.. _gaussian-temporal-model:
Gaussian temporal model
=======================
This model parametrises a gaussian time model.
.. math::
F(t) = \exp \left( -0.5 \cdot \frac{ (t - t_{\rm{ref}})^2 } { \sigma^2 } \right)
"""
# %%
# Example plot
# ------------
# Here is an example plot of the model:
from astro... | true |
8406c6be43a7a43906ce3a0d7d3bd292da3f7398 | freevanx/Quant-Projects | /EFD.py | UTF-8 | 1,447 | 3.34375 | 3 | [
"MIT"
] | permissive | # Explicit Finite Difference method to calculate values for Call and Put European options.
# Written by: Michal Lyskawinski
# 10/31/2016
from math import *
import numpy as np
S = 100
r = 0.06
sig = 0.2
T = 1
K = 100
N = 3
Nj = 3
div = 0.03 # In percentage
dx = 0.2
option = 'Call'
# Precompute consta... | true |
297d7d8c592c63ee2109876c37900e2bb8505277 | amos555/guvi | /factorial 1.py | UTF-8 | 80 | 3.40625 | 3 | [] | no_license | num=int(raw_input())
fact=1
for i in range(1,num+1):
fact=fact*i
print (fact)
| true |
c6f204db675a235aee32d2eac0dcc2b677beb840 | konczyk/mincut | /graph.py | UTF-8 | 876 | 3.875 | 4 | [] | no_license | class Graph:
"""
Undirected graph data structure represented as a list of edges
and a number of vertices
"""
def __init__(self, data):
self._v = 0
self._edges = []
self._load_data(data)
def _load_data(self, data):
"""
Load connections from the data, wher... | true |
b8e7e52d2498f5886749042868b7909053c601ea | f-z/machine-learning-projects | /wine-quality-prediction/code/regression_models.py | UTF-8 | 8,569 | 3.34375 | 3 | [
"MIT"
] | permissive | import numpy as np
import numpy.linalg as linear_alg
def ml_weights(input_matrix, targets):
"""
This method returns the weights that give the best linear fit between
the processed inputs and the targets.
"""
# phi = np.matrix(input_matrix)
phi = np.array(input_matrix)
# targets = np.matri... | true |
9d7f7b5de607b4fa6d39fa76687a7ca92ba2d888 | irinamoon/quotesca | /main.py | UTF-8 | 1,238 | 2.765625 | 3 | [] | no_license | import requests
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates(directory='templates')
@app.get('/')
def index(request: Request):
return templates.TemplateResponse('index.html', {
'request': request,
'gree... | true |
9f5b04cc92d91c56ce9c3578635283bf20c8f234 | Aasthaengg/IBMdataset | /Python_codes/p02681/s482214102.py | UTF-8 | 68 | 3.0625 | 3 | [] | no_license | s=input()
t=input()
s+=t[-1]
if(s==t):print("Yes")
else: print("No") | true |
9a560bc31d8124227fbc93bd54fed35e6db061c5 | jiadaizhao/LeetCode | /0801-0900/0842-Split Array into Fibonacci Sequence/0842-Split Array into Fibonacci Sequence.py | UTF-8 | 1,003 | 2.875 | 3 | [
"MIT"
] | permissive | class Solution:
def splitIntoFibonacci(self, S: str) -> List[int]:
for i in range(1, min(10, len(S)//2) + 1):
s1 = S[:i]
if s1 != '0' and s1[0] == '0':
break
num1 = int(s1)
for j in range(1, min(10, len(S) // 2) + 1):
if len(S) ... | true |
220f4566c26af26fe38730413f1d20e0a35334e1 | johndpope/SuperConductor | /oldfiles/midiplayer.py | UTF-8 | 2,284 | 2.828125 | 3 | [] | no_license | # UW CSE 481 Sound Capstone
# Requires Mido and Pygame external libraries
# SuperConductor, basic MIDI file player and manipulator
from mido.midifiles import MidiFile
import pygame.midi
import threading
# Global Variables
VOLUME_OFFSET = 0
PITCH_OFFSET = 0
FILE = None
PLAYER = None
# Non-blocking midi player. Only ... | true |
15833e34a835b1ce67280d1f6a506e3581912a8a | AJ-Walker/abhay-code | /merge_sort.py | UTF-8 | 1,839 | 4.125 | 4 | [] | no_license | # merge() merges two subarrays of arr[1eft..right]
# First subarray is arr[left..middle]
# Second subarray is arr[middle+1..right]
def merge(arr, left, middle, right):
n1 = middle - left + 1
n2 = right- middle
# create temp arrays
L = []
R = []
for i in range(0 , n1):
L.append(0)
... | true |
e894324c93d32f627fc98ca8c78e99aaf6540df7 | habibbueteee/Algorithm-data-structure | /single_linkedlist.py | UTF-8 | 1,895 | 4.0625 | 4 | [] | no_license |
class Node:
def __init__(self, data):
self.data = data
self.nextNode = None
class LinkedList:
def __init__(self):
self.head = None
self.numOfNodes = 0
#We can add new data at the beginning in o(1)/ ortho 1 running time complexity
def insert_start(self, data):
self.numOfNodes = self.numOfNodes... | true |
de20d8bb17ffed61ae6647e5b92f577db91f6d1f | MetallicSquid/ML-examples | /digit-classifier/build_model.py | UTF-8 | 1,284 | 2.96875 | 3 | [] | no_license | # The digit recognition model
# Necessary imports
import tensorflow as tf
from tensorflow import keras
import numpy as np
from keras.datasets import mnist
def build_model(epochs=10):
# Gather the dataset and split it into train and test sets, normalize this data between 0 and 1
(image_train, label_train), (im... | true |
568b3b6b800804caf16abd86d8e0283ddc013600 | stanshch/ThinkfulPiP | /tip_calculator.py | UTF-8 | 848 | 3.5 | 4 | [] | no_license | from optparse import OptionParser
parser = OptionParser()
parser.add_option("-m", "--meal", dest="meal", help="pre-tax cost of the meal", type="float")
parser.add_option("-x", "--tax", dest="tax", help="the tax rate in the 0.XX format", type="float")
parser.add_option("-p", "--tip", dest="tip", help="your tip in the 0... | true |
a34aedc499d333beeb6d007579cf40c8ea47506f | serre-lab/mgh-video | /unet_partseg_pose/central_reservoir/utils/layers.py | UTF-8 | 6,406 | 2.671875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import cross_replica_batch_norm
import tpu_normalization
#TODO: 1.maxpool3d, averagepool2d/3d
def linear(input_var, layer_name, output_units,
activation=tf.keras.activations.relu,
initializer=tf.keras.initializers.glorot_normal,
batch_norm=False,
update_collecti... | true |
d2ef564e2f7aecca2018e4252e5d1728d0571f9b | sgupta13/Recommendation-system-using-link-prediction | /jcsim.py | UTF-8 | 3,395 | 2.625 | 3 | [] | no_license |
# coding: utf-8
# In[17]:
import numpy as np
import networkx as nx
import os
import copy
import sys
import itertools
from collections import defaultdict
# In[7]:
os.getcwd()
# In[8]:
def get_graph():
os.chdir('D:\Graph Data Mining Final Project')
data = np.loadtxt('flickrsauop.txt', usecols=(0,1))
... | true |
7479e7ad937188da53633852358afa9162c187f9 | chapman-cs510-2017f/cw-05-cw05-tim-evan | /cplane.py | UTF-8 | 6,207 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from abscplane import AbsComplexPlane
###
# Name: Evan A Walker, Tim Frenzel
# Student ID: 01932978 ,
# Email: walke208@mail.chapman.edu , frenz102@mail.chapman.edu
# Course: CS510 Fall 2017
# Assignment: Classwork 5
###
##
## evans number: 4082341114
##
... | true |
6cc45933bc6505c6184702d5d2a224eaabd006cc | Start-Understanding-Python-Association/BudgetApp | /budget.py | UTF-8 | 4,143 | 3.078125 | 3 | [] | no_license | class Category:
"""All of the stuff needed for a budget."""
def __init__(self, name):
self.ledger = []
self.name = name
def __str__(self):
self.title_line = list('*' * 30)
s = ''
count = 0
self.body = ''
for i in self.name:
sel... | true |
a2a3aa76d7e8440c84c93b4d652f8027a4f98698 | alecherryy/CS5001_Computer_Science | /Homework _4/mbta.py | UTF-8 | 3,046 | 3.765625 | 4 | [] | no_license | '''
Alessia Pizzoccheri - CS 5001 02
Consulted https://www.programiz.com/python-programming/methods/list/index
to check how to print an item's index. I couldn't remember.
'''
RED_LINE = [
'Ashmont',
'Shawmut',
'Fields Corner',
'Savin Hill',
'JFK/UMass',
'Andrew',
'Broadway',... | true |
b112ca88cda5740fe585445de4ce986991693b36 | Zbiang/IQAS | /app/libs/ld.py | UTF-8 | 511 | 2.578125 | 3 | [] | no_license | def LD(qs, ql):
m, n = len(qs) + 1, len(ql) + 1
ted_matrix = [[0]*n for i in range(m)]
for i in range(m):
ted_matrix[i][0] = i
for j in range(n):
ted_matrix[0][j] = j
for i in range(1, m):
for j in range(1, n):
if qs[i - 1] == ql[j - 1]:
cost = 0
... | true |
46f1eac4098ac9ffc10ab0968d39dbc578c4b9a2 | shreyansh225/InfyTQ-Foundation-Courses-Assignment-Answers | /Programming Fundamentals using Python/Day 8/Exercise 39 - Level 1.py | UTF-8 | 315 | 2.9375 | 3 | [] | no_license | #PF-Exer-39
#This verification is based on string match.
principal_amount=4000
duration=12
rate_of_interest=13
simple_interest = lambda p,n,r:(p*n*r)/100
if(simple_interest(principal_amount,duration,rate_of_interest)>1000):
print("Platinum Member")
else:
print("Gold Member")
#Platinum Member
| true |
435df37717b1282d57c88889b0706947ef855d0d | fepegar/ipmi-coursework | /ipmi/template.py | UTF-8 | 4,618 | 2.546875 | 3 | [] | no_license | import shutil
from os.path import relpath
import numpy as np
from PIL import Image
from . import path
from . import nifti
from . import constants as const
from . import registration as reg
NII_EXT = '.nii.gz'
PNG_EXT = '.png'
PRIORS = '_priors'
def get_final_template():
return Template(const.FINAL_TEMPLATE)
... | true |
234da3805ca0efb045e03d571ac1624281da337e | wfw-pgr/analyze__meshQuality | /pyt/calculate__tetraEdgeLength.py | UTF-8 | 3,291 | 2.796875 | 3 | [] | no_license | import numpy as np
# ========================================================= #
# === calculate edge length of a tetrahedral element === #
# ========================================================= #
def calculate__tetraEdgeLength( elems=None, nodes=None ):
# -----------------------------------------------... | true |
7079d3b2656f8bf9fbc34a579b4581ba983536b8 | szEIgo/CVA | /run_gui.py | UTF-8 | 921 | 2.765625 | 3 | [] | no_license | from tkinter import *
def main():
root = Tk()
root.title('CVA - Computer Vision App')
root.minsize(width=450, height=450)
root.maxsize(width=450, height=450)
buttonStart = Button(root, text='Start')
buttonStart.pack(fill=X)
buttonSettings = Button(root, text='Settings')
buttonSettings... | true |
73737270786d37c1670f5bc230593ae429d54b8c | abdibogor/The-Bad-Tutorial | /05_Python/13_The IF statement/if.py | UTF-8 | 192 | 3.296875 | 3 | [] | no_license | """
myvar=50
if myvar<100:
print("You are short of being 100 percent")
print("Good bye!")
"""
myvar=150
if myvar<100:
print("You are short of being 100 percent")
print("Good bye!")
| true |
63251651c4c82d3a5d69bf5fceeb16e9833ba337 | fortachong/m | /process/predict_acc.py | UTF-8 | 4,071 | 3.0625 | 3 | [] | no_license | """
Predict with a previously trained model
--ifile : input file
--m : trained model
--t : a flag 0 or 1. If present and set to 1 it won't use the input file and just
generates the predictions on the test file used for testing the original model
"""
import getopt
import sys
import pandas as pd
import pickle
from skle... | true |
6c012168fe387ca98426f3bba7404e630ed37e24 | maverickz/Leetcode | /permute_string.py | UTF-8 | 257 | 3.140625 | 3 | [] | no_license | def permute_string(prefix, suffix):
if not len(suffix):
print prefix
else:
for i in xrange(len(suffix)):
permute_string(prefix+suffix[i], suffix[0:i]+suffix[i+1:])
if __name__ == '__main__':
permute_string('','abc') | true |
0929fe22f4e4491f8c0292b37cc5ee2fb134b5a1 | JonasAraujoP/Python | /desafios/desafio112/utilidadesCeV/moeda/__init__.py | UTF-8 | 890 | 3.6875 | 4 | [
"MIT"
] | permissive | def aumentar(v=0, t=0, per=False):
res = v + (v*t/100)
return res if per is False else f'{moeda(res)}'
def diminuir(v=0, t=0, per=False):
res = v - (v*t/100)
return res if per == False else f'{moeda(res)}'
def dobro(v=0, per=False):
res = v*2
return res if not per else f'{moeda(res)}'
def ... | true |
cc556eb8772d338d31c4a1e7e256a6d79e983b0f | lincvic/PythonDemo | /LeastSquareMethod.py | UTF-8 | 1,210 | 3.328125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
def logistic(a, b , x):
return a*x+b
def fit(p , x):
f = np.poly1d(p)
return f(x)
def residuals(p , x , y):
return y-fit(p , x)
A, B = 2,3
#样本
x0 = np.linspace(0, 10 ,10)
y0 = [np.random.normal(0,1.5) + x ... | true |
47547472771d9323a05137cd4960db6d6e4f97ce | bliebeskind/PhyloPreprocessing | /fas_to_phy.py | UTF-8 | 532 | 3.078125 | 3 | [] | no_license | #! /usr/bin/env python
import sys
from Bio import SeqIO
def fas_to_phy(infile):
'''Convert a fasta alignment into phylip format'''
records = list(SeqIO.parse(infile,'fasta'))
first_line = True
for rec in records:
if first_line:
print " " + str(len(records)) + " " + str(len(rec.seq))
first_line = False
p... | true |
89fd5723a1b8ff7fef6510a8063fc82df37f5348 | JonasG2/Curso-Em-Video-Python | /ex009.py | UTF-8 | 259 | 3.65625 | 4 | [] | no_license | # ------------ TEOREMA DE PITÁGORAS ------------ #
from math import hypot
co = float(input("Digite o valor do cateto oposto: "))
ca = float(input("Digite o valor do cateto adjacente: "))
hi = hypot(co, ca)
print ("O valor da hipotenusa e: {}".format(hi)) | true |
600da6523e70df5bf14f5e8d1d7cb50b0fd2bf7d | niddhu5598/project_python | /functions/fun_with_parameter.py | UTF-8 | 343 | 3.671875 | 4 | [] | no_license | def get_speed(dis,time):
speed = dis / time
print(f'the speed is {speed}')
# calling
get_speed(50,5)
distance = 400
time = 25
get_speed(distance,time)
get_speed(dis=250,time=10)
def pythagoras(perpendicular:int,base:int):
hyp = (perpendicular**2+base**2)**0.5
print(f'p={perpendicular}, b={base},h=... | true |
820c409a7aec2ce0db68ec5dd666213ad806adaf | Flyingdog-Huang/GA-Genetic-Algorithm- | /demo/Crossover.py | UTF-8 | 2,941 | 2.90625 | 3 | [] | no_license | # 交叉(交叉算子在此处修改)--精英单点交叉
import random
from Selection import selection
from CalobjValue import calobjValue
def findMoFa(pop, fit_value, chrom_length, max_value):
"""
寻找最精英的父母(常用轮盘选择出父母基因)
:param pop:种群
:param fit_value:种群适应度
:return: 父,母基因
"""
# maxValue = max(fit_value)
# faValue = mi... | true |
a03a169898888e636d3044634fc643edce96b295 | Bogdan808/mypython | /format.py | UTF-8 | 278 | 3.59375 | 4 | [] | no_license | user1_name = "Bogdan"
user1_age = 28
user2_name = "Anna"
user2_age = 25
print("Пользователь {0} , возраст - {1} ".format(user1_name, user1_age))
print("----------")
print("Пользователь {0} , возраст - {1} ".format(user2_name, user2_age))
| true |
f119f81927ecfd75ace7469543d99817ebea0637 | Rustofaer/GeekUniversity-Python | /lesson-5/task2.py | UTF-8 | 476 | 3.71875 | 4 | [
"Unlicense"
] | permissive | # 2. Создать текстовый файл (не программно), сохранить в нем несколько строк, выполнить подсчет количества строк,
# количества слов в каждой строке.
with open('my_file.txt') as f:
lines = f.readlines()
print('Строк:', len(lines))
for count, line in enumerate(lines):
print('Слов в строке №{}: {}'.format(count,... | true |
8228592249188bd8a220a667de78697c4bcedb56 | T0RA5/SimpleLogin | /Login/SnapchatLogin.py | UTF-8 | 754 | 2.65625 | 3 | [] | no_license | import undetected_chromedriver as uc
import os
import time
import random
driver = uc.Chrome()
driver.get('https://accounts.snapchat.com/accounts/login?continue=https%3A%2F%2Faccounts.snapchat.com%2Faccounts%2Fwelcome')
#login block
time.sleep(5)
#add username in text
time.sleep(5)
elem = driver.find_element_by_x... | true |
ae647f5cba83018ed0f05522711476f8c8330199 | erpbrasil/erpbrasil.assinatura | /tests/test_erpbrasil_fake_certificate.py | UTF-8 | 2,061 | 2.875 | 3 | [
"MIT"
] | permissive | import datetime
from unittest import TestCase
from erpbrasil.assinatura import certificado
from erpbrasil.assinatura.excecoes import CertificadoExpirado
from erpbrasil.assinatura.misc import create_fake_certificate_file
class Tests(TestCase):
"""Simple test for fake certificate creation."""
def setUp(self):... | true |
b3542d2bdb9a6c8b7698e0ef42dc39b071339193 | ricardovillalobos0990/prog_basica | /Python/tkinter/Tkinterproy.py | UTF-8 | 3,395 | 3.359375 | 3 | [] | no_license | from tkinter import ttk, messagebox
from tkinter import *
class Menu:
def __init__(self, window):
# initializations
self.wind = window
self.wind.title(' Menu Opciones ')
self.valor = IntVar()
# Create a frame Container
frame = LabelFrame(self.wind, tex... | true |
d922570bad489d61584723910de20ac9c7c41527 | goyalanu/Machine-Learning-Algorithm | /Regression/random_forest_regression/import_dataset.py | UTF-8 | 259 | 2.78125 | 3 | [] | no_license | # Random Forest Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values
| true |
4085069be019eba1433b86a95ffaa226e8554acf | mcbymef/hcc-led | /gangliacomm.py | UTF-8 | 9,143 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import serial
import time
import re
import socket
import argparse
import subprocess
import random
import serial_control
import constants
from operator import itemgetter
LEDS_PER_RACK = constants.ganglia_leds
def main():
parser = argparse.ArgumentParser(description = 'Retrieve metrics from Gan... | true |
dcb6b55d9326b2db65351eb838ee538425d00de6 | carlos2020Lp/progra-utfsm | /guias/2014-1/junio-09/varias/varias.py | UTF-8 | 876 | 3.15625 | 3 | [] | no_license | def contar_palabras(oracion):
palabras = oracion.lower().split()
cuenta = {}
for palabra in palabras:
if palabra not in cuenta:
cuenta[palabra] = 0
cuenta[palabra] += 1
return cuenta
def complementaria(adn):
return (adn.replace('g', 'x')
.replace('c', 'g')... | true |
8f18983cfb69b996611377dee912e6dc94dab28d | Calum-Johnston/object-distance-detection | /sparse-stereo-master/sparse_stereo.py | UTF-8 | 4,279 | 2.75 | 3 | [] | no_license | ####################################################################
# Example : ORB feature point detection and matching between two
# images from a set of image files
# Author : Calum Johnston, calum.p.johnston@durham.ac.uk
# License : LGPL - http://www.gnu.org/licenses/lgpl.html
# based in part on tutorial at:
#... | true |
1fccbd6e92636314ac16af50e84c0f877e82c36b | Stefanroets180/all-my-Python-work | /Chaptor8/Pages200.py | UTF-8 | 856 | 4.3125 | 4 | [] | no_license | #8-3:t-shirt
def make_shirt(size, message):
"""Summarize the shirt that's going to be made."""
print(f"\nI'm going to make a {size} t-shirt.")
print(f'It will say, "{message}"')
make_shirt('large', 'Baker Skateboard!')
make_shirt(message="nike.", size='medium')
#8-4:T-Shirt size
def t_shirt(shirt_size='L'... | true |
b4bb44a32a7954abd25af9631e40bef3620217e8 | Aasthaengg/IBMdataset | /Python_codes/p02381/s832032917.py | UTF-8 | 181 | 2.796875 | 3 | [] | no_license | while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
m = sum(s) / n
a = sum((x - m) ** 2 for x in s) / n
print(a ** 0.5) | true |
b8287028d787db6cab1ec5291e0fd97b2e638a6d | D3coy/Python | /AI/ex_perceptron.py | UTF-8 | 1,066 | 3.828125 | 4 | [] | no_license | import numpy as np
# activation function
def get_activation(x):
return 0 if x < 0.5 else 1
# n calculus
def calc(house, rock, beauty):
x = np.array([house, rock, beauty]) # input signals vector
w11 = [0.3, 0.3, 0]
w12 = [0.4, -0.5, 1] # weights for neurons in hidden layer
weight_1laye... | true |
f2e87f59bbca0defcd76951e7f34cb417611c3ea | bci-machinelearning/LearnPythonTheHardway | /Exe_07.py | UTF-8 | 873 | 3.96875 | 4 | [] | no_license | #coding=utf-8 //测试
'''
习题 7: 更多打印
现在我们将做一批练习,在练习的过程中你需要键入代码,并且让它们运行起来。
我不会解释太多,因为这节的内容都是以前熟悉过的。这节练习的目的是巩固你学到的东西。
我们几个练习后再见。不要跳过这些习题。不要复制粘贴!
'''
print "Mary had a little lamb."
print "Its fleece was white as %s." % "snow"
#用字符串常量填充 %s
print "And everywhere that Mary went."
print "." *10 #what'd that do?
#字符串快速复制:打印... | true |
ffea9ba9fc6a70183a4adc641ff520034ffe482b | xueanxi/learnAi | /test/4_block.py | UTF-8 | 134 | 3.265625 | 3 | [] | no_license | i = 3;
j = 6;#这里如果在j 前面加一个空格,会导致报错,这就是python的缩进
print("i = {}, j = {}".format(i,j))
| true |
1178b164f01bf43087d51ec081552a37c4efe347 | sonhs99/gomoku | /self_play.py | UTF-8 | 5,694 | 2.765625 | 3 | [] | no_license | import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
from game.kerasutil import set_gpu_memory_dynamic
set_gpu_memory_dynamic()
import multiprocessing
import random
import time
import tempfile
from collections import namedtuple
import h5py
import numpy as np
import argparse
from agents import zero
from agents import ex... | true |
3cb7e1a69901bd5ef580972aceebf68e6adae401 | Caspar-Cheng/Python-intermediate-projects-collection-1 | /NATO-alphabet/main.py | UTF-8 | 422 | 3.609375 | 4 | [] | no_license | import pandas
# dictionary needs to be pandas.DataFrame(dict) before using iterrows();
# here is already a DataFrame format after the pandas.read_csv() method
alphabet_data = pandas.read_csv("nato_phonetic_alphabet.csv")
letter_dict = {row.letter : row.code for (index, row) in alphabet_data.iterrows()}
word = input... | true |
b44ab1d6098dd7d4775efedd37ee1e55e02d444d | mryongsheng/bacf_detectionAndTrack | /image_process/feature.py | UTF-8 | 2,530 | 2.6875 | 3 | [] | no_license | from image_process import features_pedro_py as pyhog
import numpy as np
from PIL import Image
import cv2
def get_pixels(img, pos, n_scales, search_pix_sz, target_sz=None, mode="edge"):
"""
Crop pixels from input image `img` with the center of `pos` and resize to `target_sz`
Args:
img:
pos:... | true |
cd07cf771e268d0d63877bd6e93835532d59f3a3 | SaJa-ai/Nancho_ai | /saju.py | UTF-8 | 2,131 | 3.375 | 3 | [] | no_license | opt = """
za = "1"
chuch = "2"
ien = "3"
myeou = "4"
jin = "5"
sa = "6"
oeh = "7"
mee = "8"
sin ="9"
you = "10"
sool = "11"
hae = "12
"""
print(opt)
te = input("What is your te? ~# ")
x = input("your birth month ~# ")
y = input("your birthday ~# ")
z = input("Your birth time ~# ")
onetotwe... | true |
fd39ed91fbb4042f3abe8930931cc732c5f23628 | Catchi-Nichi/Catchinichi-AI | /recommender/similar_fragrance.py | UTF-8 | 2,440 | 2.609375 | 3 | [] | no_license | import mysql_reviews
from sklearn.decomposition import TruncatedSVD
from scipy.sparse.linalg import svds
import pandas as pd
import numpy as np
import sys
import json
def get_perfume_data():
cursor = mysql_reviews.get_cursor()
reviews_dict = mysql_reviews.get_reviews(cursor)
user_perfume_data = pd.DataF... | true |
88ee11aee4bf7d2cb8ed0bdffeecb7a1a6a0c6b2 | Alexey7953/antida-school | /Lesson 13/final v 2.0/src/blueprints/image.py | UTF-8 | 994 | 2.625 | 3 | [] | no_license | import os
from src.services.image import ImageService
from src.database import db
from flask import Blueprint, request, jsonify, url_for, send_file
bp = Blueprint('image', __name__)
upload_folder = 'download'
@bp.route('', methods=['POST'])
def post_image():
"""Загрузка изображения на сервер"""
file = reques... | true |
e986de6609822e881ba481ef2e4ce003b8d8edf2 | kinchit/MIT-ComputationalThinkingUsingPython | /MIT-6.00.1x/StringCount.py | UTF-8 | 793 | 4.59375 | 5 | [] | no_license | '''
Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s. For example, if s = 'azcbobobegghakl', then your program should print
Number of times bob occurs is: 2
'''
def CountString(s,word):
count = 0
sLength = len(s)
wordLeng... | true |
1f542345f15f8639494f4f697b950a7d4984a300 | Data-drone/fakestream | /scripts/sensor_stream.py | UTF-8 | 3,249 | 2.875 | 3 | [
"MIT"
] | permissive | from generators import SensorGenerator
from argparse import ArgumentParser
import datetime
import json
from confluent_kafka import Producer
import socket
from threading import Thread
def make_parser():
"""
argument parser for controlling the number of streams
"""
parser = ArgumentParser(description... | true |
27af94ade15a7d716c476e0ffdbb01bd210a540f | tophatraptor/hopper-tools | /parsetex/parsetex_pre_multithreading.py | UTF-8 | 4,755 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
#parsetex.py
#Jay Dhanoa
#before running this script, run getarxivdatav2.py
#if arxivdata.txt isn't already present)
import sys
import glob
import os
import re
import numpy as np
import matplotlib.pyplot as pl
import urllib
import multiprocessing as mp
from operator import itemgetter
#path to di... | true |
9d7ecbbe9fe493a7d281a9e2f7435be9cfe8f500 | andrewhunter1612/flask-homework | /application/tests/test_calculator.py | UTF-8 | 706 | 3.015625 | 3 | [] | no_license | from application.models.calculator import Calculator
import unittest
class TestCalculator(unittest.TestCase):
def setUp(self):
self.calculator = Calculator(6, 3)
def test_add(self):
self.assertEqual(9, self.calculator.add(self.calculator.number_1, self.calculator.number_2))
def test_subtr... | true |
3b0e716cc7cdf04f0fb6fe2ed77daea65a21c18b | EnriqueZepeda/Python_Skills | /Chapter7/Ex_7_2.py | UTF-8 | 660 | 3.171875 | 3 | [] | no_license | file = input('Enter a file name:')
try:
fileHandle = open(file)
except:
if file == 'na na boo boo':
print(file.upper(), 'TO YOU - You have been punk\'d!')
else:
print('Error: file', file, 'no found')
quit()
count = 0
totValue = 0
for lines in fileHandle:
lines = lin... | true |
1d25a17421d9fd3092579a5d38ef0376b7195232 | XiangyuDing/Beginning-Python | /Beginning/python3_cookbook/ch02/06-ignorecase.py | UTF-8 | 601 | 4 | 4 | [
"MIT"
] | permissive | # 2.6 字符串忽略大小写的搜索替换
import re
text = 'UPPER PYTHON, lower python, Mixed Python'
print(re.findall('python', text, flags=re.IGNORECASE))
print(re.sub('python','snake',text, flags=re.IGNORECASE))
def matchcase(word):
def replace(m):
text = m.group()
if text.isupper():
return word.upper()
... | true |
c6428050ac41424a4f4f9cac7eed5b0121dfc216 | fvictorio/project-euler | /080/problem_080.py | UTF-8 | 353 | 2.984375 | 3 | [] | no_license | from decimal import getcontext, Decimal
getcontext().prec = 102
exponent = Decimal('0.5')
total = 0
numbers = range(1,101)
for i in range(1, 11):
numbers.remove(i**2)
for i in numbers:
a = Decimal(i)**exponent
sa = str(a)
point = sa.index('.')
suma = sum(int(i) for i in sa[0:point] + sa[point+1:-2... | true |
8f76df6cb1aedd03abb265f52839915f2c49ad77 | Ulvrun/mimidoro | /lib/timer.py | UTF-8 | 290 | 2.765625 | 3 | [] | no_license | import time
class Timer:
def __init__(self):
self.timer_attribute = 'I have no idea what should be here'
def start_timer(self):
start_time = time.time()
return start_time
def stop_timer(self):
stop_time = time.time()
return stop_time | true |
1de74fa65397367c04ca552a8bb3e69082e9b363 | euske/derpyolo | /validate.py | UTF-8 | 2,752 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
##
## validate.py - Mini YOLO validator.
##
## usage:
## $ ./validate.py -i ./yolo_net.pt ./COCO/train.zip ./COCO/instances.json
##
import sys
import torch
import logging
from torch.utils.data import DataLoader
from categories import CATEGORIES
from model import YOLONet
from detect import ini... | true |
240fadf552ee8e4cacbd8fdb3fdce7c0311b7b8a | boulidad/pg_lambda | /util.py | UTF-8 | 748 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
import psycopg2
db_host = "<RDS HOSTNAME>"
db_port = 5432
db_name = "postgres"
db_user = "dba"
db_pass = "ThisIsEmpty"
db_table = "pg_stat_activity"
def make_conn():
conn = None
try:
conn = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s'" % (db_name, db_user, db_hos... | true |
45bd19f9f007a5733a1cd448208bbf0f64e893a9 | xianGuiye/AtCoder | /AtCoder_Beginner_Contest/124/c.py | UTF-8 | 466 | 3.546875 | 4 | [
"MIT"
] | permissive | str = input()
S = list(str)
N = len(S)
count = 0
#10101...か01010...の2パターンあるが,ここでは01010...とするように考える
for x in range(N):
if x % 2 == 0 and S[x] == "0":
count += 1
elif x % 2 == 1 and S[x] == "1":
count += 1
#上記の2パターンは全てのタイルを入れ替えることで片方のパターンに塗り替えることができる
if count > N / 2:
print(N - count)
else:
... | true |
0cfd26d902ac4048cc8ec04b626f1cd8d6a9ea94 | sebastien-bratieres/pygpstruct | /src/prepare_from_data.py | UTF-8 | 4,536 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
"""
dataset object fields:
- N: number of objects (images, sentences) in dataset
- n_labels: number of possible labels for each atom in an object
- object_size[n]: how many atoms (eg pixels or words) in object n ?
- n_points : object_size.sum(), # atoms in the entire data set
- X: X data (might be sp... | true |
0dd30849d0a6a834f498a161d36bc7dd48d7f35d | maks-a/batterym | /batterym/observable.py | UTF-8 | 2,710 | 3.390625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
import unittest
class Observable(object):
def __init__(self):
self.callbacks = []
def register_callback(self, callback):
if not callback in self.callbacks:
self.callbacks.append(callback)
def unregister_callback(self, callback):
if callback in self.... | true |