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 |
|---|---|---|---|---|---|---|---|---|---|---|
3b96fce60c871d2bc87e544567657ed00643bc90 | KevinJBoyer/QuoteCollector | /src/models/quotelist.py | UTF-8 | 513 | 2.828125 | 3 | [] | no_license | import random
from models.quote import Quote
from models.id import Id
class QuoteList:
def __init__( self ):
self.quotes = []
def add( self, newQuote ):
while newQuote in self.quotes:
newQuote = newQuote.copyWithNewId()
self.quotes.append(newQuote)
def getRandomQuote( self ):
return random.choi... | true |
d0e8705d77af052a97c99605bcbe6930e232b13e | iftuun/who_will_pay | /who_will_pay/who_will_pay.py | UTF-8 | 205 | 3.59375 | 4 | [] | no_license | import random
name_string=input("please enter names using coma, :")
names=name_string.split(",")
p=len(names)
p=p-1
r=random.randint(0,p)
print(f"{names[r]}, is going to pay today. ")
| true |
44c986743294a24023acbae2eb312c8d1f70403e | jasigrace/100-movies-that-you-must-watch-web-scraping-using-selenium | /main.py | UTF-8 | 778 | 2.90625 | 3 | [] | no_license | from selenium import webdriver
chrome_driver_path = "C:\Development\chromedriver.exe"
driver = webdriver.Chrome(executable_path=chrome_driver_path)
hundred_greatest_movies_endpoint = "https://www.empireonline.com/movies/features/best-movies-2/"
driver.get(hundred_greatest_movies_endpoint)
# //*[@id="__next"]/main/ar... | true |
3e0a51528d79afab1ffb063e3994fb90f2588c1e | jarrisonfor/DAW-Python | /Tema 1/1.22.py | UTF-8 | 795 | 4.03125 | 4 | [] | no_license | """
A-1.22 - Estructuras de control - Bucles Anidados. Método de la Burbuja
Escriba un programa que implemente el "Método de la Burbuja".
La Ordenación de burbuja (Bubble Sort ) es un sencillo algoritmo de ordenación. Funciona revisando cada elemento de la lista que va a ser ordenada con el siguiente, intercambiándolo... | true |
8a3b701970f2e0a9e8eca8edb9e430cf4ada058a | belaboe97/Python | /Exceptions.py | UTF-8 | 586 | 3.71875 | 4 | [] | no_license |
while True:
try:
for i in ['a','b','c']:
print(i**2)
except TypeError:
print('The Code sucks!')
break
except:
print('you failed')
else:
print('it workd out')
break
try:
x = 5
y = 0
z = x/y
except ZeroDivisionError:
print('Yo... | true |
a8fcccee31e6b61ec9075dfc8dbc9b60896b5002 | jocelyn2002/NJUAI_CodingHW | /人工智能程序设计/class/3.14/3.14_4.py | UTF-8 | 201 | 3.1875 | 3 | [
"MIT"
] | permissive | for i in range(1, 21):
for j in range(1, 34):
for k in range(3, 301, 3):
if (i+j+k == 100) & (5*i+3*j+k/3 == 100):
print('rooster=%d,hen=%d,chick=%d'%(i, j, k))
| true |
bfcfdbe660975e7baff725f0a9f2654604d3bf7d | axelFrias1998/CrashCourseOnPythonExercises | /First week/Hello World/Python can be your calculator/calculator.py | UTF-8 | 129 | 3.375 | 3 | [] | no_license | print(4 + 5)
print(9 * 7)
print(-1 / 4)
print(1 / 3)
print(((2050 / 5) - 32) / 9 )
print(2 ** 10)
print((((1 + 2) * 3) / 4) ** 5) | true |
58dfc46692f49c5340462a3afb9135b6cb48c215 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_116/111.py | UTF-8 | 1,835 | 3.3125 | 3 | [] | no_license |
def read_input(filename):
data = []
with file(filename, 'rt') as f:
for line in f:
data.append(line)
line_num = int(data[0].strip())
boards = []
curr_line = 1
for _ in xrange(line_num):
curr_board = []
for _ in xrange(4):
... | true |
5f7a961498ff3fd1862c8f780691d9e1ae4fb7af | mfranco/pymir | /code/python/pymir/analytics/key_detection/musicnet/transformations/time_domain_sax_formatter.py | UTF-8 | 1,256 | 3.0625 | 3 | [
"MIT"
] | permissive | import csv
import os
def transform_multiclass(fname, data_type='test'):
class_dict = {}
with open(fname, 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=' ')
for row in reader:
if row[0] in class_dict:
class_dict[row[0]].append(row)
else:
... | true |
14c2d96a4461744b1fc61a6e70e42cf1a54c8d55 | pierva/udagram-project | /src/util/opencvfilter.py | UTF-8 | 1,589 | 2.90625 | 3 | [] | no_license | import cv2
import numpy as np
import argparse
import os
import sys
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="absolute path to the image")
ap.add_argument('-l', "--lower", required=False,
help="lower canny threshold")
a... | true |
f2e9637cad11c8d7ffd8d664f9967afd07e08d06 | anuvrat/hackerrank-python | /src-py/contests/projecteuler/probs_81_100/euler099.py | UTF-8 | 403 | 3.0625 | 3 | [] | no_license | from heapq import heappush, heappop
import math
if __name__ == '__main__':
heap = []
log_map = {}
for _ in range(int(input())):
a, b = map(int, input().split())
log_val = b * math.log2(a)
heappush(heap, log_val)
log_map[log_val] = (a, b)
val = None
for _ in range(i... | true |
691094a6c1e8913c58d18bc3fbe4b56f488bdc07 | vanadiumlabs/pypose | /tools/models/lizard3/lizard3.py | UTF-8 | 23,972 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
"""
PyPose: Bioloid pose system for arbotiX robocontroller
Copyright (c) 2008-2010 Michael E. Ferguson. All right reserved.
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 Foun... | true |
31377325a651e03eb54294dbe7cd0e9268091d5f | luciofaso/Monitoring_DAP | /models/lake/lake_model.py | UTF-8 | 8,093 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
__author__ = 'Luciano Raso'
__copyright__ = 'Copyright 2018'
__license__ = 'GNU GPL'
import numpy as np
from scipy.interpolate import UnivariateSpline
import pandas as pd
def sim_H(h_init, forcings, par_lake, par_wind, policy):
""" Simulation of Lake dynamics"""
# preproc... | true |
5384a8e6ca52cb0691d7a15d16ec255e9b2d4f9a | Deamerrong123/GraphingCalculator | /Graph_main.py | UTF-8 | 1,149 | 3.03125 | 3 | [] | no_license | from Grapher import *
from turtle import Turtle, Screen
from math import *
from Numerical import *
if __name__ == '__main__':
#WIDTH, HEIGHT = 10,10
win = Screen()
#win.setworldcoordinates(-WIDTH/2 , -HEIGHT/2 , WIDTH//2 , HEIGHT//2)
Dim = {'X' : {'lower' : -10 , 'upper' : 10} , 'Y' : {'lower' : -1... | true |
b43d3062c64e3bb075a43ac0eceef44bac40eced | isabel-searle/diamonds | /prediction/tests.py | UTF-8 | 3,291 | 3.0625 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression, Lasso, Ridge, ElasticNet, SGDRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import cross_val_score
from numpy import asarray
import math
import sta... | true |
71ea2aff5b7d808fc76c7c550fe67d34711787ab | seven320/AtCoder | /113/C.py | UTF-8 | 556 | 2.71875 | 3 | [] | no_license | #encoding:utf-8
n,m = map(int, input().split())
P = []
Y = []
city_tb = []
for i in range(m):
p,y = map(int,input().split())
P.append(p)
Y.append(y)
city_tb.append([p,y])
city_tb_ = sorted(city_tb,key=lambda x:x[1])
# print(city_tb_)
count_cities = [0 for i in range(n+1)]
city_cla = {}
for i in range... | true |
f3b87a17874f3a5264f7781e327cbdf71a751b48 | sfepy/sfepy | /sfepy/tests/test_matcoefs.py | UTF-8 | 5,242 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | import sfepy.base.testing as tst
def test_elastic_constants():
import numpy as nm
from sfepy.mechanics.matcoefs import ElasticConstants
ok = True
names = ['bulk', 'lam', 'mu', 'young', 'poisson', 'p_wave']
ec = ElasticConstants(lam=1.0, mu=1.5)
vals = ec.get(names)
tst.report('using val... | true |
2c1de5d6eb51e3c966a10f5f44a1ad0d3ef17b4b | vikas-t/practice-problems | /full-problems/maximumRepeatingNumber.py | UTF-8 | 644 | 3.578125 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/maximum-repeating-number/0
for _ in range(int(input())):
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
for i in range(n):
arr[arr[i]%k] += k
# This is basically saying - using the value of elements as... | true |
6e83c67a64855692e6d0741be86d9dbe23b2bc0a | UllasZ/Chipster-Internship-Assessment | /Assignment_1.py | UTF-8 | 2,444 | 3.171875 | 3 | [] | no_license | import sys
from datetime import datetime
import pytz
import tzlocal
import os
import csv
import pathlib
'''
Timestamp format changer.
UTC to IST.
'''
def utc_to_ist(timestamp):
local_timezone = tzlocal.get_localzone()
# parse given timestamp string to create datetime object.
utc_time = datetime.strptime(... | true |
0bfabc0d1a50684f6119d3e7270526a90353c23b | DentTwoDev/Cifrado_aes | /descifrar.py | UTF-8 | 849 | 2.71875 | 3 | [] | no_license | from Crypto.Cipher import AES
import hashlib
import archivos
archivo_cif = "hola.txt"
archivo_des = "archivo_cifrado.aes"
archivo_descifrado = "archdescif.txt"
contrasena = str(input("Ingrese contraseña: "))
print(len(contrasena)) #imprimimos el tamaño de bits de la variable
password = contrasena.encode() #codificamo... | true |
eb535b7a9b2f83f8ce5101bd9d241457f210381c | Just7chambray/IDS_DeepQNetwork | /all_plot/CICIDS2017_overall_plot.py | UTF-8 | 2,230 | 2.75 | 3 | [] | no_license |
# way 2
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib.ticker as mtick
# whole = './CICIDS2017/TrafficLabelling_whole.csv'
# df = pd.read_csv(whole,low_memory=False)
# # print(df[' Label'].value_counts())
# df = df.replace('Web Attack � Brute Force','Web Attack - Brute Force')
# df = d... | true |
9e153510e471773ec3f54a9aea998005cb8d1212 | nithinmic/tvbc | /compare2.py | UTF-8 | 269 | 4.15625 | 4 | [] | no_license | a= int(input('Enter a number: '))
b= int(input('Enter a second number: '))
c= int(input('Enter the third number: '))
def compare(x,y):
if x>y:
return "{0} is greater than {1}".format(x,y)
elif x<y:
return "{1} is greater than {0}".format(x,y)
print(compare(a,b)) | true |
2a1fc5744f8288eeaa74663812bb7203bc8499b7 | DiedrikL/DATA3750 | /quantum_energy/physics/two_particles.py | UTF-8 | 2,419 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
import quantum_energy.physics.one_particle as physics
def create_psi_matrix(x0, a, xi):
"""
This function creates and returns a matrix populated with values from the wave funtion for two particles
psi_func = np.exp(-a*(x-x0)**2)
psi_matrix = psi_func(x; x0, a) * psi_func(x; -x0, a... | true |
2c804627de1af8e42190ef2321eea92db765a9a0 | svinepels/Python | /trapesmetoden.py | UTF-8 | 280 | 3.78125 | 4 | [] | no_license | # Trapes-metoden
def square(x):
return x ** 2
def trapes(function, a, b, n):
h = float(b - a) / n
summen = 0
for x in range(a + h, b, h):
summen += function(x)
return h / 2 * ( function(a) + function(b) + 2 * summen )
print trapes(square, 0, 1, 8)
| true |
15a94fbcc6ffcfc4cfd59c44dd78456702fb9bc7 | Konrad-Schindler/DMID-on-EU-Parliament | /XMLtoEdgeList.py | UTF-8 | 2,758 | 2.5625 | 3 | [] | no_license | import xml.etree.ElementTree as ET
import time
import numpy as np
start_time = time.time()
TOTALMEPS = 800
IGNORERELATIONUNDER = 5
relationship = np.array(np.zeros((TOTALMEPS,TOTALMEPS)))
iterations = 0
meps = dict()
parties = dict()
names = dict()
mepNumber = 0
for i in range(1,23):
tree = ET.... | true |
944d8dc2f4d5e43bfcf1c50d4a70a902296ba438 | mohyour/feature-request | /quiz.py | UTF-8 | 985 | 2.609375 | 3 | [] | no_license | # Debugging solution
from cryptography.fernet import Fernet
chars = [104, 116, 116, 112, 115, 58, 47, 47, 101, 110, 103, 105, 110, 101,
101, 114, 105, 110, 103, 45, 97, 112, 112, 108, 105, 99, 97, 116,
105, 111, 110, 46, 98, 114, 105, 116, 101, 99, 111, 114, 101, 46, 99,
111, 109, 47, 113, 1... | true |
483123c9702fd35ee70012a9bbed632f5c7ed1c6 | laurynasas/doom-bot | /graph.py | UTF-8 | 13,482 | 3.1875 | 3 | [] | no_license | class Node:
def __init__(self, x, y):
self.x = x
self.y = y
self.reachable = None
def __str__(self):
return str(self.x) + " | " + str(self.y)
class Line:
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __init__(self, a,... | true |
161c5c49e7e1398cac1e94ef04523bc870917c68 | svanish/Python-exercise | /list.py | UTF-8 | 111 | 2.984375 | 3 | [] | no_license | a = [input("> "),
input("> "),
input("> ")]
sum = sum(a)
print a
print "The sum of digits in list is %d" % sum | true |
0fa69c488a3d5f89f0444f095d5447f243578754 | Sandy4321/kaggle-bnp | /eda/analysis_num_mi_1.py | UTF-8 | 822 | 2.671875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import cPickle as pk
def third_sep(str):
c = 0
for idx,a in enumerate(str):
if a == '_':
c += 1
if c == 3:
return str[:idx], str[idx+1:-1]
mi_dict = {}
mi_list = []
with open('num_mi.data', 'r') as f:
lines = f.readlines()
... | true |
3977f9fe30f9a48147edb3faf6417dadda89b647 | semquant/IIIS | /Rolling_Train.py | UTF-8 | 4,345 | 2.734375 | 3 | [] | no_license | import pandas as pd
import sklearn.metrics as metrics
import numpy as np
import scipy
from math import sqrt
from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier
from sklearn.decomposition import PCA
NUM_CLASSES = 5
NUM_ROLLING = 20
def f(x):
if x == 0 or x == 1:
return 0
eli... | true |
81bd1036ecb8b57b7ce8af7dada857409bf3f272 | paul-g/sparsegrind | /sparsegrind/precision.py | UTF-8 | 4,571 | 3.28125 | 3 | [] | no_license | """
This module is used for the precision analysis in lossy/mixed precision
matrix representations.
Here we analyse how much we can reduce precision of matrix values (and,
apparently, drop some very tiny matrix entries), keeping matrix norms
(max and min singular values) close to original, up to a ... | true |
720d08c393a338aa658d41d5282404c2f95dd010 | skyuniv/A-Kata-A-Day | /Python/Help_the_bookseller_.py | UTF-8 | 2,248 | 4.5 | 4 | [] | no_license | # Help the bookseller !
# Level: 6kyu
'''
A bookseller has lots of books classified in 26 categories labeled A, B, ... Z. Each book has a code
c of 3, 4, 5 or more capitals letters. The 1st letter of a code is the capital letter of the book
category. In the bookseller's stocklist each code c is followed by a space an... | true |
f3a4c17441cf01b8a809db593569bd2729752ddc | ArunkumarRamanan/OpenFermion | /src/openfermion/utils/_special_operators_test.py | UTF-8 | 4,330 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | true |
001d286ec09196c48c17ede147fc51a332924b9d | marzxious/Interview | /Series/Parenthesis Series/301 Remove invalid parenthesis.py | UTF-8 | 1,243 | 3.96875 | 4 | [] | no_license | # DFS - 花花匠
def removeInvalidParentheses(self, s):
#計算左右括號不合理的個數
left, right = 0, 0 #left/right : no of invalid left/right parenthese
for c in s:
if c == '(':
left+=1
elif c==')' and left>0:
left-=1
elif c==')' and left==0:
right +=1
... | true |
5ee895b5492ac887d88c1ed8b7b933e2b98e544e | dshaporenko/homework | /homework13/var7.py | UTF-8 | 372 | 3.359375 | 3 | [] | no_license | import os
import re
def cyr_lat(path):
names = os.listdir(path)
count = 0
for name in names:
path1 = os.path.join(path, name)
if os.path.isdir(path1):
if re.search('[a-zA-Z]', name) and re.search('[а-яА-Я]', name):
count+=1
return count
n = ... | true |
97182f9fbee47b9e6e23341ddceb088cf3979a7d | trying-github-actions/quote-bot | /facebook/fbquote.py | UTF-8 | 509 | 2.8125 | 3 | [] | no_license | import facebook, yaml, random, os
page_access_token = os.environ.get('page_access_token')
graph = facebook.GraphAPI(page_access_token)
facebook_page_id = "101805031688301"
with open('quotes.yaml','r') as file:
# The FullLoader parameter handles the conversion from YAML
# scalar values to Python the dictionary... | true |
0e90b56ddd1304b8ed6207c4d3e13e7c762ed222 | Shared-Air-Shared-Action/data-retrieval | /weather/weather.py | UTF-8 | 6,344 | 2.953125 | 3 | [] | no_license | # This file gets weather data from Weather Underground and puts it into the database
import json, urllib, sys, os, psycopg2
from datetime import datetime
import keys
# Open the log file
logfile = open("/data/sasa_airquality/weather/weather.log", "a+")
# Create a function for logging/displaying output
def debugMessag... | true |
8a2e0a5c01a193455badc8f18d4a6030dd141d7f | wtliao/FairNN | /bank/encoded_dataset.py | UTF-8 | 1,356 | 2.6875 | 3 | [] | no_license | import torch
import pandas as pd
import torch.utils.data as Data
from torch.autograd import Variable
import parameters as par
from Dataset_maker import Dataset_maker
MODEL_PATH = par.FITTING_MODEL
URL = par.BANK_URL
SAVE_PATH = par.ENCODED_DATA
print("Bank fitting iteration:", par.FITTING_ITER)
MyDatase... | true |
59e2402121e95cfaad8bf1f844b82f91905ad4a7 | xzregg/tornado_project | /base/session.py | UTF-8 | 4,007 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019-03-14 17:59
# @Author : xzr
# @Contact : xzregg@gmail.com
# @Desc : 定义session 类
import sys, os, time
import memcache
import redis
import tornado.web
try:
import cPickle as Pickle
except:
import Pickle
from settings import SESSION_ENGINE
class SessionEngine(objec... | true |
64b426f2aa54fdf68ade15043a5824b56ee930b8 | pbielak/si-room | /si/problem/room_planning/test_eval.py | UTF-8 | 4,606 | 2.953125 | 3 | [] | no_license | import unittest
import si.problem.room_planning.eval as evals
from si.problem.room_planning import furniture as fun
from si.problem.room_planning.geometry import flip
from si.problem.room_planning.room import Room
class TestRoomEvaluator(unittest.TestCase):
def setUp(self):
self.room = Room(50, 50)
... | true |
b1ef9faad31962495895576e7a87533314ff8d41 | garderobin/Leetcode | /LeetcodePython/MinTotalDistance.py | UTF-8 | 1,003 | 2.796875 | 3 | [] | no_license | class MinTotalDistance:
# 这一段的连续的for没有看懂
def minTotalDistanceDiscussion(self, grid):
return sum(sum(abs(x - X[len(X)/2]) for x in X) for X in
([x for x, row in enumerate(grid) for _ in range(sum(row))]
for grid in (grid, zip(*grid))))
def minTotalDistance(self... | true |
c93494ea1068b53e3c6f40382eb00882e3fe390c | sfwan2014/Python- | /YPData/YPParse.py | UTF-8 | 1,282 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from lxml import etree
import re
from Person import *
class YPParse:
def parse(self, data):
# 创建xpath解析对象
selector = etree.HTML(data)
links = selector.xpath("//table/tbody/tr")
userList = []
for tr in links:
str = etr... | true |
788463f222e50272707b2b79e0daf254aae6586a | ChangxingJiang/LeetCode | /1501-1600/1598/1598_Python_1.py | UTF-8 | 598 | 3.125 | 3 | [] | no_license | from typing import List
class Solution:
def minOperations(self, logs: List[str]) -> int:
now = 0
for log in logs:
if log == "../":
now = max(0, now - 1)
elif log == "./":
continue
else:
now += 1
return now
... | true |
0acc6cb48af20850afd436c3f786c223ae6c2bda | luquehuong/python-homework4-tetrominoes | /car.py | UTF-8 | 1,811 | 4.09375 | 4 | [] | no_license | from graphics import GraphWin, Point, Circle, Rectangle
from wheel import Wheel
# create a car object
class Car():
def __init__(self, wheel_1, wheel_2, body):
self.wheel_1 = Wheel(wheel_center_1, wheel_radius_1, tire_radius_1)
self.wheel_2 = Wheel(wheel_center_2, wheel_radius_2, tire_radius_2)
... | true |
ac0e27a48f20bd94ff289294c75e68ba586f0f88 | mlspec/mlspec-lib | /mlspeclib/io.py | UTF-8 | 1,303 | 3.234375 | 3 | [
"MIT"
] | permissive | """ Functions for loading and saving files to disk. """
from pathlib import Path
from mlspeclib.mlschema import MLSchema
from mlspeclib.helpers import convert_dict_to_yaml
class IO:
""" Core IO class for reading and writing files."""
@staticmethod
def get_content_from_path(filepath: str) -> str:
... | true |
477a9088bd2f6640c83560062c7bc3c4ce79b123 | lord-Rheagar/Virtual-Assistant | /main.py | UTF-8 | 4,305 | 3.078125 | 3 | [] | no_license | import speech_recognition as sr
import pyttsx3
import pywhatkit
import datetime
import wikipedia
import pyjokes
import random
listener = sr.Recognizer()
engine= pyttsx3.init()
voices= engine.getProperty('voices')
engine.setProperty('voices',voices[0].id)
def talk(text):
engine.say(text)
engine.runAndWait()
d... | true |
9bf7bc12688b256c703b4b42fc23fa4a624192c2 | pragsmike/catio | /gr/recognize.py | UTF-8 | 1,770 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
'''
Recognize channels within a band by detecting signals within the band.
Input is a vector of FFT magnitudes.
Output is a list of spans [(min, max) ...]
of contiguous ranges of frequencies where nonzero magnitudes occur.
'''
"""
Embedded Python Blocks:
Each time this file is saved, GRC will inst... | true |
ec0579056e664e44366a3b9e31506cd93aa02695 | G0uth4m/daily-coding-problem | /69 - max_product.py | UTF-8 | 292 | 3.28125 | 3 | [] | no_license | import heapq
def max_product(arr):
maxis = heapq.nlargest(3, arr)
minis = heapq.nsmallest(2, arr)
return max(maxis[0] * maxis[1] * maxis[2], minis[0] * minis[1] * maxis[0])
def main():
arr = [-10, -10, 5, 2]
print(max_product(arr))
if __name__ == "__main__":
main() | true |
4b8811235ec9feff0897485bc33ec5bb0650fbd5 | GavenHwang/pythonPractice | /06_xmind2excel/xmind2excel.py | UTF-8 | 5,388 | 2.515625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from datetime import datetime
import xlsxwriter
import xmind
import argparse
import os
sub_titles = [
'用例编号',
'所属产品',
'分支',
'所属模块',
'相关需求',
'用例标题',
'前置条件',
'步骤',
'预期',
'实际情况',
'关键词',
'优先级',
'用例类型',
'适用阶段',
'用例状态',
'B',
'R',
... | true |
5cd75d83e164b515a78ad4740a63c5f6db47c89d | pombredanne/flati | /test_flati.py | UTF-8 | 386 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from nose.tools import assert_equal
import flati
def test_flatten():
iterable = [(1, 2, 3), (4, (5, 6))]
expected = [1, 2, 3, 4, 5, 6]
assert_equal(list(flati.flatten(iterable)), expected)
iterable = [('abc'), ('def', ('g', 'hi'))]
expected = ['abc', 'def', 'g', 'hi']
... | true |
68199004db6ae9f3a6c22a1e8398877e3135f376 | joaojomoura/UA | /3_ano/IA/Project/tpg-tetris-ia_equipa_13/game.py | UTF-8 | 4,635 | 3.109375 | 3 | [
"MIT"
] | permissive | from asyncio.queues import Queue
import logging
import random
import asyncio
from common import Dimensions
from copy import deepcopy
from shape import SHAPES
from collections import Counter
logger = logging.getLogger("Game")
logger.setLevel(logging.DEBUG)
GAME_SPEED = 10
SPEED_STEP = 10 # points
class Game:
de... | true |
d589c6591b9d7ff73625927478d59e1be10693be | jeanbond/lintcode | /find-median-from-data-stream/find-median-from-data-stream.py | UTF-8 | 1,820 | 3.59375 | 4 | [] | no_license | import heapq as h
class Solution:
'''
We need two heap to store all data:
big heap: to store smaller part data.(caution:python has no big heap package(python's heap or
priority queue is small heap), so we need to reverse data element by multipy -1;)
... | true |
d97c60911dc66e79a318f97eecc70358ad0cba02 | jamebluntcc/mytools | /py/_thread.py | UTF-8 | 452 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
import threading
class myThread(threading.Thread):
def __init__(self, func, args, name=""):
threading.Thread.__init__(self)
self.func = func
self.args = args
self.name = name
def run(self):
self.func(self.args)
def func():
time.... | true |
a23eba7afd68664c80214ac749455e529911b81f | jmrepka/e2-showcase_for_reference | /py/curlicuefractal.py | UTF-8 | 1,671 | 3.734375 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 20 12:43:07 2021
@author: Andycyca
Original writeup: The Curlicue Fractal (place) by Oolong
URL: https://everything2.com/user/Oolong/writeups/The+Curlicue+Fractal
"""
import numpy as np
import matplotlib.pyplot as plt
import math
plt.style.use('fivethir... | true |
a227275b47e9fcc1f9bb1dd9724b7570d0c07c20 | Kazuhito00/OpenCV-readNetFromTensorflow-sample | /sample.py | UTF-8 | 3,007 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import copy
import time
import cv2 as cv
def main():
# グラフ読み込み ###########################################################
pb_filepath = os.path.join(os.getcwd(), 'model',
'frozen_inference_graph.pb')
pb... | true |
1d15ce1da9cb3120065eb7f7bf24512a32ba0b7c | Teja3108/RockPaperScissors | /game/game.py | UTF-8 | 865 | 3.609375 | 4 | [] | no_license | import random
def gameWin(comp,you):
if comp == you:
return None
elif comp == 'r':
if you == 'p':
return True
elif you == 's':
return False
elif comp == 'p':
if you == 's':
return False
elif you == 'r':
return False
... | true |
c3f231f64df2d9ec0c4167d6d9372380f7233496 | anaferreirapy/Python-para-Zumbis-2020 | /Lista 2 - Condicionais/L2 - ex3.py | UTF-8 | 991 | 3.5625 | 4 | [] | no_license | #João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de
#seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do
#estado de São Paulo (50 quilos) deve pagar uma multa de R$ 4,00 por quilo excedente. João precisa que você
... | true |
75168854ea81a1dbedff2ba46aac8164fd31c6ec | JaimePazLopes/learningPython | /src/fileBasics.py | UTF-8 | 1,004 | 2.765625 | 3 | [] | no_license | peopleFile = open("../supportFiles/people.txt")
print(peopleFile.read())
print(peopleFile.read())
peopleFile.seek(0)
print(peopleFile.read())
peopleFile.seek(0)
fileContent = peopleFile.read()
peopleFile.seek(0)
print(peopleFile.readlines())
peopleFile.seek(0)
peopleFile.close()
print()
with open("../suppor... | true |
bd9ed67b1bf6ec7df7f1785c8f2018c9d1917ae5 | jbro321/Python_Basic_Enthusiastic | /Python_Basic_Enthusiastic/Chapter_01/P_01_3_1.py | UTF-8 | 57 | 2.546875 | 3 | [] | no_license | # Enthusiastic_Python_Basic #P_01_3_1
a = 2*2*2
print(a) | true |
c2a9865a39c10728da6af4765d66e82d815cc8c7 | furaoing/waffle | /waffle/util/datetime.py | UTF-8 | 2,252 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
class Time(object):
def get_time_zone(self):
time_zone_affix = None
local_time_struct = time.localtime()
gmt_time_struct = time.gmtime()
time_diff = local_time_struct.tm_hour - gmt_time_struct.tm_hour
if time_diff < 10:
time_... | true |
0fdb88bc2b9131d34c90359c1630913886e287cd | Tornike-Skhulukhia/Exercises-Python | /1.py | UTF-8 | 304 | 3.0625 | 3 | [] | no_license | '''
რას დაბეჭდავს პროგრამა გაშვების შემდეგ?
'''
def hi():
print("Hi, from function")
class Hi_1:
print("Hi, from Hi_1 class")
class Hi_2:
def __init__(self):
print("Hi, from Hi_2 class")
hi()
Hi_1()
Hi_2() | true |
06cfda216949c2630d63d7b9d09e4c456c8306c6 | surya-parthipan/Practice | /list_names.py | UTF-8 | 189 | 2.9375 | 3 | [] | no_license | n=int(input())
a=[]
for i in range(n):
a.append((input().split(" ")))
x=input()
y=0
for i in range(n):
if a[i][0]==x:
y=i
for i in range(y+1,n):
print(a[i][1]) | true |
f99986b5ddfe23beb4900d9b5037d2d6e64dcf94 | vrushangdev/courses_platform | /tests/domain/test_course.py | UTF-8 | 978 | 2.84375 | 3 | [] | no_license | from uuid import uuid4
from app.domain.course import Course
class TestCourseEntity:
def test_course_initialize_correctly(self):
course = Course('Test Course')
assert isinstance(course, Course)
assert hasattr(course, 'id')
assert course.name == 'Test Course'
def test_course... | true |
8f3ef92bc9b31ba6ca68896d2153ed3580ed44ba | fpelaezt/devops | /Python/Course/1.1_str.py | UTF-8 | 313 | 4.03125 | 4 | [] | no_license | name1 = "adA lovelacE"
name2 = name1
name3 = name1
print(name1.title())
print(name2.upper())
print(name3.lower())
name4 = name1 + " " + name2 + "!"
name5 = "\tSecond Line\tTabulator"
print(name4)
print(name5)
name6 = " Este cadena tiene espacios adelante y atras "
print(name6)
name6 = name6.strip()
print(name6)
| true |
474294d32c918c257d6669c04c06fd4a010cd822 | lucioeduardo/competitive-codes | /2021/Eduardo/Daily Practice/September/19 - URI 2150.py | UTF-8 | 164 | 3.328125 | 3 | [] | no_license | while True:
try:
v = input()
s = input()
res = 0
for c in s:
if c in v:
res+=1
print(res)
except EOFError:
break | true |
977d00bcf66b4e2c6f0a796377a2bd8fadc882ad | Mauriciopizarro/black_jack | /game_management_service/application/enroll_player_service.py | UTF-8 | 729 | 2.59375 | 3 | [] | no_license | from game_management_service.domain.interfaces.game_repository import GameRepository
from game_management_service.domain.player import Player
from dependency_injector.wiring import Provide, inject
from shared.injector import Injector
class EnrollPlayerService:
@inject
def __init__(self, game_repository: Game... | true |
c6b3d5c35c90a6c4915b7f782c64b7899713219b | hegang0213/DataServer | /model/data.py | UTF-8 | 6,182 | 2.59375 | 3 | [] | no_license | import time
import struct
import collections
import config
PUMP_START = 1
PUMP_STOP = 0
HIGH_FREQUENCY_INTERVAL = config.Configure.instance().loop_interval.high_frequency / 1000 # 5m
defines = {
'in_flow': 'f',
'ac_flow': 'd',
'v1': 'H', 'v2': 'H', 'v3': 'H',
'c1': 'f', 'c2': 'f', 'c3': 'f',
'... | true |
3cc862e30ce43c3abbb5722726c831f202b960c9 | ajaykumar8/Python-Programs-DUCAT | /IF ELSE 6.py | UTF-8 | 836 | 3.84375 | 4 | [] | no_license | print("Welcome to WDC bank")
def withdraw():
print("Withdrawal selected")
w=int(input("Amount you want to withdraw: "))
w=w-b
print("Amount Dispensing",w)
def deposit():
print("Deposit Selected")
d=int(input("Enter the amount you want to deposit: "))
b=d+c
print("AMount Depos... | true |
316a5e7554211831bcc5cc30677469933d80c918 | redfast00/RCPU | /tests/emulator/kernel/test_printf.py | UTF-8 | 1,044 | 2.734375 | 3 | [
"MIT"
] | permissive | from .utils import init_kernel
import pytest
def test_printf(capsys):
k = init_kernel()
# This loads the third argument of printf, a number
k.stack.push(443)
# This loads the second argument of printf, the address of a string
k.write_string(20, "this is a test")
k.stack.push(20)
# This loa... | true |
a7297d07d56b5faada78ff5201d280eaaf43ee02 | asousa/3dWIPP | /python/load_rayfile_2D.py | UTF-8 | 2,856 | 2.78125 | 3 | [] | no_license | # load_rayfile.py
# Loads a ray file from newray1.8, in python
# Started 3/2/2016, Austin Sousa
import numpy as np
import pandas as pd
import pickle
#from build_database import flux_obj
from scipy import interpolate
import matplotlib.pyplot as plt
import os
import itertools
import random
# def load_rayfile(directory,... | true |
7ed934d53c0bc222bb3701dafb9a47261760de68 | Reygrip2014/NLP-SentimentAnalysis-BTC | /Scraper_ListTopSubReddits.py | UTF-8 | 757 | 3.03125 | 3 | [] | no_license | #getting a list of top reddits
#initial try is to use https://redditlist.com as source
import requests
from bs4 import BeautifulSoup
result = requests.get('http://redditlist.com/')
src = result.content
soup = BeautifulSoup(src, 'html.parser')
#first try, commented out, because below is lsightly better
#subs_links = [... | true |
0c615bb588a64dc77b05eb0a9f8cf6f66f5584eb | superdancer/spam_filter | /bayes.py | UTF-8 | 3,016 | 2.765625 | 3 | [] | no_license | #-*- coding: UTF-8 -*-
from numpy import *
import sys
from getContent import *
reload(sys)
sys.setdefaultencoding("utf-8")
def createWordsVector(dataSet):
global wordsVector
vocabSet=set([])
for document in dataSet:
vocabSet=vocabSet|set(document)
wordsVector=list(vocabSet)
def... | true |
306b0aab5a930a274e35ef721d1e36fd10766f46 | philip-h-dye/pywincffi | /tests/test_core/test_logger.py | UTF-8 | 1,708 | 2.5625 | 3 | [
"MIT"
] | permissive | import logging
from pywincffi.core.logger import (
STREAM_HANDLER, FORMATTER, logger, get_logger)
from pywincffi.dev.testutil import TestCase
class TestStreamHandler(TestCase):
"""
Tests for ``pywincffi.core.logger.STREAM_HANDLER``
"""
def test_type(self):
self.assertIsInstance(STREAM_HAN... | true |
1e3fe224e626a0885420dcc3d6c56fa54ba38f62 | ll-O-ll/algos | /python/twoNumberSum_easy/twoNumberSum_2.py | UTF-8 | 333 | 3.625 | 4 | [] | no_license | def twoNumberSum(array, targetSum):
#using dictionaries to solve the problem
nums = {}
for num in array:
potentialMatch = targetSum - num
if potentialMatch in nums:
return sorted([potentialMatch, num])
else:
nums[num] = True
return []
if __name__ == "__main__":
twoNumberSu... | true |
f5874b3e94fe0307945ddb4c99dea7305ccdcfb1 | zhivou/playground | /algorithms/urlify_spaces.py | UTF-8 | 2,188 | 4 | 4 | [] | no_license | # Input: "Mr John Smith ", 13
# Output: "Mr%20John%20Smith"
#
# Find how many spaces there are it will help to calculate
# extra spaces that are needed. If true given use it as a max limit,
# if not add it to the end of the array/string
def replace_spaces(s: list, true_length):
number_of_spaces = 2 #str(s).find... | true |
9bf5ec6dbebcce33b9a6fb4f591a6a6806e683c5 | vvkin/bridg-it | /app/play/bridgit/bridgit.py | UTF-8 | 1,647 | 2.8125 | 3 | [
"MIT"
] | permissive | from typing import Tuple
from .const import LEVELS, GRID_SIZE, CORNERS
from .alpha_beta import AlphaBetaPrunning
import numpy as np
class Bridgit:
def __init__(self, level: str, f_move: bool, color: bool):
self.color_idx = color if f_move else not color
self.search = AlphaBetaPrunning(LEVELS[level]... | true |
ebd392a364166ec959510eef1b333069e32f4609 | silx-kit/silx | /examples/plotUpdateImageFromThread.py | UTF-8 | 4,547 | 2.84375 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | # /*##########################################################################
#
# Copyright (c) 2017-2021 European Synchrotron Radiation Facility
#
# 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 Sof... | true |
149ed1b89b2c42256906289943fa816beafdac08 | DHatUC/Jstor_analysis | /utilities/pre_processing.py | UTF-8 | 2,897 | 2.71875 | 3 | [] | no_license | from nltk.tokenize import RegexpTokenizer
from nltk.stem.porter import PorterStemmer
from stop_words import get_stop_words
import os
import collections
import json
import math
import re
def tokenize(text):
tokenizer = RegexpTokenizer(r'\w+')
tokens = tokenizer.tokenize(text.lower())
return to... | true |
bcf5c1d900d64d87e6f9ce0136a0a3fa59117525 | ChengTsungPao/working | /python/Thermal statistical physics/HW/HW2/homework2_6.py | UTF-8 | 2,444 | 3.265625 | 3 | [] | no_license | import time,random
import numpy as np
from math import factorial
import matplotlib.pylab as plt
def dise(trials,N,p):
histogram = np.zeros(N+1 , int)
sum = 0.0
j=0
r=0
while j < trials :
sum = 0
for i in range(N):
rd=random.random()
if(rd<p):
... | true |
c026df44942f1347fe9a80f1477b97dc8c0bbb36 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/30.py | UTF-8 | 384 | 3.03125 | 3 | [] | no_license | def solve():
N = [c for c in input()]
L = len(N)
for _ in range(L):
for i in range(L - 1):
if N[i] > N[i+1]:
N[i] = chr(ord(N[i]) - 1)
for j in range(i+1, L):
N[j] = '9'
print(int(''.join(N)))
T = int(input())
for num in range(1, ... | true |
14abbe44d672432691cef623ac67bfb51312d172 | riteshsahu16/python-programming | /1 if else/ex19_transport_charge.py | UTF-8 | 326 | 4.21875 | 4 | [] | no_license | # Distance Charges
# 1-50 8 Rs./Km
# 51-100 10 Rs./Km
# >100 12 Rs/Km
# Ask user to enter the distance and compute the fare.
distance = int(input())
fare = 0
if distance<=50:
fare = distance*8
elif distance >50 and distance<=100:
fare = distance*10
else:
fare = distance *12
print("fare : ",... | true |
476ba13c199ff2cdb80d91ece67db92fe256e7f3 | LiprikON2/ITMO | /homework03/life.py | UTF-8 | 7,230 | 3.25 | 3 | [] | no_license | import pathlib
import random
import math
import os
from typing import List, Optional, Tuple
Cell = Tuple[int, int]
Cells = List[int]
Grid = List[Cells]
class GameOfLife:
def __init__(
self,
size: Tuple[int, int],
randomize: bool = True,
max_generations: Optional[float] = float(... | true |
d448fc8d01649cd4983128633d869d9e625784b6 | jkal/nlp-revindex | /lt09/tokenize.py | UTF-8 | 1,728 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# tokenize.py
# text tokenizer class
#
# {ikalantzis, vrachnis}@ceid.upatras.gr
#
import re
import HTMLParser
class HTMLTagStripper(HTMLParser.HTMLParser):
"""
A simple class to strip HTML tags from text, using the HTMLParser module
from the Python standar... | true |
dff37010029a2b44aa629fa4ca6274fbca70d37a | vfarah-if/inql | /inql/generators/query.py | UTF-8 | 24,633 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
from inql.utils import string_join, open
def detect_type(types):
"""
This function will replace known GraphQL arguments types with placeholder values (useful for Burp Suite Repeater)
:param types:
Known types: String, Boolean, Float, Int, NOT_NULL
TO... | true |
c2299fb2af4bbb08601f6961827645d981c073dd | coreylowman/dominion | /dominion/cards/intrigue.py | UTF-8 | 3,046 | 2.796875 | 3 | [] | no_license | from .base import *
def baron():
return make_card(baron.__name__, cost=4, type=CardType.ACTION,
effect=InOrder(GainBuys(1),
IfElse(HasCard(estate).and_(AskYesOrNo('Discard estate?')),
InOrder(Const('estate').into(T... | true |
673437ff101a2414c193ab6057a4d9bfbedfa36d | yzl232/code_training | /mianJing111111/Google/Design a class to serialize and deserialize an object.py | UTF-8 | 2,991 | 2.671875 | 3 | [] | no_license | # encoding=utf-8
'''
Design a class to serialize and deserialize an object
http://stackoverflow.com/questions/8586511/serialization-deserialization-mechanism
http://www.javaworld.com/article/2072752/the-java-serialization-algorithm-revealed.html
The default involves a hashcode. Serialization creates a single ha... | true |
01e9162fb1368c9651d6fc0f7898e77ecd5c5bec | ChrisQiqiang/drlScheduler | /framework/algorithm.py | UTF-8 | 1,695 | 2.578125 | 3 | [] | no_license | from abc import ABC, abstractmethod
class Algorithm(ABC):
@abstractmethod
def __call__(self, cluster, clock):
pass
# class ThresholdFirstFitAlgorithm(Algorithm):
# def __call__(self, cluster, clock, cpu_threshold=0.75, memory_threshold=0.75, disk_threshold=0.75):
# instances_to_reschedul... | true |
f26a20db2ec4cb78bfbf899f50670aefe1e0a1ed | peytonhong/LSTMAutoencoder | /LSTMAutoencoder.py | UTF-8 | 12,231 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 2 23:58:18 2018
LSTM Autoencoder
@author: HyoSung Hong
Input: Vehicle's attitude signals that comprise 3-axis gyro, acceleration
as well as roll, pitch, yaw angle.
input sequence change:
before: [1 2 3] [2 3 4] [3 4 5]
after: [1 2 3] [4 5 6] [7 ... | true |
a9f794935ea5ce31fd3b41ce18c8049dea240451 | nagyorsolya/python | /pokemonok.py | UTF-8 | 226 | 2.5625 | 3 | [] | no_license | class Pokemon:
def __init__(self, nev, tipus, ellenfel):
self.nev = nev
self.tipus = tipus
self.ellenfel = ellenfel
def hatasos_ellene(self, masik):
return self.ellenfel == masik.tipus | true |
99ac70bad05860fcbbdb3b4006f08fa05e39a097 | anu565lol/codebyte-codes | /factorial.py | UTF-8 | 310 | 3.390625 | 3 | [] | no_license | def FirstFactorial(num):
# code goes here
fact = 1
if num != 0:
for r in range(1,num+1):
fact = fact*r
if num ==0:
fact = 1
return fact
# keep this function call here
print FirstFactorial(raw_input("Enrter the numbet for the factorial: "))
| true |
b123eddba223257b269a8d51bdd3599ca3a0fd02 | vprusso/toqito | /tests/test_states/test_w_state.py | UTF-8 | 1,461 | 2.890625 | 3 | [
"MIT"
] | permissive | """Test w_state."""
import numpy as np
from toqito.states import basis
from toqito.states import w_state
from toqito.matrix_ops import tensor
def test_w_state_3():
"""The 3-qubit W-state."""
e_0, e_1 = basis(2, 0), basis(2, 1)
expected_res = (
1 / np.sqrt(3) * (tensor(e_1, e_0, e_0) + tensor(e_0,... | true |
ff17556badc536a2e9cd9f71c1a439cd1fab5f3b | mkit777/traffic-flow-model | /code/stca.py | UTF-8 | 5,396 | 3.1875 | 3 | [] | no_license | from typing import List
import matplotlib.pyplot as plt
import random
#----------------------------------------
# STCA 模型实现
# author: zhy
#----------------------------------------
# 正常运行
RUNNING = 0
# 正在变道
CHANING = 1
class Car:
def __init__(self, speed, stage):
'''
存储车辆元胞状态
Arguments:
... | true |
fd004a42e00c41aace31656c3b2ceacf46a33494 | mahajanakshat07/mobilecomputing855 | /Unification Algorithm An Assignment/unifyFunctions.py | UTF-8 | 1,933 | 3.15625 | 3 | [
"Unlicense"
] | permissive |
#contains the implementation of the algorithm and related to the algorithm
from unify import unify
#checks if both lists are empty
def checkIfEitherEmpty(E1, E2):
if not E1 or not E2:
return True
else:
return False
#checks if the data is valid
def checkIfValid(data,functionL... | true |
8e7a547ac9ff54e4d608d32752f286483d9da269 | productiser/MLPlayground | /JaccardSimilarity.py | UTF-8 | 1,249 | 3.5 | 4 | [] | no_license | line_1 = "I love ice-cream and cheese most times"
line_2 = "I hate cheesecake and blue cheese but love all ice-cream"
# Create two sets with unique words
str_line_1 = set(line_1.split())
str_line_2 = set(line_2.split())
# Get count of each line of unique words
uniq_words_line1 = len(str_line_1)
uniq_words_line2 = len... | true |
b3cb6c9090e7d46a59e5eab4849f917e46da221e | LSChyi/simplified-B-tree | /storageFile/relationTable.py | UTF-8 | 3,856 | 2.625 | 3 | [] | no_license | from storageFile.page import Page
from storageFile.utils import *
from bPlusTree.bPlusTree import bPlusTree
from bPlusTree.leafNode import LeafNode
class RelationTable:
def __init__(self, name, keyType, recordSize):
self.name = name
self.pages = []
self.keyType = keyType
self.bPlusT... | true |
8f3e856b12adb233a54caa8500d35b616c4147bc | Zumbalamambo/ActivityNetVideoCaptioning | /i3d/prep.py | UTF-8 | 1,758 | 2.75 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | import sys
import os
import numpy as np
sys.path.insert(0, "../")
import action_recognition.image_funcs as image_funcs
class VideoFramesPreprocessor:
def __init__(self, mode, resize_size=256, crop_size=224, image_suffix='jpg'):
self.resize_size = resize_size
self.crop_size = crop_size
asse... | true |
0066bc305ec747ecc8349fb6bc1b03051eaf982c | feigaoxyz/adventofcode | /year2015/day25.py | UTF-8 | 814 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def get_idx(row, col):
diag = row + col - 1
base = diag * (diag - 1) // 2
idx = base + col
return idx
print('\nindex')
for r in range(1, 5):
print([get_idx(r, c) for c in range(1, 5)])
idx = get_idx(3010, 3019)
b, e, m = 20151125, 252533, 33554393
... | true |
a2984c7159f445f721147a036d7d0fd2b40df520 | GwenIves/Exercises | /pip3/12_bookmarks.py | UTF-8 | 3,106 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import os
import pickle
import shelve
import sys
import Console
DISPLAY_LIMIT = 20
def main():
filename = os.path.join(os.path.dirname(__file__), "bookmarks.dbm")
functions = dict(
a=add_bookmark,
e=edit_bookmark,
l=list_bookmarks,
r=remove_bookmark,
... | true |
e87c0fa821e66787027318345be5ea7846699e8d | hanmarookim/p1-img-hanmarookim | /src/test.py | UTF-8 | 356 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn.functional as F
label1 = torch.tensor([1, 2, 3])
label2 = torch.tensor([1, 3, 3])
label3 = torch.tensor([2, 3, 4])
ll = torch.stack([label1, label2, label3], dim=1)
lll = []
for i in ll:
l, c = torch.unique_consecutive(i, return_counts=True)
print(i[c.argmax()])
lll.append(i[c.a... | true |
1cceb315efec71719e7300ec9facaa79f3c26ce2 | hblauth/Datacamp | /ML_sb_EDA.py | UTF-8 | 599 | 3.703125 | 4 | [] | no_license | import matplotlib.pyplot as plt
# Explore datatypes
df.dtypes.value_counts()
# Encode labels as categorical variables
# Define the lambda function
categorize_label = lambda x: x.astype('category')
# Convert df[LABELS] to a categorical type
df[LABELS] = df[LABELS].apply(categorize_label, axis=0)
# Explore distributi... | true |