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 |
|---|---|---|---|---|---|---|---|---|---|---|
76139f60a3291cf8765af0bb0e368f7d52e1bff6 | fouzhe/profuzzbench | /scripts/analysis/coverage_plotting.py | UTF-8 | 2,872 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | from pandas import read_csv
from pandas import DataFrame
from pandas import Grouper
from matplotlib import pyplot as plt
import pandas as pd
#Read the results
df = read_csv('results.csv')
#Calculate the mean of code coverage
#Store in a list first for efficiency
mean_list = []
for subject in [' exim']:
for fuzzer ... | true |
0e30a5f27415c50ce8185077d3d86e9df2805a57 | 6GeniusTurtle9/TIL | /공부/2월 공부/1284수도요금.py | UTF-8 | 309 | 3.453125 | 3 | [] | no_license | T = int(input())
for tc in range(1, T+1):
P, Q, R, S, W = map(int, input().split())
Price_A = W * P
Price_B = Q
result = 0
if W > R:
Price_B += (W-R)*S
if Price_A < Price_B:
result = Price_A
else:
result = Price_B
print("#{0} {1}".format(tc,result)) | true |
4ccd005b3c8adbd3097ea3ea2d2f4142c3dfb19e | saikumarkethi/cool-papers-in-pytorch | /adversarial_discriminative_domain_adaptation.py | UTF-8 | 12,697 | 2.703125 | 3 | [] | no_license | """
Reimplementation of 'Adversarial Discriminative Domain Adaptation' (CVPR `17)
http://openaccess.thecvf.com/content_cvpr_2017/papers/Tzeng_Adversarial_Discriminative_Domain_CVPR_2017_paper.pdf
Doing domain adaptation from USPS (source) to MNIST (target) with adversarial approch.
Step 0 : Pre-training on USPS...
-... | true |
d272ab6d4aad4fb2f84005d638452a99fa5a5873 | mgear2/undervoid | /main.py | UTF-8 | 5,881 | 2.703125 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | # Copyright (c) 2020
# [This program is licensed under the "MIT License"]
# Please see the file LICENSE in the source
# distribution of this software for license terms.
import pygame as pg
import ruamel.yaml
import sys
from src.sprites.sprites import *
from os import path, environ
from src.game import Game
from src.sp... | true |
876f8dc99c5954d9ae055afa6c55d7de6d09ca8d | pappasam/npd | /c1_intro_programming/scripts/test_debugging.py | UTF-8 | 1,885 | 2.953125 | 3 | [] | no_license |
import debugging
import unittest
class RunExercises(unittest.TestCase):
gravity_tests = ( ( (debugging.EARTH['mass'], debugging.SUN_MASS, debugging.EARTH['orbital_radius']), 3.5422793159941665e+22), )
earth_escape_velocity = 11185.79353278485
valid_time_keys = [ 'seconds', 'minutes', 'years', 'days', '... | true |
9e312dcb66927fa34795277c30e67cfd5ba4c8a9 | matteosan1/TdP | /pyglet/bezier.py | UTF-8 | 1,926 | 3.265625 | 3 | [] | no_license | # modified from http://cs.nyu.edu/exact/core/download/core_v1.8/core_v1.8/python/progs/bezier/bezier.py
#
# $Id: bezier.py,v 1.2 2005/05/09 21:16:28 exact Exp $
#
# see http://www.doc.ic.ac.uk/~dfg/AndysSplineTutorial/Beziers.html
# for an interactive bezier drawing applet
from math import *
# class Point
class Poi... | true |
07e34cfcc77ee7b63aa948f1f893087900b23fd8 | wwlorey/light-up-puzzle-ea | /analysis/gen_stats.py | UTF-8 | 1,536 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
log_file_paths = ['../output/random_gen_log.txt', '../output/website_puzzle_log.txt', '../output/website_puzzle_log_random_search.txt', '../output/random_gen_log_random_search.txt', '../output/website_puzzle_log_BONUS.txt', '../output/random_gen_log_BONUS.txt']
for i in range(len(log_file_paths... | true |
c051379d1e0519580afb20894dacfd9f59c7a1b1 | xiaoyaohu0325/chess_deeplearning | /train_checkpoint.py | UTF-8 | 2,289 | 2.765625 | 3 | [] | no_license | from game import Game
from player.MCTSPlayer import MCTSPlayerMixin
from player.RandomPlayer import RandomPlayerMixin
from policy import ResnetPolicy
import argparse
import os
import logging
import daiquiri
daiquiri.setup(level=logging.INFO)
logger = daiquiri.getLogger(__name__)
def play(white_player, black_player, ... | true |
733e6a74774c45f954b896ddb3506289a54031d3 | mriosb08/pytine | /src/overlap_stats.py | UTF-8 | 3,961 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
import sys
from metrics import SetMetrics
import pickle
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from sklearn import svm
import pylab as pl
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import confusio... | true |
a395c552cfc6dbc74b2af95106121f6d57f55bdc | brachapokroy/Pokemon-Project | /pokemon_intro.py | UTF-8 | 3,624 | 2.703125 | 3 | [] | no_license | import pymysql.cursors
import json
from config import connect, commit
def load_data(filename: str):
with open(filename) as f_in:
try:
cur = connect()
cur1 = connect()
cur2 = connect()
cur3 = connect()
a = json.load(f_in)
arrayNames = ... | true |
b006adb268396889253f44f637314452bfe8af05 | aliiceland/alicja_kurs | /01_podstawy/zadanie_2.py | UTF-8 | 476 | 3.5625 | 4 | [] | no_license | """
korzystajac z funkcji round postaraj sie zmodyfikowac ponizszy kod tak aby wynikiem byla prawda
0.1 + 0.1 + 0.1 = 0.3
"""
wynik = 0.1 + 0.1 + 0.1
wynik = round(wynik,1)
print(wynik)
print(wynik == 0.3 )
# zmiana formatu zmiennej
# wywolywanie funkcji zawsze z nawiasammi (),
#mozna wypluc sama funkcje bez nawiaso... | true |
bf3455c8542b27563f1e115da615eae1bb429546 | jsadiga/dev-sprint3 | /chap8.py | UTF-8 | 365 | 3.171875 | 3 | [] | no_license | # This is where the answers to Chapter 8 questions for the BSS Dev RampUp go
# Name:shishira
def rotate_word(word,num):
newword=''
for char in word:
n=ord(char)
newn=n+num
if newn>122:
newn=96+(newn-122)
char1=chr(newn)
newword=newword+char1
else:
char1=chr(newn)
newword=newword+char1
return ... | true |
20c779157afce76cb1f80e884769fb4cdb0497f6 | ps2196/IdealnaOfensywa | /search.py | UTF-8 | 4,973 | 3.046875 | 3 | [] | no_license | # DB imodules
import trio_stat
import sqlite3
# Search modules
import random
import numpy
from deap import base
from deap import creator
from deap import tools
from deap import algorithms
DB_PATH = 'input/trios.sqlite'
conn = sqlite3.connect(DB_PATH)
curs = conn.cursor() # cursor for executing SQL queries
OVERALL_LIM... | true |
7029a2072bf8a545d6c2f4a722672a3dd1083a58 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_4/estomagordo/quali-fractiles.py | UTF-8 | 292 | 2.671875 | 3 | [] | no_license | fin = open("D-small-attempt0.in", "r")
fout = open("output.txt", "w")
t = int(fin.readline())
for case in xrange(1,t+1):
k,c,s = map(int, fin.readline().split())
lb = "" if case == t else "\n"
fout.write("Case #" + str(case) + ": " + " ".join([str(i) for i in xrange(1,s+1)]) + lb) | true |
4b492ee61f349d499d727bc12669ede991bbea0e | jasmine-dragons/HAX121 | /P074_03.py | UTF-8 | 530 | 3.46875 | 3 | [] | no_license | # HAX 121 2020 Python (3.6.0) Submission Template
# Please fill out the info fields below for identification
# Do not modify any part of the template
# Team Name: LeadTech
# Team Number: P074
# Problem Number: 3
import array
import math
import re
import string
# Class and function definitions:
def relprime():
i... | true |
e4631e04f4f00ad98cbfd0ee8256b17622c29828 | hy299792458/LeetCode | /python/630-courseSchedule.py | UTF-8 | 332 | 2.78125 | 3 | [] | no_license | class Solution(object):
def scheduleCourse(self, courses):
courses.sort(key = lambda x: x[1])
taken = []
end = 0
for c in courses:
end += c[0]
heapq.heappush(taken, -c[0])
while end > c[1]:
end += heapq.heappop(taken)
return... | true |
9037f391b065372340097e65b5b205cc936781a7 | guoheng/ProjectEulerPy | /p029.py | UTF-8 | 771 | 3.765625 | 4 | [] | no_license | # This Python file uses the following encoding: utf-8
#Consider all integer combinations of ab for 2 <= a <= 5 and 2 <= b <= 5:
#
# 22=4, 23=8, 24=16, 25=32
# 32=9, 33=27, 34=81, 35=243
# 42=16, 43=64, 44=256, 45=1024
# 52=25, 53=125, 54=625, 55=3125
#
#If they are then placed in numerical order, with any ... | true |
d793cfa68907d4cbe206915b428ffaf59610ed64 | zhaoxj0217/captcha-classify | /knn.py | UTF-8 | 3,707 | 2.65625 | 3 | [] | no_license | from PIL import Image
import numpy as np
import os
import captchaUtil as capt
#knn分类算法 此处使用欧式距离公式
#inX :待分类向量
#dataSet:训练集合
#labels:训练集合对应的分类结果
#k值
def classify(inX, dataSet, labels, k):
# 距离计算 start,
dataSetSize = dataSet.shape[0]# 计算有多少个训练样本
tmp = np.tile(inX, (dataSetSize, 1))# 将待分类的输入向量进行 行反向复制dataSetS... | true |
8a0ab2c7937728907bd71a9cc9589ce73e6ee342 | wzz482436/1807-2 | /18day/06-贪婪和非贪婪模式缩短并提取网址.py | UTF-8 | 294 | 2.59375 | 3 | [] | no_license | import re
url = "https://rpic.douyucdn.cn/appCovers/2016/11/13/1213973_201611131917_small.jpg,https://rpic.douyucdn.cn/appCovers/2016/11/13/1213973_201611131917_small.jpg"
#print(re.search(r"https://.+\.jpg",url))
print(re.search(r"https://.+?\.jpg",url)) #加?把贪婪模式变成非贪婪
| true |
18845bfd269e76ecc906fd3336d30a36b18b669d | otverskoj/Coursera_Python | /Week 6/making_archive.py | UTF-8 | 315 | 3.265625 | 3 | [] | no_license | s, n = tuple(map(int, input().split()))
users_data = []
for i in range(n):
users_data.append(int(input()))
users_data.sort()
data_sum, counter = 0, 0
for data in users_data:
curr_sum = data_sum + data
if curr_sum < s:
data_sum += data
counter += 1
else:
break
print(counter)
| true |
ef9a2c3054f1f83ed3261f53bfd2293e27906008 | CWMe/Python_2018 | /Python_Learn_Night/Python_Numbers.py | UTF-8 | 484 | 4.0625 | 4 | [] | no_license | # Single-line comments in Python start with "#"
# Python supports integers, floats, and complex numbers:
large_number = (2**100)
print(large_number)
print(59/37)
complex_num = 3 + 5j
# We can find the Type of an object using the builtin type() function
print(type(large_number))
# Conversion to other data types:
# ... | true |
3679bfd768c7d2441b266e4a62aa09e50bdcfae4 | rosenbrockc/fortpy | /fortpy/testing/comparer.py | UTF-8 | 28,954 | 2.703125 | 3 | [
"MIT"
] | permissive | from .. import msg
import xml.etree.ElementTree as ET
import re
import os
from .results import CompareResult, BodyResult, BlockResult, CompatibilityResult, ListResult
from .templates import FileTemplate, LineGroup
class FileRepresentation(object):
"""The python-valued representation of a templated file.
:arg ... | true |
2fe8921fcdc1216ff873571378bab21eb9934061 | iocbio/iocbio | /iocbio/ops/convolution.py | UTF-8 | 2,042 | 3.234375 | 3 | [] | no_license | """Provides convolve function.
Example
-------
The following example illustrates how to convolve data with a kernel::
from numpy import *
from scipy.stats import poisson
from iocbio.ops import convolve
kernel = array([0,1,2,2,2,1,0])
x = arange(0,2*pi,0.1)
data = 50+7*sin(x)+5*sin(2*x)
data_with_noise ... | true |
b87e23cbf2cdd03b5b6b560f7e6037a80cf50bba | machinelearning2/sql | /arithmetic.py | UTF-8 | 414 | 4.28125 | 4 | [] | no_license | print("1 + 1 =", 1 + 1)
print("2 * (2 + 3) =", 2 * (2+3))
print("1.2 / 0.3 =", 1.2 / 0.3)
print("5 / 2 =", 5 / 2)
base = input("Enter a base:")
exponent = input("Enter an exponent:")
print(base, "to the power", exponent, "=", int(base)**int(exponent))
def cube(num):
result = num**3
return result
print(cube(... | true |
ce1e5639ac79517120956fbeac89f3f493d5734e | bleist88/System | /Vault/mc3_select.py | UTF-8 | 2,907 | 3 | 3 | [] | no_license | #!/usr/local/bin/python3
"""
A subscript of mc3 to select a sample of a catalog based on specified criteria.
"""
from AstroLib import *
################################################################################
def mc3_select( args ):
## Parser.
Parser = Io.ArgParser( args )
Parser.add_argumen... | true |
28c47b6c9994a2903eddc136f262e3c8036baf1c | AnubhavRawat21/Python_Programs_And_Learnings | /StringPrograms/RearrangeToPalindromeString.py | UTF-8 | 149 | 2.84375 | 3 | [] | no_license | # Check if Input String Can be re-arranged as Palindrome
# Program to check if characters of the given string can be re-arranged to form a Palindrome | true |
6d92d9bb5b09f9ca56e1b6e118305637f274a7ea | nite-crawler/Python_Practice | /strings/FIzzBuzz.py | UTF-8 | 1,024 | 4.46875 | 4 | [] | no_license | #Python Interview Question FizzBuzz. Write a program that prints the numbers from 1 to 20.
# But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.
# For numbers which are multiples of both three and five print “FizzBuzz”
#ONLY one return statement
#option 1: this ret... | true |
c97f5e9426d9bae2334dd0b3f9b5e1135e526309 | nadiaadhami/python_fizzBuzz | /fizzBuzz.py | UTF-8 | 384 | 4.21875 | 4 | [] | no_license | # fizzBuzz.py
#if a number is a multiple of 3, print Fizz
#if a number is a multiple of 5, print Buzz
#if a number is a multiple of both, print FizzBuzz
import math
for i in range(0,50):
if math.fmod(i, 15) == 0:
print("FizzBuzz")
elif math.fmod(i, 3) == 0:
print("Fizz")
elif math.f... | true |
9524fc53b42b6eb253f6dd15658e25f911837fb2 | xoxo143/pyIEM | /tests/test_util.py | UTF-8 | 9,930 | 2.671875 | 3 | [
"MIT"
] | permissive | """Testing of util."""
# pylint: disable=redefined-outer-name
import datetime
from datetime import timezone
import string
import random
import tempfile
from io import BytesIO
from collections import OrderedDict
import mock
import pytest
import numpy as np
import psycopg2
from pyiem import util
from pyiem.exceptions im... | true |
c9edd8e6344464672336f35f5b22822b4eddbd2e | tamva/vouros_agents | /Node.py | UTF-8 | 1,045 | 3.359375 | 3 | [] | no_license |
class Node():
"""A node class for A* Pathfinding"""
def __init__(self, parent, state):
self.parent = parent
# 0 <- home
# 1 <- cafe
# 2 <- cinema
# state = [
# (Nick, home, delay, wait),
# (Ann, home, delay, wait),
... | true |
ee62e0589fb8f787552a52196712a0c2d777bee3 | bluesam/my_assistant | /my_assistant.py | UTF-8 | 6,156 | 2.859375 | 3 | [] | no_license | from datetime import datetime
import time
import threading
import os
current_focus = []
times_postponed = 0
break_time = False
break_interval = 30
break_duration = 1
rest_time = 23 #works on few values because I am lazy
theme_script_path = "/home/sam/Coding/theme_script.sh"
light_wallpaper_path = "shotwell //usr/sha... | true |
2efe90be34a20c834d4e30cf45bcebbe1f521a33 | Ananyagiri/quiz-application | /superuser.py | UTF-8 | 2,556 | 3.109375 | 3 | [] | no_license | class admin:
def __init__(self):
self.lv=None
self.l1=[]
self.l2=[]
self.l3=[]
self.a1=[]
self.a2=[]
self.a3=[]
self.dict_easy={}
self.dict_intermidiate={}
self.dict_difficult={}
self.l=None
self.a=None
self.score=0
def set_qs(self):
print('Please choose the difficult... | true |
36f8c7e4d33d5e25265bb03be1f4dfa864c96905 | codekansas/icm-2016-topic-modeling | /semantics.py | UTF-8 | 823 | 2.515625 | 3 | [] | no_license | from db_manager import *
import word2vec
SQL_DB = 'sqlite:///clean_chronicling_america.sqlite'
WORDS_FILE = 'docs'
PHRASES_FILE = 'docs-phrases'
BIN_FILE = 'docs.bin'
CLUSTER_FILE = 'docs-clusters.txt'
def dump_text():
session = connect(SQL_DB)
r = session.execute('select ocr_eng from articles')
with op... | true |
3b2d10ed04b84c25bdb31d889abf2ea78e1256be | tbaud44/bets1 | /Blogabet/Controleur/TipsManager.py | UTF-8 | 15,157 | 2.625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
'''
Created on 17 mai 2017
@author: Thierry BAUDOUIN
classe permettant la gestion de la bibliotheque video representees par des bande annonce, pub et animation Beaulieu
gere la persistance des informations avec la couche modele
'''
from datetime import date
import datetime
import pic... | true |
91eacd02c0a8bcf6be18465365a4f0cc43b18323 | ephindmc/project1 | /tabu.py | UTF-8 | 3,063 | 2.921875 | 3 | [] | no_license | import numpy as np
import pandas as pd
# This is a module for tabulation
def master_tab(pdf, *arg):
def weighted(cc,pdf):
lis = []
for i in cc:
lis.append(pdf['V005'][i])
return (sum(lis)/1000000)
def single_tab(pdf, col):
pdf = pdf[pdf[col].notna()]
... | true |
1cc0631ba23cd5356c435285a7b9945839e2b81b | jnslmk/CryptoBot | /app/model/add_midx_to_features.py | UTF-8 | 3,362 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #Can add midx to features dump, and then can use that in strategy.py for testing/creating a model from that
#python add_midx_to_features.py ../data/data_live.tsv
from math import log
import sys
import pandas as pd
from datetime import datetime
import multiprocessing
mids_to_add = [0, 2.5, 5, 7.5, 10, 12.5, 15, 17.5, 2... | true |
0f40ca05ed5907c975410b1c5ec27634704898a4 | achamorr/wallbreakers | /Week1_Basics_of_Coding_and_Math/union_find/friend-circles.py | UTF-8 | 773 | 2.890625 | 3 | [] | no_license | #come back to ,needs work
class Solution:
def findCircleNum(self, M: List[List[int]]) -> int:
groups = list()
candidates = list()
for i in range(len(M)):
for j in range(i+1): #only look through half
if M[i][j] == 1:
candidates.append([i,j])
... | true |
d444ad49b483732320b225765bfd9adaac99d866 | mcanacar/uptime-test | /cogs/ping.py | UTF-8 | 914 | 3.21875 | 3 | [
"MIT"
] | permissive | from discord.ext import commands
from ping3 import ping
import asyncio
class Ping(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(brief="Pings an address - ping <address> [pings]")
async def ping(self, ctx, address: str, pings: int = 1):
"""
:param ctx:
... | true |
b930eebaebfe74ef8195284fd62058e07dc5871b | guruLaaz/csep590_finalProject | /standard/ordered.py | UTF-8 | 1,386 | 3.296875 | 3 | [] | no_license | from player import Player
from strategy import RoundBasedStrategy
class Ordered(RoundBasedStrategy):
"""
Picks the best fowards, then best defensemen, then best goaltenders available
"""
def __init__(self, *args, **kwargs):
super(Ordered, self).__init__(*args, **kwargs)
def p... | true |
8f3ed94e8a138b46edf36f438ad00584c991f91b | ltngoctran/Auto-Encoding_Variational_Bayes | /AE.py | UTF-8 | 10,656 | 2.53125 | 3 | [] | no_license | import imageio
import matplotlib.pyplot as plt
import numpy as np
import PIL
import tensorflow as tf
# import tensorflow_probability as tfp
import time
import os
import argparse
from tensorflow.keras.layers import Input, Activation, Dropout, Dense, InputLayer, Conv2D, Flatten, Dense, Lambda, Reshape, Conv2DTranspose
fr... | true |
e9ed76fae1d7643fb65c1774e7252411cdbb89ff | pskim219/dojang | /ex0807.py | UTF-8 | 168 | 3.421875 | 3 | [] | no_license | # 코드 8-7 여러 개의 값을 임의로 선택하는 코드
import random
animals = ['체셔고양이', '오리', '도도새']
print(random.sample(animals, 2))
| true |
3452c6587af1b905d9c24c77c2a3006631fdc43f | abhigupta4/Competitive-Coding | /Codechef/JUNE16/FRJUMP.py | UTF-8 | 1,702 | 2.796875 | 3 | [] | no_license | import math
mod1 = 10**9 + 7
def cons_tree(low,high,pos,seg,list1):
if (low == high):
seg[pos][0] = list1[low]
seg[pos][1] = str(list1[low])
return
mid = (low + high)/2
cons_tree(low,mid,2*pos + 1,seg,list1)
cons_tree(mid+1,high,2*pos + 2,seg,list1)
seg[pos][0] = (seg[2*pos + 1][0]*seg[2*pos + 2][0])%mod1
s... | true |
c4ea1ad0bd39ff79e704ffb5d6608653ce2ceb05 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/anagram/a8256fe2a0f5496a81e4a4b750616adf.py | UTF-8 | 425 | 3.484375 | 3 | [] | no_license | def detect_anagrams(word, given_list):
results = []
for item in given_list:
if anagram_check(word, item) == 0:
results.append(item)
return results
def anagram_check(orig_word, new_word):
if orig_word.lower() == new_word.lower():
return -1
return cmp([x for x ... | true |
40763f0376f41e511f57787d49d1b478367bfdfd | oreo0701/openbigdata | /01_jumptopy/chap05/test04.py | UTF-8 | 574 | 3.78125 | 4 | [] | no_license | def sum(num1,num2):
sum=num1+num2
return sum
num1, num2 = (input("안녕하세요. 두 수를 입력하세요.(종료: 프로그램 종료): ")).split()
if type(num1) != int:
print(f"죄송합니다. 첫번째(또는 두번째) 입력이 {num1}입니다. 숫자를 입력하세요.")
elif type(num2) != int:
try:
sum()
except:
num1, num2 = (input("안녕하세요. 두 수를 입력하세요.(종료: 프로그램 종료): ")).split()... | true |
db7044672b19c9bad7031bcfafaded1e0a4cdb17 | amanrocks11/finleapconnectAPI | /API_methods.py | UTF-8 | 597 | 3 | 3 | [] | no_license | import requests
import json
def list_users(api_url):
"""
:param page_number:
:return:
"""
try:
return requests.get(api_url)
except Exception as e:
print('API GET request failed with following error: '+str(e))
def create_user(api_url, name, job):
try:
data = {"nam... | true |
1af1cf7e3f9595992f0c94310c7283dd0b922a4a | hy9125/somthingtry | /example_1.1_1.py | UTF-8 | 1,214 | 3.75 | 4 | [] | no_license | # coding:utf-8
'''
一摞有序的纸牌
'''
import collections
# 构造一个简单的类来表示纸牌
Card = collections.namedtuple('Card', ['rank', 'suit'])
# namedtuple 构造只有少数属性但是没有方法的对象
class FrenchDeck:
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamods clubs hearts'.split()
def __init__(self):
self.... | true |
6ca173c3e2dda296251d483d8b3cffa732db5ebe | a-recknagel/AoC18 | /src/AoC18/day_15.py | UTF-8 | 4,989 | 3.21875 | 3 | [] | no_license | from copy import deepcopy
from typing import List, Optional, Tuple
from AoC18 import read_data
test_1 = '''\
#########
#G..G..G#
#.......#
#.......#
#G..E..G#
#.......#
#.......#
#G..G..G#
#########'''.split('\n')
test_2 = '''\
#######
#.G...#
#...EG#
#.#.#G#
#..G#E#
#.....#
#######'''.split('\n')
class GameEndExce... | true |
ca589b819e6ed094d1b2cf5ea65cffc198a35753 | ywang40/.py | /homework5.p5.py | UTF-8 | 497 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 27 17:04:16 2017
@author: ywang40
"""
import numpy as np
l1 = 1.4e-10 # m, the length of ethylene moecule
l2 = 1.4e-10*3 # m, the length of butadiene molecule
hbar = 1.05457e-34 # J*s
me = 9.109e-31 # kg
NA = 6.022e23 # /mol
def E(n,l):
retur... | true |
5adee16d97d8e469ce7fa811a7f4b3b6adb8f639 | PolinaZulik/Grammarly-test | /Polina_test.py | UTF-8 | 1,230 | 2.65625 | 3 | [] | no_license | import urllib2
from xml.dom import minidom
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'IE')]
urllib2.install_opener(opener)
adr = 'http://en.wiktionary.org/wiki/Category:English_uncountable_nouns'
f = urllib2.urlopen(adr)
t = f.read()
f.close()
def getData(link):
f = urllib2.urlope... | true |
d6a28a5760a65e397fa4c742dc365d5b097cb0e2 | tdeboissiere/tsfresh | /tests/utilities/test_dataframe_functions.py | UTF-8 | 13,391 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
from unittest import TestCase
import pandas as pd
from tsfresh.utilities import dataframe_functions
import numpy as np
im... | true |
5dd5205542b7ca1cb979679143830071b5884a01 | Amd794/Checkupdate | /SendEmail.py | UTF-8 | 4,925 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Time : 2019/4/25 21:32
# Author : Amd794
# Email : 2952277346@qq.com
# Github : https://github.com/Amd794
import os
# 发送邮件
import smtplib
import time
# TODO 导入构造邮件模块
import traceback
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from e... | true |
7848127f01ab8274360f9902334b6e20a38631eb | sjandro/Python_Projects | /simple_text_editor.py | UTF-8 | 917 | 3.734375 | 4 | [] | no_license | # 1.append(W) - Append string W to the end of .
# 2.delete(k) - Delete the last k characters of .
# 3.print(k) - Print the kth character of .
# 4.undo() - Undo the last (not previously undone) operation of type 1 or 2, reverting S to the state it was in prior to that operation.
def process_query(S, option, entry=None)... | true |
e8689c3156eb809ee2519a0af3992fbc75b12027 | adriannajankowska/Spectrogram | /MainWindowPresenter.py | UTF-8 | 1,021 | 2.515625 | 3 | [] | no_license | from scipy import signal
import numpy as np
import RawDataPlot
import SoundData
class MainWindowPresenter:
def __init__(self, view):
self.view = view
self.rawData = None
def OpenFile(self, filename):
sd = SoundData.SoundData()
sd.Load(filename)
if len(sd.... | true |
944432897badab84db44cf47e53855aa32e56f41 | tpbadger/Project-Euler | /q5.py | UTF-8 | 350 | 3.6875 | 4 | [] | no_license | '''
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
'''
import math
num = 20
for divisor in range(1 , 20 + 1):
num *= divisor // math.gcd(divisor, num) ... | true |
1e74d4ad554667d9a27841fdb8aeaa8f30248ef5 | jorgecuza92/week2 | /Desktop/week2/Azam notes/day1/classes.py | UTF-8 | 1,214 | 3.890625 | 4 | [] | no_license | # Car:
# - model
# - make
# - vin
# - color
# creating a Car class and definining the properties of the class.
class Car:
def __init__(self, make, model):
self.make = make
self.model = model
self.vin = ""
self.color = ""
self.no_of_cylinders = 2
# create an ... | true |
cf7c0cf27f12d190c35aff5d0d08298b92bb74f5 | Sofiamdl/go-go-vaccines | /images/CollectablesAssets.py | UTF-8 | 663 | 2.65625 | 3 | [] | no_license | import os
import pygame
class CollectablesAssets:
HEART = os.path.join('assets', 'collectables', 'heart.png')
GREY_HEART = os.path.join('assets', 'collectables', 'heart-grey.png')
VACCINE = os.path.join('assets', 'collectables', 'vaccine.png')
def __init__(self):
self.__heart = pygame.image.... | true |
0243bb8843c6aca8e7ad6561ceeaf17ed3e8860a | ykk648/huawei-code-craft-2018 | /tool_lib.py | UTF-8 | 7,760 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import datetime
class Tool():
@classmethod
def mean(cls, array):
return float(sum(array)) / len(array)
@classmethod
def mid(cls, array):
return sorted(array)[len(array) // 2]
@classmethod
def zeros(cls, num):
retu... | true |
138982111deb3ba53f1ddca6318e1bce24ca7fc0 | ketanch/IITKBucks | /IITKBucks-Assignments/Assignment 5/ass5.py | UTF-8 | 635 | 2.8125 | 3 | [] | no_license | import block
import time
index = int(input("Enter index of block: "))
parent_hash = input("Enter parent hash: ")
target = input("Enter target: ")
body_file = input("Input block body file: ")
data = open(body_file,'rb').read()
body = block.BlockBodyMake(inps = [],body = data)
header = block.BlockHeaderMake(index, pare... | true |
9a6317a1d8c041b98afe197f40e0672c4d041207 | salvador-dali/algorithms_math | /training/04_summations-and-algebra/01_stepping-stones-game.py | UTF-8 | 596 | 3.796875 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/stepping-stones-game
# check potential candidates by solving the equation and taking integer value then checking
# values close to potential value and if some of them correctly works, then return it's value
def stepping(res):
attempt = int((2 * res) ** 0.5)
for i in [-1,... | true |
bbb1d5dd8afc3de7d5a64df161c60aca046deef7 | tfly2013/InfiCloud | /search.py | UTF-8 | 4,236 | 2.765625 | 3 | [] | no_license | """
Team: Cluster and Cloud Computing Team 3
Contents: Assigment 2
Authors: Kimple Ke, Roger Li, Fei Tang, Bofan Jin, David Ye
"""
import couchdb
from preprocess import *
from argparse import ArgumentParser
from twitter import Twitter, OAuth, TwitterHTTPError
# Tokens that contains the user credentials to access Twit... | true |
b6bc37ea3407d3cdb88f8920ea676dc3ca28a759 | LionHeart-coder/article-web | /posts/tests/test_models.py | UTF-8 | 2,909 | 2.640625 | 3 | [] | no_license | from posts.models import Comment, Post
from posts.tests.test_settings import TestSettings
class PostModelTest(TestSettings):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.post = Post.objects.create(
text='Тестовый тест, который должен работать и будет работать',
... | true |
0d328f641cb7844de36dc1383cd9cf97858bac71 | glrs/StackedDAE | /Train_SDAE/tools/data_handler.py | UTF-8 | 11,687 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | """ Data Handler for Allan's Data-set """
import pandas as pd
import os
import gzip
import numpy as np
from os.path import join as pjoin
from config import FLAGS
# TODO: Use Dictionary instead!
TPM = {'filtered':'TPM_common_ready_data.csv', 'ordered':'TPM_ready_data.csv', 'original':'GSE71585_RefSeq_TPM.csv', 'zippe... | true |
0d45a8b72c0a5022c94d3f54f5c8cf8c70c3734d | DOHAN25/Python | /Python_base/regular.py | UHC | 954 | 3.921875 | 4 | [] | no_license | import re
'''
Regualr Expression
. : 1
^ : ڿ
$ : ڿ
[]:
| : or
(): ȣ Խ
* : 0 or more
+ : 1 or more
? : 0 or 1
{n} : n ݺ
{n, m}: n m
{n, } : n Ѵ
'''
"""
r ڿ ǥ(re Ȯ )
\w : [a-zA-z0-9_] -> a~Z, 0~9 _ϴ
\W : [^a-zA-Z0-9_\ ->
\d : [0-9] -> 0~9
\D : [^0-9] -> ڸ
\s : [\t\n\r\f\v] -> 鹮
\S : [^\t\n\r\f... | true |
952a92d27017877fbc58a9b63cd21b843dd7fb03 | boehis/NeuralNetwork | /fast_net_test/mnist_own_images.py | UTF-8 | 1,435 | 2.953125 | 3 | [] | no_license | import glob
import imageio
import numpy
from fast_net_test.mnist_helper import get_trained_network_full
def datasets_from_inputimages():
dataset = []
for image_file_name in glob.glob('../datasets/inputimages/?.png'):
print("loading ... ", image_file_name)
# use the filename to set the correc... | true |
6c3d95a6e12969833fc97f4268ef427be2a63d9c | pdabade/LearnPython | /oop_simpleclass.py | UTF-8 | 247 | 3.5625 | 4 | [] | no_license | class Person:
def __init__(self,name):
self.name = name
def say_hi(self):
print 'Hi '+ self.name +', how are you?'
def say_hello(self):
print 'Hello '+ self.name +', how are you?'
p = Person('Pooja')
p.say_hi()
p.say_hello()
#print p
| true |
1e273f53a58f11c365680cd102c51d6eef461efd | selvaguru-ai/Languange-identifier-on-Music | /Spotting_service.py | UTF-8 | 3,096 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 4 20:02:26 2020
@author: Selva
"""
import tensorflow.keras as keras
import librosa
import numpy as np
import math
MODEL_PATH = 'f:\\DataSet\model.h5'
NUM_SAMPLES_TO_CONSIDER = 22050 # for 1 second
DURATION = 30 #seconds
SAMPLES_PER_TRACK = NUM_SAMPLES_TO_... | true |
2089fa4b427a9eb6e20f6818ac235b22ce6f697d | ESSS/alfasim-sdk | /tests/plugins/test_variables.py | UTF-8 | 2,392 | 2.640625 | 3 | [
"MIT"
] | permissive | import pytest
@pytest.mark.parametrize(
"attr, expected_type_error, expected_message",
[
(dict(name=""), ValueError, 'The field "name" cannot be empty'),
(dict(caption=""), ValueError, 'The field "caption" cannot be empty'),
(dict(unit="foo"), ValueError, "foo is not a valid unit"),
... | true |
024a8d80c35644312c25364f519cacfdb62bb6df | GiggleLiu/QuRBM | /utils.py | UTF-8 | 1,753 | 2.53125 | 3 | [
"MIT"
] | permissive | '''
Utilities.
'''
from numpy import *
import pdb
from setting import hyper_func
__all__=['load_carleo_wf','log2cosh','log2sinh','logfh']
def load_carleo_wf(filename,group=None):
'''Load wavefunction of carleo's program.'''
with open(filename,'r') as f:
fl=f.readlines()
nv=int(fl[0].strip('\n'))... | true |
30382a90be512aa7514adbf560c15be2e46234f2 | cynthiaMoon11/MasterPython | /06-bucles/bucle-while.py | UTF-8 | 737 | 4.3125 | 4 | [] | no_license | """
Bucle whie
estructura de control que itera una serie de instrucciones tantas veces
como sea necesario hara que deje de cumplirse la condición
"""
contador=1
while contador <=100:
print(f"Estoy en el número {contador}")
contador+=1
print("__________________________________________________")
contador=1
mu... | true |
9c549052c33b95b30d35432f4a4d8f87524278af | Beduardo56/store_scrapper | /store_scrapper/shopping_scrapper/shopping_vitoria/scrapper.py | UTF-8 | 1,125 | 2.796875 | 3 | [] | no_license | from selenium import webdriver
import pandas as pd
from time import sleep
from store_scrapper.shopping_scrapper.base import BaseShoppingScrapper
class ShoppingVitoria(BaseShoppingScrapper):
def __init__(self):
super().__init__('shopping vitoria', 'https://www.shoppingvitoria.com.br/lojas')
def run(sel... | true |
becae611055a63b9bb62730a59e07f1621838e5e | KarolC92/python_zadania_domowe_4 | /zadanie_5_1_2.py | UTF-8 | 305 | 3.3125 | 3 | [] | no_license | with open('baza_danych/zawodnicy.csv', 'r', encoding='UTF-8') as file:
country = input('Country: ')
sum_of_weight = sum([int(x[5]) for x in list(filter(lambda x: x[2] == country, [x.split(';') for x in file.readlines()]))])
print(f'Sum weights of {country} representatives = {sum_of_weight}')
| true |
6169351540d82fac7313872883811b670febc257 | AlgorithmLibrary/Basic-Data-Structures | /UniversalHashTableSearch.py | UTF-8 | 1,708 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 13:56:37 2020
@author: Grant
"""
import random
ips = ["112.15.6.55", "212.156.61.32", "136.111.63.121", "112.15.6.23", "52.151.62.48", "182.11.68.79", "212.156.61.111", "136.111.63.38", "91.115.61.121", "136.111.78.121", "52.151.62.71", "152.15.62.48"]
de... | true |
65b8f1448573c73222e8ea7e593752b60269b48a | raviguru123/google-python | /string1.py | UTF-8 | 1,240 | 3.875 | 4 | [] | no_license | #this is first function for returning number of donuts;
def donuts(count):
value="Number of donuts:";
if(count<10):
value+=' '+str(count);
else:
value+=' many';
return value;
#print donuts(10);
#print donuts(9);
#this is second exercise for returning both end string;
def both_ends(str)... | true |
c1a1c8a8b21362e1e06841dacb97fb90481d43dd | uniyalabhishek/LeetCode-Solutions | /Python/1450. NumberOfStudentsDoingHomeworkAtAGivenTime.py | UTF-8 | 1,516 | 3.890625 | 4 | [
"MIT"
] | permissive | '''
1450. Number of Students Doing Homework at a Given Time
Problem Link :https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time/
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished ... | true |
431aa386d7175f58b9b718363eef8986c93501c1 | lani009/BOJ | /codeUp/python/1288.py | UTF-8 | 220 | 3.484375 | 3 | [] | no_license | def factorial(n):
if(n == 1):
return 1
return n * factorial(n - 1)
n, r = input().split(' ')
if(n == r):
print(1)
else:
print(factorial(int(n)) // factorial(int(r)) // factorial(int(n) - int(r))) | true |
6f989b239e41ef5954e75034b9570b43318ff78a | fabien-vavrand/kaggle-riiid | /riiid/saint/layers.py | UTF-8 | 14,808 | 2.671875 | 3 | [
"MIT"
] | permissive | import logging
import numpy as np
import tensorflow as tf
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(d_model))
return pos * angle_rates
def positional_encoding(position, d_model):
angle_rads = get_angles(np.arange(position)[:, np.newaxis], np.arange(d_... | true |
79b4a50cb7c2e67833fb3b3b3b0ee33192b80d8e | YR1044/Picture-to-line-draft | /Python版/二次元图像线稿化.py | UTF-8 | 1,904 | 2.875 | 3 | [] | no_license | import os
import numpy as np
from PIL import Image
def ctrl_lim(num):
#控制输入的数范围在0~255
if num < 0:
return 0
if num > 255:
return 255
return num
def convolve(raw_matrix, new_matrix, kernel):
kernel_height = kernel.shape[0]
kernel_width = kernel.shape[1]
pictur... | true |
8749ecaea715e8564c85ca3d519834c7a854ad8c | lilsweetcaligula/sandbox-codewars | /solutions/python/297.py | UTF-8 | 140 | 2.734375 | 3 | [] | no_license | pattern = (lambda n:
'\n'.join(
''.join(str(digit) for digit in range(start, n + 1))
for start in range(1, n + 1))) | true |
ed3ca589105cf89127b695a9111c4e20cfdf0790 | cvbuchem/numerical_recipes | /a1/old/nr4_1.py | UTF-8 | 310 | 3.421875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
N = 1e6
def xsquared_sinx(x):
return x**2*np.sin(x)
#1.a
#Calculate the analytical derivative of this function and plot the function in the range 0,2pi
x = np.linspace(0,2*np.pi,10000)
plt.plot(x,2*x*np.sin(x)+(x**2)*np.cos(x))
plt.show()
#1.b
#
| true |
013fc77a1639db739a656265dfe6ab4940a7fb9d | daniel-reich/ubiquitous-fiesta | /hD8vgeNkjXy5trX6h_18.py | UTF-8 | 144 | 3.140625 | 3 | [] | no_license |
import itertools
def combo(lst, n):
mylist = []
for comb in itertools.combinations(lst, n):
mylist.append(list(comb))
return mylist
| true |
fb1cf11cd5423c6430354b3927cfef709fb79831 | shektor/how-to-pytest | /primes/primes_test.py | UTF-8 | 574 | 3.671875 | 4 | [] | no_license | import pytest
from primes import is_prime
from primes import sum_of_primes
@pytest.mark.parametrize('number,result', [
(1, False),
(4, False),
(15, False),
(29, True),
(83, True),
])
def test_is_prime(number, result):
assert is_prime(number) == result
def test_sum_of_primes_empty_list():
... | true |
adea10160b97f3a502bb3ea1dda7649679749905 | egor-kuzin/-yandex-algorithm-trainings-2.0 | /Дивизион В. ДЗ2/D - Лавочки в атриуме.py | UTF-8 | 515 | 2.875 | 3 | [] | no_license | plate = list(map(int, input().split()))
blocks = list(map(int, input().split()))
medium = plate[0] / 2
my_dict = {x: (- medium + x + 0.5) for x in blocks}
if plate[0] % 2 != 0 and int(medium - 0.5) in blocks:
print(int(medium - 0.5))
else:
left = dict(filter(lambda x: x[1] < 0, my_dict.items()))
... | true |
c93ac77931bd811adf98ca9b267b1c597553d4fa | avinash-nonholonomy/hack_diversity_office_hours | /archive/hash_tables_python/q2_permutation.py | UTF-8 | 1,695 | 4.59375 | 5 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Given two strings “s” and “t” , write a function to determine if “t” is a
permutation of “s”. A permutation is a rearrangement of letters.
Input: s = "anagram", t = "nagaram"
Output: true
Input: s = "rat", t = "car"
Output: false
"""
def build_dictionary(words):
# create an empty dict (h... | true |
84578042435f0f5a2153b40b821fd8856eeb1fb2 | Kevinrobot34/atcoder | /abc/abc_042_125/abc071/b.py | UTF-8 | 187 | 3.078125 | 3 | [] | no_license | from string import ascii_lowercase
s = input()
d = set([s[i] for i in range(len(s))])
ans = "None"
for c in ascii_lowercase:
if c not in d:
ans = c
break
print(ans)
| true |
e7460d54d49752caab138358b3cf78e4a161ddbc | thekingmass/OldPythonPrograms | /floatseries.py | UTF-8 | 250 | 2.984375 | 3 | [] | no_license | C=0
def generateNext(d,num):
C=float(input("Please input the starting for your series\n"))
s=float(input("Please input the d for your series\n"))
print ("The series produced by this method is")
for i in range(1,11):
print(generateNext(s,C))
| true |
255b99522ee07f88a72bb6d627db4f670882fae0 | Hironobu-Kawaguchi/atcoder | /atcoder/abc200_d.py | UTF-8 | 912 | 2.953125 | 3 | [] | no_license | # https://atcoder.jp/contests/abc200/tasks/abc200_d
n = int(input())
a = list(map(int, (input().split())))
b, c = [], []
dp = [[] for _ in range(200)]
for i in range(n):
a[i] %= 200
for j in range(200):
if len(dp[j])==0: continue
if dp[j][-1]==i+1: continue
next = (j + a[i])%200
... | true |
28ed2936db7c503b32d4dc92f320eb2201a6949e | TomasBeranek/but-ipp-project | /interpret.py | UTF-8 | 36,102 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# ******************************* interpret.py *****************************
# Course: Principles of Programming languages (IPP) - FIT BUT
# Project name: IPPcode20 code interpreter in Python
# Author: Beranek Tomas (xberan46)
# Date: 7.4.2020
# *****************************************... | true |
54e2e63eaada7f872d8665d924b03df4ed9948c6 | nyghtowl/Code_Name_Jeeves | /app/common.py | UTF-8 | 4,336 | 2.671875 | 3 | [] | no_license | '''
Common Project Methods
'''
from config import TEST_GMAIL_ID, TEST_GMAIL_PWD, TEST_GMAIL_ID_3, TEST_GMAIL_PWD_3, connect_db, pkl_dir
from sklearn.cross_validation import train_test_split
import numpy as np
import pandas
import datetime
import gmail
import re
import os
import cPickle # same as pickle but faster an... | true |
d0ff0b3b1ec24b7fe8a0a146077971285cf978f6 | uncleheart/PublicFunction | /python/NormalLibrary/deocdeLua.py | UTF-8 | 1,095 | 2.671875 | 3 | [] | no_license | # coding:utf-8
import re
import os
def Tran2Str(src):
res = ''
for i in src.split("\\"):
if len(i) > 0:
res += chr(int(i))
return res
def ReplaceAllStr(src):
p = re.compile(r'\\(1\d\d|2[01234]\d|25[0123456]|[1-9]\d?)')
return p.sub(lambda m: Tran2Str(m.group(1)), src)
def R... | true |
518623e7fb2fdbe51ec0989dab5d22770c4dfd35 | apljungquist/sprig | /tests/test_dictutils.py | UTF-8 | 404 | 2.65625 | 3 | [
"MIT"
] | permissive | from sprig import dictutils
import pytest
deflated_examples = [
{"a/i": 11, "a/j": 13, "b/i/x": "17"}, # Arbitrary tree
]
@pytest.mark.parametrize("deflated_before", deflated_examples)
def test_deflate_reverses_inflate(deflated_before):
inflated_before = dictutils.inflate(deflated_before)
deflated_afte... | true |
de72f214dfbf21102a2516b3db72cb63a0a40747 | vegeta008/FundamentosP | /Ejercicio10.py | UTF-8 | 480 | 4.46875 | 4 | [] | no_license | # 10.Calcular el área y perímetro de un rectángulo.
class Recatangulo:
def __init__(self,ancho,alto):
self.ancho=ancho
self.alto=alto
def area(self):
area=self.alto*self.ancho
return area
def perimetro(self):
perimetro=(self.alto*2)+(self.ancho*2)
... | true |
e57d84a2e6638d302f6a37c784661116ae8267ed | diegomou/Tweet-classification | /back_NLP.py | UTF-8 | 2,803 | 2.796875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
import functions_NLP as f_NLP
class data_maniputation:
def __init__(self):
self.raw_train = None
self.raw_test = None
self.raw_tweet_train = None
... | true |
b55e39e4f1e96d5a45c71f0d7735aa1c4f423541 | Aasthaengg/IBMdataset | /Python_codes/p02769/s591162236.py | UTF-8 | 808 | 3.0625 | 3 | [] | no_license | import sys
N_MAX = 200000 + 5
sys.setrecursionlimit(N_MAX)
MOD = 10**9 + 7
# ## COMBINATION (MOD) ## #
fac = [1, 1] # 元テーブル
facinv = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N_MAX + 1):
fac.append((fac[-1] * i) % MOD)
inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
facinv.append(... | true |
33f434d87c0614b5d332a270d0f8cc23b257e790 | icml-submission-2211/AMG-pytorch | /layers_sp.py | UTF-8 | 8,073 | 2.859375 | 3 | [] | no_license | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, input_dim, hidden... | true |
ed25506f7811bbeb115e4555aff76295289e7ab6 | yasharne/hackerrank | /between_two_sets.py | UTF-8 | 714 | 3.421875 | 3 | [] | no_license | def get_factor(number, a_arr, b_arr):
for element in a_arr:
if (number % element != 0):
return False
for element in b_arr:
if (element % number != 0):
return False
return True
if __name__ == "__main__":
m, n = input().split(" ")
a_arr = list(map(int, input()... | true |
c361f3ff880ef325b23d5b2c2f870faf52bad792 | gvg4991/TIL | /algorithm/가장큰구간합.py | UTF-8 | 666 | 2.96875 | 3 | [] | no_license | datas = [5,1,-4,2,-1,-5,-2,8,-3,6]
result = [0]*len(datas)
ans = []
cnt = 0
target = 0
for i in datas:
if target >= 0:
target += i
result[cnt] = target
ans.append(i)
else:
result[cnt] = i
target = i
ans = [i]
cnt += 1
print(result)
print(max(result))
print(an... | true |
c952efdadda7c69ad61474f2d8ce85b38a0218c6 | profe-givox/IA-S81 | /media-moda-mediana.py | UTF-8 | 906 | 3.28125 | 3 | [] | no_license | def Media(tot, cant):
med = tot / cant
return med
def Moda(data):
rep = 0
for i in data:
exist = data.count(i)
if exist > rep:
rep = exist
moda = []
for i in data:
exist = data.count(i)
if exist == rep and i notin moda:
moda.append(i)
... | true |
7330a4d7e95be33b6d5a25dc4b98c4dfa6358186 | nyu-compphys-2017/hw1-KaizheW | /Millikan.py | UTF-8 | 727 | 3.125 | 3 | [] | no_license | from pylab import plot,show
from numpy import loadtxt,size,linspace, arange, array
from math import *
data = loadtxt("millikan.txt",float)
x = data[:,0]
y = data[:,1]
N = size(x)
Ex = sum(x)/N
Ey = sum(y)/N
Exx = sum(x**2)/N
Exy = sum(x*y)/N
m = (Exy - Ex * Ey)/(Exx - Ex**2)
c = (Exx * Ey - Ex * Exy)/(Exx - Ex**2)
pri... | true |
447a3e4af8950732f2a99a76ef54918bc32d2ba3 | RideGreg/LintCode | /Python/load-balancer.py | UTF-8 | 1,220 | 3.859375 | 4 | [
"MIT"
] | permissive | '''
Implement a load balancer for web servers. It provide the following functionality:
- Add a new server to the cluster => add(server_id).
- Remove a bad server from the cluster => remove(server_id).
- Pick a server in the cluster randomly with equal probability => pick().
Example
At beginning, the cluster is empty =... | true |
0dc608f364416f684f37bb06271ebbb850cd4b95 | minhkhanh268/python_basic | /buổi 3/BTNV1.py | UTF-8 | 320 | 3.0625 | 3 | [] | no_license | #Bai tap 1: Max and Min
print('**********************************')
print('Bai tap 1: Max_Min')
b=int(input('Nhap 1 so B bat ki: '))
a=[3,4,1,8,23,16,18,98,b]
lon = 0
nho = b
for i in a:
if i < nho:
nho=i
for i in a:
if i > lon:
lon=i
print(lon,' La so Max')
print(nho,' La so Min') | true |