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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3b42ac5534171999418bb0acec06d6b47705d2eb | Python | vegetablejuiceftw/sauron | /playground/shared_memory/generator.py | UTF-8 | 1,079 | 2.515625 | 3 | [
"MIT"
] | permissive | from time import time, sleep
import cv2 as cv
import SharedArray as sa
import numpy as np
cap = cv.VideoCapture(0)
# cap.set(cv.CAP_PROP_FPS, 29)
# cap.set(cv.CAP_PROP_FRAME_HEIGHT, 720)
# cap.set(cv.CAP_PROP_FRAME_WIDTH, 1280)
ret, frame = cap.read()
frame: np.ndarray
shape = frame.shape
dtype = frame.dtype
print(s... | true |
c59f38407747bd9c45b86c783b40f2813f84bf25 | Python | bilherron/advent-of-code | /2019/Day 7/7.1.py | UTF-8 | 3,226 | 2.828125 | 3 | [] | no_license | import sys, io
from itertools import permutations
def computer(cmd, label, inp_values=[]):
# print(inp_values)
input_values_index = 0
# print("input_values_index", input_values_index)
output = ""
pointer = 0
instruction = str(cmd[pointer]).zfill(5)
opcode = int(instruction[3:])
try:
... | true |
7653e9f07bc705c9083511474975d2c65a1900ab | Python | xmillero/python2 | /D03/ex00/geohashing.py | UTF-8 | 670 | 3.1875 | 3 | [] | no_license | import sys
import antigravity
def Traitement(lat, lon, reste):
antigravity.geohash(lat, lon, reste.encode())
if __name__ == '__main__':
try:
lat = float(sys.argv[1]) #verif lattitude
except ValueError:
print("Parametre 1 : mauvais format")
exit(1)
try:
lon = float(sys.argv[2]) #verif longitude
except ... | true |
ab17604d524229c063740dd7e5b4365c95bd8265 | Python | broadinstitute/dig-loam | /src/scripts/make_samples_restore_table.py | UTF-8 | 1,843 | 2.59375 | 3 | [] | no_license | import pandas as pd
import argparse
def main(args=None):
df = pd.DataFrame({'IID': [], 'RestoreFrom': []})
if args.ancestry_outliers_keep:
with open(args.ancestry_outliers_keep) as f:
lines = f.read().splitlines()
tempdf=pd.DataFrame({'IID': lines, 'RestoreFrom': 'ancestryOutliersKeep'})
df = df.append(te... | true |
17c140df3ffe08f993629a49bdc02633e6e53092 | Python | raindolf/African-Grading-Program | /African-Grading-Program/main.py | UTF-8 | 2,832 | 3.671875 | 4 | [] | no_license | ## Importing Standard Libraries ##
import sys
class African_Grading_Program():
## Begin License ##
print ""
print ""
print "African Grading Program (Python Version) Copyright (C) 2012 Cody Dostal"
print "This program comes with ABSOLUTELY NO WARRANTY; for details, go to http://www.gnu.org... | true |
e85de1281c62f5f4d102c11fc4677e58839aebac | Python | evejazmin/c-digo | /resta.py | UTF-8 | 231 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 11 14:39:43 2020
@author: EstAnthonyFabricioSa
"""
def subtra(a,b):
print(a-b)
subtra(5, 2) # outputs:3
subtra(2, 5)
subtra(a=2, b=5)
subtra(b=2, a=5)
subtra(2, b=5) | true |
63ee00cbd9297c22ef490d7a235125330d38a91c | Python | georgi-lyubenov/HackBulgaria | /HackSearchProject/main.py | UTF-8 | 1,881 | 2.9375 | 3 | [] | no_license | from sqlalchemy.orm import Session
from sqlalchemy import create_engine
import requests
from bs4 import BeautifulSoup
from create_db import *
from urllib.parse import urljoin
class Spider():
def __init__(self, homepage):
self.scanned_pages = []
self.queue = []
self.engine = create_engine("... | true |
97eb410fee349185c6375859b7cb87eee509300e | Python | ha8sh/IBSng | /core/server/handler.py | UTF-8 | 1,494 | 3.0625 | 3 | [] | no_license | class Handler: #ABSTRACT
"""
this is parent class for all handlers
all handlers must set their name, and register their fucntions using register method
so it'll return it's own name and methods . Hanlder methods can be called
by "name"."method"("args") syntax.
HandlerManagers... | true |
fef2596ad53cb01fd56c81351bbaaf8aead00dcd | Python | Uxooss/Lessons-Hellel | /Lesson_09/9.2 - Shift_bit_place.py | UTF-8 | 1,732 | 4.21875 | 4 | [] | no_license | '''
Написать функцию, циклически сдвигающую целое число на N разрядов вправо или влево, в зависимости от третьего
параметра функции. Функция должна принимать три параметра: в первом параметре передаётся число для сдвига, второй
параметр задаёт количество разрядов для сдвига (по умолчанию сдвиг на 1 разряд), 3-й булевск... | true |
67cf2a4394e8dc0d426061ed2d96b1a875bb147d | Python | Kane610/deconz | /pydeconz/models/sensor/time.py | UTF-8 | 509 | 2.734375 | 3 | [
"MIT"
] | permissive | """Python library to connect deCONZ and Home Assistant to work together."""
from typing import TypedDict
from . import SensorBase
class TypedTimeState(TypedDict):
"""Time state type definition."""
lastset: str
class TypedTime(TypedDict):
"""Time type definition."""
state: TypedTimeState
class ... | true |
bf9fcbc3cdd86f0c8a2d62bfc2d863bc9a070cd7 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2354/49823/300147.py | UTF-8 | 90 | 2.953125 | 3 | [] | no_license | import random
n=int(random.random()*2)
if n==0:
print('1')
elif n==1:
print('20')
| true |
a770074c29078a4dd3a1cba0aabc8a086864f976 | Python | jacobwojcik/codewars-algorithms | /python/uniqueInOrder.py | UTF-8 | 437 | 4.03125 | 4 | [] | no_license | # Implement the function unique_in_order which takes as argument a sequence
# and returns a list of items without any elements with the same value
# next to each other and preserving the original order of elements.
def unique_in_order(iterable):
if not iterable:
return []
else:
result=[iterable... | true |
44047097744141a31f352e60ecb22531f862e589 | Python | kaismithereens/realpython | /pages 0-100/exercises_pg43.py | UTF-8 | 310 | 3.640625 | 4 | [] | no_license | my_string1 = "AAA"
print(my_string1.find("a"))
my_string2 = "version 2.0"
number = 2.0
my_string3 = my_string2.find(str(number))
print(my_string3)
user_input = input("How are you feeling today? ")
print(user_input.find("a"))
print(user_input.find("e"))
print(user_input.find("i"))
print(user_input.find("o")) | true |
ae6d229afa4d7c429f76c827b0e7513c1099efed | Python | juanjoqmelian/python-silver-bars | /silver-bars/silver_bars_live_orders_board.py | UTF-8 | 2,453 | 3.171875 | 3 | [] | no_license | import uuid
from functools import reduce
from itertools import groupby
from order import Order
from order_type import OrderType
from summary_info import SummaryInfo
class SilverBarsLiveOrdersBoard:
def __init__(self) -> None:
self.orders = []
def register(self, order: Order) -> str:
"""Regi... | true |
a41772741683a584406d00d5b82339d7a61309ed | Python | ghilbing/Ejemplos | /isUnique.py | UTF-8 | 99 | 3.296875 | 3 | [] | no_license | def isUnique(a):
return len(set(a)) == len(a)
a = ["A", "B", "C", "D", "A"]
print isUnique(a)
| true |
23c23c1105a6076d714a44159e13db730b680733 | Python | devjoag/PyAssignments | /Assignment_2/Assignment2_10.py | UTF-8 | 236 | 3.75 | 4 | [] | no_license | def main():
no=int(input("Enter Number: "))
st=list(str(no))
sum=0
for i in range (0,len(st)):
sum=sum+int(st[i])
print("Sum of Digits in {} are {}".format(no,sum))
if(__name__) == "__main__":
main() | true |
2a883e80a476386db01ce6af3f9372ed99019245 | Python | serofly/The-rudiments-of-Machine-Learning | /07kmeans.py | UTF-8 | 2,825 | 2.859375 | 3 | [] | no_license | import pandas as pd
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
from sklearn.metrics import silhouette_score
import numpy as np
# 中文和负号的正常显示
plt.rcParams['font.sans-serif'] = 'Microsoft YaHei'
plt.rcParams['axes.unicode_minus'] = False
# 读取四张表数... | true |
1b72e7090866cb9997be8ac7b5a4556b9e8dad34 | Python | jamtot/PyProjects | /The Coding Dead/game/hunter.py | UTF-8 | 564 | 3.21875 | 3 | [
"MIT"
] | permissive | from entity import Entity
class Hunter(Entity):
# is initialised with position from base class Entity
# and a map reference
def destroy_zombie(self):
# use position to check nearby tiles for zombies
# check in every direction
# kill up to 2 zombies
pass
def move(se... | true |
a89a4bf447f2825e1afa5765055e6d7d12209de7 | Python | must-11/ap_experiment | /src/chaos/euler_method.py | UTF-8 | 1,674 | 3.15625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
# パラメータ
g = 9.8
l_1 = 0.5
l_2 = 0.5
m_1 = 0.5
m_2 = 0.3
w = np.sqrt(g / l_1)
l = l_2 / l_1
M = m_2 / (m_1 + m_2)
h = 0.01
t = 100
n = np.int(t / h)
def f(Y):
d = Y[0] - Y[1]
d1 = np.square(Y[2])
d2 = np.square(Y[3])
w2 = np.square(w)
f_1 = (w2*l... | true |
556e8bda5150838a5b56a7b5dee2bea105490d8d | Python | anpark/transform | /tensorflow_transform/tf_metadata/dataset_schema.py | UTF-8 | 15,548 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | true |
cca07c7ea8eb9aedf89dd8e24aa7f3ae92d488cf | Python | mamadyonline/data_engineering | /data_engineering/database/players.py | UTF-8 | 1,496 | 3.5 | 4 | [] | no_license | """Create players class and define its characteristics"""
from data_engineering.database.base import Base
from sqlalchemy import String, Integer, Column, Boolean
class Player(Base):
__tablename__ = 'players'
id = Column(Integer, primary_key=True)
name = Column('name', String)
nationality = Column('n... | true |
6248db0ba7d34e0059177f3f99279065529d107a | Python | gowthamanniit/python | /for-loop.py | UTF-8 | 50 | 3.03125 | 3 | [] | no_license | num=2
for a in range(1,10):
print(num*a)
| true |
629d477314231a4509413a9fb3131668db7bb5f5 | Python | SLKyrim/vscode-leetcode | /0213.打家劫舍-ii.py | UTF-8 | 2,237 | 3.390625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=213 lang=python3
#
# [213] 打家劫舍 II
#
# https://leetcode-cn.com/problems/house-robber-ii/description/
#
# algorithms
# Medium (35.58%)
# Likes: 234
# Dislikes: 0
# Total Accepted: 28.9K
# Total Submissions: 77.5K
# Testcase Example: '[2,3,2]'
#
#
# 你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方... | true |
08ac316233c0b6b34dcff7ae505829a4da2dd86e | Python | eyalMDM/MDMthesis | /eaTweetStreamer.py | UTF-8 | 5,377 | 3 | 3 | [] | no_license | '''
eaStreamTwitter
by Eyal Assaf
v0.1
Stream tweets based on hashtags and compiles them into a CSV file, to be sent to UE4
'''
# -*- coding: cp1252 -*-
# _*_ coding:utf-8 _*_
import sys
import io
# Import the necessary methods from tweepy library
import tweepy
from tweepy.streaming import StreamListener
from tweepy... | true |
2cb391d72c8980fbc316634b5dc2bd0cbe4d5d87 | Python | Max-E/CS361-Reading-App | /UI/UI.py | UTF-8 | 12,711 | 2.71875 | 3 | [
"MIT"
] | permissive |
import wx, wx.lib.scrolledpanel, wx.lib.newevent
import threading
#
# Library Screen
#
COLUMN_WIDTH = 150
ROW_HEIGHT = COLUMN_WIDTH*0.75
CELL_PAD = 5
class BookThumbnail (wx.BitmapButton):
def __init__ (self, parent, enqueue_callback, bookcover):
self.enqueue_callback = enqueue_callback
... | true |
34e1f4728f7e32d4d1be8491d05a272f14343d3f | Python | proffillipesilva/aulasdelogicaprogramacao | /aula0705/matriz_fundamentos.py | UTF-8 | 961 | 4.28125 | 4 | [
"MIT"
] | permissive | from random import randint
def cria_matriz(num_linhas, num_colunas):
matriz = []
for i in range(num_linhas):
linha = []
for j in range(num_colunas):
linha.append(randint(0,10))
matriz.append(linha)
return matriz
def imprime_matriz(matriz):
for i in range(len(matriz))... | true |
d9e826a062bc52a92e69920bd2f146cbdd763d63 | Python | barthap/BPMN | /tests/test_network.py | UTF-8 | 7,646 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
import network_factory
from network import Network, NodeType
"""
Network:
A --. .-- E
|-- C -- D -- |
B --^ ^-- F
"""
test_network = {
'A': { 'C' },
'B': { 'C' },
'C': { 'D' },
'D': { 'E', 'F' },
}
class NodeTests(unittest.TestCase):
def setUp(self) ->... | true |
93130729cc1e3635b31fd3025310bf6380feef8e | Python | FurknKOC/Opencv_ve_Python_kullanarak_RaspberryPI3_ile_Yuz_Tanima | /Face REC/Face REC/Ana_Menu.py | UTF-8 | 413 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
def secim() :
prompt = '> '
print "\n"
print "Hoşgeldiniz %s\n" %os.getlogin()
print("Islem secimi yapiniz : \n")
print("[ 1 ] Grup Oluştur \n[ 2 ] Kişi Oluştur \n[ 3 ] Kişi Yüzü Ekle \n[ 4 ] Kişi Yüzü Ara \n[ 5 ] Yüz Tespiti \n[ ... | true |
01e4a7138f889120d8e3b04c6ecc2c78e898b7a5 | Python | joduncan/RaceScoring | /parse-mychiptime.py | UTF-8 | 319 | 2.5625 | 3 | [] | no_license | import sys
inl = open( sys.argv[1] ).readlines()
inl = [ i.split("\t") for i in inl ]
for i in range( len( inl ) / 3 ):
i1,i2,i3=inl[i*3:i*3+3]
number = i1[2]
name = i1[3]+" "+i1[4]
age='' #i3[6]
#print i3[9]
sex = sys.argv[2]
time = i1[1]
print ",".join( [number,name,age,sex] )
| true |
712d6a0c64485ace27aa0aebda504d4733ed0640 | Python | thomasmburke/PersonalizedGreeter | /environment_setup/populate_redis.py | UTF-8 | 5,843 | 2.9375 | 3 | [
"MIT"
] | permissive | import redis
import os
import pickle
greetings = {"defaultGreetings" : {"<speak>Greetings and Salutations {}!</speak>",
"<speak>Howdy, Howdy, Howdy {}!</speak>",
"<speak>Howdy doody {}!</speak>",
"<speak>{}, Ahoy, Matey</speak>",
"<speak>What's crackin {}?</speak>",
"<speak>{},... | true |
f92f3e98a1fbbc92a2ac9b135b35219284a2d700 | Python | AshrithPradeep/PythonT | /Python/TASK 1 AND 2.py | UTF-8 | 8,609 | 5.03125 | 5 | [] | no_license | # TASK ONE
# 1. Create three variables in a single line and assign values to them in such a manner that each one of
# them belongs to a different data type.
a,b,c = 1, 2.0, 'ashrith'
# 2. Create a variable of type complex and swap it with another variable of type integer.
a = 2 +1j
b = 1
a,b = b,a
#3. Swap two numbe... | true |
97283e71227dfc436e35ad27d41122e1758d2dc3 | Python | Windrist/UET-CAM-Demo | /captureImage.py | UTF-8 | 502 | 2.734375 | 3 | [] | no_license | import time
import cv2
if __name__ == "__main__":
# Camera configuration
cap = cv2.VideoCapture(0)
count = 0
cap.set(3, 1280)
cap.set(4, 720)
while True:
ret, image = cap.read()
cv2.imshow("Capture", image)
key = cv2.waitKey(1) & 0xFF
if key == ord('q'):
... | true |
20a9d93c0a66c511f385ba91cbec00643a4cb8ab | Python | misterbeebee/Games | /Connect/connect.py | UTF-8 | 7,628 | 3.34375 | 3 | [] | no_license | #!/bin/env python
import random
import sys
import time
def printf(*args):
sys.stdout.write(*args)
sys.stdout.flush()
class Column:
SPACE = ' '
def __init__(s, height):
s.height=height
# Bottom-to-top (aka order of insertion, per gravity)
s.content = [s.SPACE]*s.height
def full(s):
return n... | true |
c090af4139919b65cead84071f21df07c3976026 | Python | AnjoliPodder/PracticePython | /8.py | UTF-8 | 1,867 | 4.5 | 4 | [] | no_license | '''
Solution by: Anjoli Podder
December 2016
http://www.practicepython.org/exercise/2014/03/26/08-rock-paper-scissors.html
Let’s say I give you a list saved in a variable: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. Write one line of Python
that takes this list a and makes a new list that has only the even ele... | true |
7232b30a5d8032fa83bfd182064edecb8ec19412 | Python | evd0kim/poc-threshold-ecdsa-secp256k1 | /paillier.py | UTF-8 | 2,878 | 3.3125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | #!/usr/bin/env python
import struct
import utils
KEY_LENGHT = 4096
def inverse(a, n):
"""Find the inverse of a modulo n if it exists"""
t = 0
newt = 1
r = n
newr = a
while newr != 0:
quotient = int((r - (r % newr)) / newr)
tt = t
t = newt
newt = tt - quotient * ... | true |
382f48d18d6506a8fdeb77004d642f9947a3be0b | Python | CSSS/csss-site | /csss-site/src/csss/convert_markdown.py | UTF-8 | 500 | 2.5625 | 3 | [] | no_license | import markdown
def markdown_message(message):
"""
Marks down the given message using the markdown module
Keyword Argument
message -- the message to mark down
Return
message - the marked down message
"""
return markdown.markdown(
message, extensions=[
'sane_lists'... | true |
0cafa77b3197d634b00e72ffb6250fa46a67f3e4 | Python | varshanth/Coding_Algorithms | /Linked_Lists/remove_all_occurrences_of_element_from_linked_list.py | UTF-8 | 1,480 | 4.09375 | 4 | [] | no_license | '''
LeetCode: Remove Element from LinkedList
Remove all elements from a linked list of integers that have value val.
Example
Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6
Return: 1 --> 2 --> 3 --> 4 --> 5
Solution: O(n)
Algorithm:
1) Maintain 2 pointers, fast and slow. Slow will start on dummy_head and
... | true |
31d766c28f9df0982fd539e6582d7a77bfce64ac | Python | mndesai/Python | /ex16.py | UTF-8 | 1,244 | 3.671875 | 4 | [] | no_license | from sys import argv #open python file with script name and file name
script, filename = argv
print "We're going to erase %r." % filename
print "If you don't want that, hit CTRL-C (^C)." #closes script
print "If you do want that, hit RETURN."
raw_input("?")
print "Opening the file..." #I guess this is what happens ... | true |
7a7c00f304306e438067fd20581b4579fe9e08cc | Python | JasperGan-smile/fileserver | /fs.py | UTF-8 | 1,231 | 2.671875 | 3 | [] | no_license | import os,magic
import re
from genericpath import isdir, isfile
from flask import Flask,send_file,render_template,request
def show_dir(pwd):
files = os.listdir(pwd)
return render_template("index.html",files = files,pwd = pwd)
def send_to_client(pwd):
path = pwd[:-1]
return send_file(path,as_attac... | true |
1a837d72da20cb51c81b437029624d536cb25a23 | Python | uenewsar/nlp100fungos | /chap9/83.py | UTF-8 | 1,905 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
83. 単語/文脈の頻度の計測
82の出力を利用し,以下の出現分布,および定数を求めよ.
f(t,c): 単語tと文脈語cの共起回数
f(t,∗): 単語tの出現回数
f(∗,c): 文脈語cの出現回数
N: 単語と文脈語のペアの総出現回数
'''
import pickle
import sys
def write_res(word2idx, idx2word, ftc, ft, fc, N, fn):
with open(fn, 'wb') as fw:
pickle.dump( (word2idx, idx2word, ftc, ft... | true |
4dbf77fc15640c98b89990cc35c6bbaca2347bca | Python | Setugekka/Finance-Investment-Analysis-System | /webapp/Library/pyalgotrade_custom/plotter.py | UTF-8 | 2,153 | 2.75 | 3 | [] | no_license | #encoding:utf-8
from pyalgotrade import broker
from backtestOrder import backtestOrder as Order
class StrategyPlotter(object):
"""Class responsible for plotting a strategy execution.
:param strat: The strategy to plot.
:type strat: :class:`pyalgotrade.strategy.BaseStrategy`.
"""
def __init__(sel... | true |
32e47048d19132ce0a69f18498972258512f9f24 | Python | zhigang0529/PythonLearn | /src/main/operation/RSSSum.py | UTF-8 | 294 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
# !coding=utf-8
import os
list = []
sum = 0
pslines = os.popen('ps aux', 'r').readlines()
for line in pslines:
str2 = line.split()
new_rss = str2[5]
list.append(new_rss)
for i in list[1:-1]:
num = int(i)
sum = sum + num
print '%s:%s' % (list[0], sum)
| true |
de90b59e1acff18c0704a821bdd58c02a3a0b382 | Python | NiyazUrazaev/SummerPractice | /practice/models.py | UTF-8 | 3,244 | 2.671875 | 3 | [] | no_license | import datetime
from django.db import models
class BaseDiaryDay(models.Model):
"""Базовый класс для одного дня у всех аппов"""
date = models.DateField(
default=datetime.datetime.today(),
)
work_info = models.CharField(
max_length=5000,
default='',
)
is_complete = mo... | true |
0b8391aa4fbbb308e9b1c41cead7b427302e157f | Python | FZKeehn/Sunlight-Data-Exploration-Project | /Association_Rules.py | UTF-8 | 2,094 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Frank Zebulon Keehn
Sunlight Data Exploration Project
Written in Python (x,y) with Python 2.7.10
"""
"""Orange is a Python data mining and visualization library that I installed
for its association rules functions"""
import Orange
#save the basket file in a data table the association rul... | true |
a93eed488a88d5d46c1844e082867a6253020248 | Python | thomasgibson/tabula-rasa | /verification/LDGH/LDGH.py | UTF-8 | 14,676 | 3.171875 | 3 | [
"MIT"
] | permissive | """
This module runs a convergence history for a hybridized-DG
discretization of a model elliptic problem (detailed in the main
function). The method used is the LDG-H method.
"""
from firedrake import *
from firedrake.petsc import PETSc
from firedrake import COMM_WORLD
import numpy as np
import pandas as pd
def run... | true |
fe095267b52ebecf582f19f64c9886966d6af7ed | Python | uzdpe/german_credit_risk_xai | /backend/data_preprocessing/data_loading.py | UTF-8 | 9,415 | 2.890625 | 3 | [] | no_license | """Sources:
dataset: https://archive.ics.uci.edu/ml/datasets/Statlog+%28German+Credit+Data%29
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.compose i... | true |
267aade8227f528d948078718884cceb55adfb7a | Python | damaresende/USP | /SCC5900/pj2/algorithms/Kruskal.py | UTF-8 | 3,445 | 3.8125 | 4 | [] | no_license | '''
Uses union find data structure with ranking and path reduction to build a MST
based on Kruskal's algorithm. The algorithm runs V - 1 - K - 1 times, where V is
the number of vertices and K the number of clusters to be found.
@author: Damares Resende
@contact: damaresresende@usp.br
@since: May 26, 2019
@organizatio... | true |
adaea801ae00faf6413a2fdc6a05d678f7b3b809 | Python | bespoke-silicon-group/hb_starlite | /torch-sparse-example.py | UTF-8 | 1,656 | 3.09375 | 3 | [] | no_license | """Some useful utilities for working with sparse tensors using the
`torch.sparse` library.
"""
import torch.sparse
import torch_sparse
import scipy.sparse
import numpy
def sparse_scipy2torch(matrix):
"""Convert a matrix from *any* `scipy.sparse` representation to a
sparse `torch.tensor` value.
"""
coo... | true |
41618c8341326df432c3f6b8ebebb4f43845fca1 | Python | andersonms1/python-brasil | /strings/9_validade_cpr.py | UTF-8 | 1,116 | 3.609375 | 4 | [] | no_license | valid = True
sum = 0
cpf = input('Digite o CPF desejado: ')
counter = 10
second_sum = 0
second_counter = 11
# verifica o tamanho
if len(cpf) != (11 + 3):
print('Invalid size!')
valid = False
# verifica os digitos
elif not cpf[-2:].isdigit() or not cpf[4:7].isdigit() or not cpf[8:11].isdigit() or not cpf[-2:]... | true |
818ba842af171b6e52aa02435fcf8982e1c2c6b7 | Python | ReubenBond/serverless-orleans | /loadtest/locustfile.py | UTF-8 | 597 | 2.65625 | 3 | [] | no_license | import string
import random
from locust import HttpUser, task, between
class MessageActorUser(HttpUser):
wait_time = between(0.5, 2)
@task(2)
def add_message(self):
actor_id = random.randint(1, 100)
self.client.post(f"/messages/{actor_id}", json=self.__get_random_text())
@task
def... | true |
aec2c3424a24e051c12c131d6099d04567dff97c | Python | boyoonc/stackathon | /workspace/csvs/datamanip_guide.py | UTF-8 | 864 | 2.828125 | 3 | [] | no_license | arr = [comp1:{name: 1, size:5}, comp2:{name:2, size:10}, ... ]
level2dict = {
1A: {name: bucket1a, childern:[]},
1B: {name: bucket1b, childern:[]},
2A: {name: bucket1b, childern:[]}
}
level1dict = {
1: {name: bucket1, children:[]},
2: {name: bucket1, children:[]},
}
root = {
name: root,
children:[]
}
map = {co... | true |
446ec42fccc72d32f67b60e250237b9549882c10 | Python | mlvfx/vfxAssetBox | /assetbox/base/host_manager.py | UTF-8 | 2,928 | 2.546875 | 3 | [
"CC0-1.0"
] | permissive | """
HostManager reads the plugins directory, loads all plugins, and registers
their actions.
"""
import os
import imp
from assetbox.base.plugins.host import BaseHost
from assetbox.base.plugins import actions
PROJECT_FOLDER = os.path.dirname(os.path.dirname(__file__))
def find_plugins():
"""Query the plugin fold... | true |
5e130fb37a03149bdab242df468d0a3e8b036279 | Python | joehigh/COMSW4771 | /HW 2/q5/adadelta.py | UTF-8 | 940 | 2.671875 | 3 | [] | no_license | import random
from jax import grad
import jax.numpy as np
def adadelta(f, start, step, max_iter, prec):
x_hist = []
y_hist = []
x = start
iters = 0
delta_x = 0
eps = 1e-8
rho = .95
print(x.shape)
eg = np.zeros(x.shape[0])
ed = np.zeros(x.shape[0])
while True:
l = [x... | true |
eeded8e15175153813131f9c88234392b3a42737 | Python | dheerajgm/daily-coding-problem | /solutions/problem_340.py | UTF-8 | 850 | 3.296875 | 3 | [
"MIT"
] | permissive | import sys
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "[x={},y={}]".format(self.x, self.y)
def get_distance(p1, p2):
return ((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2) ** 0.5
def get_closest(point_tuples):
points = [Point(x, y) fo... | true |
5546c56aa0bc5afdc62e4290046d856cb92c1f3b | Python | JohnDoneth/cis457-project2 | /src/ftp/ftp_server.py | UTF-8 | 3,877 | 2.53125 | 3 | [] | no_license | import common
from asyncio import StreamReader, StreamWriter
import asyncio
import os
import base64
from typing import Dict
# filter out files with *.py extensions
def filter_files(path):
_, extension = os.path.splitext(path[0])
if extension == ".py":
return False
else:
return True
class... | true |
30c7f1dfdcd19f43939f915fe25f518ffdf6c2b7 | Python | jwodder/doapi | /doapi/tag.py | UTF-8 | 9,742 | 2.828125 | 3 | [
"MIT"
] | permissive | from six import iteritems, string_types
from six.moves import map # pylint: disable=redefined-builtin
from .base import Resource
from .droplet import Droplet
from .floating_ip import FloatingIP
from .image import Image
resource_types = {
"droplets": Droplet,
# Not supported by DO ... | true |
d9ce5be78cb22c14c503cca4d6fa615d01366506 | Python | SIGMAOON/Greedy | /20300.py | UTF-8 | 363 | 2.96875 | 3 | [] | no_license | # 서강근육맨
import sys
input = sys.stdin.readline
n = int(input())
muscle = list(map(int,input().split()))
muscle.sort()
if n%2 == 1:
hap = 0
for i in range((n-1)//2):
hap = max(hap,muscle[i]+muscle[-i-2])
print(max(hap,muscle[-1]))
else:
hap = 0
for i in range(n//2):
hap = max(hap,muscl... | true |
86c867bcc57c186136f640753c039f06fdea30d9 | Python | PriyanshuChatterjee/30-Days-of-Python | /day_14/Question_16.py | UTF-8 | 161 | 3.21875 | 3 | [] | no_license | from functools import reduce
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def add(num1, num2):
return num1 + num2
total = reduce(add, numbers)
print(total) | true |
929217201936de4bdaa29e6147fcfd4a78560f41 | Python | aokirae/mobaPquestionnaire | /src/checkNotation.py | UTF-8 | 4,456 | 2.96875 | 3 | [] | no_license | # アイドルの表記ゆれをみる
import csv
import sys
import numpy as np
import pandas as pd
import mojimoji
def openIdolData():
df = pd.read_csv("../data/アイドルデータ.csv", header = 0, index_col=None)
df = df.dropna(how='all')
names = df['名前'].tolist()
return names
def openQuestionnaireIdolname():
df = pd.read_csv("../data/アンケートアイ... | true |
2a265122875d3349595394bb04895151f66ce5f2 | Python | Horta-IoT/horta-iot | /client-sub/sub.py | UTF-8 | 1,645 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# Source: https://pypi.python.org/pypi/paho-mqtt/1.3.0
import paho.mqtt.client as mqtt
import sys
HOSTNAME = "mosquitto"
# HOSTNAME = "10.73.21.215"
PORT = 1883
TOPIC = 'temp/random'
def log(topic, payload):
sys.stderr.write("[sub][{}] < {:.1f}\n".format(topic, payload))
sys.stderr.flu... | true |
f239fdff7c8a9c2509c20b14c44b164d3f7ce474 | Python | Mauricio1xtra/Revisar_Python_JCAVI | /Proj_class7/modulo_prog.py | UTF-8 | 344 | 3.6875 | 4 | [] | no_license | ##Funções no Modulo
def soma(x,y):
return x + y
def calculaMaximo(x,y,z):
lista = [x,y,z]
print(max(lista))
##Tudo daqui para baixo será executado apenas em modo iterativo
#Ou quando executado o script do módulo diretamente
if __name__ == "__main__":
print(soma(2,3))
print("Executei Sozinho")
... | true |
8c61c022e973ec5715367411b0de962e3db2cb65 | Python | wanghaibo1996/PytestAuto_Security_WZ_Test | /util/clipboard.py | UTF-8 | 591 | 2.71875 | 3 | [] | no_license | import win32con
import win32clipboard as WC
class ClipBoard(object):
'''设置剪切板内容和获取剪切板内容'''
@staticmethod
def getText():
'''获取剪切板内容'''
WC.OpenClipboard()
value = WC.GetClipboardData(win32con.CF_TEXT)
WC.CloseClipboard()
return value
@staticmethod
def setTex... | true |
ca7bf68c607564bb40286df2d82079d14df511cb | Python | jzengler/IN1000 | /Innlevering 4/egen_oppgave.py | UTF-8 | 2,423 | 4.53125 | 5 | [] | no_license | '''
Lag et program som lar brukeren administrere biler og registreringsnummer.
Brukeren skal kunne legge til, slette eller skrive ut en oversikt.
Bruk løkker og lister for å løse oppgaven
'''
# Liste til å holde registreringsnummer, bilmerke, modell og farge
# kan skrives/fra fil hvis det skal lagres mellom ekskevering... | true |
3dbe7b36da796347f3e5f65a231c2f6918f212b0 | Python | dmmfix/amath-352 | /h6/tabular.py | UTF-8 | 678 | 3.59375 | 4 | [] | no_license | #!/usr/local/bin/python3
import math
vals = [2, 4, 8, 16, 64, 512]
fns = [
[lambda x: x, 'n'],
[lambda x: x * math.log2(x), 'n\log_2(n)'],
[lambda x: x ** 2, 'n^2'],
[lambda x: x ** 3, 'n^3'],
[lambda x: 2 ** x, '2^n'],
[lambda x: math.factorial(x), 'x!']
]
for f in fns:
print('\\hline')... | true |
e674af34d0abdba51912907fdef58bf30e224447 | Python | oucsealee/scipysample | /test/testPandasReadExcel.py | UTF-8 | 273 | 2.5625 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import pandas as pd
import pandasReadExcel
def main():
data_frame = pandasReadExcel.read_from_excel()
print(data_frame)
last_data = pandasReadExcel.get_last_red_data(data_frame)
print (last_data)
if __name__ == '__main__':
main() | true |
b1c41114752aa0aa23e004031fcefafd4f91d83a | Python | plee0117/LC | /238.py | UTF-8 | 368 | 2.75 | 3 | [] | no_license | class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
left = [1]
right = [1]
for i in range(len(nums) - 1):
left.append(left[i] * nums[i])
right.append(right[i] * nums[-1 - i])
out = []
for j in range(len(nums)):
out.ap... | true |
2a8028e176e1013a49931aebef967331e6b31afd | Python | wangpanqiao/Circos_python_config | /Pylomaker3.py | UTF-8 | 3,527 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from optparse import OptionParser
import sys
import subprocess
from Bio.Blast.Applications import NcbiblastpCommandline
from Bio import SeqIO
import os
from Bio.Align.Applications import ClustalwCommandline
def dowhat():
print "Gives you an iterative mutations made from germline starting with m... | true |
c24ca456ac22dd9cedb67c1336e1e1ca0930be54 | Python | DaiJitao/algorithm | /solution/binary.py | UTF-8 | 906 | 3.84375 | 4 | [] | no_license | def binaryVal(arr, e):
minIndex = 0
maxIndex = len(arr) - 1
while minIndex <= maxIndex:
midd = minIndex + ((maxIndex - minIndex) >> 1)
if e < arr[midd]:
maxIndex = midd - 1
elif e > arr[midd]:
minIndex = midd + 1
elif midd < len(arr) and arr[midd] == ... | true |
465fbdc4d672c7a9268e221698cf591d12c4f6c6 | Python | lyleaf/sound-fun | /tempo_sync_animation_demo.py | UTF-8 | 2,400 | 2.671875 | 3 | [] | no_license | import cv2
import librosa
import librosa.display
import wave
import pyaudio
from cv2 import VideoWriter, VideoWriter_fourcc
VIDEO_PATH = 'Demo_Full_1.mp4'
video = cv2.VideoCapture(VIDEO_PATH)
# Read a video to get FPS
fps = video.get(cv2.CAP_PROP_FPS)
print('Image frames per second is %d' % fps)
video.release()
# C... | true |
b6a13fc6df55777f31afe900bb6ec6d38c517d59 | Python | bernease/Mmani | /benchmarks/bench_laplacian_dense_temp.py | UTF-8 | 5,374 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
"""
Benchmarks of geometry functions (distance_matrix, affinity_matrix,
graph_laplacian) in sparse vs dense representation.
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increas... | true |
341b95915298fe3c1249fd55c8288e35ca7e2b51 | Python | tabatafeeh/URI | /python/2867.py | UTF-8 | 191 | 3.171875 | 3 | [] | no_license | v = int(input())
i = 0
while i < v:
n, m = input().split(" ")
n = int(n)
m = int(m)
tam = n ** m
tam = str(tam)
tam = list(tam)
print(len(tam))
i = i + 1 | true |
f38f34b2a53658dad12051d3e347c090cfe9dc25 | Python | TakahiroSono/atcoder | /practice/python/dpcontest/D.py | UTF-8 | 918 | 2.703125 | 3 | [] | no_license | # N, W = map(int, input().split())
# W_V = [list(map(int, input().split())) for _ in range(N)]
# dp = [[0] * (W+1) for _ in range(N+1)]
# for n in range(1, N+1):
# for w in range(W+1):
# dp[n][w] = dp[n-1][w]
# if(w - W_V[n-1][0] >= 0):
# dp[n][w] = max(dp[n][w], dp[n-1][w - W_V[n-1][0]] + W_V[n-1][1]... | true |
567caf26aa33e46aaa95d831ff4b5ea1f4b126eb | Python | rado9818/TV-programs | /TimeUtil.py | UTF-8 | 428 | 3.40625 | 3 | [] | no_license | from datetime import datetime
from Constants import SECONDS_IN_MINUTE
import time
def getDifference(start, end):
a = start
b = end
time1 = datetime.strptime(a,"%H:%M") # convert string to time
time2 = datetime.strptime(b,"%H:%M")
diff = time1 -time2
return diff.total_seconds()/SECONDS_IN_MINUTE
... | true |
48052e8ced5575fa301fe2e428440549fe744427 | Python | Bulgakoff/hws_PyQt | /lesson_6/codes_6/03_pycrypto_encrypt.py | UTF-8 | 3,599 | 3.234375 | 3 | [] | no_license | # ========================= Аспекты безопасности ==============================
# ------------- Модуль PyCrypto для криптографических функций в Питоне --------
# ------------------------- Шифрование сообщений ------------------------------
# Библиотека PyCrypto реализует криптографические примитивы и функции на Пито... | true |
b4382c17d4b50a12515d327dbc3c93bfc6c99e4a | Python | MacJim/CMPT-762-Assignment-3-Code | /helper/segmentation_path.py | UTF-8 | 1,105 | 3.140625 | 3 | [] | no_license | """
Segmentation path helpers.
"""
import typing
import copy
def fit_segmentation_path_in_crop_box(path: typing.List[int], crop_box_x0, crop_box_y0, crop_box_w, crop_box_h, set_outside_values_to_boundary_value=True):
return_value = copy.copy(path)
crop_box_x1 = crop_box_x0 + crop_box_w
crop_box_y1 = cro... | true |
194d7ef18596e430a96576c5748de088c081a6f6 | Python | tyler-fishbone/data-structures-and-algorithms | /challenges/print-level-order/print_level_order.py | UTF-8 | 870 | 3.640625 | 4 | [
"MIT"
] | permissive | from queue import Queue
from k_tree import Node, KTree
def print_level_order(input_tree):
"""
takes in a k-ary tree and returns a string that contains
a listing of all values in the tree, with new lines in-between
each level of the tree
"""
output_lst = []
queue = Queue()
if in... | true |
e2a15e87b18c46d8f2168560a59a5fda68aaf2ac | Python | cstapler/pythice | /big_sorting.py | UTF-8 | 550 | 4.09375 | 4 | [] | no_license |
def main():
"""Implement Bucktsort on an array with really big numbers
Puts numbers into buckets based on their length
"""
number_input = int(input())
buckets = {}
for _ in range(number_input):
item = input().strip()
item_len = len(item)
if item_len not in buckets:
... | true |
4fd78761d52660c43bcd785bc048f3f6f946f563 | Python | frc3512/Robot-2020 | /tools/flywheel_ols.py | UTF-8 | 2,833 | 3.046875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
"""Runs OLS on flywheel velocity recordings generated from step voltage inputs.
"""
import math
import matplotlib.pyplot as plt
import numpy as np
filename = "Flywheel characterization.csv"
# Get labels from first row of file
with open(filename) as f:
labels = [x.strip('"') for x in f.readl... | true |
648a1a412b0277b107aa54da3a8aaeafcefde22a | Python | Cafolkes/keedmd | /core/controllers/fb_lin_controller.py | UTF-8 | 1,120 | 3.015625 | 3 | [
"MIT"
] | permissive | from numpy.linalg import solve
from .controller import Controller
class FBLinController(Controller):
"""Class for linearizing feedback policies."""
def __init__(self, fb_lin_dynamics, linear_controller):
"""Create an FBLinController object.
Policy is u = (act)^-1 * (-drift + aux), where drif... | true |
9003a3a3d76fdc44670c146dd707efc61a96621e | Python | Markus28/multiresolution_algorithms_code | /fixed_point_algorithm/visualize.py | UTF-8 | 4,443 | 2.859375 | 3 | [] | no_license | import numpy as np
from scipy.ndimage.filters import laplace
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.patches as patches
import os
def read_grid(file_name):
with open(file_name) as f:
N, M = f.readline().split(",")
data = np.zeros((int(N), int(M)))
... | true |
76d70b8cdd44bfceb98f62219d496c1db7d0afce | Python | priya192/guvi--priya.github.io | /ans9.py | UTF-8 | 152 | 3.515625 | 4 | [] | no_license | data = input("Please enter the input")
count = 0
for i in data:
if i in "0,1,2,3,4,5,6,7,8,9":
count = count + 1
print("Count is:", count)
| true |
9f4d75ab9d873c22e0b5575c3a44af6d61235fbe | Python | WinnieJiangHW/Carry-lookahead_RNN | /Benchmarks/char_cnn/char_cnn_test.py | UTF-8 | 7,243 | 2.59375 | 3 | [
"MIT"
] | permissive | import argparse
import torch.nn as nn
import torch.optim as optim
from utils import *
from model import CL_RNN
import time
import math
import warnings
warnings.filterwarnings("ignore") # Suppress the RunTimeWarning on unicode
parser = argparse.ArgumentParser(description='Sequence Modeling - Character Level Langua... | true |
fd684597bc545a23afc18b49d8760149a5ab8eb6 | Python | giselabelen/redes2020 | /Taller1-Wiretapping/fuenteInfoEntropia.py | UTF-8 | 902 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
from math import *
from scapy.all import *
frames = 0
S1 = {}
def mostrar_fuente(S):
global frames
frames += 1
N = sum(S.values())
simbolos = sorted(S.iteritems(), key=lambda x: -x[1])
entropia = 0
for d,k in simbolos:
prob = k/N # k/N es la prob de ese simbolo
info = - math.log(prob,2) #... | true |
a8d8482f1e811a8125bea971b1bb72eba82f983b | Python | magnuspedro/gateCrawler | /AmazonCrawler/spiders/scraper_americanas.py | UTF-8 | 1,380 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.selector import Selector
import hashlib
from ..items import AmericanasItem
class BotAmericanasSraper(scrapy.Spider):
name = "botamericanas"
allowed_domain = 'www.amazon.com.br'
start_urls = [
'https://www.americanas.com.br/busca/xiaomi',
]
... | true |
0e60a917a1e70ce05902674b59dd2d8b479bcc21 | Python | Renato0402/Uri-Online-Judge | /python/uri1001.py | UTF-8 | 92 | 3.34375 | 3 | [] | no_license | if __name__ == '__main__':
n1 = int(input())
n2 = int(input())
print(f'X = {n1+n2}')
| true |
450e8f9cb380b1539efdee94b89c93ce60d7c85b | Python | kutaybuyukkorukcu/Codewars | /6 kyu/NthFibonacci.py | UTF-8 | 212 | 3.171875 | 3 | [] | no_license | # https://www.codewars.com/kata/522551eee9abb932420004a0
def nth_fib(n):
if n==1:
return 0
elif n==2:
return 1
else:
return nth_fib(n-1)+nth_fib(n-2)
# 🧙♂️👍 | true |
0769366c4c520892c0f8ca5d54c14264eec70a2e | Python | Pradeepnataraj/pradeep | /alphabet.py | UTF-8 | 117 | 3.09375 | 3 | [] | no_license | cht = input()
if((cht>='a' and cht<= 'z') or (cht>='A' and cht<='Z')):
print( "Alphabet")
else:
print( "no")
| true |
5c719bee992a818b2f531a743698cae1558f4c4e | Python | Sabrout/cantal_cryptocurrency | /src/structure/crypto.py | UTF-8 | 2,695 | 3.09375 | 3 | [] | no_license | from ecdsa import SigningKey
from ecdsa import VerifyingKey
from ecdsa import BadSignatureError
import os
import binascii
class Crypto():
"""
This class encapsulate the ecdsa library
"""
def __init__(self, path=os.getcwd()):
"""
We load in the constructor the private and the public key... | true |
bae59598b2f9982ac97067d65c55bf8bb5c71563 | Python | kefirzhang/algorithms | /leetcode/python/easy/p1037_isBoomerang.py | UTF-8 | 528 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | class Solution:
def isBoomerang(self, points) -> bool:
if points[2][0] == points[1][0] and points[2][1] == points[1][1]:
return False
if points[1][0] == points[0][0] and points[1][1] == points[0][1]:
return False
if (points[2][0] - points[0][0]) * (points[1][1] - poi... | true |
5524ecd8c318551c6e1ee7a4202c995aae3b0d11 | Python | JeffryHermanto/Python-Programming | /05 Data Structures/16_swapping_variables.py | UTF-8 | 103 | 3.3125 | 3 | [] | no_license | # Swapping Variables
x = 10
y = 11
# z = x
# x = y
# y = z
x, y = y, x
print("x", x)
print("y", y)
| true |
c40629dcad9853bdedc406eb61bee257c91731b2 | Python | DenkSchuldt/MasAllaDelEspacio | /ProyectoPython/src/Boton.py | UTF-8 | 641 | 3.25 | 3 | [] | no_license |
import pygame
class Boton(pygame.sprite.Sprite):
def __init__(self,imagen_01,imagen_02,x=200,y=200):
self.imagen_normal = imagen_01
self.imagen_seleccion = imagen_02
self.imagen_actual = self.imagen_normal
self.rect = self.imagen_actual.get_rect()
self.rec... | true |
8103c96ce81121092b81f81e0023bfb81f6c115b | Python | fairviewrobotics/Python-Knight-Armor | /env/lib/python3.6/site-packages/wpilib/command/subsystem.py | UTF-8 | 6,147 | 2.640625 | 3 | [] | no_license | # validated: 2018-01-06 TW 8346caed9cbf edu/wpi/first/wpilibj/command/Subsystem.java
#----------------------------------------------------------------------------
# Copyright (c) FIRST 2008-2012. All Rights Reserved.
# Open Source Software - may be modified and shared by FRC teams. The code
# must be accompanied by the... | true |
6c444f40bc74180c6ee6f9550fd1b2b55137401c | Python | honyacho/atcoder_excercise | /abc070/d.py | UTF-8 | 521 | 2.53125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**7)
N=int(input())
NODES={}
for i in range(N-1):
a,b,c=map(int,input().split())
if not a in NODES: NODES[a] = []
if not b in NODES: NODES[b] = []
NODES[a].append((b, c))
NODES[b].append((a, c))
Q,K=map(int,input().split())
MP=[-1]*(N+1)
MP[K]=0
def dfs(k):
f... | true |
312f51e5fb5aca37df5ae91e89657034099ab023 | Python | gianv9/CursoDeIntroduccionAPythonYterminalLinux | /Python/pygame/cuadrado/cuadradoConSaltoFunciones.py | UTF-8 | 3,874 | 3.53125 | 4 | [] | no_license | # importamos la libreria
import pygame
def dibujar(ventana, R1):
# para evitar que mi rectangulo deje una marca dibujo el fondo nuevamente
ventana["juego"].fill((0,0,0))
# aca el 255,0,0 es un color RGBpygame.event.get()
# rect es para dibujar un rectangulo
# hay mas funciones para mas figuras... | true |
841cfc9743d5f62c13c999a9aa68f4ca7a98b6e4 | Python | Ash515/PyDataStructures | /Non Linear Structures/Binary Heap/PriorityQueue.py | UTF-8 | 242 | 4.0625 | 4 | [
"MIT"
] | permissive | '''
Heap in priority representation
'''
import heapq
list_=[(1,"Python"),(2,"JAVA"),(3,"C++")]
heapq.heapify(list_)
print(list_)
for i in range(len(list_)):
print(heapq.heappop(list_))
'''
Output
(1, 'Python')
(2, 'JAVA')
(3, 'C++')
''' | true |
17a2fb8c4b88d9aaa71ba5c2ff508d975a80b07b | Python | ordikhan/Data-cleansing | /feature selection.py | UTF-8 | 1,141 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import cross_val_score, cross_val_predict
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
import random
from sklearn.feature_selection import VarianceThreshold
random.s... | true |
e80685991c7ef7b4cf95f1d4dd78528b43b0239a | Python | mcuv3/recipie-api-django | /app/core/test/test_models.py | UTF-8 | 1,313 | 2.984375 | 3 | [
"MIT"
] | permissive | from django.contrib.auth import get_user_model
from django.test import TestCase
class ModelTest(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with the email successful
"""
email = "test@mcuve.com"
password = "123456"
user = get_us... | true |
d968710afe83a84f2d8736d575c8b0e54ade95bb | Python | infotechaji/GeneralCodes | /Other-Modules/TimeDelta.py | UTF-8 | 863 | 3.125 | 3 | [] | no_license | import datetime
import time
#from time import sleep
current_time=datetime.datetime.now()
print 'current time :',current_time
timeout=datetime.timedelta(minutes=1)# seconds=1
print 'datetime.timedelta(minutes=5) :',timeout
timeout_expiration = datetime.datetime.now() + timeout
print 'next time out expiration :',timeou... | true |
9acdf09e5472dc68550696e775a7969603f9d467 | Python | thecodevillageorg/intro-to-python | /Python Day 8/for_loops.py | UTF-8 | 2,031 | 4.96875 | 5 | [] | no_license | # Loops
"""
Loops in Python - "for loop" and "while loop"
Loops allow us to rerun the same lines of code several times.
Loops will always run until a condition is met.
Each time a loop runs is known as iteration.
"""
# For Loop - used to loop a set number of times
"""
syntax:
for num in range(5):
range(start,stop,ste... | true |
bc82463970195798588581474431badef4d8057a | Python | abndnc/CS5590-Python-DeepLearning | /ICP5/ICP5-2.py | UTF-8 | 1,346 | 3.296875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import linear_model
from sklearn.metrics import mean_squared_error
# read data
train2 = pd.read_csv('winequality-red.csv')
# get the top 3 most correlated features
corr = train2.corr(... | true |