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 |
|---|---|---|---|---|---|---|---|---|---|---|
6cd6b022c6647945ea093b6485884c925e3fdc8f | baldassarreFe/dd2424-deep-learning | /lab3/gradientchecking.py | UTF-8 | 14,802 | 2.828125 | 3 | [] | no_license | from tqdm import tqdm
from datasets import CIFAR10
from initializers import *
from layers import *
from network import Network
def compute_grads_for_matrix(one_hot_targets, inputs,
matrix, network: Network):
# Initialize an empty matrix to contain the gradients
grad = np.empty_li... | true |
a3c4626ed5309753b7225ae11d9c9b0b989eaabb | TheSpeedX/codex | /python/problem_27.py | UTF-8 | 651 | 3.6875 | 4 | [] | no_license | import math
def isPrime(n):
if n <= 1:
return False
if n == 2:
return True
for i in range(3, math.floor(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
primes = []
for i in range(1000):
if isPrime(i):
primes.append(i)
longest = 0
largestA... | true |
f712e52b2772b1ff55bad5290d52f2105827ef91 | masskonfuzion/pymkfgame | /mkfmath/vector.py | UTF-8 | 6,277 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive | #############################################################################
# Copyright 2016 Mass KonFuzion
#
# 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/l... | true |
8c8c28722393a3f665d77de8d9422d93f9ee22f6 | harshitanand/play-with-python | /EmbibePythonGuruAssignment/parse.py | UTF-8 | 955 | 2.546875 | 3 | [] | no_license | import pyparsing as pp
questionspreamble = pp.Word(pp.alphanums + " \ \n") ("questionspreamble")
questionSectiontype = pp.Word(pp.alphas + " " + "\n")("questionSectiontype")
qno = pp.Word("\n"+pp.nums + ". ")("qno")
questioninfo = pp.Word(pp.alphanums + " ")("questioninfo")
opt = pp.Word("(" + pp.alphas +")")("opt")
a... | true |
f71dee83178f049b60596a4185afbcb9455875ee | hongxchen/algorithm007-class01 | /Week_09/G20200343040019/LeetCode_5_0019.py | UTF-8 | 769 | 2.890625 | 3 | [] | no_license | class Solution:
def longestPalindrome(self, s: str) -> str:
# 中心扩展
def check(s, i, j):
res = ""
while i>=0 and j<len(s):
if s[i] == s[j]:
res = s[i:j+1]
i-=1
j+=1
else: ... | true |
0d4ce774b6df6e68e91fb8725f43466cc70b94de | owyaggy/azhang21 | /CW1pt2.py | UTF-8 | 943 | 4.15625 | 4 | [] | no_license | #Shriya Anand and Angela Zhang
# SoftDev
# Classwork- Class Names
# POW WOW SUMMARY: When you call the printName() function, it asks you which period you want the student from. Originally, the code would then provide a random student from the list; after talking to my partner, however, we have changed it so that the us... | true |
cd70d292f5640b947f4ebc93d83cd894e03d1f41 | cclamb/of-controllers | /bin/baresshd.py | UTF-8 | 637 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
from mininet.node import Host
from mininet.util import ensureRoot
ensureRoot()
print 'creating nodes...'
h1, root = Host('h1'), Host('root', inNamespace = False)
print 'creating links...'
h1.linkTo(root)
print 'configuring...'
h1.setIP('10.0.0.7', 8)
root.setIP('10.0.0.9', 8)
prin... | true |
0a591dd0a71a0d9158ad5808a1c7d861da22a1b6 | Elegant-Smile/PythonDailyQuestion | /Answer/ jiajikang(Jjk)/20190612_调整数组奇数和偶数的位置(奇数在前偶数在后,相对位置不变):方法四:python包.py | UTF-8 | 1,169 | 3.859375 | 4 | [] | no_license | """
author:jjk
datetime:2019/3/29
coding:utf-8
project name:Pycharm_workstation
coding:utf-8
Program function:
20190612
提高题:
输入一个整数数组,实现一个函数来调整该数组中数字的顺序,
使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变。
"""
def reOrderArray(array):
odd, even = [], []
for i in array:... | true |
b16a9543162c15d80b46bdfbdc4aad6181d698ad | bjuvensjo/scripts | /vang/bitbucket/get_branches.py | UTF-8 | 1,802 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import argparse
from sys import argv
from vang.bitbucket.api import get_all
from vang.bitbucket.utils import get_repo_specs
from vang.core.core import pmap_unordered
def do_get_branches(repo_specs, branch="", max_processes=10):
return pmap_unordered(
lambda s: (
s,
... | true |
bb542870cfb82fb26ed600a12712c4911f21e2e5 | riccardocadei/deeplearning-framework | /dataset.py | UTF-8 | 972 | 3.09375 | 3 | [
"MIT"
] | permissive | import torch
import math
import matplotlib.pyplot as plt
def generate_dataset_disk(n=1000, one_hot_encoding=True, plot=True):
"""
Generate a dataset of n points in [0,1]^2 with label equal to 0
if outside the disk of radius 1/sqrt(2*pi) and 1 inside
"""
input = torch.empty(n,2).uniform_(0,1)
c... | true |
c0bbf9da0012023717bbfba6f7a8cf4a0961d138 | wnz27/fisher | /test/learn_上下文相关知识.py | UTF-8 | 3,800 | 3.71875 | 4 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
# Create by 27
# @Time : 2020/2/27 17:38
__author__ = '27'
from flask import Flask, current_app
app = Flask(__name__)
# 应用上下文 对象 对Flask的封装
# 请求上下文 对象 对Request的封装
# Flask AppContext
# Request RequestContext
# 离线应用、单元测试,需要手动推入Appcontext
# current_app是一直指向_app_ctx_stack栈顶的,request是指向_request_ctx_st... | true |
c09bdb346a8525277fb223f41e50dcc53e45edd4 | jrb26948/legendary-barnacle | /transmitter.py | UTF-8 | 1,107 | 3.15625 | 3 | [] | no_license | #Transmits live video over UDP with JPEG compression
import numpy as np
import cv2
import socket
#Set IP and Port
IP = ""
PORT = 5005
#Initialize webcam with capture resolution
cap = cv2.VideoCapture(0)
cap.set(3,320)
cap.set(4,240)
#Initialize frame count
framecounter = 0
#Loop the Transmission
while(True):
... | true |
ac6f2a2a3d6e8fe210eb9b37f04a534cf546b3d4 | zchen0211/tf-tutorial | /rnn_test/rawrnn_main.py | UTF-8 | 1,751 | 2.953125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import glog as log
if __name__ == '__main__':
# First, we need various cells as basic building blocks
cell_size = 10
cell_lstm = tf.contrib.rnn.BasicLSTMCell(cell_size)
cell_rnn = tf.contrib.rnn.BasicRNNCell(cell_size)
# build an RNN by hand
batch_size = 3
n... | true |
6c07b291690c7c6975ee4fd94eb84eac4bf02d7f | tanth1996/StyleGAN-FaceSpace | /FaceSpace.py | UTF-8 | 19,278 | 2.6875 | 3 | [] | no_license | import av
from os import listdir
from os.path import isfile, join
import pickle
import torch
import numpy as np
import matplotlib.pyplot as plt
from crop_align_face import CropAlignFace
from train_latent_space import FaceLatents, TrainLatentsEnc
from models.stylegan import StyleGAN
from plot_utils import ShowModelOut... | true |
5cdaebf3bf59fbc635678d46d8e9c01527dcffe5 | mors741/python-computer-science-6.00 | /hanoi.py | UTF-8 | 152 | 3.265625 | 3 | [] | no_license | def hanoi(n, s, t, b):
if (n == 1):
print s, "->", t
else:
hanoi(n-1, s, b, t)
hanoi(1,s,t,b)
hanoi(n-1,b,t,s)
| true |
7df1872c83cff890e15fb604dd5b28e28961e9eb | yuan201/PortfolioSite | /utilities/extractsymbols.py | UTF-8 | 660 | 3.15625 | 3 | [] | no_license | import sys
import csv
def extract_symbols(file):
with open(file) as csvfile:
reader = csv.DictReader(csvfile)
symbols = [tran['symbol']+","+tran['name'] for tran in reader]
symbols = set(symbols)
return symbols
def dump_symbols(symbols, file):
with open(file, 'w') as f:
... | true |
0b94ad9699ccb5f1148430672ca807d1020ce9c6 | OrnsteinDragonSlayer/Project_API_WEB | /Project_3/forms/main_form.py | UTF-8 | 644 | 2.546875 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
# главная форма сайта
class MainForm(FlaskForm):
city = StringField('Введите название города (для точности можно указать двухбуквенное название страны, например "Лондон, UK")', validator... | true |
b35d0fb2cd7d9b19c7dac738a020daf87757b2a0 | soufDev/PythonTuto | /StandardLibraries/Maths.py | UTF-8 | 525 | 3.59375 | 4 | [] | no_license | # -*-coding:Latin-1 -*
import math
from fractions import Fraction
import random
print(math.pow(15, 2))
print(math.degrees(2))
print(math.ceil(2.3))
print(math.floor(5.9))
print(math.trunc(5.8))
half = Fraction(1, 2)
quarter = Fraction(1, 4)
print(half)
print(quarter)
print(float(half))
print(half+quarter)
print(Fra... | true |
8bffbe945b740c431be94435f5852f880a8b0924 | kuitang/convbayes | /src/gtm.py | UTF-8 | 5,989 | 2.6875 | 3 | [] | no_license | import numpy as np
import bayespy as bp
from sklearn.preprocessing import normalize
# Fail fast on floating point error.
np.seterr(all="raise")
# But ignore underflow
np.seterr(under="ignore")
# TODO: Remove the observe step; we want to use SVI.
def setup_gtm(docs, K=10, T=100, alpha=1e-6, gamma=1e-6, a=1e-6, b=1e-6... | true |
0024bb53ad4e9fd8a9f2ec83cdd16a3d82bff041 | Kerokan/A5-MachineLearningProject | /display.py | UTF-8 | 2,767 | 3.28125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def plot_hist(dataset):
data, label = dataset[:,:-1], dataset[:,-1]
labeled_0 = data[label == 0.0, :]
labeled_1 = data[label == 1.0, :]
caracteristics = ['Mean of the integrated profile',
'Standard deviation of the integrated profile',
... | true |
7590769df440f3ed18ebb844d10d782578bfe1ec | gaowei-io/Python-little-code | /0.py | UTF-8 | 396 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''Risk2S'''
from PIL import Image, ImageDraw, ImageFont
def qq_num():
num = str(4)
img = Image.open('./qq.png')
h, l = img.size
font = ImageFont.truetype('./arial.ttf', 40)
draw = ImageDraw.Draw(img)
draw.text((h * 0.8, l * 0.05), num, (255, 33, ... | true |
1e30e88c79c0941f93ce4239a74eb38d4dcd02f5 | dtekluva/first_repo | /datastructures/ato_text.py | UTF-8 | 1,616 | 4.15625 | 4 | [] | no_license | # sentence = input("Please enter your sentence \nWith dashes denoting blank points :\n ")
# replacements = input("Please enter your replacements in order\nseperated by commas :\n ")
# ## SPLIT SENTENCE INTO WORDS
# sentence_words = sentence.split(" ")
# print(sentence_words)
# ## GET CORRESPONDING REPLACEMENTS
# rep... | true |
387ea176738c1654438d284c481998bbe152bfa0 | rajeevranjan1/Python | /Harry/star_rectangle.py | UTF-8 | 215 | 3.46875 | 3 | [] | no_license | '''File for printing star pattern'''
def starRectangle(n):
print('* ' * n,'\b','*',sep='')
for i in range(2,n):
print('*',' '*(2*n-4),'*')
print('* ' * n,'\b','*',sep='')
starRectangle(18)
| true |
d1a68fbadd62a05c4b3188cb93b0fcf307d5a33b | akab/ConvNet | /utilities.py | UTF-8 | 1,128 | 2.796875 | 3 | [] | no_license | import os
def video2images(src, train_path=r'data\images', test_path=r'data\test_images', factor=2):
"""
Extracts all frames from a video and saves them as jpg
https://github.com/thatbrguy/Pedestrian-Detection/blob/master/extract_towncentre.py
:param src:
:param train_path:
:param test_path:
... | true |
661cce24eea5c03f49dea87ceace7a3396c547a2 | mszmqp/talirt | /pyedm/model/irt/_uirt_lib.py | UTF-8 | 3,930 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2014 Hal.com, Inc. All Rights Reserved
#
"""
模块用途描述
Authors: zhangzhenhu(acmtiger@gmail.com)
Date: 2018/6/24 16:46
"""
import numpy as np
import numexpr
def add_bias(X: np.ndarray):
"""
在输入的array后面增加一列常数1
Parameters
----------
X
... | true |
91757e7e0146636975e7a46367fa6d13faca0bf7 | ROAD2018/wav2mov | /wav2mov/core/data/raw_datasets.py | UTF-8 | 6,106 | 2.96875 | 3 | [] | no_license | """Raw Datasets Classes : Grid and Ravdess"""
import os
from abc import abstractmethod
from collections import namedtuple
from tqdm import tqdm
from wav2mov.core.data.utils import get_video_frames,get_audio,get_audio_from_video
SampleContainer = namedtuple('SampleContainer',['audio','video'])
Sample = namedtuple('Sa... | true |
17e9a4deb8b9fa15b0a8dd6030c784c9af22e980 | supermouette/adventofcode2020 | /day8/fabrice.py | UTF-8 | 1,161 | 3.28125 | 3 | [] | no_license | with open("input.txt", "r") as f:
lines = [line.split(" ") for line in f.readlines()]
def execute(lines):
acc = 0
visited = set()
i = 0
while i not in visited and i+1 != len(lines):
visited.add(i)
if lines[i][0] == "jmp":
i += int(lines[i][1])
else:
... | true |
ea5377c1e99413e8f84ec4a760f3508800b9964b | MuraliMR259/50-Days-code | /day17-a.py | UTF-8 | 210 | 3.71875 | 4 | [] | no_license | n=input("enter the number :")
odd=0
even=0
for i in range(len(n)):
if(i%2==0):
even+=int(n[i])
else:
odd+=int(n[i])
if((odd-even)==0):
print("yes")
else:
print("no")
| true |
eebff7f62de40393d6ef6cb96a57667dbccd55c8 | hansuho113/AlgorithmBook | /ch4_structure_module/414_hello.py | UTF-8 | 164 | 2.90625 | 3 | [] | no_license | hello = "hello"
def world():
return "world"
if __name__ == '__main__':
print(f"{__name__} 직접 실행됨")
else:
print(f"{__name__} 임포트됨") | true |
8f824eb8c6dd4a4392ab446b45805e45131fb2e8 | metodiem/Programming-Algorithms-and-Data-Structures | /CW13.py | UTF-8 | 1,875 | 3.671875 | 4 | [] | no_license | class Vertex:
def __init__(self,v):
self.v = v
class Graph:
vertices = {}
edge_matrix = []
label = []
def add_vertex(self,vertex):
self.label.append(vertex.v) #stores the label of the vertex
self.vertices[vertex.v] = len(self.vertices) ... | true |
8f5f32e1d31b152f0bdeedda8b02c2dc33616865 | sousoul/PARIMA | /Preprocess/ObjectTrack/centroidtracker/centroidtracker.py | UTF-8 | 7,605 | 3 | 3 | [
"MIT"
] | permissive | # import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
import math
class CentroidTracker():
def __init__(self, imsize,R, maxDisappeared=50):
# initialize the next unique object ID along with two ordered
# dictionaries used to keep track o... | true |
b22e255106c1cbd967d5bd1d402d49be47ce8721 | axim1/LABS | /Python/factorial.py | UTF-8 | 551 | 4.15625 | 4 | [] | no_license | # Starting Out with Python (4th Edition).
# Tony Gaddis.
# Page 227.
# Programming Exercise.
# Q 12. Calculating Factorial of a Number.
print("Factorial: n! = n(n-1)(n-2)(n-3)...")
print("Enter the number.")
n = int(input("n = "))
if n >= 0:
# since n! = n(n-1)(n-2)(n-3) and n! = n(n-1)!;
# so n! = n(n-1)(n-2... | true |
cd6d139937cf2408b6a351b8c270489c665ed3bb | pablofleonhart/ACO_RMSD | /testAligner.py | UTF-8 | 1,564 | 2.734375 | 3 | [] | no_license | import math
import numpy as np
import copy
import sys
class tAligner( object ):
def align( self,transformation, mob_atoms):
translation = np.matrix([transformation[0:3]]*len(mob_atoms))
rot = transformation[3:6]
#print translation
#print rot
rotX = np.matrix([[1.0,... | true |
05216bdf4086a810e0c1f7981fb8f46025080e83 | gyuwseong/Algorithm | /algorithm/k_divisor.py | UTF-8 | 369 | 3.203125 | 3 | [] | no_license | # 풀이 1
def solution1(n, k):
result = []
for i in range(1,k+1):
if n % i == 0:
result.append(i)
return -1 if len(result) < k else result[i-1]
# 풀이 2
def solution2(n, k):
count = 0
for i in range(1,k+1):
if n % i == 0:
count += 1
if count == k:
... | true |
185b7bb0564b6eb47a53da5b39ce43b8c1b3f914 | ssaulrj/codes-python | /codeacademy-python3/strings/negative_indices.py | UTF-8 | 313 | 2.984375 | 3 | [] | no_license | company_motto = "Copeland's Corporate Company helps you capably cope with the constant cacophony of daily life"
#Use negative indices to find the the second to last character
second_to_last = company_motto[-2:-1]
#Use negative indices to create a slice of the last 4 characters
final_word = company_motto[-4:]
| true |
f44c93af756603af17e385f4d11b7758da314b3e | eladn/romv-scheduler-python | /hw2-romv-scheduler/multi_version_gc.py | UTF-8 | 11,461 | 2.78125 | 3 | [
"MIT"
] | permissive | from collections import namedtuple
from logger import Logger
from transaction import Transaction
from romv_transaction import ROMVTransaction, UMVTransaction
VariableVersion = namedtuple('VariableVersion', ['variable', 'ts'])
# The basic intuition is to evict the versions that no one would potentially need in
# the... | true |
1f8aa6f1727f306e361d8dfef47a91a427dfce4d | zgjh/EmbeddedSystemFinalExam | /dht.py | UTF-8 | 847 | 3.03125 | 3 | [] | no_license | import sys
import time
import Adafruit_DHT
sensor_args = { '11': Adafruit_DHT.DHT11,
'22': Adafruit_DHT.DHT22,
'2302': Adafruit_DHT.AM2302 }
if len(sys.argv) == 3 and sys.argv[1] in sensor_args:
sensor = sensor_args[sys.argv[1]]
pin = sys.argv[2]
else:
print('Usage: sudo ./Ad... | true |
6d689a04e38293e0f1cca4268143e730fe52c5fa | harishk-97/python | /beginner level/gcd87.py | UTF-8 | 115 | 2.875 | 3 | [] | no_license | n=input().split()
n=list(map(int,n))
for i in range(1,(min(n)+1)):
if(n[0]%i==0 and n[1]%i==0):
a=i
print(a)
| true |
6d5ed29bbeb345dcaac4459a289c36e3bef5fb95 | seymakara/CTCI | /01ArraysAndStrings/LCsingleNumber.py | UTF-8 | 239 | 3.59375 | 4 | [] | no_license | class Solution:
def singleNumber(self, nums):
result = 0
for num in nums:
result ^= num # xor function returns 0 for the same items. if it is 0 and something else returns something else
return result | true |
f75176fe5a870a4c9b2a7f9faffa92b853949731 | upinyergrill/scoreboard | /old/test_period_time.py | UTF-8 | 587 | 2.71875 | 3 | [
"MIT"
] | permissive | """testing period time
"""
import period_time as pt
GAME_DATA = pt.get_game_data_from_file('exampleDataGameLive.json')
#GAME_DATA = pt.get_game_data_from_file('exampleDataGameStopped.json')
PARSED_GAME_DATA = pt.get_parsed_game_data(GAME_DATA)
GAME_TIME_AND_PERIOD = pt.get_game_time_and_period(PARSED_GAME_DATA)
pri... | true |
98531955506700cc251b9aa013e855ab4c0813a6 | nerooooooz/521project-Paraphrase-Identification | /SimilarityVectorizer.py | UTF-8 | 3,379 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 23:33:09 2019
@author: Cassie
"""
import numpy as np
from nltk.corpus import stopwords
import string
from sklearn.metrics.pairwise import cosine_similarity
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
class Simila... | true |
67e9c9824557eec82216496967b535e4e0ba0b06 | drkmsmithjr/erica | /client/modules/Healthfeed.py | UTF-8 | 4,517 | 2.78125 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | import feedparser
import app_utils
import re
from semantic.numbers import NumberService
import sys
from random import randint
#usage:
# Command: Health
WORDS = ["HEALTH", "NEWS", "FIRST", "SECOND", "THIRD", "FOURTH"]
URL = 'http://www.medicinenet.com/rss/general/womens_health.xml'
MAXNEWS = 5
class Report:
... | true |
0e58e879108b71c833453bf5bf7c6ea42a976ae4 | akhila1432/code_chef | /second large.py | UTF-8 | 147 | 3.125 | 3 | [] | no_license | T = int(input())
for i in range (T):
l = []
a=map(int,input().split())
for x in a:
l.append(x)
l.sort()
print(l[1]) | true |
29039606a4ca64de1e742ffa9fc2a95479330bac | vahndi/probability | /probability/calculations/calculation_types/array_calculation.py | UTF-8 | 3,343 | 2.671875 | 3 | [
"MIT"
] | permissive | from typing import List, Type, Optional, Set, Union
from probability.calculations.calculation_types.value_calculation import \
ValueCalculation
from probability.calculations.calculation_types.sample_calculation import \
SampleCalculation
from probability.calculations.calculation_types.probability_calculation i... | true |
2f66de65aba41d3808e39e3ff0754957fc940af4 | goldenminerlmg/end_to_end_visual_odometry | /scraps/fc_losses.py | UTF-8 | 1,652 | 2.65625 | 3 | [] | no_license | import tensorflow as tf
def fc_losses(outputs, labels_u):
diff_u = outputs[:, :, 0:6] - labels_u
L = outputs[:, :, 6:12]
# The network outputs Q=LL* through the Cholesky decomposition,
# we assume L is diagonal, Q is always psd
Q = tf.multiply(L, L)
# determinant of a diagonal matrix is prod... | true |
1ecaba52b32fabeab5d09615da9a9ba9df26e005 | tomarfaruk/Competitive-programming | /Hackerrank/Algorithoms/Implementation/Cut the sticks.py | UTF-8 | 197 | 3.3125 | 3 | [] | no_license | n = input()
arr = list(map(int, input().split()))
while len(arr) > 0:
print(arr)
print(len(arr))
min_value = min(arr)
arr = [ i-min_value for i in arr if i-min_value > 0 ]
| true |
413b51e9d7f94efc0b9d193f8b1677c60cb88b5b | lucaslopes0198/artificial-intelligence | /algorithms/depthFirst.py | UTF-8 | 960 | 3.21875 | 3 | [] | no_license | from Expansion import Expansion
import LinkedList
class Search:
def depthFirst(self, start, target):
stack = LinkedList.DoublyLinkedList()
copyStack = LinkedList.DoublyLinkedList()
stack.insertEnd(start, None, None)
copyStack.insertEnd(start, None, None)
visited = [start]
... | true |
724c5ff13d7522996fee1ca835475f68e8f9cdbc | dpinezich/python_foundations | /Source/solutions/ex_02.py | UTF-8 | 155 | 3.640625 | 4 | [] | no_license | import maths
def volume_from_radius(radius):
return 4.0/3 * maths.pi * radius ** 3
radius = int(input('Radius: '))
print(volume_from_radius(radius)) | true |
84b1d292bd9fad85182abbf9febf39edef248169 | xopenapi/worth-api | /out/pytest/main.py | UTF-8 | 1,310 | 2.546875 | 3 | [] | no_license |
from __future__ import print_function
import json
import time
import worth
from worth.rest import ApiException
from pprint import pprint
def main():
configuration = worth.Configuration()
# Enter a context with an instance of the API client
with worth.ApiClient(configuration) as api_client:
# Cre... | true |
3c58d9b09bd274d4c8e2c974abc4824ea60e6dee | tenazatto/MetricLearning | /ingestion/StanfordIngestion.py | UTF-8 | 1,838 | 2.53125 | 3 | [] | no_license | import os
import random
import zipfile
import numpy as np
from datasetingestion import DatasetIngestion
class StanfordIngestion(DatasetIngestion):
def decompress(self, images_path, image_filepath):
if not os.path.exists(images_path):
print
"Extracting zip file. It may take a few ... | true |
9a0fad6551933d96eb2e7a492fb01e7a01b967f8 | aw6629/pratice | /0425/42507.py | UTF-8 | 110 | 2.75 | 3 | [] | no_license | class Base:
def __init__(self,id):
print(f'id={id}')
class Derived(Base):
pass
d= Derived(10) | true |
e1c5cde74d5c497f28a18bdafde07015083bbb9e | CyanoAlert/xcube | /test/sampledata.py | UTF-8 | 3,953 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import xarray as xr
def new_test_dataset(time, height=180, **indexers):
time = [time] if isinstance(time, str) else time
width = height * 2
num_times = len(time)
res = 180 / height
shape = (1, height, width)
data_vars = dict()
for name, value in index... | true |
667def4b57e9004fbd4f97c38d2eda9cdd8ffb23 | kybu3653/APPM4650 | /Project1.py | UTF-8 | 4,048 | 2.9375 | 3 | [] | no_license | #!/bin/usr/env python
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
from math import exp,ceil
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
##ROOT FINDING
def lf(y):
return exp(y) - 3*y
def bisection(a,... | true |
a29c71f6dbc95b065d03a05053a15812e2836e27 | gabrielmougard/serpens-project | /serpens/src/single_joint/scripts/rainbow/agent.py | UTF-8 | 18,241 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The definition of the RainbowAgent.
It is the central part of the RL loop.
"""
import logging
from datetime import datetime
from typing import Dict, List, Tuple
from collections import deque
from statistics import mean
from tqdm import tqdm
import rospy
import gym
impo... | true |
00e9ff5d50354ed3ccb67a6c850d53060ef07dfa | vocksel/elixir | /tests/test_processors.py | UTF-8 | 1,463 | 2.75 | 3 | [
"MIT"
] | permissive | from textwrap import dedent
from elixir import processors
class TestGettingFileContents:
def test_can_get_file_contents(self, tmpdir):
f = tmpdir.join("file.txt")
f.write("Content")
content = processors._get_file_contents(str(f))
assert content == "Content"
def test_does_not... | true |
68c7746681c0e9cf1c37ae02b096c29a909d3d8b | morganstanley/testplan | /examples/ExecutionPools/Remote/test_plan.py | UTF-8 | 4,737 | 2.53125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# This plan contains tests that demonstrate failures as well.
"""
Parallel test execution in a remote pool.
"""
import os
import sys
import getpass
import shutil
import tempfile
# Check if the remote host has been specified in the environment. Remote
# hosts can only be Linux systems.
REMOTE_HOS... | true |
bbad567049791a44812c02bb4b4a527c9b79b01f | LorenzoCevolani/datajob | /examples/data_pipeline_pyspark/glue_job/glue_pyspark_example.py | UTF-8 | 1,203 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import logging
from pyspark.sql import SparkSession
logging.basicConfig(level=logging.DEBUG)
def main():
logging.info("starting pyspark example")
parser = argparse.ArgumentParser()
parser.add_argument("--source", type=str, required=True)
parser.add_argument("--destination", type=str... | true |
aca9bd6611429891ef154d9a0f7b66b6ef20eb36 | DevasishMahato/Inconsistency-Detection-in-Medical-Annotation | /cosine_similarity.py | UTF-8 | 455 | 3.5625 | 4 | [] | no_license | # The function cosine similarity takes two arguments (a,b) where a and b bore a word or word phrases.
def cosine(a,b):
#creating a set of words from the word phrase
set1=set(a.split())
set2=set(b.split())
# Finding the dissimilar words in both the sets
diff_LR=list(set1-set2)
diff_RL=... | true |
db7e0293c7bb436ff98a7e7498b4e124e6156ac8 | aravindsriraj/machine-learning-python-datacamp | /Machine Learning Scientist with Python Track/18. Image Processing in Python/ch1_exercises.py | UTF-8 | 3,500 | 3.46875 | 3 | [
"MIT"
] | permissive | # Exercise_1
# Import the modules from skimage
from skimage import data, color
# Load the rocket image
rocket = data.rocket()
# Convert the image to grayscale
gray_scaled_rocket = color.rgb2gray(rocket)
# Show the original image
show_image(rocket, 'Original RGB image')
# Show the grayscale image
show_image(gray_sc... | true |
2845aa050eb446afa3e4cdd172c0e6bdc97128f1 | ccubc/DS_self_learning | /practical_python/organize_files.py | UTF-8 | 1,362 | 3.46875 | 3 | [] | no_license | import os
def get_file_list_name_startswith(prefix_str):
# within a folder, create a list with filenames starting with specific string
file_name_list = [filename for filename in os.listdir('.') if filename.startswith(prefix_str)]
return file_name_list
def concat_files_between_texts(start_str, end_str, input_list,... | true |
2627be60488e34a66bdebbf2c9e8f9089202336b | rakshify/GLM_MAB | /code/policies/epsilon_greedy.py | UTF-8 | 901 | 3.078125 | 3 | [
"MIT"
] | permissive | """
epsilon_greedy.py
Janbaanz Launde
Apr 2, 2017
"""
from policy import Policy
import random
class EpsilonGreedy(Policy):
"""Standard epsilon greedy, linear regret."""
def __init__(self, contexts, epsilon=.1):
super(EpsilonGreedy, self).__init__(contexts)
self.name = 'EpsilonGreedy({})'.forma... | true |
f99dc2de091ec289c6ec87bfabbe6f8540c55cd9 | mcognetta/transskribilo-boto | /main.py | UTF-8 | 6,335 | 2.609375 | 3 | [
"MIT"
] | permissive | import sys, collections, configparser
import discord
from discord import Webhook, AsyncWebhookAdapter
from discord.ext import commands
from transskribilo.data import data_utils
bot = commands.Bot(
command_prefix="!",
description="Roboto por aŭtomata transskribado el x-sistemo al unikodan tekston.",
)
bot._ig... | true |
12c88743ab5ea0b4e00dfcf61be9ce169f9219e2 | loucq123/Leetcode | /Merge Sorted Array.py | UTF-8 | 954 | 3 | 3 | [] | no_license | class Solution:
# @param {integer[]} nums1
# @param {integer} m
# @param {integer[]} nums2
# @param {integer} n
# @return {void} Do not return anything, modify nums1 in-place instead.
def merge(self, nums1, m, nums2, n):
self.helper(nums1, m, 0, nums2, n)
def helper(self, nu... | true |
9ff751aab81d5143023d7c4da6e28380f4f03fa8 | swaraj-gore/github-demo | /math.py | UTF-8 | 204 | 3.125 | 3 | [] | no_license | # Add Implementation
def add(x,y):
pass
# Subtract Implementation
def subtract(x,y):
pass
# Multiply Implementation
def multiply(x,y):
pass
# Divide Implementation
def divide(x,y):
pass | true |
c1b9a452c7d5c1e86cf33382f142fdfde44a3ad5 | MthwRobinson/CSE6140proj | /priority_queue.py | UTF-8 | 2,164 | 4.21875 | 4 | [] | no_license | class priority_queue:
# Implements a priority queue data structure using the Python heapq library
# The priority queue keeps track of the node, its label and its priority
# The data structure supports adding and deleting nodes in O(log n)
# and updating node labels in O(log n) by creating a dicti... | true |
2b815fbc752da3b602c589ff48592423fca5f8a9 | vlandham/social_shopper | /scrapers/competitor_prices/pipelines.py | UTF-8 | 1,277 | 2.734375 | 3 | [
"MIT"
] | permissive | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from sqlalchemy.orm import sessionmaker
from models import CompetitorPrices, db_connect, create_competitor_prices_table
from pprint import pprint
class BackcountryPipeline(object):
"""... | true |
9711932423b68e04407a55164d07431dfe61eba8 | sevenleo/tcc | /word2vec/tests/_08_sklearn.py | UTF-8 | 2,607 | 2.796875 | 3 | [] | no_license | from _00_functions import *
try:
file = str(sys.argv[1])
except:
file = 'wikipedia'
erros = 0
#LOAD FILES
try:
loadfilename = 'W2V'+'/'+file+'.model'
logs("LOAD FILE (model)",loadfilename)
w2v = Word2Vec.load(loadfilename)
print("FILE LOADED")
except:
print(file+".model FILE NOT EXIST")
... | true |
bf1d89a51ec259620deceaaaac0d3faec39d8aa6 | ixLikro/master-robotics-rospy | /hello_world/src/scripts/Turtle_draw_house.py | UTF-8 | 4,556 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import math
from std_msgs.msg import String
from turtlesim.srv import TeleportAbsolute
from std_srvs.srv import Empty
from turtlesim.srv import SetPen
from geometry_msgs.msg import Twist
velPublisher = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=100)
def init():
rospy.i... | true |
608ad079424513667c2ff62b12ee3f80678562d3 | darylchang/Hacker-Viz | /flaskDir.py | UTF-8 | 754 | 2.59375 | 3 | [] | no_license | from flask import Flask, render_template
import requests
import json
import os
app = Flask(__name__)
@app.route('/')
def hello_world():
r = requests.get("http://api.ihackernews.com/page")
r = r.json()
hacker_news_dict = {'name': 'hackernews', 'children':[]}
num = 0
for item in r["items"]:
if num>10:
break
... | true |
7ee990bdeefa0cab0476fbfe793bb80169fb6e65 | udaydontula/Snake-game | /main.py | UTF-8 | 1,060 | 3.21875 | 3 | [] | no_license | from turtle import Screen
import time
import snake
import food
import scoreboard
s = snake.Snake()
f = food.Food()
score = scoreboard.Score()
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("| Snake_Game |")
screen.tracer(0)
screen.listen()
screen.onkey(fun=s.snake_up, key... | true |
40376aa05e0a60ad87626e261ff310dbe28ac7c0 | vincycode7/maistore-jwt-extented | /resources/product.py | UTF-8 | 3,090 | 2.84375 | 3 | [] | no_license | import sqlite3
from flask_restful import Resource, reqparse
from flask_jwt import jwt_required
from models.product import ProductModel
#class to create user and get user
class ProductList(Resource):
@jwt_required() #use for authentication before calling get
def get(self):
products = ProductModel.find_... | true |
ea664dba5b807c6db0be3f640ab0073ca4e89389 | Foxy-Boxes/the2-tester | /test_the2.py | UTF-8 | 634 | 2.8125 | 3 | [] | no_license | import unittest
from the2 import isCovered
class TestCovered(unittest.TestCase):
def test_isCovered(self):
fails =[]
testfails= open("fails.txt",'w')
with open("proper.txt",'r') as file:
data = file.read()
exec(data)
file.close
with open("output.t... | true |
52dfae13ef6cd53bfdd93bb92ff10f1a8057d821 | mPAND/PowerCenterDiff | /src/XMLDiffer.py | UTF-8 | 4,927 | 2.609375 | 3 | [
"MIT"
] | permissive | import PowercenterXmlTree as pxt
import argparse
import os
import sys
import difflib
import json
def main(*args):
parser = argparse.ArgumentParser(
description="Python Script to compare two PowerCenter XML Files and display differences."
, epilog="Generates HTML output if no optional arguments are... | true |
77700c75065ca3b77dd2e39d88554967a04bc5bc | cmspooner/PoMoCo | /Moves/MoveRight.py | UTF-8 | 846 | 2.734375 | 3 | [
"MIT"
] | permissive | import time
# Move: Move Forward
move('Stand')
#Tripod 1 up
hexy.LF.knee(15)
hexy.RM.knee(15)
hexy.LB.knee(15)
hexy.LF.ankle(-85)
hexy.RM.ankle(-85)
hexy.LB.ankle(-85)
time.sleep(.2)
#Tripod 2 move
hexy.RF.hip(45)
hexy.LM.knee(45)
hexy.RB.hip(-45)
time.sleep(.2)
#Tripod 1 down
hexy.LF.hip(-45)
hexy.LF.knee(60)
hex... | true |
1223ee8d959c1810101fc6f52ca30e3271ff905d | shankarkrishnamurthy/problem-solving | /remove-all-adjacent-duplicates-in-string-ii.py | UTF-8 | 566 | 3.15625 | 3 | [] | no_license | from typing import *
class Solution:
def removeDuplicates(self, s: str, k: int) -> str:
st = []
for i,v in enumerate(s):
if st and st[-1][0] == v and st[-1][1] == k-1:
st[-k+1:] = []
else:
if st and st[-1][0] == v: st.append((v,st[-1][1]+1))
... | true |
46c08f7c6275c580276a1300c9140553a6729f79 | pwang867/LeetCode-Solutions-Python | /1048. Longest String Chain.py | UTF-8 | 1,662 | 3.890625 | 4 | [] | no_license | # group strings by length, and then process from short to long
# time O(n*m), m = len(words[i]), n = len(words)
import collections
class Solution(object):
def longestStrChain(self, words):
"""
:type words: List[str]
:rtype: int
"""
if not words:
return 0
g... | true |
0739145a9e52204fc97ac3f977fbb51da606ab44 | RikilG/Data-Science-Foundations | /PolynomialModel/ModelStats.py | UTF-8 | 940 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
# test function
def test(w, x_test, y_test):
x_test = np.array(x_test)
y_test = np.array(y_test)
err = error(w, x_test, y_test)
# print(f"Testing Data:\n MSE: {err}, \tRMSE: {err**0.5}")
# print(f"Weights: {w}")
return err
# prediction function y1 = f(x)
def f(w:... | true |
ba5d9191750dbfd7374d056b74150cb90870b6e4 | LiBromine/RCA | /detection/deviation.py | UTF-8 | 3,403 | 3.328125 | 3 | [] | no_license |
import numpy as np
import pandas as pd
import tqdm
from scipy.stats import norm
class Dev:
"""
A anomaly detection object based on deviation
"""
def __init__(self, method='abs'):
"""
Constructor
Parameters
----------
method: computation method
Returns
------... | true |
4d02958c652c89331731acc25025487501e14a55 | jiadaizhao/LeetCode | /1001-1100/1074-Number of Submatrices That Sum to Target/1074-Number of Submatrices That Sum to Target.py | UTF-8 | 717 | 3 | 3 | [
"MIT"
] | permissive | import collections
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
presum = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
presum[i][j + 1] = presum[i][j] ... | true |
1a998b1c14ecbeda285187abb55b6995205907b3 | xzjs/nav | /src/speed_sub.py | UTF-8 | 675 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
'''speed ROS Node'''
import rospy
from geometry_msgs.msg import Twist
import zmq
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5558")
def callback(data):
'''speed Callback Function'''
# rospy.loginfo(data)
linear = data.linear.x
angular = data.ang... | true |
e066a63dd0388dc24050c63404c3d65c49923748 | xairy/mipt-schedule-parser | /tools/find_teacher.py | UTF-8 | 1,482 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#coding: utf-8
from __future__ import unicode_literals
import fileinput
import regex
import sets
import sys
import urllib2
__author__ = "Andrey Konovalov"
__copyright__ = "Copyright (C) 2014 Andrey Konovalov"
__license__ = "MIT"
__version__ = "0.1"
teacher_entry_re = regex.compile(
'\<a href="(?... | true |
1a08c8c42c0244f5272b472bb4f7e6163f45756a | efesoa/moliris | /app.py | UTF-8 | 5,224 | 3.390625 | 3 | [] | no_license | from flask import Flask, render_template, request
import pandas as pd
import numpy as np
import operator
from numpy import dot
# Reading csv file and splitting the measurements from the specie name
# data.to_html() function converts the csv file (data) into html table format
data = pd.read_csv('iris.data', header=None... | true |
45b828d7f4684ca7751acc89141a0587631c8d92 | artbohr/codewars-algorithms-in-python | /7-kyu/KISS.py | UTF-8 | 930 | 4.15625 | 4 | [] | no_license | def is_kiss(words):
words_s = words.split()
for x in words_s:
if len(x) > len(words_s):
return 'Keep It Simple Stupid'
return 'Good work Joe!'
'''
KISS stands for Keep It Simple Stupid. It is a design principle for keeping things simple rather than complex.
You are the boss of Joe.
J... | true |
59c595833f2751e2aed633eed65389470a602cbc | saransh44/Data-Structures | /Question3/QuestionThree.py | UTF-8 | 156 | 3.25 | 3 | [] | no_license | import random
def create_permutation(n):
lst = []
i=0
for element in lst:
lst[i] = n
i++
temp = random.randint(0, n)
| true |
af454aed780b58fb421f1088c98c0f44000cd2e7 | josemarialuna/ClassificationPython | /MainHeatmapFS.py | UTF-8 | 1,814 | 2.53125 | 3 | [] | no_license | from docutils.nodes import thead
from sklearn.preprocessing import MinMaxScaler, binarize
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2,f_classif
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
np.random.seed(0)
sns.set(font_sc... | true |
5478823b7e74ffc9e883de461872e4cc0ca5da3b | jacobmetrick/euler | /p1/problem1.py | UTF-8 | 179 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
addables = []
for i in range(1000):
if (i % 3 == 0) or (i % 5 == 0):
addables.append(i)
value = 0
for i in addables:
value += i
print(value)
| true |
4dfbfd06ee022d0c2ef20a9c9d191c06272cc930 | avinabadey6/python | /program2.py | UTF-8 | 417 | 3.515625 | 4 | [] | no_license | totals=[]
for p in range(2):
student_id=input("input the id")
student_roll=input("enter the roll number")
student_name=input("enter the name")
students={"student_id":student_id,"student_roll":student_roll,"student_name":student_name}
totals.append(students)
print(totals)
id_special=[p["student_id"]f... | true |
1e256e9428ac913f0f4e335acf819212456b6cd1 | webclinic017/qfengine | /simulation/simulation_engine.py | UTF-8 | 871 | 3.171875 | 3 | [
"MIT"
] | permissive |
from abc import ABCMeta, abstractmethod
class SimulationEngine(object):
"""
Interface to a trading event simulation engine.
Subclasses are designed to take starting and ending
timestamps to generate events at a specific frequency.
This is achieved by overriding __iter__ and yielding Event
e... | true |
acb33bacf54c4c8965879c973b9a622356667a5b | AngelaVitaletti17/Tensorflow-Exercise-2 | /tensor.py | UTF-8 | 3,558 | 4.125 | 4 | [] | no_license | import tensorflow as tf
import numpy as np
#This lesson starts with more fundamentals and will consist of various notes
'''
This practice comes from a website called Medium.comes
'''
#Let's begin with some notes
'''
Something that was not explained very clearly to me was exactly what a 'model'
is in machine learn... | true |
b8ef29df5743672b34d43d7eecfc04c3520b3f54 | daejong123/wb-py-sdk | /wonderbits/WBLed.py | UTF-8 | 1,660 | 3.21875 | 3 | [
"MIT"
] | permissive | from .wbits import Wonderbits
def _format_str_type(x):
if isinstance(x, str):
x = str(x).replace('"', '\\"')
x = "\"" + x + "\""
return x
class Led(Wonderbits):
def __init__(self, index = 1):
Wonderbits.__init__(self)
self.index = index
def set_rgb(self, r, g, b):
... | true |
16371e52633dd1eb78e43e66323688ed89005634 | Gustacro/learning_python | /become_python_developer/4_Ex_Files_Python_Essentials/Exercise Files/Chap07/kwargs.py | UTF-8 | 515 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
def main():
x = dict(Buffy = 'meow', Zilla = 'grr', Angel = 'rawr') # this is a dictionary
kitten(**x) # 2 asterisk (**) are necessary when passing a dictionary as argument into a function
def kitten(**kwargs): # argument dictionary (**kwargs) st... | true |
6461a79df0715a001bc46a29a54a837730144328 | lytvyn139/udemy-complete-python3-bootcamp | /05-tuples.py | UTF-8 | 340 | 4.15625 | 4 | [] | no_license | """ tuples are immutable """
""" but same methods as string and lists """
t = (1,2,3)
my_list = [1,2,3]
print(type(t))
print(type(my_list))
t = ('one', 2)
""" count """
t = ('a', 'a', 'b')
print(t.count('a')) #count 'a' times
print(t.index('a')) #appears fisrt appearance
my_list[0] = "NEW"
print(my_list)
t[0] = "NE... | true |
74d20f2eecb27395b2e08a5f484fd555e23fd96e | Kraken0306/CPSC1 | /pythonsc.sh | UTF-8 | 297 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
import pandas as pd
import numpy as np
df=pd.read_csv(‘flightdelay2007.csv’)
df
#Question1
first3sfo=df[df[‘Origin’]==’SFO’][[‘Origin’,’ArrDelay’]]
print(first3sfo.head(3))
#Question2
print(df[‘Dest’].value.counts().head(4))
print('coded by Gaurav Bawa')
| true |
71e442cda854c4865f3de1a971454a7c1a653da5 | samueltphd/NLP-GDPR | /model/user.py | UTF-8 | 7,651 | 2.671875 | 3 | [] | no_license | # different modes of GDPR compliance
NO_COMPLIANCE, NEUTRAL, STRONG, STRICT = 0, 1, 2, 3
DELETE, UPDATE = "DELETE", "UPDATE"
# SHALLOW DELETION/UPDATES: NEUTRAL
# BADGE DELETION/UPDATES: STRONG
# ONE USER AT A TIME DELETION/UPDATES: STRICT
class User:
def __init__(self, uid, aggregator, logger, compliance_mode=NO... | true |
353cb7330ae31cc361b77955de2d1e4681179e0f | robertczarnik/pacman | /pacmanRC.py | UTF-8 | 24,796 | 2.515625 | 3 | [] | no_license | import pygame, sys,os
from pygame.locals import *
import random
random.seed()
pygame.init()
clock = pygame.time.Clock()
window = pygame.display.set_mode((570, 660)) # 19/21 kratki + 1 kratka tekst
sciana_zwykla_pion = pygame.image.load('sciana_zwykla_pion.png')
sciana_zwykla_poziom = pygame.image.load('sciana_zwykl... | true |
7386e6002cd82f1d1b49463dd669ac1379ba1577 | ManuelCorales/POO-Thorman-Python | /Codigo propio/src/game.py | UTF-8 | 2,272 | 3.265625 | 3 | [] | no_license | from controler import *
from thorman import Thorman
from lightning import Lightning
import time
class Game():
def __init__(self, playerName, dimentions):
self.name = playerName
self.dimentions = dimentions
self.thorman = None
self.activeBombList = []
self.availabl... | true |
73600231b67d61a7b1e9f0b21ec3124668605280 | WengsingVWong/Algorithms-Computers-Programming-1-Assignments | /Assignment 9/student.py | UTF-8 | 2,849 | 4.21875 | 4 | [] | no_license | #******************************************************************************
# student.py
#******************************************************************************
# Name: Wengsing Wong
#******************************************************************************
# Collaborators/outside sources used
#... | true |
85b00d3c4076b996aa01479c9665be1a4601884c | Royz2123/Data-Science | /HW2/util.py | UTF-8 | 912 | 3.109375 | 3 | [] | no_license | import json
import matplotlib.pyplot as plt
import numpy as np
DEFAULT_LINKS_FILE = "project_links.txt"
DEFAULT_OUTPUT_FILE = "json_data.json"
def cart2pol(x, y):
rho = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
return(rho, phi)
def pol2cart(rho, phi):
x = rho * np.cos(phi)
y = rho * np.sin(phi)... | true |
4490a6fa611e40b8ea4fe164282feaaa6dc5bb51 | arturoprg/Optimization-of-an-Automated-System-using-IoT | /Safety_door_handle_security.py | UTF-8 | 4,003 | 2.828125 | 3 | [] | no_license | # The code bellow is executed just when the function is initialized
if initialize:
# Initialize outputs
# NOTE: All visuals has to have the origin in the same
# place for the transformations to work properly
rotation_transform = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
[x, y, z, R, P, Y] = Transform2Euler(ro... | true |
15443662ff344838514aa50f0ad0e67a0703c8d5 | Aditya-Vikram-IISc/Paper_Reviews | /SENet/SqueezeExcitation_Block.py | UTF-8 | 1,008 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
#Refer Squeeze-and-Excitation Networks (arXiv: 1709.01507)
class SEBlock(nn.Module):
def __init__(self, input_channels, reduction_factor:int = 16):
super(SEBlock, self).__init__()
#Squueze Module
self.squeeze = nn.AdaptiveAvgPool2d(1)
#Excitati... | true |