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 |
|---|---|---|---|---|---|---|---|---|---|---|
1ddc22da36debb8da8accacef3c4654f2aa8f2ee | rajkmr97/POM_Python | /Pages/LoginPage.py | UTF-8 | 1,187 | 2.640625 | 3 | [] | no_license | from POMTest.Locators.locators import Locators
class LoginPage():
def __init__(self, driver):
self.driver=driver
self.login_button=Locators.login_button
self.username_textbox=Locators.username_textbox
self.password_textbox=Locators.password_textbox
self.login_btn=Locators.log... | true |
fa6e80455f85a57fdd409cf0c79a06107e356983 | yanmarcossn97/Python-Basico | /Exercicios/exercicio016.py | UTF-8 | 457 | 4.65625 | 5 | [] | no_license | import math
# math.floor(x) - arredonda x para baixo
# math.ceil(x) - arredonda x para cima
# math.fabs(x) - retorna valor absoluto de x
# math.factorial(x) - calcula o fatorial de x
n = float(input('Digite um número: '))
print('Arredondamento para baixo: {}.'.format(math.floor(n)))
print('Arrendondamento para... | true |
657c1feba5e626e42399a4d88a06caf9e59266f2 | paul028/keynet | /keynet/version.py | UTF-8 | 563 | 2.96875 | 3 | [
"MIT"
] | permissive | MAJOR = 0
MINOR = 2
RELEASE = 4
VERSION = '%d.%d.%d' % (MAJOR, MINOR, RELEASE)
def at_least_version(versionstring):
"""Is versionstring='X.Y.Z' at least the current version?"""
(major, minor, release) = versionstring.split('.')
return at_least_major_version(major) and at_least_minor_version(minor) and at_... | true |
aa9c8dfec7ce4815ddfa4c950429aa4a7b300787 | yinwangjie/firstdemo | /webapp/testmine/test2.py | UTF-8 | 1,320 | 2.921875 | 3 | [] | no_license | import unittest
class NumbersTest(unittest.TestCase):
def test_even(self):
for i in range(0,6):
with self.subTest(i=i):
self.assertEqual(i%2,0)
# class MytestCase(unittest.TestCase):
# @unittest.skip("demonstrating skipping")
# def test_nothing(self):
# self.... | true |
364cff47bda2344ddc5122ef3a97e761bc08b235 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2_neat/16_0_2_BssMsi_pancakes.py | UTF-8 | 1,970 | 2.953125 | 3 | [] | no_license | def read_word(f):
return next(f).strip()
def read_int(f, b=10):
return int(read_word(f), b)
def read_letters(f):
return list(read_word(f))
def read_digits(f, b=10):
return [int(x, b) for x in read_letters(f)]
def read_words(f, d=' '):
return read_word(f).split(d)
def read_ints(f,... | true |
57791f0238fefad2b0402cb7e4572c419450ba51 | AnujRuhela7/Python-Tutorial | /A7.py | UTF-8 | 121 | 3.578125 | 4 | [] | no_license | S = input("Enter String : ").split()
#print(list(S))
for i in range(len(S)):
if(len(S[i])%2==0):
print(S[i])
| true |
88e256a7c6cc86f378787484148ffbc128f0fe47 | kmshihabuddin/Optimization-and-Machine-Learning | /Machine Learning CSE 517/Application Projects/Milestone 2 Gaussian Process/GaussianProcess.py | UTF-8 | 3,102 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Implementation project
Milestone 3
Gausssian process
wisconsin breast cancer database used
@author: KMShihab
"""
import numpy as np
import timeit
from utilityFunctions import *
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF,... | true |
10ba42a42d1bdefba6b568a1f7bd09e581c76363 | raviy1290/py2-3 | /generator/prime.py | UTF-8 | 1,170 | 3.8125 | 4 | [] | no_license | # function vs generators
# subroutines vs co routines
# return vs yield
# control of execution -local var/states - freah vs retaining
import time
def get_ps(input_list) :
res_list = list()
for elem in input_list :
if is_p(elem) :
res_list.append(elem)
return res_list
def is_p(num) :
if num > 1 :
if n... | true |
25036fda65c6fd42e3d5253496db4254a9eef881 | saikatkumardey/tweetSpy | /dashboard.py | UTF-8 | 1,169 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import dash
from dash.dependencies import Input, Output, Event
import dash_core_components as dcc
import dash_html_components as html
import datetime
import plotly
import consumer
import analytics
app = dash.Dash(__name__)
consumer = consumer.TweetConsumer()
analytics = analytics.Analytics()
a... | true |
cbe6d5a29e12d9c80e69299db65f24a8a46b6736 | dashapetr/UnitTestsLinearRegression | /linear_regression.py | UTF-8 | 838 | 3.09375 | 3 | [] | no_license | import numpy as np
from sklearn.linear_model import LinearRegression
class SampleLinearRegression:
def __init__(self, regressors, predictor):
self.regressors = regressors
self.predictor = predictor
def reshape_regressors(self):
self.regressors = self.regressors.reshape((-1, ... | true |
75e3e4e4ac6a15bfed5c647eed093440a444dced | mrlancelot/CodingPractice | /LeetCode/py_arrays/replace_dig_char.py | UTF-8 | 257 | 3.015625 | 3 | [] | no_license | replace = "abcdefghijklmnopqrstuvwxyz"
s = "a1b2c3d4e"
res = ""
for i in range(len(s)):
if replace.find(s[i]) == -1:
ind = replace.find(s[i-1])
res = res + replace[ind + int(s[i])]
else:
res = res + s[i]
print(res)
| true |
26e5b9bd1148fe8322aefcc4673803707c1fcfe7 | gubenkoved/daily-coding-problem | /python/dcp_334_game_24.py | UTF-8 | 1,312 | 4.25 | 4 | [] | no_license | # This problem was asked by Twitter.
# The 24 game is played as follows. You are given a list of four integers, each
# between 1 and 9, in a fixed order. By placing the operators +, -, *, and / between
# the numbers, and grouping them with parentheses, determine whether it is possible
# to reach the value 24.
# For e... | true |
8cc2b6d3a728e5d92c74e84d3c0c416ddcf01af5 | crsrikanth84/test14 | /ping_router.py | UTF-8 | 1,106 | 3.40625 | 3 | [] | no_license | import threading
import time
import sys
import os
# BELOW CODE SNIPPET WILL TAKE TWO INPUTS FORM THE USER AND TRY TO PING TO A ROUTER/HOST IP ADDRESS USING THREADS
myLock = threading.Lock()
def ping_router(num, ipaddr):
start = time.time()
if os.system("ping -w 20 -n %d %s" % (num, ipaddr)) == 0:
pr... | true |
249314f5a073009decbdba88eeb2e9154e84e6e7 | Peternguyen199x/LDS | /LDS3/Class3/class3day3/B2. Factorization - Ex4 - Dimensionality Reduction/Ex4 - Cau 2.py | UTF-8 | 1,578 | 3.8125 | 4 | [] | no_license | """=============================================================================
Ex4: SVD Demensionality Reduction
Câu 2:
a) Tải dữ liệu digits từ dataset của sklearn
b) Sử dụng TruncatedSVD để giảm chiều dữ liệu xuống 10 components
c) Trực quan hóa dữ liệu sau khi giảm chiều
https://chrisa... | true |
c9054d8cbbb1d6c1c4bb6c84a349b0788d57c3c2 | GlebMorgan/ProtocolProxy | /v01/protocol.py | UTF-8 | 2,576 | 2.6875 | 3 | [] | no_license | import threading
from notifier import Notifier
from serial_transceiver import DeviceError
class Protocol():
DEVICE_ADDRESS: int
PARITY: str
BAUDRATE: int
flagAliases: dict
def __init__(self):
object.__setattr__(self, 'params', {})
self.lock = threading.RLock()
super().__in... | true |
3e528343d9a887735519679913f2945e66685c88 | nightstorm0909/MusicEA | /ALM/Individual.py | UTF-8 | 2,701 | 2.59375 | 3 | [] | no_license | import math
import numpy as np
import utilities.utils as utils
from ALM import AutoRegressiveLM as alm
class Individual:
minSigma=1e-100
maxSigma=1
minLimit=None
maxLimit=None
N = None
rand = None
multi_dim_mut_rate = None
observed_sequence = None
windowSize = None
def __init__(self):
self.model = alm(N =... | true |
717d28b7767734427a0e20e7bbe61c1534c5098e | binh-vu/semantic-modeling | /pysm/experiments/previous_work/mohsen_jws2015/app_extra.py | UTF-8 | 5,026 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import ujson, logging
from typing import Dict, Tuple, List, Set, Union, Optional
from collections import defaultdict
from pyutils.list_utils import _
from data_structure import Graph, GraphNode, GraphLink, GraphNodeType
from experiments.evaluation_metrics import f1_precision... | true |
0f00e8492bab06183f5449c49f9b3cd1cdc90a44 | shivanichauhan18/more_exercise_question | /harshad_no.py | UTF-8 | 420 | 3.59375 | 4 | [] | no_license | def is_harshad_number(number):
first_number=number/10
second_number=number%10
sum=first_number+second_number
if number%sum==0:
print "harshad no. hai"
else:
print "not harshad no. "
is_harshad_number(input("enter your no."))
def is_harshad_number(number):
i=1
while i<number:
b=i/10
c=i%10
sum=b+c
if... | true |
cf4bf6474562d5e9f1e3227cb01b1c53f601c48e | fmidev/sasse-polygon-process | /lib/smartmethandler.py | UTF-8 | 4,830 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
SmartMet Server data loader
"""
import sys, os, logging, datetime, yaml, requests, re, time
import numpy as np
from configparser import ConfigParser
import pandas as pd
import geopandas as gpd
from shapely import wkt
class SmartMetException(Exception):
""" SmartMet request fails"""
pa... | true |
90930277f01bbdcc63e3f5a6a20e4a9a35c78008 | starcosmos1225/robot_reinforcementLearning | /gym_env/puckWorld_v3.py | UTF-8 | 14,608 | 2.828125 | 3 | [] | no_license | import math
import matplotlib.pyplot as plt
import random
import gym
from gym import spaces, logger
from gym.utils import seeding
import numpy as np
from PIL import Image
class vec2d:
def __init__(self, x_=0.0, y_=0.0):
self.x = x_
self.y = y_
def __mul__(self, v):
# type:(Vec2d)->Vec2... | true |
74c922b364f80fb2b7764e938d1e4c4993ea7901 | nathhje/bachelorproject | /monte_carlo/helpers/simulations.py | UTF-8 | 2,078 | 3.21875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Runs the simulation with the right variables and handles output.
"""
import helpers.runsimulation as run
import numpy as np
import matplotlib.pyplot as plt
import helpers.muaanalytical as muaAna
def Rvsr():
""" Runs the simulation once for a given mua. """
mua = 10.
prop =... | true |
80e14d59487531b4a6cd03ca05ba8aa594132036 | jdavid54/micropython | /wifi_config.py | UTF-8 | 707 | 2.765625 | 3 | [] | no_license | import network
# interface access point
ap_if = network.WLAN(network.AP_IF)
ap_if.active()
# deactive access point
ap_if.active(False)
ap_if.ifconfig()
# interface station
sta_if = network.WLAN(network.STA_IF)
# test interface
sta_if.active()
# configure wifi
sta_if.active(True)
essid = ''
password = ''
sta_if.c... | true |
980c979d01c04be35f1752196b0f19d00c5c24bc | Clemdbs/GLPOOTD | /controller/session_active_controller.py | UTF-8 | 304 | 2.765625 | 3 | [] | no_license | class Session:
def __init__(self):
self.id_user = ""
self.id_musique_en_cours = ""
self.pseudo = ""
def initialiser_user(self, id, pseudo):
self.id_user = id
self.pseudo = pseudo
def actualiser_musique(self, id):
self.id_musique_en_cours = id | true |
4feedd9653e1892286536f20174627cc56426b94 | dneise/multipage-ocr | /multipage-ocr.py | UTF-8 | 2,652 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
"""multipage-ocr.py
Usage:
multipage-ocr.py <input_path> <output_path> [options]
Options:
--density N dpi density for ImageMagick convert [default: 300]
--depth N bit depth for ImageMagick convert [default: 8]
--imageformat FORMAT image format (e.g., jpg, png, tif)... | true |
4efb45bf5c58bca1a411938d743ef86aa69d949c | Praveencode-kumar/Pythonlearning | /chapter 12/12.5.py | UTF-8 | 660 | 3.28125 | 3 | [] | no_license |
#Exercise 12.5
from __future__ import print_function, division
import anagram_sets
def metathesis_pairs(d):
for anagrams in d.values():
for word1 in anagrams:
for word2 in anagrams:
if word1 < word2 and word_distance(word1, word2) == 2:
... | true |
7255809448a69e80b9a97285be0ab5a9a3dff4b9 | masaminh/guess_monbetsu | /create_model.py | UTF-8 | 2,114 | 2.984375 | 3 | [] | no_license | """モデルの作成."""
from argparse import ArgumentParser
import matplotlib.pyplot as plt
from keras.layers import Dense, Dropout
from keras.layers.normalization import BatchNormalization
from keras.models import Sequential
from keras.optimizers import Adam
from utility import read_data
def main():
"""メイン関数."""
pa... | true |
3c291eacb34c6934e95638fc9cc3c1f0c1aed283 | fasemoreakinyemi/Translatron | /Translatron/Server/WebsocketInterface.py | UTF-8 | 10,601 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
from autobahn.asyncio.websocket import WebSocketServerProtocol, \
WebSocketServerFactory
from Translatron.DocumentDB import YakDBDocumentDatabase, documentSerializer
from nltk.tokenize.regexp import RegexpTokenizer
from nltk.tokenize import word_tokenize
try:
import simplejson as json
exc... | true |
d6de0a42d8ae1c76e4d2f60a377ce849093d4c64 | AlexEngelhardt-old/courses | /Data Structures and Algorithms/01 Algorithmic Toolbox/Week 4 - Divide-and-Conquer/assignment/4-inversions/mergesort.py | UTF-8 | 1,241 | 3.765625 | 4 | [] | no_license | def merge_old(left, right):
"""Merge two sorted arrays into one sorted array."""
res = [0] * (len(left) + len(right))
idx_left = 0
idx_right = 0
for i in range(len(res)):
if idx_right >= len(right):
res[i] = left[idx_left]
idx_left += 1
elif idx_left >= len(le... | true |
073f5bdad732715c8a41758e79ba5f8cdd214552 | ghounakey/School | /cs232/hw7/ram.py | UTF-8 | 1,444 | 3.546875 | 4 | [] | no_license | ############################################################################
# CS 232 Homework 7
# Edited by: Advait Scaria
# added an MMU class to handle address checking
############################################################################
RAM_SIZE = 1024
class RAM:
def __init__(self, size=RAM_SIZE):
... | true |
f3de2813ccb77a8ada51836a7360fa203c74b6de | Irfan-S/BookistAPI | /tests/test_main_crud.py | UTF-8 | 4,504 | 2.609375 | 3 | [] | no_license | from fastapi.testclient import TestClient
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import json
from ..database import Base
from ..main import app, get_db
SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_sam... | true |
bff1d7f0f15021598de00ee04763df117127a8ce | abfarahani/Image-segmentation | /src/tiramisu/datasets/cilia.py | UTF-8 | 3,680 | 2.625 | 3 | [
"MIT"
] | permissive | '''
This code is mofified from
https://github.com/bfortuner/pytorch_tiramisu/blob/master/datasets/camvid.py
We also got some inspiration from
https://github.com/whusym/Cilia-segmentation-pytorch-tiramisu
'''
from glob import glob
import os
import numpy as np
from torchvision import transforms
from torch.utils import... | true |
f1300557835bfa93a33f8b9fea0e67827c07350d | galid1/Algorithm | /python/baekjoon/2.algorithm/dynamic_programming/백준_동전_2.py | UTF-8 | 759 | 2.5625 | 3 | [] | no_license | import sys
def solution():
global d, n, k, cs
for i in range(1, n + 1):
for j in range(1, k+1):
if j < cs[i]:
d[i][j] = d[i-1][j]
else:
if d[i-1][j] == -1 and d[i][j-cs[i]] == -1:
d[i][j] = -1
elif d[i-1][j] !=... | true |
97875fa355509c763dc34f7c46265995eaebd41d | prajitdas/AndroidAnalytics | /code/collection/extractApkAndPermissionsFromMobile.py | UTF-8 | 4,421 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on Apr 4, 2015
@author: Prajit Kumar Das
Usage: python extractApkFromMobile
'''
from bs4 import BeautifulSoup
import urllib2
import os
import sys
import subprocess
import databaseHandler
import platform
import _mysql_exceptions
import time
# Update "downloaded" c... | true |
3764b5bc941f76dbca306e4e3a7958ffbb8ffe40 | mintchocoicecream/SOULMOVIE | /crawling/01.crawling_to_csv.py | UTF-8 | 3,144 | 2.578125 | 3 | [] | no_license | from urllib.request import urlopen
import urllib
import xml.etree.ElementTree as et
from xml.etree.ElementTree import parse
import csv
# csv 파일 생성
with open('./list/movielist.csv', 'w', newline='', encoding='utf-8') as csvfile:
# column = [영화명, 영화명(영문), 개봉연도, 장르, 배우, 이미지주소]
fieldnames = ['title', 'alternativeT... | true |
83d952563ee364f06b8031dffa785eef2e7da93b | genggng/leetcode | /648.单词替换.py | UTF-8 | 808 | 3.515625 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=648 lang=python3
#
# [648] 单词替换
#
# @lc code=start
class Solution:
"""
哈希集合:用python的集合查找对应的字符串,时间复杂度为O(1)
总体时间复杂度为O(n*m) n为单词个数,m为单词平均长度
"""
def replaceWords(self, dictionary: List[str], sentence: str) -> str:
sentence_list = sentence.split(" ")
dictionar... | true |
54041d71bd2635d1080433f5722cbdf9000e79d2 | kobewangSky/Faster_RCNN_Pytorch_Easy | /nms/NMS_Python.py | UTF-8 | 1,616 | 2.546875 | 3 | [] | no_license | from torch import Tensor
import torch
import numpy as np
class NMS(object):
@staticmethod
def suppress(sorted_bboxes:Tensor, threshold:float)-> Tensor:
keep_indices = np.zeros(0)
temp_sorted_bboxes = sorted_bboxes
while(len(temp_sorted_bboxes)):
keep_indices = np.append... | true |
460c1978cc9ecf102350a689f8c384d3ff8e12b2 | nickdrones/Various-Python-Programs | /Fractals/Fractal Generator & Display.py | UTF-8 | 3,040 | 3.65625 | 4 | [] | no_license | from Tkinter import *
from FractalClass import *
class myFractalCode(Canvas):
def __init__(self,parent):
Canvas.__init__(self,parent,bg = "white")
self.pack(fill=BOTH, expand=1)
self.dimensions={}
self.dimensions["width"] = WIDTH
s... | true |
046777104a1eba8a1aecf061b1a53ec899ae6a5f | chasehult/Tubish | /update.py | UTF-8 | 3,365 | 2.765625 | 3 | [] | no_license | try:
trans=open("Translation.txt", "r+")
except:
trans=open("Translation.txt", "w+")
try:
tubbish=open("Tubbish_word.py", "r+")
except:
tubbish=open("Tubbish_word.py", "w+")
try:
this=open("update.py", "r+")
except:
this=open("update.py", "w+")
import urllib, urllib2
print "Updating"
def update(... | true |
4849d78e423cb5103b85ea8b7e7a46dddf0e7056 | seckcoder/lang-learn | /python/test/test.py | UTF-8 | 229 | 2.84375 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
#-*- coding=utf-8 -*-
#
# Copyright 2012 Jike Inc. All Rights Reserved.
# Author: liwei@jike.com
def foo(t):
print "called"
return t
res = [tmp for tmp in\
[foo(t) for t in [1,2,3,4,5]]]
print res
| true |
b8dfe6b3bd4edfd6c979c3cbf8a3b04aaf76d684 | gartea/rpi_crypto_hw1 | /hw2Programming/bob.py | UTF-8 | 2,896 | 2.890625 | 3 | [] | no_license | import socket
import random
from threading import Thread
import datetime
kdc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
kdc_host =''
kdc_port =8080
kdc.connect((kdc_host,kdc_port))
a_id = 1
b_id = 2
private_key = None
public_key = None
kdc_shared_key = None
alice_key = None
confirmation_nonce = None
def dh(... | true |
92224d78ba3b95f39527be091c00a49672cd49bb | zan69/Chess_py | /pieces/Knight.py | UTF-8 | 1,648 | 3.34375 | 3 | [] | no_license | from PIL import Image
from pieces import Piece
class Knight(Piece.Piece):
def __init__(self, x: int, y: int, white: bool):
super().__init__(x, y, white)
if white:
self.img = Image.open('img/white_knight.png').convert('RGBA')
else:
self.img = Image.open('img/black_kni... | true |
85dac81e7692f2098e7c63ddc613d7297ed0897c | m-dobler/sobot-rimulator | /models/Physics.py | UTF-8 | 3,582 | 2.734375 | 3 | [] | no_license | # Sobot Rimulator - A Robot Programming Tool
# Copyright (C) 2013-2014 Nicholas S. D. McCrea
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | true |
549597940ff4099127556ebd27656002145efe1a | eselyavka/python | /leetcode/solution_98.py | UTF-8 | 2,981 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
import unittest
class TreeNode(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class Solution(object):
def populateInorder(self, root, arr):
if root:
self.populateInorder(root.left, arr)
arr.ap... | true |
4bbc03132b889d52d495e44492db64825a16b729 | jia80H/python-advance-learning | /00 练习.py | UTF-8 | 289 | 2.78125 | 3 | [] | no_license | import requests
payload_tuples = [('key1', 'value1'), ('key1', 'value2')]
r1 = requests.post('https://httpbin.org/post', data=payload_tuples)
payload_dict = {'key1': ['value1', 'value2']}
r2 = requests.post('https://httpbin.org/post', data=payload_dict)
print(r1)
print(r1.text == r2.text) | true |
63370bf1356ae3d95c55bc64e77bf73b9654851c | creaciond/russian-stage-classification | /rule_based_semantic_model.py | UTF-8 | 4,298 | 3.421875 | 3 | [] | no_license | # encoding: utf-8
import gensim
import numpy as np
import pandas as pd
import wget
import zipfile
from sklearn.metrics.pairwise import cosine_similarity
class SemanticRuleClassfier:
def __init__(self):
"""Initiates a classifier.
"""
print("Started loading w2v model")
with zipfile... | true |
649a73f073027eab1be9c32aa2b157f646d7d6ea | AdamZhouSE/pythonHomework | /Code/CodeRecords/2105/60616/270971.py | UTF-8 | 490 | 3.109375 | 3 | [] | no_license | def computeArea( A, B, C, D, E, F, G, H):
if min(C, G) - max(A, E) < 0 or min(D, H) - max(B, F) < 0:
S_overlap = 0
else:
S_overlap = (min(C, G) - max(A, E)) * (min(D, H) - max(B, F))
S_first_square = (D - B) * (C - A)
S_second_square = (H - F) * (G - E)
return S_second_square + S_fir... | true |
152ee4f0c4a0ebfcb85a0445d63383c5582e09f6 | seandiacono/ARI3129-Advanced-Vision | /src/video-analysis/video.py | UTF-8 | 2,662 | 2.5625 | 3 | [] | no_license | import os
import cv2
import json
import numpy as np
font = cv2.FONT_HERSHEY_SIMPLEX
model = r"haar"
path = f"results/{model}-images"
count = json.load(open(f"video-analysis-results/lane-count/{model}_count.json"))
polys = {}
maskrcnn_pad = {"s1" : 93, "s2" : 133, "s3" : 142}
red = (0, 0, 255)
blue = (255, 0, 0)
siz... | true |
79ff639654bef17be5d377c30d5de25db2245872 | ssainz/bidding_simulator | /load_yoyi_dataset.py | UTF-8 | 1,079 | 2.765625 | 3 | [] | no_license |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#str_file = "/media/onetbssd/bidding_simulator/yoyi/train_set_example.txt"
str_file = "/media/onetbssd/bidding_simulator/yoyi/train_set"
map_features = {}
map_market_price = {}
count = 0
with open(str_file, 'r') as f:
for line in f:
... | true |
41a2f355c039a70bc505bebfa8496b88570dc7cb | rafaelperazzo/programacao-web | /moodledata/vpl_data/359/usersdata/293/109614/submittedfiles/lecker.py | UTF-8 | 904 | 3.796875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
n=int(input("Digite o tamanho da lista: "))
lista1=[]
lista2=[]
for i in range(0,n,1):
lista1.append(int(input("Digite o valor da lista 1: ")))
for i in range(0,n,1):
lista2.append(int(input("Digite o valor da lista 2: ")))
cont1=0
for i in range(1,n,1):
if lista1[i] > lista1[i-... | true |
6d725d4e831cb1e571caee37e4bfd20cc99fbd88 | rubens73/SPOJ | /Python/soma.py | UTF-8 | 112 | 3.390625 | 3 | [] | no_license | x = int(input())
soma = 0
for index in range(0,x):
num = int(input())
soma = soma+num
print(soma)
| true |
7d1cc5b9be53e3b286a23dddd9ced5b0798fced5 | dcs4cop/xcube | /xcube/core/subsampling.py | UTF-8 | 8,799 | 2.546875 | 3 | [
"MIT"
] | permissive | # The MIT License (MIT)
# Copyright (c) 2022 by the xcube development team and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limit... | true |
1eb7a281bd57bd900b1979274a784cbda97d10e0 | jportegag11/Megaproyecto | /add.py | UTF-8 | 2,281 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 18:55:45 2018
@author: user
"""
from matplotlib import pyplot
import numpy as np
import collections as cl
import math
ci1=[]
c=[]
ch=[]
cargas=[]
ar=open("atitlan25-08-18_2_nogps_2018_04_28_05h00.dat","r")
for linea in ar.readlines():
if linea[0]!='#':
ci1.... | true |
ae7ec0134b9d1621457ceb3985775799ac511f68 | lappsgrid-incubator/flask-services | /code/utils.py | UTF-8 | 453 | 2.765625 | 3 | [] | no_license | import json
def info(message):
print('INFO:', message)
def debug(message):
print('DEBUG:', message)
def dump(obj):
return json.dumps(obj, indent=4)
def get_vars(request, var_names):
return [get_var(request, var_name) for var_name in var_names]
def get_var(request, var_name):
if request.met... | true |
5cfc840e842cd93e79893a11f5357899a95d3291 | jnshill/ArcPyPublishing | /PublishLayersAsMIL.py | UTF-8 | 5,260 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
"""PublishLayersAsMIL.py: shares a list of layers as a map image layer to portal."""
import arcpy, json
from urllib.request import urlopen
from urllib.parse import urlencode
__author__ = "Shilpi Jain"
__copyright__ = "Copyright 2018, Esri"
__credits__ = ["Shilpi Jain"]
__license__ = ... | true |
c3470fc78e5301367b4a4d7f46e68b25992f90f1 | humbertoperdomo/practices | /python/AutomateTheBoringStuffWithPython/PartI/Chapter06/picnicTable.py | UTF-8 | 577 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python3
TAB_SIZE = 4
def printPicnic(itemsDict, leftWidth, rightWidth):
print('PICNIC ITEMS'.center(leftWidth + rightWidth, '-'))
for k, v in itemsDict.items():
print(k.ljust(leftWidth, '.') + str(v).rjust(rightWidth))
def getLongestKey(items):
longest = ''
for k in items.keys():
... | true |
4968a71dd3952d50bde86fd812d3ba0c0de80030 | zhaolewen/DrQA-TF | /drqa/model.py | UTF-8 | 5,668 | 2.546875 | 3 | [] | no_license | import numpy as np
import logging
import tensorflow as tf
from .rnn_reader import RnnDocReader
logger = logging.getLogger(__name__)
class DocReaderModel():
"""Inputs:
x1 = document word indices [batch * len_d]
x1_f = document word features indices [batch * len_d * nfeat]
x1_p... | true |
e56d303793671c9fcb305c68b7e920d7436421ab | jmgc/pyston | /test/tests/descriptors_callattr_cls_ics.py | UTF-8 | 2,089 | 3.09375 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | # expected: statfail
# run_args: -n
# statcheck: stats['slowpath_callattr'] <= 100
# Right now this won't work because callattr involves two calls
# one call to __get__ and then another call to the returned function.
# Of course, if the callattr were split up into getattr and a call,
# each could be re-written separat... | true |
3e39cd36fd843ae3b8b119a6a08dbba4b6f98ad0 | MariaGabrielaReis/Python-for-Zombies | /List-06/L6-ex001.py | UTF-8 | 742 | 4 | 4 | [] | no_license | # A. dormir
# dia_semana é True para dias na semana
# feriado é True nos feriados
# você pode ficar dormindo quando é feriado ou não é dia semana
# retorne True ou False conforme você vá dormir ou não
def dormir(dia_semana, feriado):
if feriado or not dia_semana:
return True
return False
def test(obtido, esper... | true |
b0a88ee48e7bd50b1f86f25bfe125855617ec582 | talgat-storage/pufiki190630 | /accounts/utilities.py | UTF-8 | 232 | 2.53125 | 3 | [] | no_license | from accounts.models import User
def get_existing_user(email, is_active):
existing_user = None
if email:
existing_user = User.objects.all().filter(email=email, is_active=is_active).first()
return existing_user
| true |
92e0bb9ebce3b37dc93c61f64c45b77941f661f6 | gladyscarrillo/mcc-adm-bozacarrillo | /calculo_manual.py | UTF-8 | 2,482 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from scipy.spatial.distance import euclidean
from fastdtw import fastdtw
import os
import time
def calcular_distancia(obj1, obj2):
files_path = "/home/gcarrillo/proyecto/ClusterTimeSeries-1000/trace-Opens.txt-interarrivals-1000"
#tiempos de objeto 1
nombr... | true |
94364a177776797a044bede5e1bfaf60cc537397 | jingzhian/aoc-2019 | /day08/code.py | UTF-8 | 1,269 | 3.953125 | 4 | [] | no_license | #
# Images are sent as a series of digits that each represent the color of a single pixel.
# The digits fill each row of the image left-to-right, then move downward to the next row, filling rows top-to-bottom until every pixel of the image is filled.
# Each image actually consists of a series of identically-sized laye... | true |
40d01aa45ce41247e5f45204a1feff20c0b3ca16 | Aasthaengg/IBMdataset | /Python_codes/p02270/s813987548.py | UTF-8 | 676 | 3.09375 | 3 | [] | no_license | def binarytruck(maxweight,truck,num):
disp = 0
for n in range(num):
if maxweight - targ[n] - disp < 0:
disp = targ[n]
truck -= 1
else:
disp += targ[n]
return truck > 0
num,truck = (int(n) for n in input().split(' '))
global targ
targ = []
for n in range(nu... | true |
60ef9a906b7c0fa3b9609e3b1e16eb82e0e61373 | Lisooo/HomeBudgetProject | /app_1_downloader/dictionaries/dictDateTime.py | UTF-8 | 724 | 3.625 | 4 | [] | no_license | class DictDatetime(object):
@staticmethod
def dict_moth(month):
month = str(month)
d = {}
# POLISH months
d["01"] = "Styczeń" # january
d["02"] = "Luty" # february
d["03"] = "Marzec" # march
d["04"] = "Kwiecień" # ... | true |
6017ee3e478f57134bab5e1b99b78ac9eb3899be | amandaabalos/mbox-short | /10.2.py | UTF-8 | 895 | 2.65625 | 3 | [] | no_license | fhand=open('mbox-short.txt')
newlist=list()
for line in fhand:
line=line.rstrip()
if 'From ' in line:
words=line.split()
#print(words)
ind=words[5]
hr=ind.split(':')
#print(hr[0])
#count=count+1
#print(ind)
newlist.append(hr[0])
#print(newlist)
... | true |
bfd5d4be877f2284b7678a272690fe4fa2d141b5 | infinispan/infinispan | /bin/find_broken_links.py | UTF-8 | 1,237 | 2.859375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | permissive | #!/usr/bin/python3
import re
import os
from urllib.request import Request, urlopen
"""
Finds broken links in documentation. Takes ~13 minutes. Run from root infinispan directory.
"""
rootDir = 'documentation/target/generated-docs/'
def isBad(url):
req = Request(url, headers={'User-Agent': 'Mozilla/5.0 Chrome... | true |
6c0b56c436791151ae146a507c4cbfea2bbc409f | YuelongLi/HaliteAI-Bot | /test/set.py | UTF-8 | 145 | 2.65625 | 3 | [] | no_license | import random
parent = [3.0, 1.0, 2.0, 1.0, 10.0, 1.0, 300.0, 300.0, 1.0, 7.0, 1.0]
i = []
i.append(random.randint(1, len(parent)))
print(i[0])
| true |
df1a53f933740c14054f839395375b1d1b058b91 | janmaltel/stew-tetris | /stew/stew/speed_tests.py | UTF-8 | 878 | 2.84375 | 3 | [] | no_license | from timeit import timeit
setup = """
import numpy as np
from numba import njit
@njit
def create_diff_matrix(p):
D = np.full((p, p), fill_value=-1.0, dtype=np.float_)
# np.fill_diagonal(D, np.float_(p-1.0))
for i in range(p):
D[i, i] = p - 1.0
return D
lam = 10000
n = 100
p = 3
D = create_di... | true |
29be5183343da3e23808fb120dd429eb1ded87dd | Beatriz-Paes/CursoPython | /seção02/aula32.py | UTF-8 | 872 | 3.859375 | 4 | [] | no_license | """
Iterando strings com while
"""
############################################################
'''
minha_string = 'o rato roeu a roupa do rei de Roma.'
tamanho = len(minha_string)
c = 0
nova_string = ''
while c < tamanho:
if minha_string[c] == 'r':
nova_string = nova_string + minha_string[c].upper()
... | true |
5da5476d3bd5a59b4a8f837ef944b66cb8383a3e | jbruns/smartchime | /scroller.py | UTF-8 | 2,232 | 2.8125 | 3 | [] | no_license | from luma.core.image_composition import ImageComposition, ComposableImage
class Scroller():
WAIT_SCROLL = 1
SCROLLING = 2
WAIT_REWIND = 3
WAIT_SYNC = 4
def __init__(self, image_composition, rendered_image, scroll_delay, synchroniser):
self.image_composition = image_composition
self... | true |
ca9392f368b2acadf462ebfbfa43f67946fe3986 | bvilhjal/PyGWAS | /pygwas/core/enrichment.py | UTF-8 | 3,720 | 2.71875 | 3 | [
"MIT"
] | permissive | import genotype
import numpy as np
import random
import logging
import operator
logger = logging.getLogger(__name__)
class permute():
def __init__(self):
pass
def load_vectors(self, target, match):
' load input as 0,1 vectors with length equal to total number of snps '
self.target = t... | true |
e38dd9ba6fb4dbb6db3252a502c15e470f70f640 | vcpope/transcript_subsequence_matching | /analysis_code/analysis_example.py | UTF-8 | 1,692 | 2.984375 | 3 | [] | no_license | # Sample analysis code to test on sample data:
# To run in terminal:
# $ python3 analysis_example
# If matching a large number of shows, it is easiest to run the combo_extractMatches
# function wth combinations:
# # Transcripts
# from itertools import combinations
# from transcriptseqanalysis import combo_extractMatch... | true |
085e44b1c82831b83d334681087a7d018d5bb6d3 | preston-scibek/Python | /talon_skin_picker.py | UTF-8 | 442 | 3.5 | 4 | [] | no_license |
import random
def talon_skin_picker():
""" pick a random talon skin """
choices = {
1: "Blood Moon",
2: "Samsung White",
3: "DragonBlade",
4: "Renegade",
5: "Crimson Elite",
6: "Base"
}
skin = random.Random()
result = skin.randint(1, 6)
return ... | true |
a8de5f77fea4bc4e258a105fa8ea5362822e1b75 | h1-the-swan/infomap_mag_snapshot | /get_linklist_pickle.py | UTF-8 | 2,534 | 2.75 | 3 | [] | no_license | import sys, os, time, pickle
from datetime import datetime
from timeit import default_timer as timer
from collections import defaultdict
try:
from humanfriendly import format_timespan
except ImportError:
def format_timespan(seconds):
return "{:.2f} seconds".format(seconds)
import logging
logging.basicC... | true |
f672f589a75335c74f8353d8d6d47519b7139db0 | xy2333/Leetcode | /leetcode/Power.py | UTF-8 | 721 | 3.546875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
def Power(self, base, exponent):
# write code here
if base == 0 and exponent == 0:
raise ValueError('in 0**0')
if exponent == 0:
return 1
if base == 0:
if exponent > 0:
return 0
else:
raise... | true |
9ede07559fe1b510ca5e95a424c76fd3bd31974d | daniel-reich/ubiquitous-fiesta | /oLmAshdKHWLP3ck7e_7.py | UTF-8 | 241 | 2.71875 | 3 | [] | no_license |
def min_difference_pair(nums):
nums.sort()
result, dif = [nums[0], nums[1]], nums[1] - nums[0]
for i,j in zip(nums[1:],nums[2:]):
if j-i < dif or (j-i == dif and j+i < sum(result)):
result, dif = [i,j], j-i
return result
| true |
6d2b1521f57a9eaab23375a14a1724f36532221d | eufrazio/ProcessamentoImagem | /proc_imagem-Distancias.py | ISO-8859-1 | 977 | 3.109375 | 3 | [] | no_license | #-* coding: cp1252 -*-
__author__ = 'Euf'
from PIL import Image
import numpy as np
from math import sqrt
import math#biblioteca para poenciacao
#----------------------------------------------------------------
print("\n\nClculo de Distncias\n")
imagem = Image.open("robotech1.jpg")
imageDist = np.array(imagem,dtype=... | true |
83d376804d80e55704cd2303f55e1a3c73f27b14 | thomas-liao/python_prac | /VIM/temp.py | UTF-8 | 116 | 2.734375 | 3 | [] | no_license | bottom_indices = [0] + [i for i in range(7, 18)] + [18] + [i + 18 for i in range(7, 18)]
print(len(bottom_indices)) | true |
89537e353c7188f14b3929b5fc171a0eddef3132 | Agnij-Moitra/readability-checker | /docxfile.py | UTF-8 | 865 | 2.609375 | 3 | [
"CC0-1.0"
] | permissive | import sys
import importlib.util
import docx
def main(doc_path):
# importing readability.py
readability = load_module("readability-algo.py", "main")
doc_txt = str(extract_txt(doc_path))
if doc_txt == "404: Not File Found":
return "404: Not File Found"
readindex = readability.main(doc_txt... | true |
069b247ab6f7783b73baf7339a8aa440d8e279f4 | matheusd0mingos/VF_Domingos | /Questao1/Questao1.py | UTF-8 | 1,859 | 2.65625 | 3 | [] | no_license | import pandas as pd
import glob
import os
path=os.getcwd()
path=str(path)+'\Compras'
print(path)
all_files = glob.glob(path + "/*.csv")
li = []
for filename in all_files:
df = pd.read_csv(filename, index_col=None, names=['Nome', 'Preço', 'Data'])
li.append(df)
frame = pd.concat(li, axis=... | true |
b8b4787a242e641f3f2c525cd9265b7dfb2ffd65 | kaelzhang/stock-pandas | /test/test_truncated.py | UTF-8 | 2,769 | 2.75 | 3 | [
"MIT"
] | permissive | from stock_pandas.dataframe import StockDataFrame
import pytest
import numpy as np
from .common import (
create_stock,
get_last,
get_stock_update
)
@pytest.fixture
def stock():
return create_stock()
def test_drop(stock):
assert get_last(stock['ma:2']) == 7.5
assert get_last(stock['ma:2,high... | true |
014526a2d2454149425c690dd40730bc30d20967 | matheus695p/fraud-detection | /src/config/config.py | UTF-8 | 6,187 | 2.578125 | 3 | [] | no_license | import warnings
from argparse import ArgumentParser
warnings.filterwarnings("ignore", category=DeprecationWarning)
def xgboost_arguments():
"""
El parser de argumentos de parámetros para el xgboost params grid
Returns
-------
args : argparser
argparser con todos los parámetros del modelo.
... | true |
1c67d9363c7701f880f8d336043ca365f0048881 | VidMegushar/AOC_2020 | /day1.py | UTF-8 | 393 | 3.125 | 3 | [] | no_license | import time
with open('input1.txt') as f:
data = [int(i) for i in f.readlines()]
t1 = time.time()
data.sort()
for i in range(len(data)-2):
for j in range(i+1, len(data)-1):
for k in range(j+1, len(data)):
if data[i] + data[j] + data[k]== 2020:
print(data[i] * data[j] * d... | true |
98da00f26fe20873ef183b0e9c87fa1e819a9afd | helblazer811/ManimML | /manim_ml/neural_network/layers/convolutional_2d_to_feed_forward.py | UTF-8 | 1,893 | 2.84375 | 3 | [
"MIT"
] | permissive | from manim import *
from manim_ml.neural_network.layers.parent_layers import ConnectiveLayer, ThreeDLayer
from manim_ml.neural_network.layers.feed_forward import FeedForwardLayer
from manim_ml.neural_network.layers.convolutional_2d import Convolutional2DLayer
class Convolutional2DToFeedForward(ConnectiveLayer, ThreeD... | true |
c8a863382a707d0eb4650c3bae1f9143b9580180 | jsicot/idref2zotero | /retrieve_author_ppn.py | UTF-8 | 1,659 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import csv
import urllib.request,urllib.parse,json
import os, ssl
# SSL exception
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and
getattr(ssl, '_create_unverified_context', None)):
ssl._create_default_https_context = ssl._create_unverified_context
def getPpn(name,firstname,birthd... | true |
ed5cdced5ed9067a1dc8d09d0b6ac5729ffc6eac | MaxSaunders/1aDay | /sum13.py | UTF-8 | 486 | 4.25 | 4 | [] | no_license | """
Return the sum of the numbers in the array, returning 0 for an empty array.
Except the number 13 is very unlucky, so it does not count and numbers that
come immediately after a 13 also do not count.
sum13([1, 2, 2, 1]) → 6
sum13([1, 1]) → 2
sum13([1, 2, 2, 1, 13]) → 6
"""
def sum13(nums):
i = 0
... | true |
c29ba4765519a3a698420082b168fa434d2f9d74 | i-djurdjevic/BioinformaticsCourseBook | /poglavlja/1/kodovi/FasterFrequentWords.py | UTF-8 | 2,672 | 3.484375 | 3 | [] | no_license | def symbol_to_number(c):
pairs = {
'A' : 0,
'T' : 1,
'C' : 2,
'G' : 3
}
return pairs[c]
def number_to_symbol(n):
pairs = {
0 : 'A',
1 : 'T',
2 : 'C',
3 : 'G'
}
return pairs[n]
def number_to_pattern(n, k):
if k == ... | true |
0197ed2a7348c251052ffc9d144abb48f1dee0f3 | hieu1394/chatbothieu | /databasevar.py | UTF-8 | 737 | 2.828125 | 3 | [] | no_license |
class Variables:
def __init__(self):
self.bossname = "Hiếu"
self.bossrelative = "anh"
self.botname = "Kusuka"
self.botrelative = "em"
self.botbirthyear = 1997
self.polite = 60
self.feelinglist = [("vui",0.3),("buồn",0.2),("bình thường",0.3),("chán",0... | true |
a3f8872b4c65576e6584b943531606b7fbfd1d37 | codygman/document-image-reader | /DocVision.py | UTF-8 | 12,812 | 2.71875 | 3 | [] | no_license | import cv2
import numpy as np
import math
import os
import copy
from PIL import Image
from scipy import stats
from scipy import ndimage
import GeometryFunctions as GEO
def GetVerticeListFromContour(contour):
vList = []
for v in contour:
vList.append([v[0][0], v[0][1]])
return vList
def rotateIm... | true |
caa06535fa243cbaa6b4617ed02b5515d06d5bf7 | joranerogier/NIPS-project | /src/check_dir.py | UTF-8 | 229 | 3.265625 | 3 | [] | no_license | import os
def check_dir(DIR):
"""
Check if directory already exists.
If not, create the directory.
"""
if not os.path.exists(DIR):
print("Creating directory '%s' ...", (DIR))
os.makedirs(DIR)
| true |
6d36023a73abfdc1ef051a26755ce7d4441566c5 | leo173701/codes-bank | /path-with-maximum-probability/path-with-maximum-probability.py | UTF-8 | 717 | 2.921875 | 3 | [] | no_license | class Solution:
def maxProbability(self, n: int, edges: List[List[int]], succProb: List[float], start: int, end: int) -> float:
graph, prob = dict(), dict() #graph with prob
for i, (u, v) in enumerate(edges):
graph.setdefault(u, []).append(v)
graph.setdefault(v, []).append(u)... | true |
a878fd3988be63a55110c76c0f099d9a362456a8 | PathwayAnalysisPlatform/ProteoformNetworks | /src/Python/lib/percolation.py | UTF-8 | 6,033 | 3.265625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | # Library with functions for percolation analysis
import copy
import itertools
import random
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
from scipy.interpolate import make_interp_spline
def getCompletenessValues(n):
"""
Returns a list of n float values in rang... | true |
cb3bcae5a2d5ba8f5a410cc05a9dab4ff024e067 | Sergtrf/Sergey-Trofimov | /Python школа(2017-2020)/5.py | UTF-8 | 64 | 3.15625 | 3 | [] | no_license | a = open('input.txt', 'r')
d = a.read()
a.close()
print(d[::-1]) | true |
96ea995e95b9677e92cd1a74dff3c027e73b0eb8 | n18018/programming-term2 | /src/algo-p2/task20180807_q01.py | UTF-8 | 448 | 4.40625 | 4 | [] | no_license | # 変数fruitsに、複数の文字列を要素に持つリストを代入してください(要素は"apple", "banana", "orange")
fruits = ["apple", "banana", "orange"]
# インデックス番号が0の要素を出力してください
print(fruits[0])
# インデックス番号が2の要素を文字列と連結し、「好きな果物は〇〇です」の形式で出力してください
print("好きな果物は", fruits[2], "です")
| true |
ccd1f871d1ab8b64d249edfe6b7f8778029bd3a8 | dilanSachi/Lyrics-Crawler | /Example/spiders/ThirdSpider.py | UTF-8 | 1,893 | 2.875 | 3 | [] | no_license | import scrapy
import json
class ThirdSpider(scrapy.Spider):
name = "ThirdSpider"
data = {}
data['Songs'] = []
start_urls = [
'https://www.lyrics.com//genre/Pop',
]
def writeToJson(self, lyrics, songName, songArtist):
self.data['Songs'].append({
'Title': songName... | true |
2cb6fc0c80c5bf1d7d14aa9b4debe87db840fce6 | dylan-shao/movie_trailer | /movie.py | UTF-8 | 509 | 2.734375 | 3 | [] | no_license | #class
import webbrowser
import media
class Movie(media.Media):
#like static variable which is class level
VALID_RATINGS = ["G", "PG", "PG-13", "R"]
def __init__(self, movie_title, movie_storyline, poster_image, tailer_youtube, rating):
#inheritance, title is from parent media
media.Media.__init__(self, movie_t... | true |
053d64f7e4061786a327b3215d3c7b6950ea552d | xnguyen97/LINUX | /python/Khoa.py | UTF-8 | 261 | 2.671875 | 3 | [] | no_license | class Khoa:
def __init__(self,mk,tk):
self.mk=mk
self.tk=tk
def setmk(self,mk):
self.mk = mk
def getmk(self):
return self.mk
def settk(self,tk):
self.tk = tk
def gettk(self):
return self.tk
def toString(self):
print (self.mk,self.tk)
| true |
0b706a24c7f90460712da4070a68b869fa4a3012 | oowgnoj/daily-algorithm | /greedy/1541.py | UTF-8 | 649 | 2.875 | 3 | [] | no_license | lst=input().split('-') # -로 split한다움
ans = sum(map(int, lst[0].split('+')))
for i in range(1, len(lst)):
ans -= sum(map(int, lst[i].split('+')))
print(ans)
# stop = 0
# isOpen = False
# ans = ''
# for i, el in enumerate(string):
# if el == '-':
# if isOpen:
# ans += ')'+ el + '('
# ... | true |
e407e91c708355d11c82fc714cf8561c61272614 | RosyOo/CellularLearningAutomata | /Automaton.py | UTF-8 | 1,572 | 2.921875 | 3 | [
"MIT"
] | permissive | import numpy as np
import uuid
from Enivronment import Environment as Env
class Automaton:
def __init__(self, num_states, rules):
self.num_states = num_states
self.state = np.random.randint(2 * num_states)+1
self.rewards = 0
self.punishments = 0
self.id = uu... | true |
79b7f09f192856e3e0e19582380181de58d25935 | ddcr/opencv-practice | /thresholding/simple_thresholding.py | UTF-8 | 1,343 | 3.484375 | 3 | [] | no_license | # USAGE
# python simple_thresholding.py --image coins01.png
# import the necessary packages
import argparse
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
args = vars(ap.parse_args())... | true |
aeece2e9ce669a48c6e1cc57c03fa46391ae80d4 | ashmanov/PuzzleLib | /Cuda/Kernels/Embedder.py | UTF-8 | 3,172 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from PuzzleLib.Cuda.GPUArray import GPUArray
from PuzzleLib.Cuda.SourceModule import SourceModule
from PuzzleLib.Cuda.Utils import device, warpSize, roundUpDiv, memoryPool as memPool
embedTmpl = """
extern "C"
__global__ void embed(float *outdata, const int *indata, const float *vocabulary, int s... | true |