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 |
|---|---|---|---|---|---|---|---|---|---|---|
3fe0f678a6bed58bb288b2267f64e3895fc172f3 | caitlingrasso/voxcraft-viz-vxa-generator | /random_bot.py | UTF-8 | 1,890 | 2.59375 | 3 | [] | no_license | import numpy as np
from vxa_generator import vxa_from_array
from scipy.ndimage.measurements import label
WORKSPACE_LENGTH = 6 # length of the bounding box for the bot
MUSCLE_ONLY = False # If True, uses active voxels only. If False uses both passive and active voxels.
n_mats = 2 if MUSCLE_ONLY else 3
def make_one... | true |
c904ecf263b20abe351a1183a6ce0bd7baf9644b | neiljdo/problem-solving-practice | /EPIP/5_1.py | UTF-8 | 2,816 | 4 | 4 | [] | no_license | import sys
import math
from functools import partial
"""
Write a program that takes an array A and an index i into A, and rearranges the elements
such that all elements less than A[i] (the "pivot") appear first, followed by elements equal to the pivot, followed by elements greater than the pivot.
"""
def dutch_flag... | true |
008a595394338884fc22e5a1d42ca6d29a93c5de | mrcuongtroll/Intro-to-AI-capstone-project | /Pilgrim_bredth_first.py | UTF-8 | 5,076 | 3.140625 | 3 | [] | no_license | import random
from collections import deque
import timeit
class node():
def __init__(self, coordinates = (0,0), path = (), tax: float = 0, action_sequence = ()):
self.coordinates = coordinates
self.available_dir = ['w', 'e', 's', 'n']
self.path = path
if self.coordinates[0]... | true |
06b8d5d61fabdf0dd1bf927f7b336df53ddba680 | CMoucer/PEP_integration_optimization | /RK/Examples/Compare_Step_Size.py | UTF-8 | 2,196 | 2.78125 | 3 | [] | no_license | ###############################################################################
# COMPARE SCHEMES AS A FUNCTION OF THE STEP SIZE
###############################################################################
import matplotlib.pyplot as plt
import numpy as np
import cvxpy as cp
import os, sys
sys.path.append(os.path.... | true |
b0af65ec67794322b8adfe98d6e7c187e90bec71 | lakisheshu/Django | /travello/views.py | UTF-8 | 763 | 2.6875 | 3 | [] | no_license | from django.shortcuts import render
from .models import Destination
import random,json
# Create your views here.
def travell(request):
# def travello():
# dest=["Mumbai","Bangalore","Chennai"]
# discrption=["The city Don't sleep",'The city with full of traffic',"The city high sunny "]
# destinatio... | true |
80b0e794cfd0d97eee06d0c9a8e1ab8f0aafc776 | hhatto/pgmagick | /example/pixels.py | UTF-8 | 416 | 2.640625 | 3 | [
"MIT"
] | permissive | from pgmagick import Image, Blob
blob = Blob(open('X.jpg').read())
img = Image(blob)
size = img.size()
pixels = img.getPixels(0, 0, size.width()/2, size.height()/2)
for cnt, pixel in enumerate(pixels):
if False:
print(pixel.red, pixel.blue, pixel.green, pixel.opacity)
pixel.blue = pixel.blue / 2
p... | true |
75d6c3d34251f391c87788616f5145d0e8a8e5dc | usha15nov/k.usha | /tuplesprgrm.py | UTF-8 | 64 | 2.78125 | 3 | [] | no_license | #tuples program
my_tuple = (1, "Hello", 3.4)
print(my_tuple[2])
| true |
2f0050cd0d2ea0ac1997ae5cf99df07f42ae3b69 | xyloguy/cs1410-2018-20-01-examples | /2018-01-24/main.py | UTF-8 | 296 | 2.984375 | 3 | [] | no_license | import pencil
def create01():
p = pencil.Pencil(3)
return p
def totalRemainingLead(p):
t = p.getNumLeads() * pencil.MAX_LEAD_LENGTH
t += p.getCurrentLeadLength()
return t
p1 = create01()
p1.addLeads(5)
for i in range(15):
p1.click()
print(totalRemainingLead(p1))
| true |
895b9b365b68b63abd7d8741486865cedf15a749 | crackCodeLogn/Tribal_Wars | /tw/DriverCommandCenter.py | UTF-8 | 862 | 3.1875 | 3 | [] | no_license | """
@author Vivek
@since 26/01/20
"""
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class Driver:
def __init__(self, browser, path):
self.driver = self.__create_driver__(browser, path)
def get_driver(self):
return self.driver
def __create_driver__(... | true |
f5f5563b922408dedcf5dadf4fcde0a4de95a67c | morinlab/lab_scripts | /CheckMotifMutBias/CheckMotifMutBias.py | UTF-8 | 17,915 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# DESCRIPTION
# Checks for evidence of mutations at a given motif, as well as a designated position in the motif
#
# After obtaining the sequences for each region of interest, all 4 possible orientations of the input
# motif is generated. The locations of the motif in each region are then iden... | true |
ffef31dde111d16cffeba8ed8652bb8675d06016 | Aasthaengg/IBMdataset | /Python_codes/p03048/s979074306.py | UTF-8 | 716 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
de... | true |
5dedac4ea742c7545fcd13c6c4df10d6347bfb8b | JohanAberg/NKPD | /nkbridge/Container.py | UTF-8 | 2,131 | 2.765625 | 3 | [] | no_license | import os
import sys
from DetailsPage import *
from FaderWidget import *
from functools import partial
from PySide.QtGui import *
from PySide.QtCore import *
class ContainerButton( QPushButton ):
'''
Button for containers holds extra cName attribute to hold the container name without showing the label.
Th... | true |
f4f0c603fc47d107b1a837c72cc394214e4af7c3 | x15azovich/Hacking_tools | /python/ftp/anonftp.py | UTF-8 | 359 | 3.34375 | 3 | [] | no_license | #!/usr/bin/python
import ftplib
def anonLogin(hostname):
try:
ftp=ftplib.FTP(hostname)
ftp.login('anonymus', 'anonymus')
print("[*] " + hostname +" Ftp Anonymus Login Successful ")
ftp.quit()
return True
except Exception, e:
print ("[-] " + hostname +" FTP Anonymus Login Failed ")
host = raw_input("Ent... | true |
d1b9ecf4c178dd2bdaf9307572a216a45c794bb4 | udevarakonda/Coding-Projects | /GroceryOrganization/manager.py | UTF-8 | 1,337 | 2.96875 | 3 | [] | no_license | from tkinter import *
from CategoryAskerScreen import CategoryAskingScreen
from ItemChooser import ItemChoosingScreen
from ItemLists import ItemListing
class GroceryManager (object):
def __init__ (self):
self.root = Tk()
self.root.geometry("2000x1000")
self.current_screen = None
... | true |
2c596738ae536f7e215eae93517f1ead6e31c68e | tahabilal/ComputationalGenomics | /Assignment#1/hw1.py | UTF-8 | 1,933 | 3.640625 | 4 | [] | no_license |
from collections import Counter
import re
print("\nDefault file name(InputA) is assigned when it was not entered any file name\n")
input_text = input("Enter a file name (without \".txt\"): ") + ".txt"
if len(input_text) < 1:
input_text = "InputA.txt"
Text = open(input_text)
Text = Text.read()
Text = Text.upper()... | true |
1afc0de658bb1a8dc88bd61907b2b07cc961ac58 | kkolyvek/MooshProcessingTesting | /MooshTracker.py | UTF-8 | 1,034 | 2.546875 | 3 | [] | no_license | """
Moosh Systems 2021
"""
import os
import processImage
import exportImage
import cv2
def main():
VID = "DJI_0001"
BUCKBUNNY = "https://www.rmp-streaming.com/media/big-buck-bunny-360p.mp4"
DRONE_STREAM = "rtmp://192.168.1.2/live/stream1"
cap = cv2.VideoCapture(DRONE_STREAM)
width, height, vid_fp... | true |
4ac3bfc810a21e1e35347b7ec8068840eef4d49e | mveselov/CodeWars | /tests/beta_tests/test_my_first_bug_fixing_kata.py | UTF-8 | 244 | 3.0625 | 3 | [
"MIT"
] | permissive | import unittest
from katas.beta.my_first_bug_fixing_kata import foo
class FooTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(foo(), 42)
def test_instance(self):
self.assertIsInstance(foo(), int)
| true |
012dc947cbd01ad3499e50f59e4bfee9b053d62f | zotochev/VSHE | /week_06/notes_06/notes_06_05_lambda2.py | UTF-8 | 62 | 3.28125 | 3 | [] | no_license | x = [1, 5, 2, 3]
y = list(map(lambda x: x ** 2, x))
print(*y)
| true |
ff15cb11ec8dbd060f5881f9321534e8175b5919 | sbabineau/data-structures | /data_structures/binarytree_tests.py | UTF-8 | 1,633 | 3.46875 | 3 | [] | no_license | import unittest
from binarytree import BinaryTree as Tree
class BinaryTreeTests(unittest.TestCase):
def setUp(self):
self.tree = Tree(7)
def test_insert(self):
self.tree.insert(9)
self.assertTrue(self.tree.contains(9))
def test_reinsert(self):
self.tree.insert(7)
... | true |
61ac88efbcf057f4b7682532a9313516735dc122 | BrendanStringer/CS021 | /Assignment 07.0/grades.py | UTF-8 | 3,747 | 3.75 | 4 | [] | no_license | # Brendan L. Stringer
# CS 021
# Grades.py
# This will read the grades out of an output file and then make a corrosponding letter grade file while printing a histogram of ****
def main():
# Prepare for graceful error exiting
try:
# Start Varibles
Acount = 0
... | true |
be03ffd3f59ca8a3bf5f997c40377aed05340668 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/224/users/4385/codes/1633_2925.py | UTF-8 | 71 | 2.703125 | 3 | [] | no_license | pop1=float(input("digite o total da pop1"))
pop2=print(round(2**pop1))
| true |
ae9470a6497ad09277388dc0d57a543d3ce29419 | artheadsweden/maxedout_decorators | /Timer/test_timer.py | UTF-8 | 277 | 3.703125 | 4 | [] | no_license | from Timer import timer
@timer(3, 5)
def print_greeting(greeting, name):
print(f"{greeting}, {name}!")
@timer(1)
def print_hi(name):
print(f"Hi {name}!")
def main():
print_greeting('Hello', 'Alice')
print_hi('Bob')
if __name__ == '__main__':
main()
| true |
97190c4a1ea3d86280ee2ce88665031f2e52e25a | rafaeldefazio/randomclusteredgraph | /save.py | UTF-8 | 1,906 | 2.5625 | 3 | [] | no_license | import networkx as nx
import matplotlib.pylab as plt
import csv
import numpy as np
import os
from datetime import datetime
class Save:
global cmaps
cmaps = [
'Grey', 'Purple', 'Blue', 'Green', 'Orange', 'Red',
'Yellow','Grey', 'Purple', 'Blue', 'Green', 'Orange', 'Red','Grey', 'Purple', '... | true |
981a82d2faeb76c7e8d6c439f503f15ad175de09 | angeloskath/php-sourceclassifier | /data/train/Python/46 | UTF-8 | 1,005 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
fname = "A-large"
fin = open(fname+".in","r")
fout = open(fname+".out","w")
def gcj_read():
linestr = fin.readline().strip()
return [int(numb) for numb in linestr.split()]
numcases = gcj_read()[0]
def get_lines(grid):
for row in grid:
yield set(row)
for i in range(4):
... | true |
8a722a9dd94e472d37c786f86c8c1ca3dcb3a4aa | KaiyangZhou/deep-person-reid | /torchreid/models/mobilenetv2.py | UTF-8 | 8,387 | 2.546875 | 3 | [
"MIT"
] | permissive | from __future__ import division, absolute_import
import torch.utils.model_zoo as model_zoo
from torch import nn
from torch.nn import functional as F
__all__ = ['mobilenetv2_x1_0', 'mobilenetv2_x1_4']
model_urls = {
# 1.0: top-1 71.3
'mobilenetv2_x1_0':
'https://mega.nz/#!NKp2wAIA!1NH1pbNzY_M2hVk_hdsxNM1NU... | true |
c12883a33729a857c4c927bf6c8250eb0b0a69be | Bwendel26/Jokenpo | /jogadas.py | UTF-8 | 1,762 | 3.703125 | 4 | [] | no_license | from gameSet import gameSet
from gradeJogo import criaGrade
from aindaJoga import aindaJoga
import switchPlayer
from random import randint
from time import sleep #intervalo de decisao
def pensar():
# TIMER
def frasePensar():
print("Pc esta pensando...")
secs = randint(2, 3)
while (secs > 0):
fra... | true |
39796b0f338d9ae83aa014f4de844fec94ce9f8a | sarah-story/shelterbot | /shelters/models.py | UTF-8 | 906 | 2.640625 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Address(models.Model):
number = models.IntegerField()
street = models.CharField(max_length=50)
city = models.CharField(max_length=50)
state = models.CharField(max_length=50)
zip = models.IntegerField()
def __str__(self):
re... | true |
5739d38c39617525c1a3c973fd122fa9d6e92bfe | zhangzhenrui-learn/CPSC2021_python | /batch.py | UTF-8 | 2,901 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import torch.nn as nn
def cal_cnn_batch(train_loader,model,criterion,device,optimizer = None,reg_loss = None,is_train = True):
model.train()
loss_list = []
acc_list = []
confusion_matrix = np.zeros((2,2))
for i,data in enumerate(train_loader,0):
inputs,lab... | true |
ce2b020c02dbe842545e66c9b834b544a7d47730 | dmgolembiowski/BW-Chaos-Thesis-FA2018 | /Graphing/Python/practice1.py | UTF-8 | 970 | 3.359375 | 3 | [] | no_license | #Created By Ana Dalipi
#8/27/2018
#Practice I
import pylab as plt #plots
import numpy as np #mathematical stuff
r=0.9
x=range(200)
x[0]=0.5
for n in range(1,200):
z = x[n - 1];#z is previous x
x[n] = r*z*(1 - z);
#print(x[n])#print results; all points
plt.plot(x,'ro')
###############
r=1.1
x=range(2... | true |
c02d0df3abee755150ea15a72ff2e88a771b6dc4 | vishxm/unsplash-POTD | /base.py | UTF-8 | 783 | 2.96875 | 3 | [] | no_license | # libraries
import os
import requests
from bs4 import BeautifulSoup
# url to get the photo of the day id
url = "https://unsplash.com/"
print("Getting the page https://unsplash.com/ ......")
page = requests.get(url)
soup = BeautifulSoup(page.text, 'html.parser')
print("Getting the ID of photo of the day ..........")
ph... | true |
ff8a7e3b360cb885e5a6f6362f1114efc6fed949 | pardalaco/python-practicas | /exercicis/04positubo o negatibo.py | UTF-8 | 322 | 3.8125 | 4 | [] | no_license | opcion1=int(input("Introduce el primer signo: "))
opcion2=int(input("Introduce el segundo signo: "))
def adivina(opcion1, opcion2):
if opcion1 and opcion2=="+"and"+":
print ("Es positivo")
elif opcion1 and opcion2=="+"and"-":
print("Es negativo")
else:
print("Es negativo")
print("Ek orograma ha finalizado... | true |
896f2586e7b47fda3d7330671425a2a15a3474e2 | juanpanu-zz/PM_DataScience | /Clases/ProgDinamicaEstocastica/Montecarlo/barajas.py | UTF-8 | 1,215 | 3.65625 | 4 | [
"MIT"
] | permissive | import random
import collections
PALOS = ['espada','corazon','rombo','trebol']
VALORES = ['As','2','3','4','5','6','7','8','9','joker','reina','rey']
def crear_baraja():
barajas=[]
for palo in PALOS:
for valor in VALORES:
barajas.append((palo,valor))
return barajas
def obtener_mano(... | true |
09310788dfbdf977c7474bab5249a54178eab3b7 | SonalKhare13/Covid-19_Project | /app.py | UTF-8 | 5,107 | 2.671875 | 3 | [] | no_license | # Flask is a Python web developpement framework to build web applications. It comes with jinja2, a templating language for Python, and Werkzeug, a WSGI utility module.
# PostgreSQL is an open source relational database system which, as its name suggests,
# uses SQL.
# SQLAlchemy is an Object Relational Mapper (ORM), it... | true |
3c4b5b31d205084b8f3e03dbf7e9c330dc4b7513 | Tatenda1Chataira/02_Sports_Quiz | /01_Introduction.py | UTF-8 | 2,608 | 4.21875 | 4 | [] | no_license | def quiz_questions():
return ""
def instructions():
print("**** How to Play ****")
print()
print(" You will start off with 5 points. For every question answered correctly you will gain 2 points."
"For every question awnsered incorrectly you will lose 3 points. You wil... | true |
8f4e5c691ba894ba7b298eb06e6a0b35c6bdf86c | nt4cats/thinking-in-python | /source/func.py | UTF-8 | 350 | 3.8125 | 4 | [] | no_license | class Dog:
def eat(self, food):
print('This dog eats the {}.'.format(food))
class Cat:
def munch(self, food):
print('This cat munches the {}.'.format(food))
def get_munch(self):
return self.munch
d = Dog()
c = Cat()
animal_feed = d.eat
animal_feed('popcorn')
animal_feed = c.get_... | true |
e2a13f5402ba07ff2778764349b319cdc45ecd7a | Evgeniy-Nagornyy/Python_algoritm | /Lesson_2/task_1 21.00.33.py | UTF-8 | 2,263 | 4.0625 | 4 | [] | no_license | #https://drive.google.com/file/d/1U6PAid3r5YFm3V_0_hN62n_gQ9xHyF14/view?usp=sharing
# 1. Написать программу, которая будет складывать, вычитать, умножать или делить два числа.
# Числа и знак операции вводятся пользователем. После выполнения вычисления программа не должна завершаться,
# а должна запрашивать новые данны... | true |
c4aa7de3c936e8bcd347f66b19363dd5faeb838f | dharakyu/HPDS-data-mining | /harvest_google_data.py | UTF-8 | 2,852 | 2.96875 | 3 | [] | no_license | import requests
import json
import googlemaps
import pandas as pd
import csv
import time
def get_cities(filename):
cities = []
with open(filename, 'r') as f:
reader = csv.reader(f)
for entry in reader:
cities.append(entry[0])
cities[0] = "New York"
return cities
def get_place_ids(cities, api_key):
url =... | true |
5ed78efe68eb264025bc1e215811493c91f3cbcf | ash/amazing_python3 | /019-stdin.py | UTF-8 | 97 | 3.1875 | 3 | [] | no_license | # Reading command-line
# arguments
import sys
name = sys.argv[1]
print('Hello, ' + name + '!')
| true |
ca39a0ef9d5821d73edc79173a2d74a3fe06d723 | kuzovkov/python_labs | /7/form_num.py | UTF-8 | 760 | 2.828125 | 3 | [] | no_license | #coding=utf-8
from Tkinter import *
from test import *
root=Tk()
root.geometry('800x600')
root.title('Вопрос num')
i=5
result={}
def send():
global rsp_text
global result
if rsp_text.get()==str(responses_num[i]):
result.update({i:True})
else:
result.update({i... | true |
252499faa40d4ef625440519651665b79eac4d93 | WorshipCookies/RankSVMLoader | /RankSVM_Loader.py | UTF-8 | 7,699 | 2.8125 | 3 | [] | no_license | import itertools
import numpy as np
import sys
import operator
from scipy import stats
import json
from Tkinter import Tk
from tkFileDialog import askopenfilename
def calculateRBF(x_i, x_j, gamma):
square_i = calculateDot(x_i,x_i)
square_j = calculateDot(x_j,x_j)
return np.exp(-gamma*(square_i+square_j-2*... | true |
2083ffd7ab165981934cd8c8ef26ae54e3798c0e | leipzig/gatk-sv | /src/sv-pipeline/02_evidence_assessment/02d_baftest/scripts/BAFpysam.py | UTF-8 | 8,400 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from scipy import stats
import numpy as np
from sklearn import mixture
# calculate the Del statistic given a FME combo in het files
def Deltest(F, M, E, length, crit=0.01, thres1=0.0005):
# if True:
thres1 = min(50 / length, thres1)
if F / length < thres1 and M / length < thres1 \
... | true |
ae3fd080024c73bd040d9967c8556a0c362be7ea | mtedaldi/PyFanControl | /get_ip.py | UTF-8 | 486 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# A simple function to get the IP address of the
# host. You have to use a reachable IP-Address!
# This is to prevent getting 127.0.0.1 as result
#
# (c) Marco Tedaldi <tedaldi@hifo.uzh.ch>, 2014
# License: MIT, http://opensource.org/licenses/MIT
import socket
def get_ip():
s = socket.socket(so... | true |
69a22ad238ecaf63d73d72c5867bf5bb8dacae63 | nikitiwari/Learning_Python | /square.py | UTF-8 | 164 | 4.1875 | 4 | [] | no_license | inp = raw_input("Enter an integer:")
try:
x = (int)(inp)
print "Square root is", x*x
print "Cube root is " ,x*x*x
except:
print "Integer required"
| true |
2f3d2cc0950cedeaad8d210f5eff022114948dde | Zarkrosh/AoC-2018 | /dia25/dia25_p1.py | UTF-8 | 549 | 3.34375 | 3 | [] | no_license | # Advent Of Code: Dia 25
import networkx as nx
from ast import literal_eval
def manhattan((X,Y,Z,T), (X2,Y2,Z2,T2)):
return abs(X2-X) + abs(Y2-Y) + abs(Z2-Z) + abs(T2-T)
# Lee entrada
with open('entradaDia25') as f:
inp = [l.rstrip() for l in f.readlines()]
grafo = nx.Graph()
for i in range(len(inp)):
c = litera... | true |
7d9d7358f1916d3f9f8c97a8b382958da283cad8 | hariketsheth/PyGrams | /sum_of_num.py | UTF-8 | 95 | 3.765625 | 4 | [] | no_license | n = input("Enter the Number: ")
sum1 = 0
while n > 0:
sum1 += n%10
n /= 10
print sum1
| true |
ac6df95da6dc2e80969dc688c490dbfa087804de | mmngreco/py_est2 | /1 - VA DISCRETA /ejercicio 5 estadística 2.py | UTF-8 | 1,104 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ejercicio 5 estadística 2
import numpy as np
# DATOS:
print "ESTADISTICA 2: \n- TEMA 1: \n -- EJERCIO 5\n"
horas = range(1,9)
ni = [20, 38, 53, 45, 40, 13, 5, 36]
pago = [3, 6, 9, 12, 14, 16, 18, 20]
fi = map(lambda x: float(x)/sum(ni), ni)
# esperanza de los pagos:
#... | true |
3fab15f4af0db15216820f75080a82d67330e40e | AlinesantosCS/vamosAi | /Módulo - 1/Módulo 1-5 - Sem condições!/sair.py | UTF-8 | 331 | 3.890625 | 4 | [] | no_license | print('Você usou qual produto para higenizar as mãos antes de sair ?')
print('Alcool em gel - 1')
print('Sabão - 2')
print('Nenhum - 3')
higiene = input('Escolha um número: ')
if (higiene == '1') or (higiene == '2'):
print('Você está pronto para sair de casa!')
else:
print('Tristeza! Volte e lave as suas mãos... | true |
8c9779b0b4401cdba9ca00ed179f1ea7a64a5a3d | ghoulfish/NS | /p/CSCD27-developer/a1/aes.py | UTF-8 | 16,123 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python #
''' Compiler/OS Used: cygwin Win7
Sources Used: BitVector documentation, NIST AES-spec appendix for tests
'''
import sys
import BitVector
import binascii
import copy
rounds = 10 # 128-bit AES uses 10 rounds
''' S-box for use in encryption '''
sbox = [[0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0... | true |
f1b99119cb69229e2ad55d17d7b8132ef6b2e5da | JasmanPall/Python-Projects | /Fibonacci.py | UTF-8 | 336 | 4.21875 | 4 | [] | no_license | # This program prints the fibonacci series upto the desired length of the user
leng = int(input(" ENTER THE LENGTH OF FIBONACCI SERIES: "))
num1 = 0
num2 = 1
if leng>0:
print(num1)
for loop in range(1,leng):
print(num2)
num1,num2=num2,num1+num2
else:
print("U ENTERED LENGTH AS ... | true |
4ac9f3f8566325867d443a43ea537edefecaa878 | joostmeulenbeld/A6_project_software | /inputValue.py | UTF-8 | 2,322 | 3.265625 | 3 | [] | no_license | import wave
from rangeRateClass import rangeRate
def enterValues():
wavReader = None
decision = None
start = -1.0
end = -1.0
carrierFrequency = None
satelliteVelocity = None
Flag=0
while Flag==0:
try:
Flag=1
wavReader = raw_input('Enter file name [filenam... | true |
8be52328385cce45d38971c94eb6a10cd9a1c963 | VishveshPatel/MachineLearning | /SolarPanel_Thermal_faultdetection_kerasConv2d/Cnn2_withStructure.py | UTF-8 | 3,161 | 3 | 3 | [] | no_license | # Importing the Keras libraries and packages
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.models import load_model
def Cnn_layers(training_set, test_set):
# Initialisin... | true |
fcf4bba8e6cc9ab237a462c365d9b377b43ca19e | Ntaylor1027/Python-InterviewPrep | /Chapter 5 Arrays/IncrementByOne.py | UTF-8 | 1,137 | 3.8125 | 4 | [] | no_license | import unittest
"""
Book version
Runtime: O(n)
Space: O(1)
"""
def increment_by_one(A):
# Iterate backwards
for i in range(len(A)-1, -1, -1):
# Add 1
A[i] += 1
# If carry over
if (A[i]) == 10:
A[i] = 0
# If first digit is 10
if i... | true |
413f0b1b704f3859ddb795a7c7b50353f7909156 | e-dzia/hearthstone | /simulator/main.py | UTF-8 | 3,008 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import datetime
import os
import sys
import numpy as np
import pandas as pd
from fireplace import cards, logging
from fireplace.exceptions import GameOver
import mcts.mctstree as mctstree
from research.saver import SAVE_PATH, create_if_not_exists, parse_to_dir_name, parse_to_file_name
from simul... | true |
bad9babf21f70393afba7e5ba0175f1145d7fd17 | Arrowheadahp/Contests-Challenges-and-Events | /Codechef 2019/April Lunchtime 2019/attendance.py | UTF-8 | 390 | 2.953125 | 3 | [] | no_license | for _ in range(input()):
n=input()
fset=set()
dset=set()
A=[]
for _ in range(n):
name=raw_input()
A.append(name)
f=name.split()[0]
if f in fset:
dset.add(f)
else:
fset.add(f)
for i in A:
first=i.split()[0]
if fir... | true |
d7587a579e67290958935263960d841752923b27 | dariadec/strategia | /strategia.py | UTF-8 | 330 | 2.59375 | 3 | [] | no_license | from jednostki.rycerz import Rycerz
from jednostki.lucznik import Lucznik
def main():
p = Rycerz()
print(p)
p.maszeruj(10)
print(p)
p.atakuj()
print(p)
l = Lucznik()
print(l)
l.maszeruj(20)
print(l)
l.atakuj()
print(l)
if __name__ == '__main__':
... | true |
aa3682683b701113c4671f929366871a82f121f1 | mleone18/CS550-FallTerm. | /bank.py | UTF-8 | 855 | 4.125 | 4 | [] | no_license | class Bank:
def __init__(self, account, balance, pin, isOpen):
self.account = account
self.balance = balance
self.pin = pin
self.isOpen = True
def closed(self):
if self.isOpen == True:
print("Account is open. Balance: " + str(self.balance))
else:
print("Account closed.")
def deposit(self, amount... | true |
44919f442eec6f20a2d154d5ef0f321b234bf9ae | janakaufm/stockx-sneakers-prices | /src/scraper.py | UTF-8 | 3,296 | 2.796875 | 3 | [] | no_license | import requests
import argparse
import csv
import datetime
import os
#CLI definition
parser = argparse.ArgumentParser(description="Retrieve last sales from StockX")
parser.add_argument("--keywords", type=str, nargs="+", help="Keywords of the shoe you want to retrieve sales of", required=True)
args = parser.parse_args... | true |
66d708cb54b1233eb7e72d7995cdd07e90abdb36 | SINHOLEE/Algorithm | /python/beckjun/ram.py | UTF-8 | 1,180 | 2.640625 | 3 | [] | no_license | def memory_check(function):
import psutil
import os
def wrapper():
memory_usage_dict = dict(psutil.virtual_memory()._asdict())
memory_usage_percent = memory_usage_dict['percent']
print(f"BEFORE CODE: memory_usage_percent: {memory_usage_percent}%")
# current process RAM usage... | true |
cb38caa5a68afe980f06404d83e6a16e8b154b2e | JopvHest/Theorie-Project- | /code/functions/MinChainLenNeeded.py | UTF-8 | 675 | 3.1875 | 3 | [] | no_license | # Authors: Brent van Dodewaard, Jop van Hest, Luitzen de Vries.
# Heuristics programming project: Protein pow(d)er.
# Determines if a remaining chain can reach a particular spot of an available fold based on the manhatten distance.
def chain_can_reach_spot(amino_coordinates, spot_coordinates, remaining_aminos):
#... | true |
b75b9baeff8e38b7f2ae26e53cdfc54ff7390b5d | VarcoChuck/SimplePythonCode | /simpleCalculator - V2.py | UTF-8 | 2,888 | 4.1875 | 4 | [] | no_license | from __future__ import division
from math import sqrt
from math import sin
from math import cos
import os
def Addition(a,b):
return a + b
def Decrease(a,b):
return a - b
def Division(a,b):
return a / b
def Multiplication(a,b):
return a * b
def Involution(a,b):
return a ** b
def TRD(a,b):
return a % b
def C... | true |
71dab406c02b7eea0bda0e62cc1e03ef9892205a | jsl12/AoC-Solutions | /2018/day6.py | UTF-8 | 3,054 | 3.015625 | 3 | [] | no_license | import numpy as np
import re
REGEX = re.compile('(\d+), (\d+)')
def parse(line):
match = REGEX.match(line.strip())
assert match is not None
return int(match.group(2)), int(match.group(1))
def create_space(input, value=0, offset=3):
max_x = max([c[0] for c in input]) + offset
max_y = max([c[1] for... | true |
767113865a6ee78af0ccb85d6451f9bedea713d2 | AzhanL/challenge-jmir | /lib/collector.py | UTF-8 | 3,659 | 3.421875 | 3 | [] | no_license | import logging
import requests
from requests import Response
from lib.author import Author
from typing import List
class InfoCollector(object):
"""
Collects information from various data sources: CrossRef, Pubmed
Attributes:
title (str): Title of the work
authors (List[Author]): Array ... | true |
ebee199d94b22031cb13c05223b8183e856ceee0 | yzheng21/Leetcode | /leetcode/two_pointer/Remove Duplicate Numbers in Array.py | UTF-8 | 351 | 3.1875 | 3 | [] | no_license | import collections
class solution:
def del_duplicates(self,nums):
dict = collections.defaultdict(set)
for i,item in enumerate(nums):
if item not in dict:
dict[item] = 1
return len(dict),dict
duplicate = [2, 4, 10, 20, 5, 2, 20, 4]
len,dict = solution().del_duplic... | true |
f72d9432207cb6f2e6f62abb73061aba45ca53cb | skaparelos/ObliPay-Server | /src/service.py | UTF-8 | 8,564 | 2.609375 | 3 | [] | no_license | import acl
import crypto
import database
def ACLSpend(params, encoded):
(h0gamma, h1gamma, ggamma, zeta1, proof, coin) = crypto.unmarshall(encoded)
publicParams = (h0gamma, h1gamma, ggamma, zeta1)
if crypto.verifySpend(params, publicParams, proof) == False:
return "Couldn't verify coin spend"
... | true |
61e9f814d3e11060209f46e53650dc63e69e5ee8 | LJamesHu/Galvanize-Miniquizzes | /Week_6/scrape_snacks.py | UTF-8 | 1,097 | 2.671875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
# baseurl = 'http://www.snackdata.com'
# r = requests.get(baseurl)
# soup = BeautifulSoup(r.content, 'html.parser')
# for link in soup.find(id='indexholder').find_all('a'):
# r2 = requests.get(baseurl + link['href'])
# soup2 = BeautifulSoup(r2.content, 'html.pars... | true |
13fa38180777cf7df6431d2c463935f52780bcda | ZhuRonghui/program | /draw.py | UTF-8 | 110 | 3.171875 | 3 | [] | no_license | import turtle as t
t.pensize(5)
for i in range(0, 1440):
t.forward(1)
t.left(0.25)
t.done()
| true |
270643d55a66e84b857186b30b95a483c0216caa | jcpatrick/PythonBaseCode | /0-1基础部分/老王打枪.py | UTF-8 | 2,815 | 3.96875 | 4 | [] | no_license | class Person(object):
def __init__(self, name):
self.name = name
self.gun = None
def setup_zidan(self, danjia, zidan):
"""将子弹安装到枪中"""
danjia.add_zidan(zidan)
def setup_danjia(self, gun, danjia):
"""将弹夹安装到枪中"""
gun.setup_danjia(danjia)
def set_gun... | true |
4fa541e817e0e0443202dced39d21354cc53dd86 | naseeihity/leetcode-daily | /search/105.construct-binary-tree-from-preorder-and-inorder-traversal.py | UTF-8 | 716 | 3.296875 | 3 | [] | no_license | #
# @lc app=leetcode id=105 lang=python3
#
# [105] Construct Binary Tree from Preorder and Inorder Traversal
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right... | true |
4950c48596478e37c965e09d023c52c2372214be | RiadAdel/frontendmasters-python | /python fundamentals/lists.py | UTF-8 | 472 | 4.25 | 4 | [] | no_license | # list: collection of similar items
# mixed
l = [1, "string", True]
# create list [4,4,4,4,4]
l = list([4] * 5)
l = [4] * 5
# get size
len(l)
# accessing
l = ["a", "b", "c", "d", "e"]
print(l[:3]) # [a,b,c]
print(l[::2]) # [a,c,e]
print(l[2]) # c
# you can add comma after last elm
l = [
1,
2,
3,
]
... | true |
5ef1881bb40ec095cd2ca922b7be82af67ce3284 | shenwei0329/rdm-flasky | /DataHandler/date.py | UTF-8 | 1,434 | 2.953125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
#
class DateObject:
def __init__(self):
self.date_link = {}
self.sum_counter = 0
def add(self, date, obj):
if date not in self.date_link:
self.date_link[date] = {}
_obj = obj
if ',' in obj:
_obj = obj.split(',')
... | true |
1d1b73e17d71814ef19fd78fc39da73bc1124c65 | MatheusKlebson/Python-Course | /PRIMEIRO MUNDO - FIRST WORLD/Convertendo temperatura - 14.py | UTF-8 | 238 | 4.03125 | 4 | [
"MIT"
] | permissive | #Exercício Python 014: Escreva um programa que converta uma temperatura digitando em graus Celsius
# converta para graus Fahrenheit.
c = float(input("Temperatura em celsius: "))
f = c * 9/5 + 32
print("Convertendo...",f,"Em Fahrenheit")
| true |
240df995bd5da18dec8f66e1398807825ec95c8f | taazi1101/Public | /P2P/p2p_serv-logging.py | UTF-8 | 1,391 | 2.78125 | 3 | [] | no_license | import socket
import time
import threading
def start_serv(sock,ip,port):
sock.bind((ip,port))
sock.listen()
conn, addr = sock.accept()
print("connection from: " + addr[0])
return conn,addr
def start_conn(sock,ip,port):
sock.connect((ip,port))
return sock
def send(sock, data... | true |
6b5d019670b63735b0fd327b30012c9e25673dd5 | green-fox-academy/kitta11 | /datascience/practice/hourglasses.py | UTF-8 | 332 | 3.078125 | 3 | [] | no_license | testarray = [
[1, 1, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0],
[0, 0, 2, 4, 4, 0],
[0, 0, 0, 2, 0, 0],
[0, 0, 1, 2, 4, 0]
]
pattern = [
[1, 1, 1],
[0, 1, 0],
[1, 1, 1]
]
for i in range(len(testarray)-3):
for y in range(len(pattern)-1):
print(testarray[i][y], ... | true |
e7c6d7979ef869ef7c625532c3eb98d153d10b12 | mahavivo/Python | /Python-cookbook-2nd/cb2_02/cb2_2_6_sol_2.py | UTF-8 | 153 | 2.5625 | 3 | [] | no_license | import re
re_word = re.compile(r"[\w'-]+")
for line in open(thefilepath):
for word in re_word.finditer(line):
dosomethingwith(word.group(0))
| true |
41528b29a334e1b180c910175eaf09370c72325a | LonelyProgrammer/Microservices | /AWSChaliceDemo/todoListBlog/users.py | UTF-8 | 3,562 | 2.953125 | 3 | [] | no_license | import os
import json
import getpass
import argparse
import hashlib
import hmac
import boto3
from boto3.dynamodb.types import Binary
def get_table_name(stage):
# We might want to user the chalice modules to
# load the config. For now we'll just load it directly.
with open(os.path.join('.chalice', 'confi... | true |
72ea4059918a23b6d2b012ffd2e19cd286903d18 | rpmirish12/CP2018 | /A4-Blending/blending.py | UTF-8 | 17,238 | 3.75 | 4 | [] | no_license | """ Pyramid Blending
This file has a number of functions that you need to fill out in order to
complete the assignment. Please write the appropriate code, following the
instructions on which functions you may or may not use.
References
----------
See the following papers, available on T-square under references:
... | true |
c0115d633c90fa007be81cdcaa0e2329ce6ea8a0 | ld269440877/workspace | /spider_dot/myspider.py | UTF-8 | 833 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
# _*_ coding: UTF-8 _*_
"""
@project = spider_dot
@file = myspider.py
@author = Administrator
@create_time = 2019/10/18 10:02
software: PyCharm
"""
import requests
import re
# etree用于Xpath进行定位功能
from lxml import etree
# 贴吧网址以字符串格式赋值在变量url
url = "http://tieba.baidu.com/f?kw=%E4%B8%AD%E5%9B%BD%E7%9F%B3... | true |
46bd5272063fe6417cf057980d6fea1ebea0257a | simranmakandar/DSCI-553 | /Assignment 1/simranmakandar_task1.py | UTF-8 | 2,725 | 3.359375 | 3 | [] | no_license | import re
import json
import sys
from pyspark import SparkContext
from pyspark.sql.types import IntegerType
commandArgs = sys.argv
if (len(commandArgs) != 7):
print("Check if the number of arguments passed are = 7.")
print("Usage of command line arguments: spark-submit task1.py review.json output_file <stopwo... | true |
26d0d28fbd3799198bf5e041c360018bd0ef81f9 | attamatti/EPU_shot_tracking | /parse_EPU_metadata_DAimage.py | UTF-8 | 750 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import xml.etree.ElementTree as ET
import sys
def parse_xml_DA(xml_file):
root = ET.parse(xml_file).getroot()
ABXYZ = []
beamshift = []
for i in root.findall(".//{http://schemas.datacontract.org/2004/07/Fei.SharedObjects}Position/"):
print(i,i.text)
ABXYZ.append(i... | true |
c030befa231024faaf73486af1b24b9b1b54fb24 | RedVeil/Dividenden_trade_flask | /create_indicator.py | UTF-8 | 5,590 | 2.75 | 3 | [] | no_license | import sqlite3
import build_packages as packages
class Company:
def __init__(self, ticker, name, company_id, average_high, average_medium, average_low, median_high, median_medium,median_low, bad_trades, severe_trades, great_trades, start_date, end_date):
self.ticker = ticker
self.nam... | true |
002ba311058515d3a31873e190f0995f5ddcaf6c | GustavoPMoreira/My_Exercises- | /Python/Exercícios-URI/Crise de energia.py | UTF-8 | 815 | 3.515625 | 4 | [] | no_license | ''' 1031 '''
def criar_regioes(N,regioes):
for i in range (1,(N+1),1):
regioes.append(i)
def shut_down(regioes,m):
i=0
while i<=(len (regioes)-1):
regioes[i]=0
i=i+m
i=0
while i<=(len (regioes)-1):
if regioes[i]==0:
del (regioes[i])
else:
... | true |
1896b7b0f469710d17c2b0c40c465d3242d1655a | nickylimjj/Python-Projects | /6.00.1x files/sequence counting.py | UTF-8 | 180 | 3.828125 | 4 | [] | no_license | #bob counting program
s='abobasdadbobobs'
bobcount=0
for x in range(len(s)):
if s[x:x+3] == 'bob':
bobcount+=1
print('Number of times bob occurs is: '+str(bobcount)) | true |
e88fb8a648b0ef923f962caea1897e65212c0336 | HarvestGuo/DeepLearn | /ch03/softmax.py | UTF-8 | 138 | 2.625 | 3 | [] | no_license | import numpy as np
def softmax(a):
c=np.max(a)
exp_a=np.exp(a-c)
sum_exp_a=np.sum(exp_a)
y=exp_a/sum_exp_a
return y | true |
1216281811aa36573055e22a939ea900afce4370 | ntc-netmesh/netmesh-rfc6349-client | /netmesh_rfc6349_app/main/utils/netmesh_location.py | UTF-8 | 2,118 | 2.578125 | 3 | [] | no_license | import subprocess
import json
import re
def getRawGpsCoordinates():
location_commands = [
# Works on Android 12
"""adb shell dumpsys location | grep "last location=" | awk -F'=Location' '{print $2}' | grep -Po "(?<=\[).*?(?<=\])" | jq -R 'split(" ")|{mode:.[0], latitude:.[1]|split(",")[0], longitud... | true |
0e1604f96a2bc422072ac1c38045890df57cebb4 | yuyuyuyushui/s14 | /day9/条件变量淘同步.py | UTF-8 | 1,075 | 3.03125 | 3 | [] | no_license | import threading, time
from random import randint
class Producer(threading.Thread):#生产者
def run(self):
global L
while True:
var = randint(1, 100)
print('生产者', self.name, ":append"+str(var), L)
if lock_acqui.acquire(): # 加锁
L.append(var)
... | true |
dda4683d697ff67605a99ae281a4afddf50a4b33 | CREATORGAME19/Minesweeper | /Minesweeper.pyw | UTF-8 | 12,342 | 2.890625 | 3 | [] | no_license | import tkinter as tk
import time
import random
import tkinter.messagebox
# Minesweeper V1.1 by Calin Novogreblevschi
def startgame2():
global sizetitle
global sizelabel
global sizescale
global minelabel
global minescale
global configurebutton
global start1
start1 = False
... | true |
6818231e8a5655ff377c8d443c7bb98d08a7a689 | Maltseva-Anastasia/polytech-diskrete-2020 | /Doynikov Ilia/Kapr/PyCap.py | UTF-8 | 2,173 | 3.59375 | 4 | [] | no_license | # num to array
def num2arr(num):
arr = []
while num != 0:
arr.append(num % 10)
num = num // 10
arr.reverse()
return arr
# array to number
def arr2num(number_list):
res = 0
deg = len(number_list) - 1
for numeral in number_list:
res += numeral * (10 ** deg)
deg... | true |
f49ac7e32ae918abffc843317188a7717654f8e9 | uc3mJM/CMSHeavyAttack | /RedisBloomAttack.py | UTF-8 | 2,501 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import redis
import random, string
import sys
from redisbloom.client import Client
redis_host = "localhost"
redis_port = 6379
redis_password = ""
def randomword(length):
letters = string.ascii_letters.join(string.digits);
return ''.join(random.choice(letters) for i in rang... | true |
bb94839bb3ac228622035fbee900f60aeff29d07 | Ashikoki/project_euler | /Problem7.py | UTF-8 | 512 | 3.375 | 3 | [] | no_license | #!/usr/bin/python
from math import sqrt, ceil
def test_prime(num):
if num==1:
return False
elif num==2:
return True
elif num==3:
return True
else:
for i in range(2,ceil(sqrt(num))+1):
if num%i==0:
return False
return True
def find_pr... | true |
39be2fd47eb5cc3268814b9fdd58a07ca4d7e85b | eNorris/tfx | /pycharm_project/geo/combinatorialbody.py | UTF-8 | 1,710 | 3.09375 | 3 | [] | no_license | __author__ = 'Edward'
class CombinatorialBody(object):
nextid = 1
def __init__(self):
super(CombinatorialBody, self).__init__()
self.id = CombinatorialBody.nextid
CombinatorialBody.nextid += 1
self.comment = ""
#self.visualizer = None
#self.color = (0, 0, 0)
... | true |
9272c8131648b0251b533ca20c899cd119344237 | leinian85/year2019 | /month05/day02/02_plot.py | UTF-8 | 1,546 | 3.140625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as mp
x = np.linspace(-np.pi, np.pi, 1000)
y = np.sin(x)
cosx = np.cos(x) / 2
# 设置坐标轴的范围
# mp.xlim(0,np.pi)
# mp.ylim(0,1.5)
# 修改x轴的刻度文本
values = [-np.pi, - np.pi / 2, 0, np.pi / 2, np.pi]
texts = [r"$-\pi$",r"$-\frac{\pi}{2}$","0","π/2","π"]
mp.xticks(values, texts)
# 修改坐... | true |
0890edec23450b40e5cd1f3617ad0adbbb3edec8 | AWangHe/Python-basis | /22.MySQL/4.MYSQL与Python交互/4.数据库更新操作.py | UTF-8 | 415 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pymysql
db = pymysql.connect("localhost","root","root","sunck", charset="utf8")
cursor = db.cursor()
#建表
sql = 'update car set money = 1 where name = "奥迪"'
try:
cursor.execute(sql)
db.commit()
print("成功")
except:
#如果提交失败,回滚到上一次数据
db.rollback()
print("失败")
cur... | true |
8371ea4e7dcb84ea43b1004357e68414f1d5568a | duraisamykarthi/Text_Classification_using_Movie_Reviews | /Text Classification.py | UTF-8 | 2,371 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 3 05:54:06 2019
@author: KARTHI
"""
import random
import nltk
from nltk.corpus import movie_reviews
# Build of list of documents
documents = [(list(movie_reviews.words(fileid)), category)
for category in movie_reviews.categories()
... | true |
8e5b423a01e7001e48688e3181a0c1598ecac8c7 | JonathanGarizado/ProgramVentaReto7 | /funciones.py | UTF-8 | 15,182 | 3.375 | 3 | [] | no_license | """ Reto Semana 7
incorpora al modulo funciones.py
Jonathan Garizado Toscano
Universidad de Caldas
Junio 22-2021
"""
#---------------- Zona librerias------------
import matplotlib.pyplot as plt
import datetime as dt
import pandas as pd
## Diccionarios Globales
dicc_productos = {}
dicc_venta = ... | true |
6d08a64765c6cbd07cbb979f194dfa5e616c0eb2 | erictsui98/Final-Year-Project | /utils.py | UTF-8 | 5,706 | 2.609375 | 3 | [] | no_license | #%% INIT
import json
import random
import os
import numpy as np
import re
import time
import os
from zipfile import ZipFile
import torch
from transformers import AutoTokenizer, AutoModelForMaskedLM, BertModel
#%% SAMPLING
"""
sample_idx = random.sample(np.arange(0, len(df)).tolist(), 3000)
df = [df[idx] for idx in sa... | true |
707e85498c6e5506911a0ced5f037a37dc4cee60 | justinh99/self-driving-program | /test.py | UTF-8 | 9,500 | 3.46875 | 3 | [] | no_license | from Motor import *
from servo import *
from Ultrasonic import *
from Led import *
import time
motor = Motor()
servo = Servo()
ultrasonic = Ultrasonic()
led=Led()
def check_distance():
#distance = integer
distance = ultrasonic.get_distance()
return distance
def speed_control():
try:
servo.set... | true |
c3a4611c701dcd1cbf662e40f5d128e58afb18c2 | LijiAlex/oneNeuron_pypi | /src/utils/all_utils.py | UTF-8 | 4,390 | 2.984375 | 3 | [
"MIT"
] | permissive | """
author : Liji Alex
email : liji.alex@gmail.com
"""
import os
import joblib
import pandas as pd
from oneNeuron.perceptron import Perceptron
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
import logging
import os
#from oneNeuron.perceptron import Perceptron
logging_s... | true |
04f91926820b4968e2914aca0877c4453f2a983a | staceyj118/Food-Recalls | /Project3/test.py | UTF-8 | 1,956 | 3.21875 | 3 | [] | no_license | # Import Module
import json
import requests
# Import our pymongo library, which lets us connect our Flask app to our Mongo database.
import pymongo
# Create connection variable
conn = 'mongodb://localhost:27017'
# Pass connection to the pymongo instance.
client = pymongo.MongoClient(conn)
# Connect to a database. W... | true |
43373bafd2ff4cf9f73a92a04665e6db4711670b | sweet-home-of-python/Pythonicus | /step_by_step/ebu1.py | UTF-8 | 1,345 | 2.78125 | 3 | [] | no_license | import pygame
import time
from pomoshnik_udavu import *
x3,y3 = x2,y2
x4,y4 = x,y
while Play:
sc.fill(WHITE)
pygame.draw.rect(sc, black, (x,y,20,20))
pygame.draw.rect(sc, black, (x2,y2,20,20))
pygame.display.update()
for i in pygame.event.get():
if i.type == pygame.QUIT:
Play = ... | true |
8ceaf53540f58e72e9cd3d70ee5864b584b23982 | johnnydevriese/wsu_courses | /watkins_math448/assignment3.py | UTF-8 | 3,236 | 3.609375 | 4 | [
"MIT"
] | permissive | import scipy.optimize as optimize
import numpy as np
# **************** problem #1 ******************
def func(x):
return np.cos(x)**2 + 6 - x
def f(x):
return np.power(x, 2) + 6.0 * x + 4
def f_prime(x):
return 2.0 * x + 6.0
# 0<=cos(x)**2<=1, so the root has to be between x=6 and x=7
print(optimize... | true |