blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9d78520ce2125fce87e699aa14d3994d959cbfac | Python | harry1180/aws-ci-cd-lambda | /lambda_code/PreProd_AmazonConnect_DBFunction1/PreProd_AmazonConnect_DBFunction/main.py | UTF-8 | 4,591 | 2.53125 | 3 | [] | no_license |
# A lambda function to interact with AWS RDS MySQL
from __future__ import print_function
from UserHistory import *
from FetchTransactionInfo import *
import pymysql
import sys
import boto3
import os
import time
REGION = ''
rds_host= ""
name = ""
password = ""
db_name = ""
conn = pymysql.connect(rds_host, user=name, ... | true |
30630335d660d853020bfef3b1da87f0d785025c | Python | codewithgauri/HacktoberFest | /folders/LinearRegression/LG.py | UTF-8 | 1,640 | 2.921875 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
def predictValue(X,theta):
return np.sum(predict(X,theta))
def predict(X,theta):
return X@theta
def hypothesis(X,Y,theta):
X = np.append([[1]]*np.size(X,0),X,1)
return (np.transpose(theta)@X - Y)
def costFunction(X,Y,theta):
cost = X@theta -... | true |
9405a8ba91e36e9885d1a945a0968fcf26979b76 | Python | AlejandroSantorum/Connect4_HeuristicPrediction | /board_features.py | UTF-8 | 3,341 | 2.984375 | 3 | [] | no_license | ################################################################################
# Authors: #
# · Alejandro Santorum Varela - alejandro.santorum@estudiante.uam.es #
# alejandro.santorum@gmail.com ... | true |
2c95758b85103d566a62ebb6a8c04ccc1b1958ec | Python | mstfakdgn/python-workouts | /audio/SoundOfAI/tensorflow_mlp.py | UTF-8 | 1,226 | 2.953125 | 3 | [] | no_license | import numpy as np
from random import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
# dataset array([[0.1,0.2], [0.2,0.2]])
# output array([[0.3], [0.4]])
def generate_dataset(num_samples, test_size):
x = np.array([[random()/2 for _ in range(2)] for _ in range(num_samples)])
... | true |
bcf37dbc920c00661870349a26bf43145e20cda8 | Python | PhilAScript826/anime_recommendation_engine | /nlp.py | UTF-8 | 839 | 2.828125 | 3 | [] | no_license | from sklearn.feature_extraction.text import TfidfVectorizer
import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
def recommender(name):
anime_df = pd.read_pickle('data.pickle')
tfidf = TfidfVectorizer(stop_words='english')
anime_df['Description']=anime_df['Description'].fillna('')
... | true |
628eefa3e3208336e8ad47d96b42738529e6adb7 | Python | audiovisual2018/Juego_Barraco | /Juego_barraco/SomeGuySomeBalls.py | UTF-8 | 19,661 | 3 | 3 | [] | no_license |
#Hecho por Juan Barraco, modificando el pong escrito por Daniel Fuentes B (https://www.pythonmania.net/es/2010/04/07/tutorial-pygame-3-un-videojuego/).
# ---------------------------
# Importacion de los módulos
# ---------------------------
import pygame
from pygame.locals import *
import os
impo... | true |
eba0eaaf2c8b11dbfe646a8b81f4ff548dd9b0e8 | Python | berleon/theano-nets | /test/test_cost.py | UTF-8 | 2,719 | 2.734375 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
import math
import numpy as np
import theano
import theano.tensor as TT
from theanets.cost import NegativeLogLikelihood, QuadraticCost
class SupervisedCostTest(object):
def setUp(self):
nn_out = TT.matrix("nn_out")
self.cost_fn = theano.function([nn_out] + self.cost.... | true |
1ab8b58c742d50913793fc898ee9482a4fd1e0a7 | Python | sofrone7/Lab-de-redes-sistemas-y-servicios | /p1.2/cliente-servidor/servidor.py | ISO-8859-1 | 1,893 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: cp1252 -*-
import sys
import socket
import select
if len(sys.argv) != 2:
print('Usage:', sys.argv[0], '<Server Port>\n')
ServPort = sys.argv[1]
# Socket TCP del servidor
ServSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Configurarlo para que no se ... | true |
0fb6de503fae565df6fa020515ac9624b70a8731 | Python | jagadeesh1414/assignment9_note.py | /assign9_prog3.py | UTF-8 | 175 | 3.265625 | 3 | [] | no_license | a = [35,23,35,20,10,20,40,50]
dup_items = set()
uniq_items = []
for x in a:
if x not in dup_items:
uniq_items.append(x)
dup_items.add(x)
print(dup_items) | true |
4753fe7a28290340cc5c8dc6c8232ade67044d45 | Python | atrukhanov/routine_python | /23_nxopen_refactoring/8_check_background_color.py | UTF-8 | 2,268 | 2.640625 | 3 | [] | no_license | import NXOpen
import NXOpen.UF
import subprocess
class NXJournal:
def __init__(self):
self.session = NXOpen.Session.GetSession()
self.work_part = self.session.Parts.Work
self.lw = self.session.ListingWindow
self.uf_session = NXOpen.UF.UFSession.GetUFSession()
self.python_p... | true |
67eb3fb87f43e7c924074a240d244a559e09e8b2 | Python | ConnorJRob/Codeclan_Karaoke | /tests/room_test.py | UTF-8 | 6,661 | 3.625 | 4 | [] | no_license | import unittest
from src.room import *
from src.guest import *
from src.song import *
class TestRoom(unittest.TestCase):
def setUp(self):
self.room1 = Room(1, 6, 4.00)
self.room2 = Room(1, 3, 5.00)
def test_room_has_number(self):
#This test checks that given the Room object created a... | true |
e66e8373cb4b8d8bffa2855c088e6ee20cea133a | Python | alfarih31/SK-FIX | /Test/test_move2.py | UTF-8 | 10,623 | 2.640625 | 3 | [] | no_license | from time import sleep, time
import math
import dronekit
from pymavlink import mavutil
print("HERE")
vehicle = dronekit.connect("/dev/ttyUSB0", baud=57600, wait_ready=False)
print("CONNECTED")
# while not vehicle.is_armable:
# print("WAITING INITIALIZING")
# sleep(1)
vehicle.mode = dronekit.VehicleMode("GUID... | true |
99c21b5f443d0f5ae5222924db61f36383b1044d | Python | axelthorstein/university-projects | /Old Classes/Computer Science/108/A3/text_check_rhyme_scheme.py | UTF-8 | 4,161 | 2.890625 | 3 | [] | no_license | import unittest
import poetry_functions
class TestCheck_Rhyme_Scheme(unittest.TestCase):
def test_check_rhyme_scheme_example_1(self):
# Test if rhyme scheme matches poem
poem_lines = ['The first line leads off,', \
'With a gap before the next.', 'Then the poem ends.']
... | true |
be0cd60d399e3078a68cf03086aa8a979933088d | Python | mfrankovic0/pythoncrashcourse | /Chapter 9/9-1_restaurant.py | UTF-8 | 614 | 3.921875 | 4 | [] | no_license | class Restaurant:
"""A restaurant model."""
def __init__(self, name, kind):
"""Initialize name and type."""
self.restaurant_name = name
self.cuisine_kind = kind
def describe_restaurant(self):
"""Describes restaurant name and type."""
print(f"{self.restaurant_name} i... | true |
9fc74366cf2f61150133631f0c4d13183ab18ce3 | Python | GorillaFu/holbertonschool-higher_level_programming | /0x0A-python-inheritance/10-square.py | UTF-8 | 1,161 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python3
"""
square + rectangle subclass of basegeometry class
"""
BaseGeometry = __import__('7-base_geometry').BaseGeometry
class Rectangle(BaseGeometry):
"""
rectanngle class that inherits attributes from BaseGeometry
"""
def __init__(self, width, height):
self.__width = width
... | true |
4ee355b6bf941df86f9743d3dd7cc5faf9ae916d | Python | QUER01/FinanceModule | /src/app.py | UTF-8 | 767 | 3.015625 | 3 | [] | no_license | import streamlit as st
# To make things easier later, we're also importing numpy and pandas for
# working with sample data.
import numpy as np
import pandas as pd
data = pd.read_csv(r'data/etf_20200217/df_backtest_portfolio.csv', sep = ';')
# LAYING OUT THE TOP SECTION OF THE APP
row1_1, row1_2 = st.beta_columns((... | true |
66bf6ab5d68cfeab850235fc52b69ae7abc09c76 | Python | VibhuJawa/custrings | /python/tests/test_rmm.py | UTF-8 | 1,654 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from librmm_cffi import librmm as rmm
from librmm_cffi import librmm_config as rmm_cfg
# setup rmm to use memory pool
rmm_cfg.use_pool_allocator = True
rmm_cfg.initial_pool_size = 2<<30 # set to 2GiB. Default is 1/2 total GPU memory
rmm_cfg.use_managed_memory = False # default is false
rmm_cfg.enable_logging = True
... | true |
a2c8170fbd7fa0512cbf443b3e4e5383397dc437 | Python | MaximusKorea/data_structure | /Stack/Stack1.py | UTF-8 | 631 | 4.03125 | 4 | [
"MIT"
] | permissive | # Stack은 나중에 들어간 것이 먼저 나온다.
# push : 데이터 스택에 쌓임, pop : 데이터 스택에서 꺼냄
# 스택은 최대로 쌓을 수 있는 공간을 정해두어야 하기 때문에 공간의 낭비가 발생할 수 있다.
# list로 stack 구현해보기(원래 list에는 append와 pop 메서드가 있어 그것을 통해서 stack을 구현할 수 있다.)
test_stack = list()
def push(num):
test_stack.append(num)
def pop():
num = test_stack[-1]
del test_stack[-1... | true |
d0022e87bd887c889c6b86a228f043b925fa8c0b | Python | ToLoveToFeel/LeetCode | /Python/_0342_Power_of_Four/Solution.py | UTF-8 | 532 | 3.1875 | 3 | [] | no_license | # coding=utf-8
# Date: 2021/5/31 8:50
# 执行用时:36 ms, 在所有 Python3 提交中击败了89.43%的用户
# 内存消耗:14.7 MB, 在所有 Python3 提交中击败了79.74%的用户
class Solution:
def isPowerOfFour(self, n: int) -> bool:
if n <= 0:
return False
r = int(n ** 0.5)
if r * r != n:
return False
return ... | true |
20dd7830c483ca5d9bbb33ca4acaac22565c72d0 | Python | nguyendachungphu/Mediapipe-With-CNN | /processingData.py | UTF-8 | 433 | 2.71875 | 3 | [] | no_license | import numpy as np
import cv2
original_image = cv2.imread('IMG1.jpg', cv2.IMREAD_COLOR)
gray_original = cv2.cvtColor(original_image, cv2.COLOR_BGR2GRAY)
background_image = cv2.imread('IMG2.jpg', cv2.IMREAD_COLOR)
gray_background = cv2.cvtColor(background_image, cv2.COLOR_BGR2GRAY)
foreground = np.absolute(gray_origi... | true |
b4787d4e9244cf380d64918b8bde4a1c69fb0434 | Python | microsoft/aerial_wildlife_detection | /modules/FileServer/app.py | UTF-8 | 2,433 | 2.6875 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | '''
Serves files, such as images, from a local directory.
2019-21 Benjamin Kellenberger
'''
import os
from bottle import static_file, abort
from util.cors import enable_cors
from util import helpers
class FileServer():
def __init__(self, config, app, dbConnector, verbose_start=False):
self.conf... | true |
b8b948b48b953fbe30fbba71aa48ea20e8a16705 | Python | YoupengLi/leetcode-sorting | /Solutions/0062_uniquePaths.py | UTF-8 | 1,387 | 3.953125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/4/16 0016 08:40
# @Author : Youpeng Li
# @Site :
# @File : 0062_uniquePaths.py
# @Software: PyCharm
'''
62. Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or ... | true |
8bac45cf1001f6a58060ef5a69be3f1b0e151ad1 | Python | ContinuumIO/enaml | /enaml/widgets/menu.py | UTF-8 | 2,257 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | true |
b65fed2785f85cf2156c76ec3ff470db6a302c10 | Python | dongyn/UI-Test | /testSmoke/test_tab.py | UTF-8 | 1,745 | 2.578125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
#@Time : 2019/9/16 16:02
#@Author: dongyani
#@Function: 首页的标签
import unittest
import comm.common as common
from comm.webDriver import webDriver
from pageElement.base_element_operate import base
from comm.readConfig import ReadConfig
appPackage = ReadConfig().get_config("appPackage")
list_home_... | true |
5c45d60a564752c7d9fb5c4070d7bbf9a37411f1 | Python | RashikAnsar/everyday_coding | /python_exercises/basics/11_functions.py | UTF-8 | 1,349 | 4.03125 | 4 | [] | no_license | from types import BuiltinFunctionType
########################################
###### Built-in Functions #######
########################################
# `isinstance`: it is used to check instance of variable/literal
x = ['Python', 3.9]
print(isinstance(x, list))
print(isinstance(x[0], str))
print(isinstance... | true |
0ff701e97dc93e7a19952c79cbc1d1e0517eb112 | Python | durgesh-agrhari/coderspree | /check_submissions.py | UTF-8 | 6,102 | 2.765625 | 3 | [] | no_license | import os
from pathlib import Path
from typing import List
from mdutils.mdutils import MdUtils
import requests
home = os.path.abspath(Path(__file__).parent)
submission_architecture = {"GettingStarted": 5}
domains = ["AR-VR", "IOT", "ML", "Android", "Web"]
class Student:
def __init__(self, name, githubID, lilb... | true |
74f00b6d23721d1e0c8481876ae9dc3d3370a08b | Python | noronhafamily/noronhafamily.github.io | /pythonprograms/firstprogram.py | UTF-8 | 546 | 3.984375 | 4 | [] | no_license | import random
def main():
program2()
def program2():
secret_number = random.randint(1,9)
turns=3
while turns>0:
print("You have ",turns, "turn(s)")
num = int(input("Guess a number between one to ten"))
if num == secret_number:
print("good job! the number ... | true |
f79d2a0206cddd9d3c58b23b3ec1a230cce7889e | Python | Myeishamadkins/What_Do_You_do | /what_do_you_do.py | UTF-8 | 2,438 | 3.390625 | 3 | [] | no_license | def main():
# if name == 'Glen Evens' or name == 'Kagan Coughlin':
# print('Co-Founder')
# elif name == 'Bethany Copper' or name == 'Sage Nichols' or name == 'John Marsalis':
# print('Founding Trustee')
# elif name == 'Caral Lewis':
# print('Trustee')
# elif name == 'Sean Anthon... | true |
784576394ab7c3d1e6ec6c693c37e198b9aaa0ab | Python | poseidon078/CS641 | /Level5/find_matrix.py | UTF-8 | 1,964 | 2.828125 | 3 | [] | no_license | from utils import *
A = [[84, 0, 0, 0, 0, 0, 0, 0],
[119, 70, 0, 0, 0, 0, 0, 0],
[0, 30, 43, 0, 0, 0, 0, 0],
[0, 0, 1, 12, 0, 0, 0, 0],
[0, 0, 0, 104, 112, 0, 0, 0],
[0, 0, 0, 0, 96, 11, 0, 0],
[0, 0, 0, 0, 0, 88, 27, 0],
[0, 0, 0, 0, 0, 0, 2, 38]]
exponents = [23, 118, 38, 76, 92, 45, 24, 23]
plaintexts = open("pla... | true |
7fcdd121f1660cfcd3a463cc4ab7674ae7406aaa | Python | msemikin/distributed-sudoku | /src/client/networking/connection.py | UTF-8 | 508 | 2.671875 | 3 | [] | no_license | class Connection():
def __init__(self, out_queue):
'''
:param out_queue: queue to publish updates pushed from server
'''
self.out_queue = out_queue
def shutdown(self):
raise NotImplementedError()
def connect(self, server):
'''
:param server: server a... | true |
567c80a1fbda761b3f06281dad1673d7553acf4a | Python | rajesh612/Problem-solving-in-BioInformatics-Using-Python | /BioInformaticsSolutions/BioArmoryPb2/dnacount.py | UTF-8 | 416 | 2.703125 | 3 | [] | no_license | from Bio.Seq import Seq
if __name__== "__main__":
dna_file = open('C:/Users/Rajesh/PycharmProjects/BioArmoryPb2/dna_seq.txt').read().strip().split()
for line in dna_file:
dna_seq = Seq(str(line))
print dna_seq
a_count = dna_seq.count('A')
c_count = dna_seq.count('C')
g_count = dna_seq.co... | true |
47c7e8307d6ad248661d55c004a26055cf593ba6 | Python | HongbinW/learn_python | /learn_python/03_OOP/oop_04___del__方法.py | UTF-8 | 267 | 3.953125 | 4 | [] | no_license | class Cat:
def __init__(self,new_name):
self.name = new_name
print("%s 来了"%self.name)
def __del__(self):
print("%s 去了"%self.name)
#tom是一个全局变量
tom = Cat("Tom")
print(tom.name)
#del关键字 可删除一个对象
# del tom
print("-"*50) | true |
3a42b91dbc010c9328fa6955ed22063c4e500196 | Python | surtich/TFG_Manuel_R | /Tema_6_1_Patrones_de_resumen/counter.py | UTF-8 | 745 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
from mrjob.job import MRJob
class counter(MRJob):
def mapper_init(self):
#Creamos un diccionario con los que serán los contadores a 0
self.contadores={"Netherlands":0,"France":0,"Australia":0}
def mapper(self, _, line):
linea=line.split(";")
# ... | true |
1f9dfef72dff666599ae16c48b3b685f4a08db1b | Python | ges0531/TIL | /Algorithm/개념정리/순열/프로그래머스_소수찾기/소수찾기.py | UTF-8 | 993 | 2.84375 | 3 | [] | no_license | def solution(numbers):
answer = 0
a = list(str(numbers))
result = []
def prime_num(num):
for k in range(2, num):
if num % k == 0:
return 0
else:
return 1
def comb(n, r, arr, t):
if r == 0:
ans = int(''.join(t))
... | true |
3285775da4f3c0401767d778b834db6c94dad85e | Python | chrishefele/kaggle-sample-code | /ReverseGameOfLife/src-old-approaches/atabot/readBoards.py | UTF-8 | 3,143 | 3.09375 | 3 | [] | no_license | import pandas
import numpy as np
from tools import create_blank, print_board, board_rows_str
from search import Search
import copy
TEST_FILE = '../../download/test.csv'
TRAIN_FILE = '../../download/train.csv'
BOARD_ROWS = 20
BOARD_COLS = 20
BOARD_SHAPE = (BOARD_ROWS, BOARD_COLS)
BOARD_CELLS = BOARD_ROWS * BOARD... | true |
4892106532338e1db258998458877620b5bb9648 | Python | wang-sj16/Intro2DL | /homework-3/criterion/softmax_cross_entropy.py | UTF-8 | 1,597 | 3.421875 | 3 | [] | no_license | """ Softmax Cross-Entropy Loss Layer """
import numpy as np
# a small number to prevent dividing by zero, maybe useful for you
EPS = 1e-11
class SoftmaxCrossEntropyLossLayer():
def __init__(self):
self.acc = 0.
self.loss = np.zeros(1, dtype='f')
def forward(self, logit, gt):
"""
Inputs:... | true |
813a00c4578e06d650cd857e191af4b0a4dde8a6 | Python | 5l1v3r1/UAB-Projects | /Labyrinth/Brain_4.py | UTF-8 | 2,442 | 3.171875 | 3 | [] | no_license | # -*- coding: latin-1 -*- # Comentari per permetre que s'utilitzin accents i caràcters especials als comentaris i les cadenes de text.
"""
Daniel Martos Tornay - 1369988
Hector De Armas Padron - 1369599
"""
from pyrobot.brain import Brain
from LinkedList import * # Es suposa que LinkedList està implementada correcta... | true |
51ee99599d6ee7d348d848352c58bc82af602d40 | Python | Kartikei-12/Pyrunc | /main.py | UTF-8 | 2,696 | 3.796875 | 4 | [
"GPL-3.0-only"
] | permissive | """main.py file representingcomparison statistics for Pyrunc module"""
# Python module(s)
from timeit import timeit
# Project module(s)
from Pyrunc import Pyrunc
def main():
"""Main Method"""
pr_c = Pyrunc()
# --------------------------------------------------------------------------------
# ----... | true |
590fb6211dab2833ea4251649eb197a13a831ffa | Python | KelvinUbaechu/tic-tac-toe | /logic/game.py | UTF-8 | 2,231 | 3.4375 | 3 | [] | no_license | from typing import Optional
from errors import CellOccupiedError
from models.board import NonOverlappingBoard, BoardView
from models.chips import BoardChip
from models.player import Player, Human, Computer
from logic.judge import BoardJudge
class TicTacToe:
def __init__(self) -> None:
self.initialize()
... | true |
a8a95ca0358798636165e601350f220a453e6ddc | Python | rafalp/misago_docker | /wizard/sentry.py | UTF-8 | 1,653 | 2.625 | 3 | [
"MIT"
] | permissive | import re
from config import misago
from utils import input_bool, input_choice, print_setup_changed_message
SENTRY_DSN_REGEX = re.compile(r"^https://[0-9a-z]+(:[0-9a-z]+)?@sentry\.io/[0-9]+$")
def run_sentry_wizard(env_file):
if input_bool("Enable Sentry logging?"):
run_dsn_wizard(env_file)
else:
... | true |
d641f5eb8e618fabf6593db0c59a08ad06636aaa | Python | clairessmileyworld/Class4finally | /rockpaperscissors.py | UTF-8 | 1,957 | 3.625 | 4 | [] | no_license | import random
computer_win_counter = 0
player_win_counter = 0
print("Welcome. The Rock, Paper, Scissors tournament is starting now. Best of 5.")
print("\n")
name = input("Player 1, please enter your name: ")
def print_result():
global computer_win_counter, player_win_counter
print (name + " won: " + str(play... | true |
249d540e026ae50833e440ed221f1882a03ea650 | Python | sansseriff/caltech-ee148-spring2020-hw03 | /main.py | UTF-8 | 22,052 | 2.53125 | 3 | [] | no_license | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.optim.lr_scheduler import StepLR
from torch.utils.data.sampler import SubsetRandomSampler
import matplotlib.pyplot... | true |
ee1ae22e16c43bba68f6adfaff8621939416abe7 | Python | hevi9/etc-python | /fragtext/parser1.py | UTF-8 | 1,723 | 2.609375 | 3 | [] | no_license | from scanner import Scanner
import logging
import re
from texts import *
log = logging.getLogger()
D = log.debug
class Parser:
def __init__(self):
# define scanners
flags = re.MULTILINE
# flags = 0
self.s1 = Scanner((
(r'\n\n', self.on_nl2),
(r'\n', self.o... | true |
e080bffce33114f21ac41691a2eeb1b0f5a236d1 | Python | kamyu104/LeetCode-Solutions | /Python/find-players-with-zero-or-one-losses.py | UTF-8 | 495 | 3.34375 | 3 | [
"MIT"
] | permissive | # Time: O(nlogn)
# Space: O(n)
import collections
# hash, sort
class Solution(object):
def findWinners(self, matches):
"""
:type matches: List[List[int]]
:rtype: List[List[int]]
"""
lose = collections.defaultdict(int)
players_set = set()
for x, y in matche... | true |
292ad25a5915870484b03bb138c335b9f72880eb | Python | Ilyiad/PATI | /conftest.py | UTF-8 | 7,823 | 2.640625 | 3 | [] | no_license | #!/usr/local/bin/python3.5
#
# Copyright 2016, Dan Malone, All rights reserved
#
import util.globals
import testlink.tltrack
import control.netem
#########################################################################################
#
# MODULE : conftest.py()
#
# DESCRIPTION: This module contains methods speci... | true |
117de10ae0facf1565398b69aa2dc6b8c0e8e355 | Python | smiley16479/AI_bootcamp | /week_0/Day00/ex04/operations.py | UTF-8 | 863 | 3.6875 | 4 | [] | no_license | import sys
def usage():
print ("Usage: python operations.py\nExample:\n python operations.py 10 3")
def inputError():
print ("InputError: too many arguments\n")
def inputError1():
print("InputError: only numbers\n")
num1 = 0
num2 = 0
del sys.argv[0]
if len(sys.argv) < 2:
usage()
sys.exit(0)
e... | true |
202b290562552023d17235432c7e33c6737d2723 | Python | MarioActuationTeam/SuperMarioPlayer | /src/SuperMarioMovement.py | UTF-8 | 11,881 | 3.140625 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
import src.SuperMarioImages as SuperMarioImages
import src.SuperMarioMap as SuperMarioMap
import src.EnumMovement as EnumMovement
##
# This class is responsible for every kind of movement the player makes. It also implements different
# movement strategies.
#
# @author Wolfgang Mair,... | true |
8e86641fc710c5bdb05866889cccd20e9ca9c30a | Python | Stanleyli1984/myscratch | /lc/prob_44.py | UTF-8 | 840 | 3.25 | 3 | [] | no_license | class Solution:
# @param {string} s
# @param {string} p
# @return {boolean}
def isMatch(self, s, p):
array = [1] + [0] * len(s)
for p_char in p:
if not any(array):
return False
new_array = [0] * (len(s) + 1)
if p_char == '*':
... | true |
c39f6b66522fe90414868ccd8639a91662b31b4e | Python | CiprianBodnar/CLM-laboratories | /laborator2/laborator2.py | UTF-8 | 5,160 | 3.375 | 3 | [] | no_license | from nltk.tokenize import word_tokenize, casual_tokenize
import re
corpusName = "corpus.txt"
startWithBigLettter = "^([A-Z])"
listOfAbrv = ["Mr", "Dr", "Lect"]
listOfName = ["a priori", "San Francisco"]
listOfHyphens = ["dati-i-l","dati-m-il","da-mi","s-a","i-am","mi-ai","l-ai","m-ai","m-a","te-a"]
def readCorpusFro... | true |
2d93554de200680f7307cac53dbfc84f8dc54ffc | Python | ach-raf/lacor_es_scrapping | /lacor_products_scrapping/lacor_products_scrapping/spiders/products.py | UTF-8 | 1,950 | 2.828125 | 3 | [] | no_license | import scrapy
class ProductsSpider(scrapy.Spider):
name = "products"
def start_requests(self):
allowed_domains = ['http://lacor.es']
start_urls = ['http://lacor.es/eng/catalogo/chef-sets/4335/%s/' % index for index in range(1, 2)]
for url in start_urls:
yield scrapy.Reques... | true |
d1b00b89034f4a8598679d73bd2ae162a73135f6 | Python | manishapme/hb_ratings_prediction | /server.py | UTF-8 | 4,357 | 2.8125 | 3 | [] | no_license | """Movie Ratings."""
from jinja2 import StrictUndefined
from flask import Flask, render_template, redirect, request, flash, session
from flask_debugtoolbar import DebugToolbarExtension
from model import (User, Rating, Movie, connect_to_db, db, get_user_by_email, add_user,
get_user_by_email_and_pass... | true |
4a749dd615da92bb7914012001fb76e187024da0 | Python | adayofmercury/TIL | /boj/11279.py | UTF-8 | 487 | 2.921875 | 3 | [] | no_license | import sys
import heapq
input = sys.stdin.readline
li = []
for _ in range(int(input())) :
command = int(input())
if command == 0 :
if li :
a = heapq.heappop(li)
print(-a)
else :
print(0)
else :
heapq.heappush(li, -command)
... | true |
03b59f3fc010d5071d499f00c1551183b4b2c059 | Python | TheCamilovisk/WagonDetection | /wagon_tracking/utils.py | UTF-8 | 152 | 2.640625 | 3 | [
"MIT"
] | permissive | import os
import sys
def get_realpath(path):
return os.path.abspath(os.path.expanduser(path))
def warning(msg):
print(msg, file=sys.stderr)
| true |
c1b254bf582325a4706785f35ca1e6a9560e9273 | Python | Daransoto/holbertonschool-machine_learning | /math/0x04-convolutions_and_pooling/4-convolve_channels.py | UTF-8 | 1,951 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
""" This module contains the function convolve_channels. """
import numpy as np
def convolve_channels(images, kernel, padding='same', stride=(1, 1)):
"""
Performs a convolution on images with channels.
images is a numpy.ndarray with shape (m, h, w, c) containing multiple
ima... | true |
71b90444315f1ee092710f841b0b4c4f903567de | Python | watsjustice/qwe | /Parser/parser.py | UTF-8 | 3,920 | 2.671875 | 3 | [] | no_license | import requests
import json
from bs4 import BeautifulSoup as bs
headers = {
'UserAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36'
}
q = 'https://www.gurufocus.com/stock/AAPL/summary'
r = requests.get(url = q).text #, headers = '... | true |
5fd6c12b577a10ec9182a4400555d289449d0873 | Python | jmccormac01/DIAPL2 | /DIAPL_PlotStars.py | UTF-8 | 27,654 | 2.640625 | 3 | [] | no_license | # ----------------------------------------------------------------------------------
# Description
# ----------------------------------------------------------------------------------
#
# DIAPL_PlotStars.py - a program to filter out the variable stars
#
#
# -------------------------------------------... | true |
84338670e54c5af3135425e0ab7d179d0d50c66d | Python | vdblm/Human-Machine-MDP | /environments/make_envs.py | UTF-8 | 9,574 | 3.359375 | 3 | [] | no_license | """
Environment types in the paper for both cell-based and sensor-based state spaces.
"""
from environments.episodic_mdp import GridMDP, EpisodicMDP
from environments.env_types import EnvironmentType
import numpy as np
# default number of features in sensor-based state space
N_FEATURE = 4
# default cell types
CELL_TY... | true |
d36e6208dc97717a599a4dcfd4de92efb63dfc45 | Python | Frindge/Esercizi-Workbook | /Exercises Workbook Capit. 2/Exercise 046 - What Color Is That Square.py | UTF-8 | 490 | 4 | 4 | [] | no_license | # Exercise 46:What Color Is That Square?
l=input("Enter coordinate letter. ")
num=int(input("Enter coordinate number. "))
y=num % 2
x=num % 2
if l > "h" or num > 8:
print("Error,beyond letter h and number 8, data not allowed.")
elif l=="a" and y==0 or l=="b" and y==1 or l=="b" and y==1 or l=="c" and y==0 \... | true |
235688fc4f2e6d5a45674c1273fc4dcb1dc4dc84 | Python | howardpaget/CNTK-UWP-Example | /CNTKFitExample/CNTKFitExample.py | UTF-8 | 2,300 | 2.796875 | 3 | [] | no_license | # Adapted from this example: https://cntk.ai/pythondocs/CNTK_101_LogisticRegression.html
import cntk
import numpy as np
input_dim = 2
num_output_classes = 1
np.random.seed(0)
# Create features and labels that are dependent on them
features = np.asarray(np.random.random_sample((10000, 2)), dtype=np.float32)
labels =... | true |
fbdda5cb06cdb554b0ce15354785aa755bb77f9c | Python | dblotsky/ipd2readable | /shatter.py | UTF-8 | 4,497 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
"""
Splits an IPD binary archive file into a more manageable JSON list of databases and records.
"""
import re
import json
import sys
import os
import argparse
HEADER = "Inter@ctive Pager Backup/Restore File"
class NoMoreBytes(Exception):
def __str__(self):
return "no more bytes"
# de... | true |
ca48f7b5dd3fc79ba7beca6d3237cc9fbcc19152 | Python | yalimohammadi/School-COVID | /Testing_Strategies/netwrok_based_random.py | UTF-8 | 583 | 2.9375 | 3 | [] | no_license | import random
def test_random_neighbor(school,test_cap,status):
testable = []
test_prob=test_cap*1./len(status.keys())
for v in status.keys():
if not(status[v]=="T"):
if random.uniform(0,1)<test_prob:
#now choose a neighbor of v
# note that if u appears t... | true |
bd31994e4458067dc8cf813159a862c3dec85f71 | Python | kugurst/music-recommender | /music/song.py | UTF-8 | 3,522 | 2.65625 | 3 | [] | no_license | import aifc
import base64
import hashlib
import os
import numpy as np
import scipy
from pydub import AudioSegment
from scipy import signal
from scipy.fftpack import fft
from util import os_utils
__all__ = ["Song", "SongSpectrogram", "SongFFT"]
_FFMPEG_ENV = "FFMPEG"
try:
AudioSegment.ffmpeg... | true |
a3842b5644dda74b14c6feef658489b4b1cdb02d | Python | Lazy-coder-Hemlock/Leet_Code-Solutions | /318. Maximum Product of Word Lengths.py | UTF-8 | 308 | 2.78125 | 3 | [] | no_license | class Solution:
def maxProduct(self, words: List[str]) -> int:
res=0
for i in range(len(words)-1):
for j in range(i+1,len(words)):
if len(set(words[i]).intersection(words[j]))==0:
res=max(res,len(words[i])*len(words[j]))
return res
| true |
c8a68e5000c250b35182d842dc13c9a061a31d17 | Python | jcoombes/computing-year-2 | /relscript2.py | UTF-8 | 2,118 | 3.203125 | 3 | [
"Unlicense"
] | permissive | """
Tests the super_boost() method of FourVector class.
This second test ensures boost() has the same behaviour as super_boost() in 1d.
"""
from __future__ import division
import relativity as rel
import numpy as np
fail = False
a0 = rel.FourVector(0,[0,0,0]) #This could be done with a for loop and eval()
a1 = rel.F... | true |
7e97e7c6013fa9da0dbccc16568cc74728f37831 | Python | zdamao/flask_crud | /main.py | UTF-8 | 3,068 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template, request , redirect , url_for
from db import dbconnection
from conversion import get_dict_resultset
import pandas as pd
conn = dbconnection()
cur = conn.cursor()
app = Flask(__name__)
@app.route('/contacts', methods=['GET','POST'])
@app.route('/contacts/<method>/<contact_id... | true |
98c8dd347c44a97c8f7c511e1c2af76eea369911 | Python | arlandgoh/pycrawlers | /nba_players_crawler/TeamCrawlerBasicInfo_v1.0.py | UTF-8 | 7,370 | 2.625 | 3 | [] | no_license | import settings
from settings import delay
from settings import DATA_PATH, MAIN_URL
import os
import requests
from bs4 import BeautifulSoup
import pandas as pd
import sys
import re
import pdb
from datetime import datetime
import time
import numpy as np
def teams_basic_information():
teams_data_dir = os.path.join(DA... | true |
3e310a7a31f6959e3ecc47f1a8f9cd9fd7971747 | Python | milu234/Python | /house.py | UTF-8 | 974 | 3.109375 | 3 | [] | no_license | from tkinter import *
root=Tk()
#Window Appearancw
root.title("House")
c=Canvas(root,bg='white',height=700,width=1500)
#----------------------------------House Front------------------------------------------------
c.create_polygon(600,250,700,150,800,250,800,400,600,400,width=2,fill="yellow",outline='black')
c.creat... | true |
b18882dc45dc6c8c558fc7804db5c83f14a49dc8 | Python | Do-code-ing/ChanSuShin_Algorithm | /알고리즘/01_재귀_Recursion.py | UTF-8 | 1,661 | 4.34375 | 4 | [] | no_license | """
재귀 (Recursion)
재귀 함수 = 함수 내부에서 한 번 이상 자신의 함수를 호출
예1: 1 + 2 + ... + n
sum(n) = 1 + 2 + ... + (n-1) + n
= sum(n-1) + n
def sum(n):
if n == 1:
return 1
return sum(n-1) + n
수행시간:
T(n) = T(n-1) + c = O(n)
1. n ... | true |
da6e6eff1c297c699732be6134b2963e1fa9a6cd | Python | IrvingA5106/APCSP_Zork_Thingie | /main.py | UTF-8 | 12,489 | 3.53125 | 4 | [] | no_license | from __future__ import print_function
from player import Player
def startGame():
print('Welcome to the mysterious mansion.')
# raw_input('Press enter to start the game. ')
player = Player()
basement(player)
print('Congratulations! You escaped the house.')
def library(player):
in_library =... | true |
b6e5ddb8fee11f43cc3dd85d10d159d0bfaa4ab2 | Python | AndreasKralj/SECMizzouCyberChallenge | /logger.py | UTF-8 | 5,322 | 3.40625 | 3 | [] | no_license | def log_operation(user_id,operation,auth,success ):
#The user ID is an interger determined by looking up the auth token in the token database and
#returning the associated user ID. The ID is passed to the logging function as an interger. The
#operation is a character value, defined by its corresponding CRUD value. ... | true |
cb0348fa410526a5f93b823b712577eefed28657 | Python | dwikinuridhuha/shutit-percobaan | /pause.py | UTF-8 | 162 | 2.515625 | 3 | [] | no_license | import shutit
session = shutit.create_session('bash')
session.pause_point('Have a look around!')
session.send('echo "Did you enjoy your pause point?"', echo=True) | true |
db21db67b6689e909deaec37d8689e5b4b5ba1b4 | Python | quyam2/th6 | /bước 6 hoàn thành.py | UTF-8 | 3,715 | 3.046875 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk, Image
from time import sleep
img=[0,0,0,0,0]
game = Tk()
game.title("Game bóng")
# tạo tên cho game``
canvas = Canvas(master=game, width=600 , height=450, background="Light blue")
canvas.pack()
# tạo khung cho game
img[0]=ImageTk.PhotoImage(Image.op... | true |
e8b17ee2610c55dc2996c5df8b85d896f4535f97 | Python | emag-notes/automatestuff-ja | /ch03/validateNumber.py | UTF-8 | 203 | 3.71875 | 4 | [] | no_license | print('整数を入力してください:')
try:
input_num = int(input())
print('入力値: ' + str(input()))
except ValueError:
print('入力された値は整数ではありません。')
| true |
ac66668c91333cca75f5558bf1b4b19a46c56fa0 | Python | 70ucanbin/IMS | /ims/common/ExcelLogicUtil.py | UTF-8 | 6,327 | 2.640625 | 3 | [
"MIT"
] | permissive | import openpyxl as px
import os, shutil, traceback
from calendar import monthrange
from flask import abort
from flask_login import current_user
from ims.service.comServ import getComUser
class __ExcelUtil(object):
"""Excelの共通処理
各出力機能の共通部分を定義します。
1.一時ファイルの作成処理
2.Excel処理中のException処理
3.一時ファイルを閉じ... | true |
3f2910f2e2da27ef07bc2ef5f2f2d039b245a570 | Python | RedRAINXXXX/info2 | /main.py | UTF-8 | 17,984 | 2.53125 | 3 | [] | no_license | import re
import pandas as pd
import os
import glob
import natsort
from tqdm import tqdm
import sys
import os.path
from win32com.client import Dispatch
#initialization
app = Dispatch('Word.Application')
excel = Dispatch('Excel.Application')
data_list = []
label_list = []
color_dict = {'橙色':49407,'蓝色':15773696,'绿色':52... | true |
8f4f7a9553adaeb3811191e67cb92da2fb85604f | Python | inwidyana/thesis | /preprocessing.py | UTF-8 | 3,595 | 2.796875 | 3 | [] | no_license | #%%
import csv
import os
from shutil import copyfile
#%%
def create_file(file_name):
new_file = open(file_name, 'w+')
new_file.close()
def delete_file(file_name):
os.remove(file_name)
#%%
def get_east_java_data(source_file, dest_file):
with open(source_file) as source:
source_data = csv.read... | true |
03a8a969bb6db63662730a6d224bbda0ecd3226f | Python | harshraj22/problem_solving | /solution/leetcode/1025.py | UTF-8 | 948 | 3.59375 | 4 | [] | no_license | # https://leetcode.com/problems/divisor-game/
# Solved again on Feb28, 2021
class Solution:
from math import sqrt
def __init__(self):
self.cache = dict([(1, False), (2, True), (3, False)])
def divisorGame(self, n: int) -> bool:
if n in self.cache:
return self.cache[n]
... | true |
1c738375a7c06c556444c774b02ee57ed395d5ba | Python | aplaceoutofthesun/misc-files | /PythonMisc/bookjoin.py | UTF-8 | 1,594 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
#
# bookjoin.py - small script to join a folder of pdf files into a single file
import os
import sys
import shutil
import PyPDF2
def main(target_path, output_fname=None):
if not os.path.exists(target_path) or not os.path.isdir(target_path):
sys.exit("Check the target path.\nIt must... | true |
47d9259b570a1a60b3247dcea8c1bf14613c0cb8 | Python | doctaphred/stuff-django | /src/accounts/models.py | UTF-8 | 648 | 2.78125 | 3 | [] | no_license | from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
"""Empty user model, for ease of future customization.
According to the Django docs, "If you're starting a new project,
it's highly recommended to set up a custom user model, even if the
default User model is sufficient for... | true |
6db2af6472b80cd7c899ddcf4a57d71870827a99 | Python | pgm-n117/SSIIP1 | /Estructuras/Maze.py | UTF-8 | 1,049 | 3.859375 | 4 | [] | no_license | import sys, random
def getProblemInstance(n, nCars, seed):
"""
This method generates a new problem instance.
Cells with value 0 means empty cells. Cells with value -1 are walls.
Cells with value i (1..n) are occupied by the i-th car.
Returns a maze (problem instance)
Parameters:
:param n... | true |
a9a167ab3db792b1f897f15650cc83aab33cacf2 | Python | CamiloMonteagudo/ViajesMng_Python | /Datos/table.py | UTF-8 | 3,474 | 3.375 | 3 | [] | no_license | import money as Mnd
class Table():
"""Clase base para todas las tables de la base de datos"""
def __init__ (self):
"""Crea una tabla sin ninguna columna"""
self.rows = {}
self.nowId = 0
def NRows(self):
"""Retorna el número de columnas de en la tabla"""
return len(s... | true |
9cb4e88df8c8a2398674ec19a413ab518cc56b6d | Python | martinbo94/INF200-2019-Exercises | /src/martin_boe_ex/ex03_project/test_sorting.py | UTF-8 | 2,550 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'Martin Bø'
__email__ = 'martinb@nmbu.no'
def bubble_sort(data1):
sorted_list = list(data1)
for i in range(len(sorted_list) - 1):
for j in range(len(sorted_list) - 1 - i):
if sorted_list[j] > sorted_list[j+1]:
sorted_list[j], sorted_lis... | true |
b98872e656bc3fb0e12a8ce8d5ed73668e736de2 | Python | cohoe/barbados | /barbados/factories/origin.py | UTF-8 | 316 | 2.546875 | 3 | [] | no_license | from barbados.factories.base import BaseFactory
from barbados.objects.origin import Origin
class OriginFactory(BaseFactory):
@classmethod
def raw_to_obj(cls, raw):
raw_obj = cls.sanitize_raw(raw_input=raw, required_keys=cls.required_keys)
return Origin(**raw_obj) if raw_obj else Origin()
| true |
10d06b93ea3c0800c1df67934eb7b449d6e666da | Python | syujisu/For_Algorithm | /Baekjoon/12865.평범한 배낭.py | UTF-8 | 1,733 | 3.515625 | 4 | [] | no_license | # 문제
# 이 문제는 아주 평범한 배낭에 관한 문제이다.
# 한 달 후면 국가의 부름을 받게 되는 준서는 여행을 가려고 한다. 세상과의 단절을 슬퍼하며 최대한 즐기기 위한 여행이기 때문에, 가지고 다닐 배낭 또한 최대한 가치 있게 싸려고 한다.
# 준서가 여행에 필요하다고 생각하는 N개의 물건이 있다. 각 물건은 무게 W와 가치 V를 가지는데, 해당 물건을 배낭에 넣어서 가면 준서가 V만큼 즐길 수 있다. 아직 행군을 해본 적이 없는 준서는 최대 K무게까지의 배낭만 들고 다닐 수 있다. 준서가 최대한 즐거운 여행을 하기 위해 배낭에 넣을 수 있는 물건들의 가치의 최... | true |
04e92b192153fa5753406c248227a3dfafb1455b | Python | viakondratiuk/e-olimp | /31.py | UTF-8 | 380 | 3.203125 | 3 | [] | no_license | import datetime
dates = []
intervals = int(input())
for i in range(intervals):
dates.append(input())
fridays = 0
for d in dates:
years = list(map(int, d.split()))
for year in range(years[0], years[1] + 1):
for month in range(1, 13):
if datetime.datetime(year, month, 13).weekday() == 4:... | true |
f0c1b3c9f9c921dccf9406e79448787617d3a5fb | Python | sjtupig/codingInterviews | /034-丑数.py | UTF-8 | 2,905 | 4 | 4 | [] | no_license | #暴力解法:超时
# -*- coding:utf-8 -*-
class Solution1:
def GetUglyNumber_Solution(self, index):
# write code here
#ugly = 5**a * 3**b * 2**c, 看a,b,c取值,0-无穷
def is_ugly(a, mul):
for i in mul[::-1]:
while a%i==0:
a=a/i
if a==1... | true |
6dd71a9afd40fbc65b0b6de63819f93c61ec4038 | Python | krvc/Python-Programs | /euler_problems/prob_3.py | UTF-8 | 539 | 4.09375 | 4 | [] | no_license | """
Problem:3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
"""
def prim_fact(n):
"Returns all the prime factors of a positive integer"
if n < 1:
raise ValueError, "Parameter must be at least 1."
factors = []
d = 2
... | true |
cc1930d4b0a745acc47aa9c285852034aefe8d0b | Python | wangbokun/Script | /Mysql批量dump时间段格式表.py | UTF-8 | 1,646 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: kionf
#
import os
import sys
import datetime
#需要加时间的日期表
Change_Tables = ['expadd', 'test', 'user_lock']
Dump_Tables = ''
def strtodatetime(datestr, format):
return datetime.datetime.strptime(datestr, format)
def datediff(beginDate, endDate):
format ... | true |
5eea947e82833ed2302231880656b28e4ef8344e | Python | kippen/Python_Class | /lab_05_01.py | UTF-8 | 1,633 | 5.0625 | 5 | [] | no_license | '''
1) Create an application that uses a list to hold the following data:
Id Name Email
1 Bob Smith BSmith@Hotmail.com
2 Sue Jones SueJ@Yahoo.com
3 Joe James JoeJames@Gmail.com
2) Add code that lets users appends a new row of data.
3) Add a loop that lets the user keep adding rows.
4) Ask the user if they ... | true |
6a77d5acc285700921e56bd8aa6df0b8d6d9fc75 | Python | Mikerpen22/Python_game | /1A2B_ver3.py | UTF-8 | 7,765 | 2.96875 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from PIL import Image, ImageTk
from time import sleep
import pygame
import random
answer = ""
playerGuess = ""
nOfDigits = 4
count = 10
# 我無聊亂放音樂
pygame.init()
pygame.mixer.music.load('Fantasy_Game_Background_Looping.mp3') # Loading File Into Mixer
pygame.mixer.mu... | true |
26dfaa27bf6fe58d4b330a140761bd557474180f | Python | cieabora/opencv | /opencv6.py | UTF-8 | 532 | 2.8125 | 3 | [] | no_license | import cv2
import numpy as np
image = np.full((512, 512, 3), 255, np.uint8)
# image = cv2.line(image, (0, 0), (255, 255), (255, 0, 0), 3)
#
# image = cv2.rectangle(image, (20, 20), (255, 255), (255, 0, 0), 3)
#
# image = cv2.circle(image, (255, 255), 30, (255, 0, 0), 3)
#
# points = np.array([[5, 5], [128, 258], [463,... | true |
d4b5037d8c234446943e7e482257a7a13721804b | Python | yotam-happy/DeepProject | /experiment_setup/src/PairwisePredict.py | UTF-8 | 5,511 | 2.828125 | 3 | [] | no_license | import itertools
import math
import operator
import random
from WikilinksStatistics import *
class PairwisePredict:
"""
This model takes a pairwise model that can train/predict on pairs of candidates for a wikilink
and uses it to train/predict on a list candidates using a knockout method.
"""
de... | true |
330be548f60552645d9ed423625f7f55f4057bd4 | Python | jonasrosland/lpthw | /ex3.py | UTF-8 | 992 | 4.53125 | 5 | [] | no_license | # Print out a line
print "I will now count my chickens:"
# Calculate 25 + 30 divided by 6
print "Hens", 25 + 30 / 6
# Calculate 100 - 25 times 3 modulo 4, which gives 100 - ((25 * 3)%4)
print "Roosters", 100 - 25 * 3 % 4
# Print a line
print "Now I will count the eggs:"
# Calculate (3 + 2 + 1 - 5) + (4 % 2) - (1 / 4... | true |
e718f7cff9ad573d274fd32f41f3843b07ed7954 | Python | pawlos/dnr-visualizer | /parser-tests.py | UTF-8 | 2,038 | 3.234375 | 3 | [
"MIT"
] | permissive | import unittest
import parser
import datetime
from bs4 import BeautifulSoup
class TestParserFunctions(unittest.TestCase):
def test_getGuest_works_when_there_is_with_phrase(self):
self.assertEqual('Coyotee',parser.getGuest('Episode with Coyotee'))
def test_getGuest_works_when_there_is_only_guest_info(self):
sel... | true |
fc9c0bfe00ae9b1638d8a517e7206c32128a5be5 | Python | fahim9898/LearningGit | /for_loop.py | UTF-8 | 91 | 2.625 | 3 | [] | no_license | for i in range(10):
print("hello")
print("Done with for loop")
print("WE in Dev Branch") | true |
2c1e4b8831e3bf6102cf6f1223756087cc617645 | Python | cgautamkrish/optimize-taxi | /fare.py | UTF-8 | 278 | 2.75 | 3 | [] | no_license |
class Fare:
def __init__(self, amount, tips, toll, total, payment_type):
self.amount = amount
self.tips = tips
self.toll = toll
self.total = total
self.payment_type = payment_type
def getAmount(self):
return self.amount
def getTotal(self):
return self.total | true |
c0f324499587d92a00f4140e494e802e562c2a74 | Python | gdeside/LEPL1506_Projet4 | /codepython/coda_tools.py | UTF-8 | 4,314 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Some tools to import and process data from the codas.
Created on Wed Mar 17
@author: opsomerl
"""
import pandas as pd
import numpy as np
from scipy import signal
def import_data(file_path):
"""Imports data from a CODA *.txt file and stores it in a data frame"""
# Import da... | true |
c188f732fe3b8df7a50a4b9585ccf21fe7e22ac3 | Python | omarmohd/historicalStockPrices | /Job3/MapReduce/mapper.py | UTF-8 | 2,934 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
# Serve per creare dizionari annidati
class AutoTree(dict):
def __missing__(self, key):
value = self[key] = type(self)()
return value
# VARIABILI GLOBALI:
# dizionario che immagizzina azione > mese > data iniziale, data finale, valori
stock_mese = {}
# serve da ... | true |
66e3d9c4f410eba7af56a83e22f6242194028f48 | Python | futurecolors/fc-toolbelt | /fc_toolbelt/tasks/git.py | UTF-8 | 1,312 | 2.671875 | 3 | [] | no_license | # coding: utf-8
from fabric.api import local, run
from fabric.tasks import Task
__all__ = ['prune']
class DeleteMergedBranches(Task):
"""Useful git aliases"""
name = 'git'
default_branches = ('dev', 'master')
delete_merged_brances_cmd = ('echo git push origin'
'$(gi... | true |
c9e3962af6fbab9972cdaeddffe82f0f31186a5f | Python | earth-chris/grad-school | /projects/costarica/cr-plot-covar-dist.py | UTF-8 | 2,736 | 2.5625 | 3 | [
"MIT"
] | permissive | # script to plot the density distributions of covariates at the field sites and for costa rica
import aei
import gdal
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib tk
# set the paths to use
base = '/home/salo/Downloads/costa-rica/'
plots = base + 'plots/'
sp_file = base + 'sp-data... | true |