blob_id
large_string
language
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
9a9d08616301c9dd4158052c7c106351d644b4da
Python
jackadam1981/LearnPython
/02-数据组合/09.datatime.py
UTF-8
1,975
3.796875
4
[]
no_license
# !/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2017/12/13 15:23 # @Author : Jackadam # @Email : # @File : 07.date.py.py # @Software: PyCharm #时间戳是通用的。 import time,datetime #当前时间: print(datetime.datetime.now())#2017-12-13 15:25:28.892519 带毫秒的当前时间字符串 print(type(datetime.datetime.now()))#格式是datetime.datet...
true
1c3a64d045ffd4738dae4bbe9f697e2a7f022250
Python
hoyeoness9837/Algorithm-Sources
/problems/greedy/백준문제/15_보석도둑.py
UTF-8
2,332
3.421875
3
[]
no_license
# 세계적인 도둑 상덕이는 보석점을 털기로 결심했다. # 상덕이가 털 보석점에는 보석이 총 N개 있다. 각 보석은 무게 Mi와 가격 Vi를 가지고 있다. 상덕이는 가방을 K개 가지고 있고, 각 가방에 담을 수 있는 최대 무게는 Ci이다. 가방에는 최대 한 개의 보석만 넣을 수 있다. # 상덕이가 훔칠 수 있는 보석의 최대 가격을 구하는 프로그램을 작성하시오. # 첫째 줄에 N과 K가 주어진다. (1 ≤ N, K ≤ 300,000) # 다음 N개 줄에는 각 보석의 정보 Mi와 Vi가 주어진다. (0 ≤ Mi, Vi ≤ 1,000,000) # 다음 K개 줄에는 가방에 담...
true
5b0574e8e2c82eeb4d53b8636b89e86891bd8b80
Python
chonpsk/38cmSK_C-34
/proxyPool/proxyPool/db.py
UTF-8
2,151
3.0625
3
[ "Apache-2.0" ]
permissive
""" ------------------------------------------------- File Name: db.py Description: 数据库操作模块,负责对象与底层数据库 的交互。 Author: Liu Edited by: chonps ------------------------------------------------- """ import redis import random from .error import PoolEmptyError from .setting ...
true
e1843eb40501357f8e37205d2f6c200a2d16b45e
Python
caioraveli/Python2021
/02-Intermediate/34-decoradores02.py
UTF-8
623
4.03125
4
[]
no_license
# Decoradores pode ser utilizada para adicionar outras funcionalidades a função que será decorada # Pode ser usada para verificar o tempo que a função decorada leva pra ser executada from time import time,sleep def velocidade(funcao): def interna(*args,**kwargs): start_time = time() resultado = fu...
true
bf3e0f0137f928f1d324d02de07953303a286240
Python
gyrospectre/securitybot
/securitybot/tasker.py
UTF-8
4,551
2.96875
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
''' A system for retrieving and assigning tasks for the bot as well as updating their statuses once acted up. This file contains two abstract classes, Tasker and Task, which define a class to manage tasks and a task class respectively. ''' __author__ = 'Alex Bertsch, Antoine Cardon' __email__ = 'abertsch@dropbox.com, a...
true
dbe14a7073f6bac1774a83af13c26bb65819cb05
Python
Akumatic/ViPLab-Backend-C-CPP-Module
/example_run.py
UTF-8
807
2.546875
3
[ "MIT" ]
permissive
import os, sys, c, dataObjects # load exercise and solution data in json format cur_dir = os.path.dirname(os.path.abspath(sys.argv[0])) exercise_data_path = os.path.join(cur_dir, "examples", "exercise.json") solution_data_path = os.path.join(cur_dir, "examples", "solution.json") exercise_data = dataObjects.readJson(ex...
true
c777e00bef9aea52df6b0ceaf9549496cc9bd5c7
Python
viing937/leetcode
/algorithms/python/449.py
UTF-8
1,232
3.625
4
[ "MIT" ]
permissive
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None from bisect import bisect class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode ...
true
4c12bddd4cf082aa4b3cb9291a02d223d1d57802
Python
jorgesfj/Jorge-Soares
/P1ELP1/funcoes_recursivas/decimal_binario..py
UTF-8
107
3.4375
3
[]
no_license
def binario(n): resto = n%2 n = int(n/2) if n>0: binario(n) print(resto) n = int(input()) binario(n)
true
5eb14fd642f7c14762fb6ee2a15dc4af8d37eb2b
Python
liyong6351/python_sbs
/shell/10第十章file/json/1json.py
UTF-8
398
3.09375
3
[]
no_license
import json numbers=[1,2,3,4,5,6,7,8] number1=[] try: with open("data/json.txt","w") as js: json.dump(numbers,js) except FileNotFoundError as fn: print(str(fn)) else: print("Greate !") print(number1) try: with open("data/json.txt") as js: number1 = json.load(js) except FileNotFound...
true
d60d96a95beed4f866e5b8a1968454bf003309ea
Python
sandhya563/codechef
/multi_list.py
UTF-8
124
2.796875
3
[]
no_license
# list=[2,3,4,5,6] # i=0 # multi=1 # while i<len(list): # a=list[i] # multi=multi*list[i] # i=i+1 # print(multi)
true
f5c3c89557b3eb14c50d10bfff8fd7f2d79457ae
Python
PSahithi2k/OMR-SCANNER-APPLICATION
/models/AnswersModel.py
UTF-8
519
2.5625
3
[]
no_license
from lib.db import * class AnswersModel: def __init__(self): self.conn = connect('app.db') def createAnswer(self, subject, typeOfExam, className, answerskey): query = f"INSERT INTO keysheet (subject, typeOfExam, answerskey, className) VALUES ('{subject}','{typeOfExam}','{answerskey}',...
true
09e9979ae87fdc888adb312f9046d5fa076455f3
Python
antoinemaz/CARI
/controllers/listeProjets.py
UTF-8
2,857
2.546875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
# coding: utf8 # page listant les projets @auth.requires_login() def projets(): # tableau contenant tous les projets # attention : la requete (premier argument de la méthode grid, contient la requete qui va lister tous les projets, EN FONCTION DU ROLE # DU USER CONNECTE : demandeur --> tous les dossie...
true
2037eb85f3c38962bab1ed2bc653ba7557076141
Python
ihrigb/stagebuzzer
/usbdrive/_osfile.py
UTF-8
902
3.3125
3
[ "Apache-2.0" ]
permissive
from ._file import File from os import listdir, sep from os.path import isdir, exists, dirname class OsFile(File): def __init__(self, path: str): self._path = path def is_directory(self) -> bool: return isdir(self._path) def get_absolute_path(self): return self._path def get...
true
a03844d3cec418d29ebe6ecb4edb3bf2e42fec45
Python
ecccoyao/CNN
/make_sample_data.py
UTF-8
292
2.9375
3
[]
no_license
input_file = open('filter_data', 'r') output_file1 = open('sample2.txt','w') with input_file as f: lines = f.readlines() count = 0; for line in lines: count += 1 if count % 2 == 0: output_file1.write(line) input_file.close() output_file1.close()
true
7dd0c9dc79ea13be4de7fd952310521b0b772d8f
Python
XingyuLu2/Robotics_Navigation
/IMU_Sensor_Analysis/scripts/IMU_Driver.py
UTF-8
3,633
2.609375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy import serial import utm import numpy as np from sensor_msgs.msg import Imu, MagneticField def cov_to_quat(yaw, pitch, roll): qx = np.sin(roll/2) * np.cos(pitch/2) * np.cos(yaw/2) - np.cos(roll/2) * np.sin(pitch/2) * np.sin(yaw/2) qy = np.co...
true
d0cbd8c6594deeaa0ee2469abdaa684372406b72
Python
shreyaslad/imgmanipulate
/common.py
UTF-8
1,696
2.984375
3
[]
no_license
''' common.py Common classes and functions for this project ''' import enum def hexToRGB(value): value = value.strip("0x"); lv = len(value) return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)) # this text object prevents the functions from becoming too repetitive # TODO: implement text de...
true
fbd06d3766e0ca4fbc3b1088d3446e07502f323f
Python
udayinbiswas/Classification-Analysis
/q2e.py
UTF-8
669
2.6875
3
[]
no_license
import numpy as np import math import re import csv import random import sys testlabel=[] predictedlabel=[] with open('mnist/test.csv',newline='') as csvfileX: reader = csv.reader(csvfileX) for row in reader: testlabel.append(int(row[-1])) file = open('A2SampleInputOutputFiles/q23output.txt', 'r') for line i...
true
e3b23843c6531f69939db92d0f0eaa164b21adae
Python
huangqiank/Algorithm
/laiclass/hashmap/char_remove.py
UTF-8
216
3.0625
3
[]
no_license
''' Created on Oct 1, 2017 @author: qiankunhuang ''' def remove(A): lst=[] for fast in A: if fast not in ["u","n"]: lst.append(fast) return "".join(lst) A="aunsdad" print(remove(A))
true
489cc139273f5effb2c39a13360d6555e66ab059
Python
kwokmoonho/Machine-Learning-SP500
/stock.py
UTF-8
7,218
3.234375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 16 14:21:12 2020 @author: kwokmoonho Stock prediction by using LSTM, KNN, and linear regression - Using python and different machine learning algorithms to conduct predictions on the S & P 500 index. (LSTM, KNN, Linear Regression) - Implementing t...
true
f16644124c9810718b988fa4fa815f37b988f6cb
Python
darsovit/AdventOfCode2018
/Day07/Day07.5.py
UTF-8
2,437
3.25
3
[]
no_license
#!python ''' Advent of Code 2018, Day 7, 1st Solution https://adventofcode.com/2018/day/7 ''' def readInputGraph(): graph = {} graph['edges'] = [] graph['nodes'] = set() with open('input.txt') as f: for line in f: parts = line.split(' ') startNode = parts[1] ...
true
7db4153c3cc4e8988d83bf05e3761d75f7b79215
Python
dafna972/Cracking-The-Coding-Interview
/Chapter-2/Node.py
UTF-8
379
3.9375
4
[]
no_license
class Node: def __init__(self, next=None, data = None): self.next = next self.data = data def __str__(self): string = str(self.data) linked_list = self while (linked_list.next != None): string += " -> " string += str(linked_list.next.data) ...
true
11b73877908496f60c4d112ef861006acd20bda2
Python
msecher/scripts_python_3_opentelemac_r14499
/scripts/python3/data_manip/computation/polyline_integrals.py
UTF-8
7,324
3.25
3
[]
no_license
#!/usr/bin/env python3 """@author TELEMAC-MASCARET Consortium @brief Compute 2D integrals over time across polygonal chains @details Based on PyTelTools that was originally written by Luc Duron (CNR). The extraction has to be done with the dedicated library. The integration is performed here. ...
true
42aa1f9f9d346f57982f1da0086c551801a1e31e
Python
sukeesh/Jarvis
/jarviscli/plugins/corona.py
UTF-8
2,836
3
3
[ "MIT" ]
permissive
import requests from colorama import Fore from plugin import plugin, require from inspect import cleandoc @require(network=True) @plugin("corona") class CoronaInfo: """ corona : Display total cases of the world corona <Country name | country code> : Display cases for the specific country" corona ...
true
e085390e7c998fe115104e349aa34f3192f1e561
Python
justindodson/PythonProjects
/CPR_Temps/resources/date_processor.py
UTF-8
316
3.640625
4
[]
no_license
""" Simple date processor to take the datetime object and convert it into a more usable date format that would be expected on the card. """ def process_date(date): str_date = str(date) year = str_date[:4] month = str_date[5:7] day = str_date[8:10] return ("{}/{}/{}".format(month, day, year))
true
00ce54d54cc6e930fba8fe17911b12e9195e457c
Python
AlexCovizzi/critical-node-problem
/example.py
UTF-8
15,795
2.828125
3
[]
no_license
import time from graphdraw import GraphDraw from greedy import algo_greedy, max_degree_best, min_conn_best, min_conn_ratio_best, create_population from graph import create_graph, calc_objective, create_graph_with_n_edges, calc_alt_objective from asp import global_optimum from minizinc import relaxed_optimum from neighb...
true
a98acea386d9c4bb4e98d54d114d118c1443fe34
Python
CodingDojoTulsaMay2018/Tom_Reese
/Python/python_OOP/intro_to_tdd/intro_to_tdd.py
UTF-8
2,041
3.640625
4
[]
no_license
def reverseList(list): for i in range(len(list)//2): list[i],list[len(list)-i-1] = list[len(list)-i-1],list[i] return list def palindrome(str): for i in range(len(str)//2): if str[i] == str[len(str)-i-1]: continue else: return False return True def coins(change): coin = [0,0,0,0] ...
true
6456a302c4514054efcd58e9978a5f155abff955
Python
SHADIBRAHIM/Python
/CO2/3_sumoflist.py
UTF-8
58
3.0625
3
[]
no_license
l=[1,2,3,4,5] s=sum(l) print("Sum of elements in list:",s)
true
96baeef88fdc07b0c02a8f32d54091cc07355c71
Python
devaun-mcfarlane/CST8279-Lab-3
/Exercise 10.py
UTF-8
143
3.5
4
[]
no_license
m = int(input("Enter the miles driven:")) g = int(input("Enter the gallons used:")) mpg = (m/g) print ("The mpg for the car is ", mpg ," .")
true
5ab5b8dd07f758ba6aead9633febac5a650938ec
Python
edforsberg/FFR120
/src/AvgSpeed.py
UTF-8
116
3.09375
3
[]
no_license
import numpy as np def get_average_speed(dx,v,t,angle): avg_speed = dx*v*t*np.cos(angle) return avg_speed
true
98ac3c5d0ab99ac54a4ec2eb966ba6fe136515b7
Python
santiagopemo/holbertonschool-plds_challenges
/The_Holbie_Champion/main.py
UTF-8
9,761
2.796875
3
[]
no_license
#!/usr/bin/python3 from base_champion import BaseChampion from fighter import Fighter from cleric import Cleric from mage import Mage from ranger import Ranger from paladin import Paladin from rogue import Rogue import fighter from os import path import random import os import time import glob champ_types = [Cleric, ...
true
c5e29d0f31c936e3b271077cd4c781ff20008a0b
Python
t-suzuki-shl/0_start_ai_170928
/src/05_nn/35_nn_part3.py
UTF-8
2,406
3.359375
3
[]
no_license
import numpy as np class NeuralNetwork: def __init__(self): self.hw = np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]) self.hb = np.array([0.1, 0.2]) self.ow = np.array([[0.1, 0.2], [0.3, 0.4] ,[0.5, 0.6]]) self.ob = np.array([0.1, 0.2, 0.3]) def sigmoid(self, x): return 1...
true
26103744cbb9293dfea2697831952b21d346b969
Python
Edinaldobjr/Python
/Geek_University/4. Variáveis e Tipos de Dados em Python/7 - Fahrenheit para Celsius.py
UTF-8
174
3.828125
4
[]
no_license
print('Conversor de temperatura (Fahrenheit para Celsius)\n') F = float(input('Digite a temperatura em Fahrenheit: ')) C = 5 * (F -32) / 9 print('C =', round(C, 2), 'ºC')
true
b5b307d383284d020670fcf07400bc8d2ea6ccff
Python
ambarish710/python_concepts
/graph/directed_graph_comprehensive.py
UTF-8
3,011
3.9375
4
[]
no_license
from queue import Queue # Graph class Graph: def __init__(self, edges_list): self.adjacency_list = {} self.bfs_parent = {} self.dfs_parent = {} self.visited = {} self.color = {} self.bfs_traversal_output = [] self.dfs_traversal_output = [] self.bfs_q...
true
490c7ba35b3d87f250e29043842f43d548a5f80d
Python
sqiprasanna/coding-questions
/Greedy/page_faults_in_LRU.py
UTF-8
1,705
3.984375
4
[]
no_license
""" url : https://practice.geeksforgeeks.org/problems/page-faults-in-lru/0 In operating systems that use paging for memory management, page replacement algorithm are needed to decide which page needs to be replaced when the new page comes in. Whenever a new page is referred and is not present in memory, the page fault...
true
f2712a5f329cfd135638cc956284336067e26e11
Python
Aasthaengg/IBMdataset
/Python_codes/p03681/s683423628.py
UTF-8
249
2.9375
3
[]
no_license
import math n, m = map(int, input().split()) R = 1000000007 if abs(n - m) >= 2: ans = 0 else: nf = math.factorial(n) mf = math.factorial(m) if n == m: ans = (nf * mf * 2) % R else: ans = (nf * mf) % R print(ans)
true
c706683629ced8b932bf84c8f87d3d20068c3a4c
Python
ruiwu1990/vwplatform
/app/visualization/util.py
UTF-8
5,663
3.40625
3
[]
no_license
# this is used to force division to be floating point # e.g. 4/5=0.8 from __future__ import division import numpy as np #This function is used to get the name of each item #and remove the offset and write the results into temp file #The users need to remove the temp file by themselves def getItemName(downloadDir='', f...
true
d9dae35079f18ceae43f479f414f5e02033e0d52
Python
sayed07/sayed
/pro10.py
UTF-8
170
2.71875
3
[]
no_license
bb1=int(input()) nn1=list(map(int,input().split())) jj1=0 for i in range(0,bb1): for r in range(0,i): if nn1[r]<nn1[i]: jj1=jj1+nn1[r] print(jj1)
true
38426f86d56a78d8172c9eec8f28cc1e47f087bd
Python
medical-projects/value-of-medical-notes
/mimic3preprocess/scripts/get_validation.py
UTF-8
1,809
2.546875
3
[]
no_license
import pandas as pd import numpy as np import os from sklearn.model_selection import train_test_split import argparse parser = argparse.ArgumentParser(description='get readmission data that have physician notes') parser.add_argument('--path', type=str, default="/data/joe/physician_notes/mimic-data/...
true
b2c3bb022ccbb91e66fe0acefb70a972bbd44dfc
Python
Aasthaengg/IBMdataset
/Python_codes/p03079/s159538546.py
UTF-8
260
3.015625
3
[]
no_license
''' Created on 2020/08/20 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write A,B,C=map(int,pin().split()) if A==B and B==C: print("Yes") return print("No") return main()
true
b1f687da9cbc6c510888fdcbc115ebd56b117855
Python
naveen12124/lab2.0
/LAB 1 LCM GCD of 3 numbers.py
UTF-8
396
4.1875
4
[]
no_license
a = int(input("Enter the first number : ")) b = int(input("Enter the second number : ")) c = int(input("Enter the third number : ")) # Calculation of GCD gcd1 = gcd(a,b) gcd2 = gcd(gcd1,c) # GCD of 3 numbers # Calculation of LCM lcm1 = a*b//gcd1 lcm2 = c*lcm1//gcd(c,lcm1) # GCD of 3 numbers # Printing the answer pr...
true
26ba0b87b9a55c98ac7182be4db3e89e11fb03d1
Python
Nikkuniku/AtcoderProgramming
/JOI/第12回日本情報オリンピック 予選(過去問)/d.py
UTF-8
700
2.515625
3
[]
no_license
d, n = map(int, input().split()) temp = [int(input()) for _ in range(d)] cloth = [tuple(map(int, input().split())) for _ in range(n)] dp = [[0]*n for _ in range(d+1)] for i in range(d): t = temp[i] for j in range(n): a, b, c = cloth[j] if i == 0: if a <= t <= b: dp[...
true
085bd32ebe6ed6de34e01fb104c38013a2dd5099
Python
ahorjia/longform
/ConnectDots/ProcessContent.py
UTF-8
9,092
3.109375
3
[]
no_license
import xml.etree.ElementTree as ET from bs4 import BeautifulSoup from nltk.corpus import stopwords from nltk.tokenize import RegexpTokenizer from nltk.stem.porter import * import pickle import re from datetime import datetime import time from ArticleEntry import ArticleEntry from constants import * _digits = re.compi...
true
b6f66053ce30a44d6d9817b2578102662c9abe87
Python
amitramachandran/pythonprogramming.org
/list overlap comprehensin.py
UTF-8
455
3.4375
3
[]
no_license
import random values=range(1,100) b=[] a=[] c=[] e=[] #two random list generation for i in range(10): b.append(int(random.choice(values))) a.append(int(random.choice(values))) print a,b #this shows the logic for common element without duplication c=[num for num in a if num==b[i]] d=set(c) print "c...
true
8e6681e9f6e968b479e6c5e796b352077828f150
Python
sangee9968/codekata6
/print_digits.py
UTF-8
91
2.96875
3
[]
no_license
n=int(input()) s="" for i in str(n): s=s+str(i)+" " #print result print(s.strip())
true
ce175abb9bb4138b797a14dc5971b1d5d7214d66
Python
GB-CodeDreams/Statist
/crawler/crawler/bd_pages_parser.py
UTF-8
6,407
2.546875
3
[]
no_license
#!/usr/bin/python3 from sqlalchemy import and_, func from datetime import datetime from string import punctuation from bs4 import BeautifulSoup from html2text import html2text import models from bd_pages_downloader import page_downloader def make_word_indexes_dict(text): text = text.lower() word_list = te...
true
2909272853d7029ad75cef776bee3cee14947844
Python
metacoma/overlap
/overlap.py
UTF-8
371
3.09375
3
[]
no_license
import sys, json import itertools def overlap(a): s = sorted(a) result = [] n = 0 for i in s: for j in range(0, n): e = s[j] if (e[1] >= i[0] and e[1] <= i[1]): result.append(e) if (i[0] >= e[0] and e[1] >= i[0]): result.append(i) n = n + 1 return result print(js...
true
5639c74974013512398b1a7b37eff7ad436aa8c8
Python
Ziggid/GetRichQuick
/GetRichQuick/Stock.py
UTF-8
798
3.296875
3
[]
no_license
import requests def getCurrentStockPrice(stockId: str): response = requests.get( "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=" + stockId + "&interval=1min&outputsize=compact&apikey=HUTM7V18LBLQPIOP") # Since we are retrieving stuff from a web service, it's a good i...
true
dc5e5e68921594eef5331b2d5a72131c5f1cde5d
Python
estherbs/iovana.github.io
/reddiment.py
UTF-8
4,574
2.796875
3
[]
no_license
from flask import Flask from flask import request, render_template import requests, time, string, re, operator from lxml import html app = Flask(__name__) @app.route('/', methods=['POST', 'GET']) def index(): if request.method == 'POST': form_data = request.form['url'] word_list = check_url(form_...
true
467aa064f3d6242424697f31088293a1638ee12b
Python
notro/tmp_CircuitPython_stdlib
/stripped/test/test_posixpath.py
UTF-8
13,319
2.75
3
[]
no_license
import itertools import os import posixpath import sys import unittest import warnings from posixpath import realpath, abspath, dirname, basename from test import support, test_genericpath # An absolute path to a temporary filename for testing. We can't rely on TESTFN # being an absolute path, so we need this. ABSTF...
true
5f60740d0f7f7dd92f35ad9bc4fc17ce962dc128
Python
Nyapy/TIL
/04_algorithm/02day/전기버스.py
UTF-8
1,321
2.6875
3
[]
no_license
import sys sys.stdin = open("전기버스_input.txt") sys.stdout = open("전기버스_output.txt", "w") T = int(input()) for tc in range(T): move, stop, charger = map(int, input().split()) bus_stop = [0] * (stop+1) charge_count = 0 stop_list = list(map(int, input().split())) for i in range(1, stop): if i i...
true
29b7dc55f1aad89eca679560fc79492484830c3a
Python
aoxy/Machine-Learning-Lab
/Lab1/LR.py
UTF-8
3,615
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def main(): # 载入数据 x_train = np.load("./data/train_data.npy") # shape: (70, 3) y_train = np.load("./data/train_target.npy") # shape: (70, ) x_test = np.load("./data/test_data.npy") # shape: (30, 3) y_test = np.load("./d...
true
e39b900dd27fb4780d17d2c85d33676863405899
Python
ashwinmhn/guvi
/loop/hcf.py
UTF-8
308
3.484375
3
[]
no_license
# program to find HCF (GCD) of two numbers print("Enter a") a=int(input()) print("Enter b") b=int(input()) small=0 hcf=0 if a > b: small = b else: small = a for i in range(1, small+1): if((a % i == 0) and (b % i == 0)): hcf = i print(hcf)
true
6626481a7494160f0daf8818167b820f48aa8792
Python
ozsoftcon/QDataSet
/qmldataset/system_layers/quantum_evolution.py
UTF-8
1,100
3.03125
3
[ "MIT" ]
permissive
"""Quantum Evolution """ from tensorflow import ( complex64, eye, shape, Tensor ) from tensorflow.keras import layers from .quantum_step_layer import QuantumCell class QuantumEvolution(layers.RNN): """Custom layer that takes Hamiltonian as input, and produces the time-ordered evolution unitary...
true
f86fbacf98d4837fde30209ba6650a72104e859a
Python
recantha/musicbox
/mcp.py
UTF-8
201
2.625
3
[]
no_license
from gpiozero import MCP3008, LED from time import sleep pot = MCP3008(channel=3, device=0) purple_led = LED(24) purple_led.on() while True: pot_reading = pot.value print(pot_reading) sleep(0.1)
true
e2444526822efa526669cd5dea34e2431cc36b62
Python
NSLS-II-XPD/ipython_ophyd
/profile_collection/simulators/92-testdipfit.py
UTF-8
3,618
2.84375
3
[]
no_license
#individually fit peaks ''' The problem is that the peak is in too narrow of a range. If we're off in our guess, then we're wrong. Instead, we should just fit to a peak and return the center. ''' uids = ('79b54d30-7fff-4a24-80c1-1d5cb3e71373', 'b0b7a12b-ec80-47a1-ac24-c86eb9ebf464', 'c1e766f...
true
5800e458ca68bfc3da4b3cfc004917e4edeb17af
Python
shobhit-cstep/IDEX-1
/LSTM.py
UTF-8
1,116
2.921875
3
[]
no_license
from keras.models import Sequential from keras.layers import LSTM from keras.layers import Dense from sklearn.metrics import mean_squared_error class LSTMModel(object): def __init__(self,): self.model = None def build(self, layer1_parameters=50, layer2_parameters=50, input_shape_n_steps=3, input_shap...
true
770621b3e4358facf608c6aa4a6cecd5db78b2f4
Python
adrian729/LP
/Python/PracticaPython/cerca.py
UTF-8
10,444
2.609375
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- import argparse import unicodedata import urllib.request import xml.etree.ElementTree as ElementTree from math import sin, cos, sqrt, atan2, radians from ast import literal_eval # Define valid call arguments parser = argparse.ArgumentParser() parser.add_argument("--lan", hel...
true
61a416b990f94a12e19e53d7f2653697029a6154
Python
konotorii/Albin
/Cogs/help.py
UTF-8
578
2.546875
3
[]
no_license
import discord from discord.ext import commands class HelpCog(commands.Cog, name="help commmand"): def __init__(self, bot:commands.Bot): self.bot = bot @commands.command(name = "help", usage="help", description = "displays help command") @commands.co...
true
b3c83878ecaf1952b577086a9d42fb99dd6b96f4
Python
LiuJiazhen1999/Qd-Tree
/qdTrees/queryparsing/qdtree.py
UTF-8
9,459
2.640625
3
[]
no_license
import numpy as np class IterationResult(object): def __init__(self, qd_tree, rewards): self.qd_tree = qd_tree self.rewards = rewards def get_qd_tree(self): return self.qd_tree def set_qd_tree(self, qd_tree): self.qd_tree = qd_tree def get_rewards(self): ret...
true
0a276a72bd3bac6cc889ebb1ed0fe84fca5e37a6
Python
pleimi/Cuenta_regresiva_otros_scripts
/list.py
UTF-8
1,334
4.0625
4
[]
no_license
#demo_list = [1, "hello", 2.5, True, [1, 2, 3]]# aqui hay una lista dentro de otras #print(dir(demo_list)) #print(demo_list) #colors = (["red", "green","blue"])# me imprime una lista [] # print(colors) # number_list= list((1, 2, 3, 4)) # esto es una tuple, datos inmutables # print(number_list) # print(type(number_li...
true
4db9e98240cea4aa75f3ee4654bc5f33fd668120
Python
VictorBro/Introduction_To_Algorithms_CLRS_solutions
/10_2_7_reverse_list.py
UTF-8
976
3.84375
4
[]
no_license
class Node: def __init__(self, val, next=None): self.key = val self.next = next class LinkedList: def __init__(self): self.head = None def insert(self, val): new_node = Node(val) if self.head is None: self.head = new_node else: new_n...
true
7ec8eb2b4f893fa850e6bd33ceeb2371cdd46f43
Python
ZongweiZhou1/Hope
/model/loss.py
UTF-8
4,381
3.046875
3
[]
no_license
from __future__ import print_function import torch import torch.nn as nn from torch.autograd import Variable class TripletLoss(object): def __init__(self, margin=None): self.margin = margin if margin is not None: self.ranking_loss = nn.MarginRankingLoss(margin=margin) else: ...
true
3f87072f4c12f9109bc57784e4402987947f5aba
Python
tkaczk/Bootcamp-Kodilla-2020
/Projects/profits.py
UTF-8
305
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jul 9 21:21:26 2020 @author: tkacz """ items= [ ['456_Longneck', 100000, 1000, 99], ['454_Bier', 25000, 1000, 180], ['155_Bordeaux', 50000, 1000, 150] ] cost = [(item[1]*item[3])/1000 for item in items] print(cost)
true
41c5aaf87f9a9d873db20d3d4bcc250565e70b83
Python
Sunnysuh99/HelloPython03
/untitled/lab02.py
UTF-8
2,068
3.609375
4
[]
no_license
#19. 윤년계산 (2012년은 윤년) year = int(input('알고싶은 윤년 년도를 입력하세요')) if((year % 4 == 0 and year %100 != 0) or (year % 400 == 0)): print('%d 는 윤년입니다' % year) else: print('%d는 윤년이 아닙니다' % year) #20. 복권 빌행 import random lotto = str(random.randint(100, 999)) print(lotto) lucky = str(input('복권 숫자 3자리를 입력하세요! \n')) matc...
true
d2e41daaa90d2145cc8dc94e5ec96d29d4a66320
Python
jorpramo/CALLES
/busqueda.py
UTF-8
4,932
2.609375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'jpradas' import wikipedia import settings from collections import Counter from fastkml import kml import operator import csv, re, os import genderator import pypyodbc from nltk.corpus import stopwords from nltk import word_tokenize import nltk import time from go...
true
a0a3bcfd64d3bef6e65c235546bb944cc9377282
Python
RooshhilPatel/AsthmaAnalytics
/regression_model.py
UTF-8
3,480
3.53125
4
[]
no_license
import csv import warnings import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt from scipy.stats import * warnings.filterwarnings("ignore") # ignore warnings # Read the file given and save the data in arrays def read_CSV(filename, var_title): vari...
true
b586c4fa051c794fe6ddf32757aa9d47bcf08e55
Python
kishao1996/ashu_music_deprecated
/bilibili/singer.py
UTF-8
666
2.59375
3
[]
no_license
# encoding: utf-8 from moviepy.editor import * from common.logger import logger from settings import PWD class Singer(object): def __init__(self): pass def sing(self, path): clip = AudioFileClip(path) clip.preview() clip.close() def sing_all(): with open(PWD + '/song_li...
true
1531fe56d1c96a3e78e360a7db1f3cb34f490202
Python
ROB7-StayHumble/golfcart-sensorfusion
/sensorfusion/utils/img_utils.py
UTF-8
1,349
3.203125
3
[]
no_license
#!/usr/bin/env python3 import cv2 import numpy as np colors = { 'white':(255, 255, 255), 'black':(0,0,0), 'green':(0, 255, 0), 'blue':(0,255,255) } def angle_from_box(img,box): h,w = img.shape[:2] (xA, yA, xB, yB) = box center_y, center_x = (h-(yA+(yB-yA)/2...
true
640f58c00c45f2362a33ae8ec43c81c9102ad519
Python
catapult-project/catapult
/dashboard/dashboard/api/utils.py
UTF-8
1,032
2.671875
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function from __future__ import division from __future__ import absolute_import import datetime def ParseBool(value): """Pa...
true
af3d093aa64d3b7d72c8ac4c6882a6290c13689f
Python
E3798211/ITASposter
/CQIPrediction/script_conservative_cqi.py
UTF-8
675
2.796875
3
[]
no_license
#!/usr/bin/python3 # Experiment setup step = 10 # ms experiment_time = 1000 # ms import re # read real CQI fin = open("CQI_current", "r") time_cqi = fin.read() fin.close() time_cqi_list = re.findall(r'\d+', time_cqi) time_cqi_list = [int(i) for i in time_cqi_list] time = 0 while time_cqi_list[time] < 400: ti...
true
b481f7251cddbabd9d358a5e1fdc08d37d9292eb
Python
wulrahman/cv
/pages/models.py
UTF-8
2,005
2.5625
3
[]
no_license
from django.db import models from os.path import splitext, basename import uuid # Create your models here. def image_upload_to(instance, filename): base, ext = splitext(filename) newname = "%s%s" % (uuid.uuid4(), ext) return "static/image/{}".format(newname) class Experience(models.Model): job_title =...
true
e1a5ed0b4cd219baff061a4f2f0f025ae624bdbb
Python
netaz/dirty-rl
/dqn.py
UTF-8
19,512
2.75
3
[ "Apache-2.0" ]
permissive
"""Deep Q-Learning Based on the code cited below with various changes to make it more conformant with the DQN paper. https://github.com/pytorch/tutorials/blob/master/intermediate_source/reinforcement_q_learning.py Also described in https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html. Changes: ...
true
dd3d63f91c71d022509c6ee7c021a16fd79a09ec
Python
reproducible-agile/reviews-2020
/reports/2020-009/computational-workflow/reachability-python/src/visualizer.py
UTF-8
14,815
2.546875
3
[ "Apache-2.0" ]
permissive
import pandas as pd import numpy as np import shutil import multiprocessing.pool import matplotlib.dates import matplotlib.pyplot as plt import matplotlib.cbook import matplotlib.cm from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() from matplotlib import colors as mcolors ...
true
c5b93f128533583ad43c5728bb6383f9a9a3441f
Python
keionbis/stm32f1-custom-usbhid
/hid-test.py
UTF-8
489
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import hidapi import binascii import time hidapi.hid_init() print 'Loaded hidapi library from: {:s}\n'.format(hidapi.hid_lib_path()) devices = hidapi.hid_enumerate(0x0483, 0x5750) if len(devices) == 0: print "No dev attached" exit(1) device = hidapi.hid_open(0x0483, 0x5750) impo...
true
f43b2010f8e5e803a81557f776f09f7717ec88eb
Python
baovu98/Homework-Python
/multiply.py
UTF-8
435
3.59375
4
[]
no_license
def multiply_list(Lalisalist): # Multiply the Numbers in the list one by one result = 1 for i in Lalisalist: try: int(i) except: return False for i in Lalisalist: result = result * i return result #Insert Desired numbers yourList = [] you...
true
e4d52afd4ff43109e382d7b549260c907193649c
Python
rubys/feedvalidator
/time.cgi
UTF-8
229
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/python print "Content-type: text/plain\r\n\r\n", import rfc822 import time print "Current time:\n" print " RFC 2822: " + rfc822.formatdate() print " RFC 3339: " + time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
true
71238a0a6a9a180192f73c37938f49eb854f7b4f
Python
LuisHernandez96/Pichon
/NeededSize.py
UTF-8
1,228
3.15625
3
[ "MIT" ]
permissive
# Store the amount of variables a scope needs to execute # NOTE: WE ENDED UP NOT USING THIS AND JUST GIVE 10000 ADDRESSES TO EACH DATA TYPE class NeededSize: # Constructor def __init__(self, localInts = 0, localFloats = 0, localBooleans = 0, tempInts = 0, tempFloats = 0, tempBooleans = 0): self.localInts = localIn...
true
1b643c9ac2da65e238e8dd0cdf564e403a699a4e
Python
sainihimanshu1999/Leetcode---Top-100-Liked-Questions
/longestvalidparanthesis.py
UTF-8
341
2.6875
3
[]
no_license
def longestvalidparanthesis(self,s): if not s: return 0 stack = [] dp = [0]*len(s) for i in range(len(s)): if s[i] == '(': stack.append(i) continue if stack: leftIndex = stack.pop() dp[i] = i-leftIndex+1+dp[leftIndex-...
true
40157c1585bd14365ceb5fa50d17f0736f950501
Python
wikilife-org/wikilife_processors
/wikilife_processors/tests/processors/stats/was/factors/height_factor_tests.py
UTF-8
1,026
2.765625
3
[]
no_license
# coding=utf-8 from wikilife_processors.tests.base_test import BaseTest from wikilife_processors.processors.stats.was.factors.factors_model import HeightFactor class HeightFactorTests(BaseTest): def test_process_value(self): factor = HeightFactor(values=[ {"id": "lt1", "name": "less than 1.0...
true
0000d029a1c348a1769b5604e4efcd07cf2cb4d7
Python
ninjascant/wiki-parser
/tests/parse_sections_tests.py
UTF-8
2,426
3.09375
3
[]
no_license
import unittest import wikitextparser as wtp from wikiparser.parse_sections import check_is_nested_section, parse_section_text TEST_PAGE = ''' '{{other uses|Answer (disambiguation)}}\n{{refimprove|date=August 2013}}\n{{Use mdy dates|date=June 2013}}\n\n\nIn law, an \'\'\'answer\'\'\' was originally a solemn assertion ...
true
9c7826ef72647aa32093bcb21a611db2644b10ed
Python
WeeJang/basic_algorithm
/TreeArray.py
UTF-8
729
3.484375
3
[]
no_license
#!/usr/bin/env python2 def lowbit(x): return x & (-x) class TreeArray(object): def __init__(self,n): self.__n__ = n self.__array__ = [ 0 ] * ( n + 1 ) def update(self,index,value): assert index <= self.__n__ while index <= self.__n__: print "modify index",index self.__array__[index] += value in...
true
cce860b8707d8adedcadea5374103bab6ce571d8
Python
Guruscode/getting-started-with-python
/modules-and-packages/basicmath/calculator.py
UTF-8
362
3.09375
3
[]
no_license
# calculator module print( 'basicmath/calculator.py: __name__ => ', __name__ ) print( 'basicmath/calculator.py: __package__ => ', __package__ ) # export a function def add( num1, num2 ): return num1 + num2 # import numbers subpackage using absolute intra-package referennce from basicmath.numbers import power def ...
true
87f0393dc5a0ec631ee5cefc3e894450153fd275
Python
m-atlantis/BloodTypeCompatibility
/dealer.py
UTF-8
1,904
3.078125
3
[]
no_license
import random import numpy as np import alice import bob def __init(): global s, r, truth_table, matrix_a, matrix_b, n_size # We work with bloodtypes, and there's 8 different ones, so to get 2**n = 8, n = 3. n_size = 3 r = create_random_bit_string() s = create_random_bit_string() # Initial...
true
431e57c2a288807fb06d8ffc20dda0eac5e451bd
Python
Zakalren/Problem-Solve
/BOJ/5430.py
UTF-8
500
2.90625
3
[]
no_license
import sys T = int(input()) for _ in range(T): P = input() N = int(input()) arr = list(sys.stdin.readline().replace('[', '').replace(']', '').split(',')) for c in P: if c == 'R': arr.reverse() else: if arr: arr.pop(0) else: ...
true
23b438dad91fc77099d1e540fab1bb932649bc01
Python
slieser/flowdesignbuch
/python/wordwrap/interactors_tests.py
UTF-8
1,044
3.0625
3
[ "MIT" ]
permissive
from unittest import TestCase from interactors import start class InteractorTests(TestCase): def test_start(self): result = list(start(['', 'max_und_moritz.txt', 20])) self.assertEqual(result, [ 'Mancher gibt sich', 'viele Müh Mit dem', 'lieben Federvieh:', ...
true
cadfa25cc55de6a588c8d184bc7770de3801da39
Python
yanigisawa/data-dispenser
/tests/write_results.py
UTF-8
476
2.5625
3
[ "MIT" ]
permissive
""" Creates a .result file for each file in this directory, for verifying results. """ from file_stems import split_filenames from data_dispenser.sources import Source import pickle for (filename, stem, ext) in split_filenames(): src = Source(filename) src._dump('%s.result' % stem) src = Source(filename) ...
true
88d8a85e16455c447e7eacc96f571ff69862e848
Python
malgorzatagwinner/Python
/ZADANIA_11/11_1.py
UTF-8
874
3.328125
3
[]
no_license
#!usr/bin/env python3 # -*- coding: utf -8-*- import random as r import statistics as s from random import gauss as g def ad_a(n): lista = list(range(n)) r.shuffle(lista) return lista def ad_b(n): lista = list(range(n)) for i in range(n-1): a = r.randrange(i, min(n-1, i+5)) li...
true
3e7fb0bd67ea6a663d840b554b2aa9dc1b9c03ad
Python
yhtyht308/linux_study
/pratice/calculator.py
UTF-8
3,961
2.78125
3
[]
no_license
#!/usr/bin/env python3 import sys import csv from collections import namedtuple IncomeTaxQuickLookupItem=namedtuple( 'IncomeTaxQuickLookupItem', ['start_point','tax_rate','quick_subtractor'] ) INCOME_TAX_START_POINT=3500 INCOME_TAX_QUICK_LOOKUP_TALE=[ IncomeTaxQuickLookupItem(80000,0.45,13505), IncomeTaxQuickL...
true
7f32b989627448390741459eea04ced7f31ac39b
Python
hectorgavin/squash
/squash2000/api.py
UTF-8
539
2.65625
3
[]
no_license
from datetime import datetime import requests class Squash2000Api(object): calendar_endpoint = 'http://www.squash2000-paramount-fitness.de/plan.php' @classmethod def get_timetable(cls, date=datetime.now().date()): response = requests.get(cls.calendar_endpoint + '?jahr={}&monat={}&tag={}'.format(...
true
8cfae95d372deb19202c08417c3d8b8ce52f797d
Python
tavo18/MLCaptchaSolver
/train_model_8.py
UTF-8
4,383
2.890625
3
[]
no_license
import cv2 import pickle import os.path import numpy as np from imutils import paths from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers.convolutional import Conv2D, MaxPooling2D from keras.layers.core import Flatten...
true
0bb5ad685b6a8fcf3eec4fc8d540dbafa0e5bb0a
Python
Nikkuniku/AtcoderProgramming
/ARC/ARC109/B.py
UTF-8
176
2.984375
3
[]
no_license
n=int(input()) def f(k): return k*(k+1)//2 l=-1 r=n+1 while r-l>1: mid=l + (r-l)//2 if f(mid)<=n+1: l=mid else: r=mid ans=n-l+1 print(ans)
true
3d135605923214bc9b5e5641ee69ee471678f822
Python
suchen2018/Some-useful-code
/quadratic.py
UTF-8
874
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 3 14:14:55 2018 @author: n10027301 """ import math def quadratic(a,b,c): if a == 0: raise TypeError('a不能为0') if not isinstance(a,(int,float)) or not isinstance(b,(int,float)) or not isinstance(c,(int,float)): raise TypeErro...
true
37da93dce4a58cb24b9ac632044abee92bb57f9c
Python
DiagnosticRobotics/dr-chf-models
/deep/lstm_model.py
UTF-8
3,121
2.90625
3
[]
no_license
from deep.attention import AttentionWithContext from keras import Model, Input from keras.layers import Dense, Dropout, Activation from deep.deep_sequential_model import DeepSequentialModel class LstmModel(DeepSequentialModel): def __init__(self, model_name = 'deep_model', activation = 'sigmoid',...
true
7df6fd4ec83524eb18c4fa483feedd21724ca722
Python
worklifesg/Daily-Coding-Challenges-Practice
/GeneralCodingPractice/1.Arrays/6_RotateArray_Modified.py
UTF-8
748
3.6875
4
[]
no_license
class Solution: def rotate(self, nums: List[int], k: int) -> None: def reverse_array(start, end): while start < end: nums[start],nums[end] = nums[end],nums[start] start+=1 end-=1 length = len(nums) k = k % length ...
true
96d42012277bad79f8d75638c36dee1a2588bbb8
Python
justgolikeme/My_MachineLearning
/Base_On_Scikit-Learn_TensorFlow/Chapter_2/Demo_2/Analyze_Data.py
UTF-8
565
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019/12/21 15:33 # @Author : Mr.Lin ''' 分析数据 ''' from Chapter_2.Demo_2.DataSource import housing # 查看前五行的数据 每一行代表一个区 print(housing.head()) print("") # info方法获取数据集的简单描述 print(housing.info()) print("") # 查看 ocean_proximity 属性有多少中分类存在 print(housing["ocean_proximity"].value_counts...
true
559d7e35ddb621d7ff3ca774d292a473c0413468
Python
pto8913/KyoPro
/ABC/ABC105/B.py
UTF-8
179
2.890625
3
[]
no_license
# URL: https://atcoder.jp/contests/abc105/tasks/abc105_b N = int(input()) ans = "No" for i in range(26): for j in range(16): if(i*4+j*7 == N): ans = "Yes" print(ans)
true
0fc9b9a2f752b27266536d2f3fb18f2003a93bd8
Python
brandonhillert/StructeredProgramming
/Mastering Mastermind/test.py
UTF-8
1,605
3.90625
4
[]
no_license
import itertools import random def code_invullen(): code = " " print("Vul een code in: ") code = input() for i in code: if i not in "abcdef" or len(code) != 4: print("Foutmelding") print("Vul een code in") code = input() return list(code) def feedback...
true
61301d112826b38c23d58c441a1e8057d0fc8557
Python
Nikukzn/ParaMol
/ParaMol/Force_field/force_field.py
UTF-8
47,945
3.03125
3
[ "MIT" ]
permissive
""" Description ----------- This module defines the :obj:`ParaMol.Force_field.force_field.ForceField` class which is the ParaMol representation of a force field that contains all the information about the force field terms and correspondent parameters (even relatively to those that will not enter the optimization). """...
true
44d1f98dd1b5ea3e87c9c9d31a33a4bf718c083d
Python
glamod/icoads2cdm
/py_tools/common/colorbar_functions.py
UTF-8
2,614
2.703125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 30 09:42:02 2018 @author: iregon """ for vari in vars_in: # Set the colormap and norm to correspond to the data for which # the colorbar will be used. cmap = cmaps.get(vari) norm = mpl.colors.Normalize(vmin=min_value_global, vmax=ma...
true
3eeaf7f71b2b79dc94b50bd981e3dfa71bd7a68e
Python
JEDGIT18/PythonExercises
/EPpractice/binarydistance.py
UTF-8
823
3.90625
4
[]
no_license
#Converts a number to binary and finds its binary gap check = False while not check : try: num = int(input("Input a number: 0 - 255 ")) check = True except ValueError: print("Enter a number!") binaryStr = "" max = 128 while num > 1 or len(binaryStr) != 8: if num >= max: ...
true