blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cd07e67058136e0e517527a88b03e4e5c154bac6 | Python | echolabstech/python | /queue.py | UTF-8 | 170 | 2.671875 | 3 | [] | no_license | # Major Sapp III 02/13/2017
import array
if __name__ == "__main__":
array = []
print("before:",array)
array.append("foo")
array.append("bar")
print("after:",array)
| true |
fe0b98e9e37c5ec075a1123d7eac2fa794500573 | Python | bryanpilatuna/examen2016B-4 | /ProyectoFinal.py | UTF-8 | 5,530 | 3.34375 | 3 | [] | no_license | #ESCUELA POLITECNICA NACIONAL
#ESCUELA DE FORMACION DE TECNOLOGOS
#PROGRAMACION AVANZADA
#EXAMEN BIMESTRAL
#FECHA:07-12-2016
import sys
from time import time
## Datos globales
nombre1 = "Josue Cando "
nombre2= "Bryan Pilatuña "
nombre3 ="Lizeth Toasa "
nombre4="Edison Chulde "
nombre5 = "Katherine Montoya"
inte1 ... | true |
55bcbe6880eb6eaf9a1bfdc9d8fcb4de3cb7b9e3 | Python | jamesdterry/FirstPiGame | /play_scene.py | UTF-8 | 3,870 | 2.765625 | 3 | [] | no_license | #
# Main Game Scene
#
import pygame
import random
from screen import Screen
from sprite import Sprite
from scene import Scene
import over_scene
SPAWNBUG = pygame.USEREVENT + 1
MAX_BUGS = 5
GAME_LENGTH = 20
class play_scene(Scene):
eraser_sprite = None
bug_sprites = []
down_pressed = False
up_press... | true |
07d64b4e64c08bd0edc6716aa27682bcabaffb62 | Python | LukeFarrell/Genetic-Learning-Algs | /Species.py | UTF-8 | 3,901 | 3 | 3 | [] | no_license | '''
Created on Jun 24, 2016
@author: Jake
'''
from Gene import Gene
import random
class Species(object):
inputs={}
genes={}
out=0
leftThresh=0
rightThresh=0
shareFactor=0
inputList={}
startPriceList={}
endPriceList={}
MUTATION_RATE=5
#gene is of form Gene(inputs,left,right,... | true |
e285b8c645d61b11b31c7a16a8ec8a94e68f2291 | Python | Aasthaengg/IBMdataset | /Python_codes/p03145/s240425638.py | UTF-8 | 78 | 2.703125 | 3 | [] | no_license | S_list = list(map(int,input().split()))
print(int(S_list[0] * S_list[1] / 2))
| true |
10477f83fa648cfafbf1a1a94d829761eb508548 | Python | 17020940/multimedia-homework | /bai1/bai1.py | UTF-8 | 786 | 3.0625 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
# cac thong so cho truoc
f= 5 # tan so
fs =80000 # tan solay mau
N = 5 # so chu ki ve
A = 2 # bien do
n= 10 # 1 gia tri nguyen
# Get x values of the sine wave
x = np.arange(0,N/f,1/fs)
i = 0
y = A*np.sin(2*np.pi*f*x)
z = 0
while (i< 2*n +1) :
z+= A/( (2*i+1... | true |
53fe093c6ba42538bd4956f428eb7a77abb69ef4 | Python | ColtonDever/BubbleSort | /bubble.py | UTF-8 | 261 | 3.359375 | 3 | [] | no_license | array = [5,2,12,14,23,9,1,0,2]
for i in range(len(array)-1,0,-1):
for i in range(i):
if array[i]>array[i+1]:
b = array[i]
array[i] = array[i+1]
array[i+1] = b
print(array)
print("Sorted Array: ",array) | true |
4740447ec61305fcaf932e78fb93167ccbded43f | Python | tonydavidx/Python-Crash-Course | /bithday.py | UTF-8 | 68 | 2.78125 | 3 | [] | no_license | age = 23
message = "Happy " + str(age) + "rd Bithday"
print(message) | true |
0f7cc50a369909242e3c2303457bb784adc9a590 | Python | sharkbound/Python-Projects | /pygameapps/pygame_cursor_tracking/game.py | UTF-8 | 1,451 | 3.03125 | 3 | [] | no_license | import pygame
from pygame import display, draw, math as pmath, QUIT, KEYDOWN, KEYUP, MOUSEMOTION, MOUSEBUTTONDOWN, MOUSEBUTTONUP
from pygame.math import Vector2
from data.colors import Colors
screen_size = (600, 600)
game = pygame.init()
screen = display.set_mode(screen_size)
clock = pygame.time.Clock()
def vector... | true |
1c9bfe37b2cdff2b78cb5a2ffb6379c8ab160c7e | Python | toohong5/algorithm | /190905/pascal.py | UTF-8 | 459 | 3.109375 | 3 | [] | no_license | import sys
sys.stdin = open('input1.txt', 'r')
T = int(input())
for tc in range(1, T + 1):
N = int(input())
arr = [[0] * N for _ in range(N)]
arr[0][0] = 1
for i in range(1, N):
for j in range(1, N):
arr[j][0] = 1
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j]
print(... | true |
d647907d63f825b09d86d31f4cedf712815bb0b0 | Python | fdrozdowski/coffee-tracker | /weight_translator_test.py | UTF-8 | 1,077 | 2.890625 | 3 | [] | no_license | import unittest
from weight_translator import CoffeeWeightToStatusTranslator
class TestWeightTranslator(unittest.TestCase):
translator = CoffeeWeightToStatusTranslator()
max_weight = translator.MAX_COFFEE_MAKER_WEIGHT
min_weight = translator.MIN_COFFEE_MAKER_WEIGHT
diff = max_weight - min_weight
... | true |
4b4edcd55a46433450d1cd1073872d6e1c4b82d1 | Python | yalcinkilic/Euler_Project | /Problem0085.py | UTF-8 | 489 | 3.296875 | 3 | [] | no_license | import math
diff = 1000000007
closeA = 0
closeB = 0
for a in range(1,2001):
upperbound = math.ceil(math.sqrt(8000000/(math.pow(a,2))))
for b in range(upperbound, 1, -1):
numOfGrids = (b+1)*(a+1)*a*b
if abs(numOfGrids - 8000000) < diff:
closeA = a
closeB = b
diff = abs(numOfGrids - 8000000)
if numOfGri... | true |
4eae301cb38c5300d6ef802a967907003f4e4371 | Python | shotz19/Code | /challenge1.py | UTF-8 | 433 | 4.28125 | 4 | [] | no_license | #https://www.programiz.com/python-programming/methods/list/sort
#Create a list of 15 random numbers from 0-100. Ask the user for one input from 0-100. Append this input to the list. Sort the list into descending order.
import random
g=[]
for x in range(15):
g.append(random.randint(1,100))
... | true |
cf2bbc2d306adbecace0a071e3d4c94829bd9434 | Python | 15ma1a0454/ANISETTY.TRIVENI | /fifteen.py | UTF-8 | 104 | 3.203125 | 3 | [] | no_license | t=int(input())
r=int(input())
for num in range(t+1,r):
if num%2==0:
print num
num=num+1
| true |
022d5617c6c204cca48d50760f73d7947bc3ea0a | Python | harsh1915/Machine_Learning | /Python/02_Practice_Programce/01_Basic_Programs/15_Sum_of_Cube.py | UTF-8 | 191 | 3.875 | 4 | [] | no_license | num= int(input("Enter any number = "))
ls= [i** 3 for i in range(1,num+1)]
print(ls)
total= 0
for i in ls:
total+= i
print(total, end=", ")
print(f"Sum of squares of {num} = {total}") | true |
6fa6f1d0bea6dbeab533a84ec41c226f675dd8d6 | Python | LexxXell/d2e_basic | /plugins/e2k.py | UTF-8 | 2,682 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# By Lexx Xell 2019
import time
import ctypes
from sys import argv
key_code = 0x0
key_presses_amount = 0
data_is_correct = False
# =========== БЛОК ИМИТАЦИИ НАЖАТИЯ КЛАВИШ ==============
SendInput = ctypes.windll.user32.SendInput
PUL = ctypes.POINT... | true |
d16ae21e7494158e0e6011cd29fef072c56a2698 | Python | Nurmaa/Python | /Lab3.py | UTF-8 | 490 | 2.6875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
html = requests.get("https://www.tomsk.kp.ru/").text
soup = BeautifulSoup(html, "html.parser")
kek = []
for i in soup.find_all("div", "txt"):
title = []
desc = []
for titles in i.find_all("div", "digestTitle"):
title = titles.get_text()
for descr... | true |
85afd72b146e04b14b0915282b11f85b8dab5935 | Python | HaythemLazaar/ProjectEuler_solutions | /Problem6_solution.py | UTF-8 | 118 | 3.609375 | 4 | [] | no_license | #Sum square difference
sum = 0
sum1 = 0
for i in range(101):
sum += i*i
sum1 += i
print((sum1*sum1)-sum) | true |
3c2a4a6549307ffd45aa4ab52eb801dafcb0b20d | Python | bzzeke/camera | /app/cleanup.py | UTF-8 | 2,224 | 2.609375 | 3 | [] | no_license | import os
import re
import time
from threading import Thread
from os.path import join, getsize
from pathlib import Path
from util import log
from api.clips import Clips
from models.config import config
class Cleanup(Thread):
current_size = 0
max_size = 0
api = None
period = 5 * 60 * 60 # seconds
... | true |
18c58ecea7e3ae8600224641fc3501f68af553bc | Python | mathildebadoual/energym | /tests/test_energy_market_env.py | UTF-8 | 1,201 | 2.53125 | 3 | [
"MIT"
] | permissive | import numpy as np
import unittest
import gym
import energym
import datetime
from contextlib import contextmanager
from energym.envs.grid_scale.utils import OptimizationException
class TestEnergyMarketEnv(unittest.TestCase):
def setUp(self):
self.env = gym.make('energy_market-v0')
def test_as_gym_env... | true |
a6c166088d8f4bdccc6e05b2eb87d233ae44084b | Python | saiergong5243/-Group-Project-Paper-Reproduction-Residual-Atention-Network-for-Image-Classification | /utils/preprocess.py | UTF-8 | 1,131 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
# CIFAR
# padding and random crop
def CIFAR_preprocess(image):
# padding
pad_image = np.zeros([40, 40, 3])
pad_image[4:36, 4:36] = image
# Random crop
crop_image = tf.image... | true |
d70a6c2bba5590bf573a85fb6c0e819840043c10 | Python | alxbu/hhu-cs | /CV/project-2/render.py | UTF-8 | 5,585 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
from collections import namedtuple
from PIL import Image, ImageDraw
from functools import reduce
import json
import sys
import os
import numpy as np
import itertools
class Shape:
def __init__(self, points, edges, surfaces):
self.points = points
self.edges = edges
s... | true |
48381c9e2e98b491c0e85fd33662663935a10ef0 | Python | pbmiddendorf/drone_code | /utils/server.py | UTF-8 | 857 | 2.5625 | 3 | [] | no_license | #server.py
import sys
import socket
import os
host = ''
skServer = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
skServer.bind((host,8085))
skServer.listen(10)
print "Server Active"
bFileFound = 0
while True:
Content,Address = skServer.accept()
print Address
sFileName = Content.recv(1024)
for fil... | true |
9cdce0842a7b5cc8c0457571346bb09c074f0df5 | Python | rasand18/python_exercise | /minaövningar/exercise1/loadingbar.py | UTF-8 | 466 | 2.8125 | 3 | [] | no_license | import time
print("| |",end="\r")
time.sleep(1)
print("|=> |",end="\r")
time.sleep(1)
print("|==> |",end="\r")
time.sleep(1)
print("|===> |",end="\r")
time.sleep(1)
print("|====> |",end="\r")
time.sleep(1)
print("|=====> |",end="\r")
time.sleep(1)
print("|======> |",end="\r")
time.s... | true |
376c49bf6cf17c696c32c87027332a05a8c628da | Python | holoviz/panel | /panel/tests/layout/test_accordion.py | UTF-8 | 5,201 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
from bokeh.models import Column as BkColumn, Div
import panel as pn
from panel.layout import Accordion
from panel.models import Card
@pytest.fixture
def accordion(document, comm):
"""Set up a accordion instance"""
div1, div2 = Div(), Div()
return Accordion(('Tab1', div1), ('Tab2', div2))... | true |
890721b54eab80cb9ddea5a2d3a93358c03d295b | Python | Jonathan-aguilar/DAS_Sistemas | /Ago-Dic-2019/Ejemplos/APIs/http-requests.py | UTF-8 | 256 | 2.765625 | 3 | [
"MIT"
] | permissive | import requests
# https://requests.readthedocs.io/en/master/
# https://github.com/psf/requests/
r = requests.get('https://jsonplaceholder.typicode.com/users')
print(r)
print(r.status_code)
print(r.headers)
print(r.encoding)
print(r.text)
print(r.json()) | true |
0a9b57693578e590be3d82f1839db4723eb491f7 | Python | Frannx1/IncrementalLearningProject | /trainers/lwf_sequential_train.py | UTF-8 | 3,816 | 2.75 | 3 | [] | no_license | import copy
import os
from datetime import datetime
from torch import nn
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from config import Config
from trainers.lwf_train import lwf_train_model
from trainers.train_once import test_model
def lwf_sequential_train(net, split_d... | true |
aa599d761aabcc6454a04661e20c3f6a1f4dc4ef | Python | tnks1/top-product | /app/services.py | UTF-8 | 622 | 3.40625 | 3 | [] | no_license |
from typing import List
from app.schemas import Product
async def get_highest_rated_product(products: List[Product]) -> Product:
""" basic algorothem to get the top rated product in a list. It first assigns the top product to the first elemnt in the list and then it compare that item to every other item in the l... | true |
2136ced5b18b483a8477a1a6cfec2d197924b018 | Python | HalliganHelper/HalliganHelper | /tas/tests/models/test_request.py | UTF-8 | 1,328 | 2.703125 | 3 | [] | no_license | import pytest
from django_dynamic_fixture import G
from django_dynamic_fixture.ddf import BadDataError
class TestRequest(object):
@pytest.mark.django_db
def test_request_string(self):
from tas.models import Request
request = G(Request)
assert str(request) == '{} - Comp {}'.format(
... | true |
48cb5d4d2cbcdc94fb0569364330774e5c604b73 | Python | javathought/learnPy | /src/main/python/mdf/spirale.py | UTF-8 | 696 | 3.171875 | 3 | [] | no_license | import sys
n = int(input())
t = [["="] * n for _ in range(n)]
#s = gbdh
s = 'h'
l = (n-1)//2
c = (n-1)//2
t[l][c] = '#'
sd = 0
for i in range(n-1):
for j in range(i):
if s == 'g' or s == 'd':
l += sd
if s == 'h' or s == 'b':
c += sd
t[c][l] = "#"
if s == 'h... | true |
0db958b860468927e703153c091e4338323ebec5 | Python | Lana1402/bcw5 | /Paper.py | UTF-8 | 1,590 | 3.53125 | 4 | [] | no_license | class Paper(object):
"""A new class Paper, python realization"""
__slots__ = ('__max_symbols', '__symbols', '__content')
def _validate_attr(self, value):
try:
if not isinstance(value, (int, str)):
raise TypeError
if isinstance(value, str... | true |
be0cf67041541b2e0fd48e08fe238d6ff155b55e | Python | MazinSaeed/HacktheHood1 | /test.py | UTF-8 | 270 | 3.21875 | 3 | [] | no_license | print("hello world")
print("testing")
name = "Lebron"
age = 35
salary = 37.44
plays_basketball = True
jersery_number = "23"
car_name = "Mercedes"
x = 50
print(type(name))
print(type(age))
print(type(salary))
print(type(plays_basketball))
print(type(jersery_number)) | true |
1c4dabd56004ea7c2451202b66bd37b5e39f82e1 | Python | NikitaPilipchuk/TP_Zadanie1 | /Zadanie1_4.py | UTF-8 | 300 | 3.265625 | 3 | [] | no_license | import random as r
def get_fraction(x):
if x >= 0:
result = x - int(x)
else:
result = (x - int(x))*-1
return result
numb_list = []
for _ in range(10):
numb_list.append(r.uniform(-100,100))
print(sorted(numb_list, key=lambda x: get_fraction(x)))
| true |
2962fc317ce56ea305d8bc228bf4e23a0136b957 | Python | nchemsak/tuples_basics | /zoo.py | UTF-8 | 834 | 5.09375 | 5 | [] | no_license | # Create a tuple named zoo that contains your favorite animals.
zoo = ("lions", "tigers", "bears")
print(zoo)
# Find one of your animals using the .index(value) method on the tuple.
zoo.index("tigers")
print(zoo.index("tigers"))
# Determine if an animal is in your tuple by using "for value in tuple"
for animal in zoo... | true |
adefc6df96d199b9c04b391698947247e7748634 | Python | fdrmrc/SDEs_Project | /codes/StochasticIntegrators.py | UTF-8 | 5,635 | 2.59375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import sys
class Integrators_LSO:
def __init__(self, met_name,dt,y0,T,**kwargs):
self.met_name = met_name #just a string
self.dt = dt
self.y0 = y0
self.alpha = kwargs.get('alpha') #parameter in the stoch. oscillator equation
... | true |
76dab3fc535e62c167fad1b23acab581ac626c4b | Python | kevokvr/PythonPractice | /Assignment4/Assignment4.py | UTF-8 | 4,163 | 3.984375 | 4 | [] | no_license | import unittest
'''
'''
class binary_search_tree:
def __init__ (self, init=None):
self.__value = self.__left = self.__right = None
if init:
for i in init:
self.add(i)
def __iter__(self):
if self.__left:
for node in self.__left:
... | true |
a97a8af1a67fb03a4180803675e5d06d883ffb8f | Python | didwns7347/algotest | /알고리즘문제/15654 n and m.py | UTF-8 | 266 | 3.09375 | 3 | [] | no_license | from itertools import combinations
from itertools import permutations
n,m=map(int,input().split())
numlist=[x for x in range(1,n+1)]
numlist.sort()
out=list(combinations(numlist,m))
for x in range(len(out)):
for y in out[x]:
print(y,end=" ")
print()
| true |
36783f3f4ab27539babf182d0d14bff77e9622c5 | Python | brunobeltran/bruno_util | /bruno_util/math.py | UTF-8 | 5,211 | 3.109375 | 3 | [
"MIT"
] | permissive | import numpy as np
def center_by_mass(x, particle_axis=0):
"""Subtract center of mass (unweighted) from a collection of vectors
corresponding to particles's coordinates."""
shape = x.shape
# center of mass is the average position of the particles, so average over
# the particles
centers_of_mas... | true |
cda6172f1fb90686d4b00d7373fdb0347e065892 | Python | Proxian/Cyberstorm_Mayan | /Programs/XORCrypto/xor_Markham.py | UTF-8 | 1,550 | 3.953125 | 4 | [] | no_license | ##############################################################################
# #
# Team: Mayans #
# Names: Dawson Markham #
# Date: 5/1/2019 #
# #
# Description: Program takes user input performs an XOR operation using a #
# file listed as 'key'. ... | true |
8483978f6d9c223c6026f243642d37dd4ccbc4e8 | Python | liuyuan0627/LeetCode | /python/278_First_Bad_Version.py | UTF-8 | 1,087 | 3.640625 | 4 | [] | no_license | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
# solution 1
l = 1
r = n
whil... | true |
a86d53fd8a9af30dd299f63afaf961c88982e1d2 | Python | error404csp/weather | /minilabs/nolan/testpage.py | UTF-8 | 2,165 | 3.375 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
from minilabs.nolan import nolan_bp
#code from mr. m's fibonnaci thing
class Fibonacci:
#Initializer of class takes series parameter and returns Class Objectg
def __init__(self, series):
#Built in validation and exception
if series < 2 ... | true |
bfd7ee5fdd843dd99f97ec4ff229e37c7cb63441 | Python | Dawnlnz/data-structure-and-algorithm | /data_structure/Stack/stack.py | UTF-8 | 2,474 | 4.53125 | 5 | [] | no_license | ''''基于列表实现栈'''
class Stack(object):
def __init__(self):
# 列表实现栈
self.stack = []
def length(self):
'''获取栈的元素个数'''
return len(self.stack)
def is_empty(self):
'''判断栈是否为空;栈为空,返回True;栈不为空,返回False'''
return self.length() == 0
def push(self, data):
... | true |
4e2ec382faa28f7952cea7ff53ce0caef58a7dcb | Python | nirvanaxuan001/weixin_service4steaminfo | /funcIf4weixin.py | UTF-8 | 5,025 | 2.53125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import xml.etree.ElementTree as ET
import timeHelper
import re
import requests
import json
RESPONSE_TEXT_TEMPLATE = '''
<xml>
<ToUserName><![CDATA[{TO_USER}]]></ToUserName>
<FromUserName><![CDATA[{FROM_USER}]]></FromUserName>
<CreateTime>{TIME_STEMP}</CreateTime>
<MsgType><![CDATA[text]]></MsgT... | true |
c85fec74b13b6744b17e4006632f895f8f0af689 | Python | saotian/p1804 | /eryueyizhou/gou.py | UTF-8 | 306 | 3.296875 | 3 | [] | no_license | class Dog(object):
def wan(self):
return "普通小狗玩泥巴"
class xiaotianquan(Dog):
def wan(self):
return "哮天犬在天上玩泥巴"
class People(object):
def play_with(self,dog):
print("人在和",dog.wan())
a = Dog()
xtq = xiaotianquan()
b = People()
b.play_with(a)
b.play_with(xtq)
| true |
c14caa25c3ab8cc3c3fb595557682edf1a3a20fc | Python | Vaishnavi0522/pythontraining | /connnn.py | UTF-8 | 107 | 3.078125 | 3 | [] | no_license | d="vaishu"
for letter in d:
if letter=='s':
continue
print ('current letter:',letter)
| true |
d6b1b239313c628030641d1dc18284750778eb86 | Python | olivierh59500/multilabel-clustering-audio | /interface/create_spectrograms.py | UTF-8 | 1,866 | 2.53125 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | import os
import librosa
import matplotlib.pyplot as plt
import glob
import numpy as np
import librosa.display
import matplotlib.ticker as ticker
def create_spectrogram(recording_group_dir, filename, spectrogram_dir, sr, amin=1e-4):
"""
* Calculates spectrogram and add those to an image `<group_id>... | true |
32013d0735cd1023e1041d356029df214eea3ad6 | Python | markpp/Thermal-Activity-Surveillance-System-TASS | /data processing/detection/detect.py | UTF-8 | 9,318 | 2.625 | 3 | [] | no_license | import numpy as np
import cv2
import csv
import time
import tools
import presentation
import detection
import tracking
import persons
# Process frames continously or step through
def detect_hog(frames_dir, start_frame, frame_list):
"""runs detector and prints the properties of each detection to file.
"""
... | true |
a2dbde37397653dd3c76365ab35aa4e7a4c00d02 | Python | Summer-Ronin/Python-Fundamentals-for-Django | /Level_One/Exercises/functions.py | UTF-8 | 4,630 | 4.78125 | 5 | [
"MIT"
] | permissive | #####################################
#### PART 9: FUNCTION EXERCISES #####
#####################################
# Complete the tasks below by writing functions! Keep in mind, these can be
# really tough, its all about breaking the problem down into smaller, logical
# steps. If you get stuck, don't feel bad about ha... | true |
c36cb502134387e809c1f87c7a9df75d6a79904e | Python | dengl11/Leetcode | /problems/add_to_array-form_of_integer/solution.py | UTF-8 | 437 | 2.609375 | 3 | [] | no_license | class Solution:
def addToArrayForm(self, A: List[int], K: int) -> List[int]:
carry = 0
ans = []
for i in range(len(A)-1, -1, -1):
K, curr = divmod(K, 10)
curr += carry + A[i]
carry, curr = divmod(curr, 10)
ans.append(curr)
K += carry
... | true |
000e29c5bccadd9efb88ef7431186e53b6e24d88 | Python | postman-open-technologies/Unbreakable-API-Py | /server/common/db_connect.py | UTF-8 | 1,680 | 3.015625 | 3 | [
"MIT"
] | permissive | import mysql.connector
import os
def sql_connect():
'''Connect to the MySQL database using credentials from class properties.
Returns:
MySQLConnection: The return value. Object to perform MySQL actions on.
'''
return mysql.connector.connect(
host=os.environ['DB_HOST'],
user=os... | true |
ce1ca9b819143c43b7c15ec09f6cd8ef74fddc72 | Python | Aasthaengg/IBMdataset | /Python_codes/p03575/s907941007.py | UTF-8 | 784 | 2.578125 | 3 | [] | no_license | from collections import deque
def main():
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
L = []
for _ in range(m):
a, b = list(map(lambda x: int(x) - 1, input().split()))
G[a].append(b)
G[b].append(a)
L.append(set([a, b]))
ans = 0
for l in L:
... | true |
b3e7e0c456b279cacd046bb15dfecaf6eecead1d | Python | IyLias/algorithm-solutions | /Q2668.py | UTF-8 | 894 | 3.390625 | 3 | [] | no_license | # Q2668 number selection
N = int(input())
number_table = []
number_table.append(0)
selected_numberlist = []
total_selected_number = 0
for i in range(0,N):
number = int(input())
number_table.append(number)
for i in range(1,N+1):
# dfs()
next_node = i
current_node = i
visited = []
in_loop = False
while Tru... | true |
255e4f9d321aeaeafc1044311aa4c7209cb14b7d | Python | Aasthaengg/IBMdataset | /Python_codes/p03170/s894537470.py | UTF-8 | 268 | 2.78125 | 3 | [] | no_license | N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = [0 for _ in range(K+1)]
for i in range(K+1):
for j in range(N):
if i-A[j] >= 0:
dp[i] |= not dp[i-A[j]]
if dp[K]:
print('First')
else:
print('Second') | true |
51cc200c99e6f1b94673a9a36bdc3c5a02fb40b1 | Python | liulimin90/Python_Practice | /Palindrome.py | UTF-8 | 291 | 3.609375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# creating a palindrome(回数)
def _is_palindrome(n):
s = str(n)
for i in range(len(s)):
if s[i] == s[-i-1]:
pass
else:
return False
return True
output = filter(_is_palindrome, range(1, 10000))
print(list(output)) | true |
7f8b3f6c9970216666e1d0cffc5221d06b5f1b36 | Python | viad00/uts_march_2016_py | /16.3.16/F.py | UTF-8 | 520 | 2.984375 | 3 | [] | no_license | import sys
sys.stdin = open('wave.in', 'r')
sys.stdout = open('wave.out', 'w')
n, m, start = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
x, y = map(int, input().split())
g[y - 1].append(x)
g[x - 1].append(y)
visited = set()
Q = []
BFS = []
def bfs(v):
if v in visited:
... | true |
7bc1fc1785bd7bf243b831378fa643e264586620 | Python | filecoin-project/consensus | /code/vrf-chain-sim/find_pattern.py | UTF-8 | 3,856 | 2.875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import numpy as np
import time
from math import floor
import multiprocessing as mp
import scipy.special
#Initialize parameters
Num_of_sim_per_proc = 1
start_time = time.time()
e = 5.
alpha = 0.33
ntot = 100
na = int(ntot*alpha)
nh = ntot - na
height = 5 #height of the attack
p=float(e)/float(1*ntot)
unrealistic = 0 #d... | true |
01a3a84133bf6be2faab2c1a871b72f3f5b85f01 | Python | skytreader/yestivator | /yestivator.py | UTF-8 | 1,268 | 2.546875 | 3 | [] | no_license | import json
import logging
import pynotify
import random
import sys
import time
sys.path.append("./python-daemon")
from daemon import Daemon
logging.basicConfig(filename="yestivator.log")
logger = logging.getLogger("yes")
logger.setLevel(logging.INFO)
class QuoteSource(object):
"""
Hard-coded quote source.
... | true |
36d5a8c42b781b9f9117cd86dbe6e170e1e97779 | Python | BodenmillerGroup/pycytools | /pycytools/library.py | UTF-8 | 21,045 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Contains various functions for image processing
@author: vitoz
"""
from __future__ import division
import json
import os
import numpy as np
import pandas as pd
import requests
import scipy as sp
import skimage as sk
import tifffile
import tifffile as tif
from scipy import ndimage as ndi
... | true |
0d49a6f6941c26f0aaf95a8ef8e89c23f0286bf8 | Python | idanash123/FaceRecognition | /face/compare_2_photos.py | UTF-8 | 2,388 | 3.171875 | 3 | [] | no_license | # import the necessary packages
from skimage.measure import structural_similarity as ssim
import matplotlib.pyplot as plt
import numpy as np
import cv2
import time,os
def mse(imageA, imageB):
# the 'Mean Squared Errr' between the two images is the
# sum of the squared difference between the two images;
# NOTE: the t... | true |
39e4f4128d29d3e8412568e4a856e4f1818c03af | Python | embg/python-fast-listsort | /crawler/crawl.py | UTF-8 | 2,029 | 2.6875 | 3 | [] | no_license | import sys
assert(sys.version_info >= (3,5))
import re
from requests import get
import subprocess
def run(s):
return subprocess.run(s,
shell=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
directory = open('list.html').r... | true |
ce8e3e4b21330466e2ca79d3e26be68a3ebd2fdc | Python | JulyBelost/watermark-remover | /src/preprocess.py | UTF-8 | 1,139 | 2.984375 | 3 | [] | no_license | import os
import sys
import cv2
import numpy as np
from matplotlib import pyplot as plt
def plot_images(images, bgr=True):
for img in images:
img_res = img[:, :, ::-1] if bgr else img
plt.figure(dpi=300)
plt.imshow(img_res)
plt.xticks([]), plt.yticks([])
plt.show()
def re... | true |
4e57ac706f2fd338a798a7e81d35123ec1209b6c | Python | Hem1700/python-codes | /dictcount1.py | UTF-8 | 212 | 3.765625 | 4 | [] | no_license | str = input("Enter a string :")
str = str.lower()
dict = {}
for i in str:
if i not in dict:
dict[i] = 0
dict[i]+=1
print(dict)
count =0
for k,v in dict.items():
count = count+v
print(count)
| true |
0673dac91f6eeb2ecb41dbe92aa19afe99f75a69 | Python | Liz0916/jdata-2019-1st | /code/cate_shop_feature.py | UTF-8 | 6,975 | 2.515625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from datetime import datetime, date, timedelta
import os
from config import feature_path, base_file_path
from functools import partial
from sklearn.preprocessing import minmax_scale
from tools import reduce_mem_usage
merge_feature = partial(pd.merge, on=['cate', "shop_id"], how=... | true |
34d1ba60c92791b60a23c3ad8f02cb4d9f51e181 | Python | MoCuishle28/python-practice | /chapter04/bisect_test.py | UTF-8 | 786 | 4.28125 | 4 | [] | no_license | import bisect
"""处理已排序序列"""
# 二分查找
inter_list = []
bisect.insort(inter_list, 3)
bisect.insort(inter_list, 2)
bisect.insort(inter_list, 5)
bisect.insort(inter_list, 1)
bisect.insort(inter_list, 6)
# 以这种方式插入 维护一个增序的序列
print(inter_list)
print(bisect.bisect(inter_list, 3)) # 返回应该插入的位置
print(bisect.bisect_left(inter_list... | true |
211e617b08bbbf026b65ace9b91a154d844378c2 | Python | SEBv15/pycertifspec | /pycertifspec/EventTypes.py | UTF-8 | 2,619 | 2.578125 | 3 | [] | no_license | class EventTypes:
"""All possible SpecMessage cmd types"""
SV_CLOSE = 1
"""Can be sent by the client to terminate a connection, allowing the server to release resources. Resources will be released in any case, if the server loses the connection to the client."""
SV_ABORT = 2
"""Sent by the clie... | true |
25c3898cfaafa416c3a296299949486ecd1b8be3 | Python | saadshamim01/udacity-meme-generator | /quoteengine/quote_model.py | UTF-8 | 443 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python3
"""QuoteModel to represent encapsulate body and author."""
class QuoteModel:
"""QuoteModel to represent encapsulate body and author."""
def __init__(self, body="", author=""):
"""Accept body and author."""
self.body = body
self.author = author
def __repr__... | true |
3f48dd09b0a4665ca04f4f96ae1e556d5c3bfdb5 | Python | nrohr/whatsnew-06-2020 | /get_data.py | UTF-8 | 372 | 2.78125 | 3 | [] | no_license | import pandas as pd
# Read our ETF data from a CSV file
stocks = pd.read_csv('https://colorado.rstudio.com/rsc/content/1255')
stocks.head()
# Calculate rolling averages for SPY
stocks.index = pd.to_datetime(stocks['date'], format='%Y-%m-%d')
spy = stocks.loc[:,'SPY']
short_rolling_spy = spy.rolling(window=20).mean(... | true |
df72f87279710d727bb81c3aff742a5557df3c85 | Python | jankomuzykant19/fifteen_solver | /node.py | UTF-8 | 6,068 | 3.40625 | 3 | [] | no_license | import time
solved = [['1', '2', '3', '4'], ['5', '6', '7', '8'], ['9', '10', '11', '12'], ['13', '14', '15', '0']]
empty_field = {}
# Klasa węzeł
class node:
def __init__(self, current_board, parent, last_move, way, order):
self.board = current_board # Do zmiennej tablca przypisujemy obecny wygląd tab... | true |
8fe4efcf1aacce634af0df239312f91aaf9ac25f | Python | mmassom96/Computer_Vision_Utilities | /mp4_to_jpg.py | UTF-8 | 2,218 | 3.4375 | 3 | [] | no_license | # Matthew Massom
# github.com/mmassom96
# mp4_to_jpg.py
# October 2, 2019
#
# This program was written to convert a .MP4 video file into .jpg image files of
# each individual frame of the video. The purpose of this program is to prepare
# images from a video that can then be annotated for training in a YOLOv3 object
# ... | true |
b0cb39225c9bcf5925b72e9c5f0b3a267983a2be | Python | julianpistorius/python-webdev-presentation | /cgi_root/cgi-bin/11_hello.py | UTF-8 | 460 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
import cgi
form = cgi.FieldStorage()
user_name = form.getvalue('name', 'Anonymous')
template_values = {'user_name': user_name}
print "Content-Type: text/html"
print
print """\
<html>
<body>
<h2>Hello {user_name}!</h2>
<form method="post">
What is your name?
... | true |
8e8c975ba26f68eaea40b9c7e3a7983261e536e9 | Python | jcchan23/Python-Learning | /Chapter_8/8.2 favorite_books.py | UTF-8 | 124 | 3.140625 | 3 | [] | no_license | def favorite_book(book_title):
print("One of my favorite books is " + book_title)
favorite_book('Alice in Wonderland')
| true |
6a6a43abbfb41baa3aba03af351bc34e5d5f96d1 | Python | jeffs5/WerewolfTag | /WerewolfTagClient.py | UTF-8 | 1,896 | 2.859375 | 3 | [] | no_license | import pygame
import GameState
from Game import Game
'''
Created on Nov 10, 2014
@author: Jon, Angel
'''
class WerewolfTagClient:
game = None
window = None
display = pygame.display
event = pygame.event
mixer = pygame.mixer # for sound
frameRate = 60
screenWidth = 640
screenHeight... | true |
38daf9ab8d8bb85023bc6388e512072e316a1758 | Python | LeoSaci/Routine-Bandits | /plot.py | UTF-8 | 5,500 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import matplotlib.font_manager
import pylab
import matplotlib as mpl
from scipy import stats
import os
q = stats.norm.ppf(0.975)
mpl.rcParams['font.size'] = 22
mpl.rcParams['font.serif'] = "Computer Modern Roman"
def plot_regret(time, regret, it, fig_name, policies,... | true |
7216db8b10d99934c93eb86a251ca1c1c1f70f07 | Python | vieirafrancisco/algorithms | /concurrent_programming/Threads/Semaphore/main.py | UTF-8 | 557 | 3.5 | 4 | [] | no_license | import threading
from ball import Ball
from player import Player
def name_generator(n, ball):
for idx in range(n):
yield ("Player " + str(idx+1), ball)
def main():
print("start the game!")
b = Ball()
n_players = 5
join_list = []
for player_status in name_generator(n_players,... | true |
0dc206efa16264390366dc0ed1891e161e030a9e | Python | realhum/server-usd-rate | /test_server.py | UTF-8 | 954 | 2.609375 | 3 | [] | no_license | from settings import ADDRESS, PORT, USD_TEST_RATE
from server import get_usd_rate
import requests
import unittest
class TestServer(unittest.TestCase):
def test_bad_request(self):
r = requests.get("http://{}:{}".format(ADDRESS, PORT),
json={'usd': -10})
self.asser... | true |
d31b2365bb07414f88bd3307ae0dc75f2ec2be0c | Python | rosoareslv/SED99 | /python/spaCy/2016/12/test_home.py | UTF-8 | 5,135 | 2.65625 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import pytest
import spacy
import os
try:
xrange
except NameError:
xrange = range
@pytest.fixture()
def token(doc):
return doc[0]
@pytest.mark.models
def test_load_resources_and_process_text():
from spacy.en import English
nlp = English()
doc = nlp(u... | true |
d4ca850af167e76133d0c12f66e59b113f88f448 | Python | IvayloSavov/Fundamentals | /my_final_exam_09.08.2020/3_2.py | UTF-8 | 1,867 | 3.109375 | 3 | [] | no_license | from statistics import mean
from _collections import defaultdict
plants_rarity = {}
plants_rating = defaultdict(list)
plants_average_rating = defaultdict(int)
n = int(input())
for _ in range(n):
information = input().split("<->")
plant = information[0]
rarity = int(information[1])
if plant not in pla... | true |
5cc25b33243cfabb04b40b8263bf1123e722429d | Python | GabeOchieng/ebola-predictor | /utils/add_var.py | UTF-8 | 1,877 | 2.96875 | 3 | [
"BSD-2-Clause"
] | permissive | """
Adds a new variable to the data, using the provided script
@copyright: The Broad Institute of MIT and Harvard 2015
"""
import sys, os, csv, argparse
from importlib import import_module
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", nargs=1, default=["./data/data.csv"],
... | true |
6b7851fc587b9cf814061ee2d4810e6cd2e4150c | Python | HafaroId/Credit_Card_Fraud_Detection | /model_tester.py | UTF-8 | 945 | 2.671875 | 3 | [] | no_license | import json
import requests
import pandas as pd
from sklearn.metrics import roc_auc_score, accuracy_score, confusion_matrix, f1_score
from settings.constants import TEST_CSV
from utils.data_preprocessor import DataLoader
# read test dataset
test = pd.read_csv(TEST_CSV, header=0)
# preprocess test dataset for predict... | true |
ebee2e71cab905fe1c7524906726e1893081bff1 | Python | umairkarel/Machine-Learning | /Projects/LogisticRegression/logic.py | UTF-8 | 508 | 2.921875 | 3 | [] | no_license | import numpy as np
def sigmoid(z):
return (1/(1+ np.exp(-z)))
def cost(h, y):
m = len(y)
J = (-1/m) * (y.T @ np.log(h) + (1-y).T @ np.log(1-h))
return J[0][0]
def fit(X, y, theta, iters=1000):
X = np.concatenate((np.ones((X.shape[0], 1)), X), axis=1)
m = len(y)
alpha = 0.01
cost_hist... | true |
69af57529735c0ef6845da5dab43c2179739dca9 | Python | BTFProdigy/DumpScripts | /shittyparser.py | UTF-8 | 398 | 2.625 | 3 | [] | no_license | #! -*- coding:utf-8- -*-
import re
import sys
from gzopen import gzopen
with gzopen(sys.argv[1]) as f:
for line in f:
shit,score = line.rstrip('\n').split('\t')
if int(score) < 11: continue
pair = re.sub("[')(]", '', shit).replace(' ', '_').split(',_')
sys.stdout.write('%s (u) %s = %s\n' % ... | true |
bba80ca869e70506e51a3475b8ab6621e35e89a8 | Python | gistable/gistable | /all-gists/4689974/snippet.py | UTF-8 | 1,866 | 3.796875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Table(object):
def __init__(self, table):
self.row_len = len(table)
self.col_len = len(table[0])
self.table = table
def row(self, n):
return self.table[n]
def col(self, n):
return [self.table[i][n] for i in xran... | true |
8efeeea2a645c4d078b2edeadc09cfd2f7e6be88 | Python | Ascend/ModelZoo-PyTorch | /PyTorch/contrib/audio/speech-transformer/test/steps/overlap/get_overlap_segments.py | UTF-8 | 4,950 | 3.125 | 3 | [
"GPL-1.0-or-later",
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #! /usr/bin/env python3
# Copyright 2020 Desh Raj
# Apache 2.0.
"""This script takes an input RTTM and transforms it in a
particular way: all overlapping segments are re-labeled
as "overlap". This is useful for 2 cases:
1. By retaining just the overlap segments (grep overlap),
the resulting RTTM can be used to t... | true |
b091560f104c25ad8717424af1d80a5b00f33cb8 | Python | shylaharild/awsume | /awsume/awsumepy/lib/exceptions.py | UTF-8 | 1,916 | 2.6875 | 3 | [
"MIT"
] | permissive | class ProfileNotFoundError(Exception):
""""""
def __init__(self, profile_name='', message=''):
self.profile_name = profile_name
self.message = message
def __str__(self):
if self.message:
return self.message
return 'Profile {} not found.'.format(self.profile_name)
... | true |
40be4e86eae9d136b308b50e03462ca3f85e2cad | Python | jonathanlloyd/advent-of-code-2019 | /day-06/part_1.py | UTF-8 | 1,600 | 3.359375 | 3 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self._children = {}
def __repr__(self):
return str(self)
def __str__(self):
return f"<Node value={self.value}, children=[{','.join([child.value for child in self.children])}]>"
def add_child(self, child_node):
... | true |
6dbfaa2bdac2d44559734a8dca92f888dc703a46 | Python | ulamaca/DRLND_P3_MultiAgent_RL | /utils.py | UTF-8 | 350 | 3.234375 | 3 | [] | no_license | import random
# Misc
def random_color(choice=False):
"select the color code from "
lib=['r', 'b', 'g', 'k', 'y', 'c', 'm']
if isinstance(choice, int):
if choice<=6:
return lib[choice]
else:
raise ValueError("choice value should be less than/equal to 6")
else:
... | true |
8bc5f66b52e7e97e09d8d76cc8b3531a17a8c501 | Python | clarammdantas/statistics-helper | /helper.py | UTF-8 | 2,457 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
#Author: Maria Clara Moraes
from math import sqrt
#lx = [16 31 38 39 37 36 36 22 10]
#ly = [290 374 393 425 406 370 365 320 269]
def getRol(lx):
sortedLx = sorted(lx)
return sortedLx
def median(lx):
lx.sort()
n = len(lx)
medianX = -1
if n % 2 == 0:
medianX = (lx[(n-1) / 2] + lx[(n-1)... | true |
dfa6ba3b7b76f0741878a432e778eeb647985851 | Python | adcerros/dataStructuresAndAlgorithms | /grafos/problem2.py | UTF-8 | 4,708 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""Problem2-undirectedDisjktra.ipynb
#Problem 2 - Grafos
Sea Graph la implementación de un grafo dirigido no ponderado. Implementa una funcion, minimumPath, que reciba dos vértices start y end, y devuelve la lista que represente el camino mínimo entre start y end. Si start o end no existen, la... | true |
a473ccbf4b3177fbc40810b9c7e3122a527fad7e | Python | chandanpandit/python_tutorial | /tableapp.py | UTF-8 | 720 | 3.671875 | 4 | [] | no_license | from tkinter import *
from tkinter import messagebox
# prints table of given number
def update_table():
try:
number = int(entry.get())
for i in range(10):
line = str(number) + " X " + str(i + 1) + " = " + str(number * (i + 1))
table[i].set(line)
except ValueError:
... | true |
04c8414d4148b114d9a0339c2c9faf1a810e89d6 | Python | MrWormsy/polychess | /Evaluation_FEN.py | UTF-8 | 753 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Created on Mon Dec 10 09:35:35 2018
@authors: MrWormsy (AKA Antonin ROSA-MARTIN), Loick Combrie, Lucile Delage and David Petit
"""
''' permet d'évaluer à partir d'un FEN quelle équipe a le plus de chance de gagner '''
def evaluation (fen) :
liste_a_suppr=["1","2","3","4","5","6","7","8","/"]
for i in ran... | true |
a2a15e29a890ff9ce7d4a3c805def464b2c89bfe | Python | awerenne/multi-robot-mapping | /code/robot/tests/1-components/bluetooth/data/analysis_measures.py | UTF-8 | 1,958 | 2.78125 | 3 | [] | no_license | # import pandas as pd
# import matplotlib.pyplot as plt
# frequency_slave;arrival_time_step_master;seq_number
# data = pd.read_csv("measures_test_2.csv", sep=';')
# df = pd.DataFrame(data=data)
# min_frequency = df['frequency_slave'].min()
# min_time = df.loc[df['frequency_slave'] == min_frequency].value_counts() * 1... | true |
ae0c66053d983f89d27f41078f692816ba7943e3 | Python | mishakuzma/daily-programs | /223A-stringLetterRemover.py | UTF-8 | 392 | 4.03125 | 4 | [] | no_license | """ String remover. Consumes two strings, and produces a string where
letters from the second string are removed from the first string"""
def main():
originalIn1 = str(input("What is your first string? "))
originalIn2 = str(input("What is your second string? "))
newString = ""
for i in originalIn1:
if i in ori... | true |
99607feacfe46f1981d11d2278f83cf8d72efde2 | Python | Tejas1510/Pythonary | /CodeChef/CodeChef3.py | UTF-8 | 160 | 3.5625 | 4 | [] | no_license | test=int(input())
for i in range (0,test):
x=int(input())
if (x!=2 and x>0 and x!=1):
print(x**3-(x-2)**3)
else:
print(x**3)
| true |
3d023e33216d6d932ff4e9034702e1ae3588ec07 | Python | jackmoody11/iexfinance | /iexfinance/iexdata/base.py | UTF-8 | 11,239 | 2.765625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from datetime import datetime, timedelta
import pandas as pd
from iexfinance.base import _IEXBase
from iexfinance.utils import _handle_lists
# Data provided for free by IEX
# See https://iextrading.com/api-exhibit-a/ for additional information
# and conditions of use
class Market(_IEXBase):
"""
Base class ... | true |
368e78e4cc38caeb925a2896a5a2b3de331b4b80 | Python | CssBv/Challenge | /challenge1.py | UTF-8 | 1,749 | 3.828125 | 4 | [] | no_license | #Input of numberIndex of test cases
testCases = int(input())
#Input must be between 1 and 100.
if testCases >= 1 and testCases <= 100: #If condition is true then
repeat = 0 #Iterate each testCase without for loop.
results = []
while repeat < testCases:
#Ask for quantity of numbers contained in ... | true |
4e7d320b3c106d68561fb7148f660a4734472323 | Python | Woz4tetra/overhead_mobile_tracker | /src/odom_conversions.py | UTF-8 | 1,929 | 2.9375 | 3 | [] | no_license | import copy
import numpy as np
import tf.transformations as tr
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Quaternion
def odom_to_numpy(odom):
"""
Convert a nav_msgs/Odometry message into a 3 dimensional Numpy array
[x,y,theta].
We assume rotation is around body-fixed z-axis.
... | true |
f3a6ed59467117303dcba033ea89b5a55b7da423 | Python | charlesdaniels/litepkg | /litepkg/litepkg.py | UTF-8 | 7,015 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
import os
import sys
import subprocess
import argparse
import logging
import logger
import litepkg
import pkgutils
import imp
import re
import config
import tempfile
import shutil
def ensure_dir_exists(directory):
"""ensure_dir_exists
Make sure the directory exists, creating it if it d... | true |
5eec7cbd32da686f574af47a34f3e10a3441622a | Python | eheh5454/2017_2DGP | /Items.py | UTF-8 | 3,042 | 2.9375 | 3 | [] | no_license | from pico2d import *
import random
class Special_attack_item():
PIXEL_PER_METER = (10.0 / 0.2)
RUN_SPEED_KMPH = 15.0
RUN_SPEED_MPM = (RUN_SPEED_KMPH * 1000.0 / 60.0)
RUN_SPEED_MPS = (RUN_SPEED_MPM / 60.0)
RUN_SPEED_PPS = (RUN_SPEED_MPS * PIXEL_PER_METER)
TIME_PER_ACTION = 1.0
ACTION_PER_T... | true |
c359486b9d619c34b64888dc0905f9d6d08463b1 | Python | dpjmv/2d-gravity-pygame | /utils.py | UTF-8 | 1,217 | 3.0625 | 3 | [] | no_license | from fps import fps
import numpy as np
import pygame
def rndint(n):
return int(round(n))
def normalize(vector):
norm = float(np.linalg.norm(vector))
if norm > 0:
new_vec = np.array([vector[0] / norm, vector[1] / norm])
return new_vec
return np.array((0, 0))
def draw_vector(screen, ... | true |
54ca1a312a2a056156660e339d4e7f92e3a32b45 | Python | vBubbaa/justdnd-backend | /sheets/models.py | UTF-8 | 2,208 | 2.71875 | 3 | [] | no_license | from django.db import models
from django.utils.text import slugify
# A blank character sheet to create from scratch
class EmptyCharacterSheet(models.Model):
user = models.ForeignKey(
'authentication.CustomUser', on_delete=models.CASCADE, default=None)
name = models.CharField(blank=False, null=True, ma... | true |