blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
253cfceb918477ab57dff1229e91eeb5fc5ae053 | Python | arshk123/twitter-scraper | /src/db.py | UTF-8 | 472 | 2.75 | 3 | [] | no_license | import psycopg2
import json
""" function to connect to db using credentials specified in config """
def getDBConnection():
with open('../config/config.json') as json_data:
data = json.load(json_data)
data = data['database_credentials']
try:
conn = psycopg2.connect(dbname=data['dbname']... | true |
3af06a38231aaada5f9947a5ce658282de9c5817 | Python | rogeriosilva-ifpi/teaching-tds-course | /programacao_estruturada/20192_186/cap5_condicionais/dojo-condicionais-master/dojo_10_condicional.py | UTF-8 | 580 | 4 | 4 | [] | no_license | # Exercícios by Nick Parlante (CodingBat)
# Troca Letras
# seja uma string s
# se s tiver tamanho <= 1 retorna ela mesma
# caso contrário troca a primeira e última letra
# troca('code') -> 'eodc'
# troca('a') -> 'a'
# troca('ab') -> 'ba'
from Testes import teste, msg_sucesso, msg_inicio
def troca(s):
pass
msg_i... | true |
c8625319dfc76f1ab40104cc25c6c9128eb3141b | Python | ashwin-ramachandran/Sudoku | /sudoku.py | UTF-8 | 3,644 | 3.984375 | 4 | [] | no_license | # A sample board (all boards must be 2D lists)
board = [
[7,8,0,4,0,0,1,2,0],
[6,0,0,0,7,5,0,0,9],
[0,0,0,6,0,1,0,7,8],
[0,0,7,0,4,0,2,6,0],
[0,0,1,0,5,0,9,3,0],
[9,0,4,0,6,0,0,0,5],
[0,7,0,3,0,0,0,1,2],
[1,2,0,0,0,7,4,0,0],
[0,4,9,2,0,6,0,0,7]
]
# Function to print the board, so user may see a b... | true |
665cad7f8b0d4d15209339fba3295631952caadd | Python | Muhodari/python-complete-crash-Course | /P.2D Lists/2dList.py | UTF-8 | 142 | 3.484375 | 3 | [] | no_license | myList = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
print(myList[0][1])
for lists in myList:
for row in lists:
print(row)
| true |
8299556cbe3e5dc43696580f77b9f0df79da58d6 | Python | ItzFrostbite/BMI_Calculator | /BMI_Calculator.py | UTF-8 | 540 | 3.65625 | 4 | [] | no_license | from time import sleep
height = float(input("Enter Height In Inchs: "))
lbs = float(input("Enter Weight In Pounds: "))
BMI = round(lbs / (height * height) * 703, 2)
print("Your BMI Is:", BMI)
if BMI <= 24.9 and BMI >= 18.5:
print("You Are Healthy")
sleep(3)
exit = input("Press Enter To Exit: "... | true |
268a046b8cc41c000f40b1eea70cb5818dde9ce4 | Python | Tianyijian/pytorch-tutorial | /AIChallenger2018/HAN-AI18/data_utils.py | UTF-8 | 11,978 | 2.640625 | 3 | [] | no_license | import torch
from torch import nn
from torch.optim.lr_scheduler import LambdaLR
import numpy as np
from collections import Counter
import jieba
from tqdm import tqdm
import pandas as pd
import itertools
import os
import json
import gensim
import logging
import time
import re
def read_csv(csv_folder, split, sentence_l... | true |
e45fd1c58499e5cb728472c66038afde2097cf92 | Python | nddsg/HDTM | /scripts/article2hlda.py | UTF-8 | 538 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# This program convert raw document-word file to Graphlab's LDA format
import sys
with open(sys.argv[2], "w+") as fout:
with open(sys.argv[1]) as f:
for line in f:
raw_data = [int(x) for x in line.split()]
word_set = dict()
for x in raw_data[1:]:... | true |
6ef44aae11e55be7a2575b65c7aec230f94b6f71 | Python | dba-base/python-homework | /Day05/re模块.py | UTF-8 | 990 | 3.34375 | 3 | [] | no_license | import re
print(re.search('(abc){2}',"abcacabcasdf") )
print(re.search('\A[0-9]+[a-z]+\Z','1234asd')) #1234asd
print(re.search('\A\w+\Z','1234asd')) #同上
print(re.search("(?P<id>[0-9]+)(?P<name>[a-zA-Z]+)","asdfg12345asdf@13").groupdict()) #{'id': '12345', 'name': 'asdf'}
print(re.search("(?P<province>[0-9]{4})(?... | true |
25c16516725c262adea8aa125fd28b7305d2ac4f | Python | zhujixiang1997/6969 | /7月11日/作业02.py | UTF-8 | 392 | 3.921875 | 4 | [] | no_license | '''
2.写一段代码判断一个人的体重是否合格:
公式:(身高-108)*2=体重,可以有10斤左右的浮动
'''
weight = eval(input('请输入体重(单位斤):'))
height = eval(input('请输入身高(单位cm):'))
if (height - 108)*2 >= weight - 10 and (height - 108)*2 <= weight+10:
print('恭喜你的体重合格!')
else:
print('兄dei,不行呀!') | true |
a2b9392b71737c3f064b6f0451b913fdcbc18a3c | Python | tensorflow/datasets | /tensorflow_datasets/text/wsc273/wsc273.py | UTF-8 | 5,676 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
# Copyright 2023 The TensorFlow Datasets Authors.
#
# 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 appl... | true |
68812f8f540cdcfb70f803d3370b799b5172707f | Python | rishavanand/little-python-scripts | /rss_fossbytes.py | UTF-8 | 996 | 3.046875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import json
def get_fossbyte_feed():
"""
Exatracts all news from FossByte's rss feed
including their title, link, date and categories
"""
# Fetch feed
url = 'https://fossbytes.com/feed/'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) G... | true |
eaba0535613dc0a9db671b443dd1e23b8bf8f1d7 | Python | weiyuyan/LeetCode | /剑指offer/面试题9.用两个栈实现队列.py | UTF-8 | 1,216 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:ShidongDu time:2020/3/7
'''
用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,
分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回 -1 )
示例 1:
输入:
["CQueue","appendTail","deleteHead","deleteHead"]
[[],[3],[],[]]
输出:[null,null,3,-1]
示例 2:
输入:
["CQueue","delet... | true |
871edbbcc4e7b1a6b00ad520e588fda59ddef16d | Python | Jeffery12138/Python- | /第5章 if语句/动手试一试/5-4 alien_color2.py | UTF-8 | 173 | 3.625 | 4 | [] | no_license | # alien_color = 'green'
alien_color = 'yellow'
if alien_color == 'green':
print("You will get 5 points for shooting the alien")
else:
print("You will get 10 points") | true |
1d0a01ed93c2cf898989b358d436caa833407c81 | Python | Liubasara/pratice_code | /滑动窗口的最大值.py | UTF-8 | 460 | 3.078125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
def maxInWindows(self, num, size):
# write code here
if size == 0:
return []
if not num:
return None
length = len(num)
return_res = []
for i in range(length-size+1):
res = num[i:i+size]
... | true |
3af79d0f6cbf2843503cf0b6bd9315ce3ac3023c | Python | ericgreveson/projecteuler | /p_050_059/problem57.py | UTF-8 | 495 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | from fractions import Fraction
from digit_tools import num_digits
def main():
"""
Entry point
"""
denom = 2
heavy_num_count = 0
for i in range(1000):
root_2_approx = 1 + Fraction(1, denom)
denom = 2 + Fraction(1, denom)
if num_digits(root_2_approx.numerator) > num_digit... | true |
3f98e8e4d2d2c471807872d4ba516247a7bd2dcd | Python | emanuelgsouza/ping-analyzer | /ping-analyser.py | UTF-8 | 1,022 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 7 12:00:48 2018
@author: emanuel
"""
import pandas as pd
getValuesFromLine = lambda line : line.split(' ')[5:8]
def getValFromColumn(val):
name, val = tuple(val.split('='))
if name in ['icmp_seq', 'ttl']:
val = int(val)
else:... | true |
0f9ebdd6dc2ce6e9a93d82434e8298d9dbac2b5e | Python | adubowski/big-data-ip-hosting | /get_indeces.py | UTF-8 | 2,017 | 2.75 | 3 | [] | no_license | import pickle
import requests
import json
import csv
import time
import multiprocessing as mp
url_list = []
cc = "http://index.commoncrawl.org/CC-MAIN-2020-50-index"
with open("/home/s2017873/top-1m.csv") as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
i = 0
for row in csv_reader:
... | true |
8d44e40f3063d47792ab80f3aa438c3d71a7d3a8 | Python | J-sephB-lt-n/exploring_statistics | /recsys_alg_implementation_code/user_item_networkx.py | UTF-8 | 15,003 | 3 | 3 | [] | no_license | import sys
import networkx as nx
import walker # for generating random walks quickly
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import pandas as pd
## simulate user/item data ## ---------------------------------------------------------------------
sys.path.append("..")
from recsys_simul... | true |
782f5962dfda8f524238ce26871a3097eaeed567 | Python | larsga/fhdb | /reports/chartlib.py | UTF-8 | 851 | 3.125 | 3 | [] | no_license |
from PIL import Image
def combine_charts(images, per_row, filename):
'''images: file names as strings
per_row: number of images per row
filename: output filename'''
images = [Image.open(image) for image in images]
widths, heights = zip(*(i.size for i in images))
width = int(max(widths)) * pe... | true |
e24e089bf5383c13adb42e098888735336ab7c9d | Python | xkjyeah/MRT-and-LRT-Stations | /pull_bus_stops2.py | UTF-8 | 2,284 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import onemap
import urllib
import httplib2
import json
import gzip
import cPickle
import re
import pandas as pd
import pyproj
import data_mall
import numpy as np
url = onemap.GetURL('RestServiceUrl')
svy21 = pyproj.Proj(init='epsg:3414')
def download_stuff():
"""
Bus stop codes are 5-d... | true |
027df683d0f4d75f9517a03621bf8b1e4051d3b4 | Python | davidt99/spotipy | /spotipy/util.py | UTF-8 | 6,025 | 2.71875 | 3 | [
"MIT"
] | permissive | import contextlib
import socket
import time
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from urllib import parse
from urllib.parse import parse_qs
from urllib.parse import urlparse
import requests
from spotipy import exceptions
from spotipy import auth
PORT = 8080
REDIRECT_ADDRE... | true |
a0a67dfcae15650490a7aee0486a1538b4c3177b | Python | aLonelySquidNamedBob/Random-Projects | /NeuralNetworks/Seb_Lague/program.py | UTF-8 | 407 | 2.6875 | 3 | [] | no_license | import neuralnetwork as nn
import numpy as np
import time as t
start_time = t.time()
with np.load('mnist.npz') as data:
training_images = data['training_images']
training_labels = data['training_labels']
layer_sizes = (784, 20, 20, 10)
net = nn.NeuralNetwork(layer_sizes)
net.print_accuracy(training_images, traini... | true |
6f26806d561589588d9576a385fcd7160a847f2e | Python | radomirbrkovic/algorithms | /hackerrank/other/save-the-prisoner.py | UTF-8 | 326 | 3.421875 | 3 | [] | no_license | # Save the Prisoner! https://www.hackerrank.com/challenges/save-the-prisoner/problem
def saveThePrisoner(n, m, s):
ans = (s+m-1)%n
if ans==0:
return n
return ans
print saveThePrisoner(5, 2, 1)
print saveThePrisoner(5, 2, 2)
print saveThePrisoner(7, 19, 2)
print saveThePrisoner(3, 7, ... | true |
4d65f48d8eca1deddcd08ef8141b11f5cbe6a4e5 | Python | CseTitan/CseTitanHotel | /organize_menu.py | UTF-8 | 319 | 3.09375 | 3 | [] | no_license | SCREEN_WIDTH = 100
def print_center(s):
x_pos = SCREEN_WIDTH // 2
print((" " * x_pos), s)
def print_bar():
print("=" * 100)
def print_bar_ln():
print_bar()
print()
def input_center(s):
x_pos = SCREEN_WIDTH // 2
print((" " * x_pos), s, end='')
return input()
| true |
1d6203bd06ebd1cdc75ca35ad228ec1b3f90bd58 | Python | ShruthaKashyap/Linear-Regression-Python-Spark | /linreg.py | UTF-8 | 2,283 | 3.59375 | 4 | [] | no_license | # linreg.py
#
# Standalone Python/Spark program to perform linear regression.
# Performs linear regression by computing the summation form of the
# closed form expression for the ordinary least squares estimate of beta.
#
# TODO: Write this.
#
# Takes the yx file as input, where on each line y is the first element
#... | true |
2f388675cbbae8e4cae1dabafd9c642808cd3a42 | Python | Peng-YM/pymoo | /tests/test_interface.py | UTF-8 | 1,360 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import unittest
import numpy as np
from pymoo.algorithms.so_genetic_algorithm import GA
from pymoo.interface import AskAndTell
class InterfaceTest(unittest.TestCase):
def test_ask_and_tell(self):
# set the random seed for this test
np.random.seed(1)
# create the algorithm object to be... | true |
30c645a082fb9a188b40fa8f2726a5a3e5be0ed0 | Python | Kitware/vtk-examples | /src/Python/Tutorial/Tutorial_Step2.py | UTF-8 | 2,451 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
=========================================================================
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without... | true |
4ff87c42b818777bd9558766a401cc4736df2111 | Python | slamice/invested | /trademanager/stocks/robinhood_stock.py | UTF-8 | 823 | 2.796875 | 3 | [] | no_license | class RobinHoodStock:
def __init__(self, last_trade: dict):
self.raw_stock_info = last_trade
@property
def code(self):
return self.raw_stock_info.get('symbol')
@property
def adjusted_previous_close(self):
return float(self.raw_stock_info.get('adjusted_previous_close'))
... | true |
e33555f71727656ff5a126923ca2d10f900cdb37 | Python | Ruzzan/Anime-Downloader | /anime_dl.py | UTF-8 | 2,358 | 2.796875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
# import PySimpleGUI
import re, os, sys, time
ABS_PATH = os.path.abspath(__file__)
BASE_DIR = os.path.dirname(ABS_PATH)
OUTPUTS = os.path.join(BASE_DIR, 'Downloads')
def get_file_size(file_path):
file_size = os.path.getsize(file_path)
return file_size
anime_nam... | true |
fcb46ece8b4be90574513a941251ec83d6988c08 | Python | idaohang/SoftGNSS-python | /geoFunctions/deg2dms.py | UTF-8 | 1,117 | 3.3125 | 3 | [] | no_license | import numpy as np
# deg2dms.m
def deg2dms(deg=None, *args, **kwargs):
# DEG2DMS Conversion of degrees to degrees, minutes, and seconds.
# The output format (dms format) is: (degrees*100 + minutes + seconds/100)
# Written by Kai Borre
# February 7, 2001
# Updated by Darius Plausinaitis
### ... | true |
8f60e5f61d87e20c14591933b91a55e898b8d445 | Python | SushiMaster8/Ahrens_S_RPS_Fall2020 | /gameComponents/winLose.py | UTF-8 | 935 | 3.40625 | 3 | [
"MIT"
] | permissive | from gameComponents import gameVars
#define a win/lose function and refer to it (invoke it) in our game loop
def winorlose(status):
#print("called winorlose", status)
if status == "won":
pre_message = "THERE'S NO WAY YOU WON, WHAT, HOW? YOU MUST BE CHEATING! ADMIT IT YOU CHEATER! I NEVER LOSE!!!!!"
else:
pre_... | true |
ff4498f415b0dffc113d8bac45ee1d841ad3661d | Python | milindgaikwad13/AWS-BigData | /PythonBootcamp/Lessons/8_Error_Handling/pylintTest.py | UTF-8 | 123 | 2.703125 | 3 | [] | no_license |
## pylint creates a report for all possible errors and missing details such as docstring
a = 1
b = 2
print(a)
print(B) | true |
05920dcbdea3e073a74045c99add145e62948dbf | Python | Kylmalcolm/Diabetes_Analysis | /app.py | UTF-8 | 4,201 | 2.96875 | 3 | [] | no_license | from flask import Flask, render_template, request, send_file
from flask_bootstrap import Bootstrap
import random
from model import diabetesPrediction
class User:
def __init__(self, name, age, weight, height, glucose, active, skin, generate):
if generate == False:
self.name = name
se... | true |
0e93d470b889c0f808fc70354185d5ff60759527 | Python | upple/BOJ | /src/2000/2294.py3.py | UTF-8 | 444 | 2.8125 | 3 | [
"MIT"
] | permissive | import queue
n, k=map(int, input().split())
v=[False for i in range(k+1)]
m=[int(input()) for i in range(n)]
Q = queue.Queue()
v[k]=1
cnt=0
Q.put(k)
while Q.qsize():
size=Q.qsize()
while size:
size-=1
cur=Q.get()
if cur==0:
print(cnt)
exit(0)
for i in m:
... | true |
3e19f2f00be0bd2d8039ddf980f4ba4b0f62cf86 | Python | ravanagagan/DataStructures-Python | /DataStructures/3 - HashMap/Hash Map- 1st adn 2nd Exercise.py | UTF-8 | 1,280 | 4.4375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# nyc_weather.csv contains new york city weather for first few days in the month of January. Write a program that can answer following,
# What was the average temperature in first week of Jan
# What was the maximum temperature in first 10 days of Jan
# Figure out data structure th... | true |
ddd01cb9447cfcd3824c1d4a19bbb2c089c7a602 | Python | ekim197711/python-tutorial | /variablesAndDatatypes/my_conversion.py | UTF-8 | 258 | 3.078125 | 3 | [] | no_license |
my_float = float(5)
print(my_float)
my_int = int(10.6)
print(my_int)
my_string = str(25)
print("" + str(25))
# print(my_string)
my_set = set([100,200,300,100])
print(my_set)
my_tuple = tuple({15,26,37})
print(my_tuple)
my_list= list('hello')
print(my_list)
| true |
ec8fbdb7c2e657c868b5de05b92dfa1dd4082585 | Python | ralfleistad/Kattis | /baconeggsandspam.py | UTF-8 | 731 | 3.4375 | 3 | [] | no_license | import sys
import math
### Read list of numbers into a list and convert to integers
# nums = list(map(int, input().split(' ')))
### Sort dictionary by key
# for i in sorted (key_value.keys()) :
while True:
n = int(input())
if n == 0:
break
repo = {}
for i in range(n):
... | true |
f335c25867e03f6d2412241be96876f3e6a1b522 | Python | mysqlplus163/aboutPython | /20170213.py | UTF-8 | 350 | 3.015625 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
# Date: 2017/2/13
"""
如何在Pycharm中执行某个文件的某一部分代码
"""
# print("Start...")
#
# name = input("Please input your name: ")
# print("Hello ", name)
#
# print("End...")
exit_flag = False
a = 1
l = [1, ]
while not exit_flag:
l.append(a)
a = 2
| true |
96d56cae1b104c508440692a12150d23ef3c834d | Python | lukas-ke/faint-graphics-editor | /help/example_py/scripting_intro_squares.py | UTF-8 | 165 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | from faint import line
#start
for i in range(100):
line( (0, i * 10), (640, i * 10) ) # Horizontal lines
line( (i * 10, 0), (i * 10, 480) ) # Vertical lines
| true |
3573d527254520d07bc526f4a5771e30225da24e | Python | estercs/snakegame | /snake.py | UTF-8 | 1,067 | 3.40625 | 3 | [
"MIT"
] | permissive | import pygame
import sys
x_cord= 300
y_cord= 200
x_change= 0
y_change= 0
class snake():
def __init__(self):
self.height= 10
self.width= 10
def draw(self, screen, x, y):
self.shape= pygame.Rect((x,y),(self.height, self.width))
pygame.draw.rect(screen, pygame.Color("blue"),self.shape)
if __name__ == "__main_... | true |
e34f08d1681af47448cf4c5f8d675f3ac9eaa9eb | Python | mauriziokovacic/ACME | /ACME/math/vec2quat.py | UTF-8 | 399 | 2.796875 | 3 | [
"MIT"
] | permissive | from .cart2homo import *
def vec2quat(V, dim=-1):
"""
Converts a vector in quaternion form
Parameters
----------
V : Tensor
a (3,) or (N,3,) vector tensor
dim : int (optional)
the dimension along the vectors should be converted
Returns
-------
Tensor
the (... | true |
70bb7193962cccc29612b994e1cbb2bc12b14033 | Python | gvnaakhilsurya/20186087_CSPP-1 | /cspp1-assignments/m22/assignment1/assignment1/test.py | UTF-8 | 243 | 2.96875 | 3 | [] | no_license |
def main():
"input and output"
lines = int(input())
lis = []
for i in range(lines):
lis.append(input())
for i in lis:
print(i)
if __name__ == '__main__':
main()
read_input.py
Displaying read_input.py. | true |
fe047a93a149d7a0f9adf9945c0879b9bde200b7 | Python | islamariful/playfair-cipher | /playfairencription.py | UTF-8 | 3,104 | 3.859375 | 4 | [
"MIT"
] | permissive | #Initializing variables a and b for use in recurson in #filling other characters
a = b = 0
#Getting user inputs Key (to make the 5x5 char matrix) and Plain Text (Message that is to be encripted)
key = input("Enter key: ")
key = key.replace(" ", "")
key = key.upper()
plaintext = input("Plain text: ")
plaintext = plainte... | true |
e1bcfa2677d03df66531d02ec4fac76610e1aab0 | Python | mathildaMa/concourse-http-resource | /test/test_in.py | UTF-8 | 1,319 | 2.875 | 3 | [
"MIT"
] | permissive | from helpers import cmd
def test_in(httpbin, tmpdir):
"""Test downloading versioned file."""
source = {
'uri': httpbin + '/range/{version}',
}
in_dir = tmpdir.mkdir('work_dir')
output = cmd('in', source, [str(in_dir)], {'version': '9'})
assert output['version'] == {'version': '9'}
... | true |
48b8005a978fa796702bd43c7b8186c64d8aa6ba | Python | jadecodespy/python | /Code/COTD5.py | UTF-8 | 261 | 3.140625 | 3 | [] | no_license |
def comb_srt(first_word, second_word):
string_one =list(first_word)
string_two =list(second_word)
comb=1
for i in string_two:
string_one.insert(comb,i)
a=+ 2
return "" .join(string_one)
print(comb_srt(Lion, Tiger)) | true |
6fc7fe6e4fc9c838201c27b637c0f56b378bae3a | Python | alexhsamuel/ntab | /ntab/lib/memo.py | UTF-8 | 392 | 2.546875 | 3 | [
"MIT"
] | permissive | import functools
#-------------------------------------------------------------------------------
def lazy_property(fn):
name = fn.__name__
@functools.wraps(fn)
def wrapped(self):
try:
return self.__dict__[name]
except KeyError:
val = fn(self)
self.__di... | true |
2558bf608fea9c623866b7e55b87adb4df999c22 | Python | ali-sefidmouy/HamrahChallenge | /academy/academyapp/views.py | UTF-8 | 783 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from django.db import models
from django.http import JsonResponse
from rest_framework import status
from rest_framework.decorators import api_view
def sum(a, b):
return int(a) + int(b)
@api_view(['GET',])
def SumView(request):
if request.method == 'GET':
a = request.query_params.get('a'... | true |
d28b2f608d0743b65fd7e9dd9409bf8a6e626612 | Python | bokveizen/leetcode | /1022_Sum of Root To Leaf Binary Numbers.py | UTF-8 | 642 | 3.328125 | 3 | [] | no_license | # https://leetcode-cn.com/problems/sum-of-root-to-leaf-binary-numbers/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sumRootToLeaf(self, root: TreeNode) -> int:
ans = 0
... | true |
89ab7a55b709e8802405dba26e9a6c08787463b8 | Python | ramakrishna00/py-coding | /cross_bridge.py | UTF-8 | 351 | 2.84375 | 3 | [] | no_license | def get_time(a, b, c, d):
return a+b+c+d+min(a,b,c,d)
class GetTime{
public static int main(String args[]){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
return a+b+c+d+Math.min(a,Math... | true |
f873e605721b22cf4ae07aaa28c89aad4e2f1230 | Python | 3StarAnchovy/PythonTest | /test18.py | UTF-8 | 144 | 3 | 3 | [] | no_license | score = list(map(int, input().split()))
sum = 0
for i in score:
sum += i
avg = sum/len(score)
print(int(avg))
#print(sum(score)/len(score)) | true |
961f253507f72d9a7aefc0b6cafd3eb169242b6a | Python | Ast3risk-ops/My-Stuff | /My_website.py | UTF-8 | 355 | 3 | 3 | [] | no_license | # A simple web application.
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/hello/<name>")
def greet(name='Stranger'):
return render_template("greeting.html", name=name)
@app.route("/slash")
def slash():
return... | true |
39ae64169b222e579f6bf2763b557b6ab31e0a2d | Python | amiribr/airLUSI | /src/Rayleigh_direct_transmittance.py | UTF-8 | 3,460 | 2.625 | 3 | [] | no_license | # Amir Ibrahim :: amir.ibrahim@nasa.gov :: April 2020
# These are imports necessary to run the script
import os
import re
import glob
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import numpy.matlib as npm
from scipy.interpolate import interp1d
from matplotlib.legend_handler import... | true |
5b1b315a08b6e9afa64074b2a61509d144f82015 | Python | ryokugyu/Finding-Sister-City-with-NLP-approach | /algo/skcriteriaVersion.py | UTF-8 | 1,693 | 2.75 | 3 | [] | no_license | import sys
import numpy as np
import math
# Minimize for items with positive weights, maximize for items with negative weights
from skcriteria import Data, MIN, MAX
from skcriteria.madm import closeness
import sharedFormulas as form
from collections import OrderedDict
# Create a dictionary from the city_with_data file... | true |
d69e4b13b28c78134201bdb06fab7ab3130812d6 | Python | thorbenwiese/ML | /Assignment3/assignment3.py | UTF-8 | 13,678 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import scipy.io as sio
from sklearn.neighbors import KNeighborsClassifier as classifier
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report, confusion_matrix
... | true |
c945317bfdda80d544be8256a9792cedfe8d60b8 | Python | ritesh-deshmukh/Algorithms-and-Data-Structures | /Practice/fizzbuzz.py | UTF-8 | 519 | 3.953125 | 4 | [] | no_license | # arr = [a for a in range(1,21)]
# arr2 = [] * len(arr)
# print(arr)
for num in range(1,21):
if num%3 == 0 and num%5 == 0:
# arr2.append("FizzBuzz")
print("FizzBuzz", end=" ")
elif num%3 == 0:
# arr2.append("Fizz")
print("Fizz", end=" ")
elif num%5 == 0:
# arr2.appen... | true |
78517cec2e7fe5c10e7897159e6af60a7f4b4669 | Python | sclaughl/biblequiz-helps | /load_romans.py | UTF-8 | 2,916 | 2.859375 | 3 | [] | no_license | import logging
import urllib2
import os
import sqlite3
from BeautifulSoup import BeautifulSoup
# configure logging
log = logging.getLogger('romans_loader')
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler()) # write log to stderr
# configure database -- delete it if it exists
DB_FILE = os.path.join(os... | true |
4a47617e9cbcf6b7de20ff82a41aefea917ccda3 | Python | czardien/beautiful-bundlifier | /lib/models/notification.py | UTF-8 | 964 | 3.046875 | 3 | [] | no_license | from typing import List
from datetime import datetime
class Notification:
_TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S"
def __init__(self, timestamp: str, user_id: str, friend_id: str, friend_name: str):
self.timestamp = datetime.strptime(timestamp, self._TIMESTAMP_FORMAT)
self.user_id = user_id
... | true |
cfa123412a16a766e5c70ef9bb64c063ea4ed597 | Python | kyosukekita/ROSALIND | /Bioinformatics textbook track/find_substrings_of_a_genome_encoding_a_given_amino_acids_string.py | UTF-8 | 1,327 | 3.09375 | 3 | [] | no_license | def translate(seq):
decoded=""
string = """TTT F CTT L ATT I GTT V
TTC F CTC L ATC I GTC V
TTA L CTA L ATA I GTA V
TTG L CTG L ATG M GTG V
TCT S CCT P ACT T GCT A
TCC S CCC P ACC T GCC A
TCA S CCA P ACA T G... | true |
3236b0c0fe85e530ef6100f6d1b4e1e02485ddcc | Python | stacywebb/ledypi | /src/patterns/equation.py | UTF-8 | 3,479 | 3.15625 | 3 | [] | no_license | import logging
from Equation import Expression
from patterns.default import Default
from utils.color import scale
from utils.modifier import Modifier
pattern_logger = logging.getLogger("pattern_logger")
class Equation(Default):
"""
Use user-defined function for the rgb values. The function may depend on :
... | true |
529637da17b5c86d1c2db73fb15f742e4c314a4d | Python | xuewanqi/incubator-singa | /python/singa/data.py | UTF-8 | 7,254 | 2.921875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"MIT",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | true |
acd1e4cfefe4ffddbe25a4fec134dda4ce7073cc | Python | danielkza/desafios-2015 | /aval1/chat-online/run.py | UTF-8 | 542 | 2.96875 | 3 | [] | no_license | from sys import stdin
from itertools import chain
p, q, l, r = map(int, stdin.readline().rstrip().split())
x_times = set()
z_times = []
for i in range(p):
s, e = map(int, stdin.readline().rstrip().split())
x_times |= set(range(s, e+1))
for i in range(q):
s, e = map(int, stdin.readline().rstrip().spl... | true |
53c97193c723cd7a00ab36d0e5d6b38cdb0b6db5 | Python | NERSC/dayabay-data-conversion | /roottools.py | UTF-8 | 8,828 | 2.78125 | 3 | [] | no_license | # roottools by peter sadowski
import ROOT
import array
import numpy as np
import itertools
class RootTree():
def __init__(self,filename, treename, intbranches=[], floatbranches=[],ivectorbranches=[],fvectorbranches=[]):
ch = ROOT.TChain(treename)
status = ch.Add(filename)
#if status == 1:
... | true |
c8ae29d53aa917e4f1924dea558f34d8703e3256 | Python | jigi-33/async_python_beginner_21 | /realpyth_samples/ext1_async_await_syntax_and_coroutines.py | UTF-8 | 1,005 | 3.640625 | 4 | [] | no_license | import asyncio
"""
Coroutine - a function that can suspend its execution before reaching return
and it can indirectly pass control to another coroutine for some time.
countasync.py in original article - http://realpython.com/async-io-python
"""
async def count(): # the native courutine
print("One")
await a... | true |
3ff90dabed90d6577540e70ca19bc536e15b311f | Python | rkuo2000/homebot | /RPi/uart.py | UTF-8 | 158 | 3.4375 | 3 | [] | no_license | import serial
ser = serial.Serial('COM6', 9600)
ser.write(b'start ')
while 1:
ser.write(b'readline')
line = ser.readline()
print(line)
| true |
24620f047444d14fb1287c75fb65c5dff2edd54b | Python | QiTai/python | /processManage/fig18_09.py | UTF-8 | 898 | 3.515625 | 4 | [] | no_license | #Demonstrating popen and popen2
import os
#determine operating system, then set directory-listing and reverse-sort commands
if os.name =="nt" or os.name == "dos":
fileList = "dir /B"
sortReverse = "sort /R"
elif os.name =="posix":
fileList = "ls -l"
sortReverse = "sort -r"
else:
sys.exit("OS not supported by thi... | true |
3445de8ffa23b2046a099196f63f10caa33946f7 | Python | 24mu13/concierge | /tests/test_intent_toggl.py | UTF-8 | 1,386 | 2.546875 | 3 | [
"MIT"
] | permissive | import datetime
def test_empty_summary(summary_intent):
entities = {
"since": "2019-09-11",
"until": "2019-09-11",
}
summary = summary_intent.execute("random-execution-id", entities)
assert "title" in summary
# assert summary["title"] == "Toggl Summary for Tuesday, September 10t... | true |
0c3700880ff956fc7c37f8eea993e57a179928e0 | Python | bpinapinon/bpina_Homework5 | /bpina_Pyber.py | UTF-8 | 6,205 | 3.890625 | 4 | [] | no_license | # # Option 1: Pyber
# 
# The ride sharing bonanza continues! Seeing the success of notable players like Uber and Lyft, you've decided to join a fledgling ride sharing company of your own. In your latest capacity, you'll be acting as Chief Data Strategist for the company. In this role, you'll b... | true |
5431e6b6741d45f58729bd070a765bdf9ea8d85f | Python | HTY2003/CEP-Stuff | /CEP Y3/Unit 2.7 Hash Tables/HengTengYi_PS3/chainhash.py | UTF-8 | 11,348 | 3.46875 | 3 | [] | no_license | import sys
import math
import ctypes
from collections import deque
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:
_get_byte = ord
class HashTable:
"""
Hash table that uses separate chaining to assign to assign key-value pairs
Separate chaining eliminates the need for col... | true |
e895978865d8cbd235ef6c5c78ebc5b1192fb09b | Python | j-csy/temperature-check | /temperature_check_cmdline.py | UTF-8 | 3,010 | 3.890625 | 4 | [] | no_license | import requests
def continue_question(question = "[y/n]", strict = True):
""" Asks the question specified and if the user input is 'yes' or 'y', returns 'yes'.
If the user input is 'no' or 'n', it returns no.
If strict is False, many other answers will be acceptable."""
question = question.st... | true |
1d32bcfc6695e5085068227dec552a0d4088cf5a | Python | ericdddddd/NTUST_Information-Retrieval | /Hw1/Hw1.py | UTF-8 | 4,794 | 2.578125 | 3 | [] | no_license | #%%
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
#%%
import os
queriesPath = 'C:\\Users\\User\\Desktop\\IR\\data\\ntust-ir-2020\\queries'
docsPath = 'C:\\Users\\User\\Desktop\\IR\\data\\ntust-ir-2020\\docs'
queriesList = os.listdir(queriesPath)
queriesLi... | true |
ede40b126fd6d5f1e296833a82a10819f0e425e7 | Python | IsCoelacanth/NeurIPS-2018-Adversarial-Vision-Challenge-Targeted-Attack | /localmainBA.py | UTF-8 | 2,305 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
from foolbox2.criteria import TargetClass
from foolbox2.attacks.boundary_attack import BoundaryAttack
# from adversarial_vision_challenge import load_model
# from adversarial_vision_challenge import read_images
# from adversarial_vision_challenge import store_adversarial
# from adversarial_vision_cha... | true |
9b73f1106f5267c2476af8f07eaa15518803b051 | Python | slancast/Immuno | /most_abundant_CDR3_w_functions.py | UTF-8 | 3,130 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
#slancast@scg4.stanford.edu:/srv/gsfs0/projects/snyder/slancast/repertoire/
#I want this program to find the change from 1 to 2 and then from 2 to 3 to see if more antibodies stick around from 2 to 3.
import sys
import numpy as np
from collections import Counter
from repertoire_counting import op... | true |
822b8bde8eee33e4866d5e6d3a477bef3765f15f | Python | just-lana-l/module12 | /task_8.py | UTF-8 | 315 | 4.34375 | 4 | [] | no_license | print('Задача 8. НОД')
#Напишите функцию, вычисляющую наибольший общий делитель двух чисел
x = int(input('x: '))
y = int(input('y: '))
def nod(x, y):
while x != 0 and y != 0:
if x > y:
x = x % y
else:
y = y % x
print(x + y)
nod(x, y) | true |
770abbab22d387831532215c4688cea93b719497 | Python | ionut23carp/Training | /PythonAdvance/python-mar2020/exercises_solutions/string_format_exercise.py | UTF-8 | 779 | 3.15625 | 3 | [] | no_license | persons = [
{'first_name': 'John', 'last_name': 'Cornwell', 'net_worth': 2632.345},
{'first_name': 'Emily', 'last_name': 'Alton', 'net_worth': -4578.234},
{'first_name': 'James', 'last_name': 'Bond', 'net_worth': 1000.07},
]
print('-' * 35)
for person in persons:
print('| {last_name:<15} {first_name:.... | true |
98c2e3ced3db1add653ec2a5cd9ba8c95c39c991 | Python | yuseungwoo/baekjoon | /1371.py | UTF-8 | 420 | 3.109375 | 3 | [] | no_license | # coding: utf-8
import sys
dic = {chr(x):0 for x in range(97, 123)}
s = sys.stdin.readlines()
s = ''.join(s)
s = s.replace('\n', '')
for char in s:
if char in dic:
dic[char] += 1
temp = []
for key in dic.keys():
temp.append((key, dic[key]))
temp = sorted(temp, key=lambda x: x[1], reverse=True)
... | true |
0f392192d2acc07e432e61261d4e71338efc4917 | Python | Terorras/pystuff | /prac20.py | UTF-8 | 478 | 3.25 | 3 | [] | no_license | #for i in range(1, 101):
# print i*'*', i*'#'
#for i in range(1, 501):
# if i % 3 == 0 and i % 5 == 0:
# print 'fizzbuzz'
# elif i % 3 == 0:
# print 'fizz'
# elif i % 5 == 0:
# print 'buzz'
# else:
# print i
for i in range(1, 101):
if i * 21 < 100:
print ' ', i ... | true |
c26d5ea54fd3177c2e9d0d9ef2c081eb513bf327 | Python | csev/class2go | /main/courses/management/commands/exam_edit.py | UTF-8 | 5,438 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | from optparse import make_option
from textwrap import wrap
from collections import namedtuple
from pprint import pprint
import sys
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from c2g.models import Exam
class Command(BaseCommand):
"""
Define the edit_exam ... | true |
e008de4c9f0ae4f36cd608c9058d4ac3432ee210 | Python | shuvamoy1983/PythonWebProgramming | /Chap1.py | UTF-8 | 2,552 | 3.046875 | 3 | [] | no_license | import urllib.request
from urllib.error import URLError,HTTPError,ContentTooShortError
print("Step 1) Downloading a web page")
def download(url):
return urllib.request.urlopen(url).read().decode("utf-8")
print("______________________________________________________________")
print("Step 2) Downloading a web page ... | true |
7678782ac065a40b49a6618fe954c17b78cb4c36 | Python | 218478/VariousMLTforOCR | /src/DatasetReader.py | UTF-8 | 11,838 | 2.953125 | 3 | [] | no_license | import argparse
import cv2
import keras
import os
import sys
import numpy as np
from keras import backend as K
from NearestNeighbor import NearestNeighbor
def image_invalid(image):
"""
Checks if the image contains NaN or Inf records.
"""
return np.isinf(image).any() or np.isnan(image).any()
def pr... | true |
839c261c9f05a44c488376443d9bd0b45c5dbd47 | Python | fei-zhang-bb/Lessons | /Machine_Learning_and_Parallel_Computing/FINAL_MLP_MAXMIN/mlp.py | UTF-8 | 4,124 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
import numpy as np
import scipy.io as scio
import math as ma
from tensorflow.contrib import layers
import time
def next_batch(data, label, batch_size):
index = np.arange(7293)
np.random.shuffle(index)
index = index[0:batch_size]
batch_data = data[index]
batch_label = label[... | true |
8cf3abcc32891e224ecaf2f226bb18158e9fa5c5 | Python | snowood1/SPN-project | /RandomGrowth.py | UTF-8 | 1,510 | 3.015625 | 3 | [] | no_license | import numpy as np
import random
from SumProductNets import *
class RandomGenerator(object):
def __init__(self, num_feature, rv_list):
self.features = list(range(num_feature))
self.rv_list = rv_list
def generate(self):
return self._create_node(self.features, True)
def node_select... | true |
08f9cdac0bdb4b159194c4bb5aaaf49b9a124a35 | Python | CmPunk96/LR4 | /LR4.py | UTF-8 | 2,835 | 2.953125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
pd.options.mode.chained_assignment = None
pd.set_option('display.max_columns', 30)
pd.set_option('display.width', 1000)
google_play = pd.read_csv('googleplaystore.csv', encoding='latin-1')
bar_graph_plot = plt.figure(figsize=(15, 8))
bar_graph = bar_graph_plot.add... | true |
bdd490856ee9c4c5bf02f3b1b77f62caaf8f8bc9 | Python | lihuacai168/python_learning | /TestView/quicksort.py | UTF-8 | 1,379 | 4.0625 | 4 | [] | no_license | def quick_sort(list,first,last):
# 只有一个元素时,就是递归的出口
if first >= last:
return
# 数组的游标
low = first
high = last
# 去数组的第一个值作为参照
mid_value = list[first]
while low < high:
# 如果高位的值大于参照的值并且游标还没相遇,高位游标就一直向左移动.(高位的值等于参照值,也需要移动,否则当数组的前后两个元素刚好相等,会出现死循环)
if low < high and... | true |
3d8b4e1f9053bd7d54cd5f0b6c43107f079e1d53 | Python | axura/shadow_alice | /demo03.py | UTF-8 | 96 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
import sys
string = sys.stdin.read()
for i in range(0, 3):
print string
| true |
0ddb4857badd13ea9c710024f08bcfb6ea7256f4 | Python | geethayedida/codeacademy_python | /multiplying.py | UTF-8 | 535 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 03 21:00:01 2016
@author: Geetha Yedida
"""
class Animal(object):
"""Makes cute animals."""
is_alive = True
health = "good"
def __init__(self, name, age):
self.name = name
self.age = age
# Add your method here!
def description(self... | true |
ae429a9829aa93a26ce05b5a5ab1d95dd0c21b8f | Python | mariuszdrynda/kryptografia | /Lista1/zad1.py | UTF-8 | 2,611 | 3.875 | 4 | [] | no_license | from functools import reduce
import math
from random import randint
class prng_lcg:
def __init__(self, seed, m, c, n):
self.state = seed # ziarno
self.m = m # mnożnik
self.c = c
self.n = n # modulo
def next(self): # funkcja generuje kolejną pseudolową liczbę z zakresu [0, n]
... | true |
ace2446edd644493cc7468248e2b548e39e45b77 | Python | balujaashish/NOW_PDF_Reader | /test2.py | UTF-8 | 675 | 3.203125 | 3 | [] | no_license | from PDF_OCR_Reader.String_compare import String_Compare
def is_sublist(a, b):
if not a: return True
if not b: return False
return b[:len(a)] == a or is_sublist(a, b[1:])
def is_substring(str1, str2):
sc = String_Compare()
str1 = sc.strip_punctuations(str1)
w1 = sc.prepare_phrase(str1,0)
... | true |
ef869593f924de2e89f6a1fec105c7867a053b78 | Python | kmkmkkball/iot | /SAKS-tutorials/nightlight/main.py | UTF-8 | 3,281 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 NXEZ.COM.
# http://www.nxez.com
#
# Licensed under the GNU General Public 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.gnu.org/licen... | true |
4e9475e756744dfc74bdf54c15191d5450f7abc7 | Python | jasonmoofang/codelab | /camp0_reference/turtle.py | UTF-8 | 668 | 3.109375 | 3 | [] | no_license | from ch.aplu.turtle import *
ann = Turtle()
ann.setPenColor("red")
#square
ann.forward(100)
ann.right(90)
ann.forward(100)
ann.right(90)
ann.forward(100)
ann.right(90)
ann.forward(100)
#triangle
ann.setPenColor("blue")
ann.forward(100)
ann.right(120)
ann.forward(100)
ann.right(120)
ann.forward(10... | true |
78a556658eea5d03ebbdd76ecf3e7d2888f3860c | Python | rafa761/leetcode-coding-challenges | /2020 - august/008 - non-overlapping intervals.py | UTF-8 | 1,500 | 3.921875 | 4 | [] | no_license | """
Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Example 1:
Input: [[1,2],[2,3],[3,4],[1,3]]
Output: 1
Explanation: [1,3] can be removed and the rest of intervals are non-overlapping.
Example 2:
Input: [[1,2],[1,2],[1,2]]
... | true |
e3f33f64f607dbab28e475652a619185deb8d652 | Python | evgenii-malov/interviews | /interview_21.08.2016/task1_next_biggest_number/next_biggest_number.py | UTF-8 | 2,191 | 3.546875 | 4 | [] | no_license | # coding: utf8
import sys
def nbn(n):
"""
Logic:
We must increase digit in minimum possible digit index (from right to left)
We can encrease it only by digits from right tail
It is inpossible to increase digits from left part,
because it make number smaller (smaller digit goes left)
So we ... | true |
f0a7565559095ef9e6c1f93c435b63632195b58c | Python | brooke-zhou/MovieLens-Visualization | /ImplicitImplementation.py | UTF-8 | 4,202 | 3.15625 | 3 | [] | no_license | import implicit
import pandas as pd
from scipy.sparse import csr_matrix
import numpy as np
from statistics import mean
from matrixFactorMethods import get_err, centerUV, calculateProjection
def implicitModel(movieLensDataTrainPath='train_clean.txt', movieLensDataTestPath='test_clean.txt'):
''' Implementation of t... | true |
9ee1a9b07cb5fb4256de4d766f43f8ccb74fb6d4 | Python | LHKze/Notes | /flask-test-login.py | UTF-8 | 2,499 | 2.578125 | 3 | [] | no_license | from flask import Flask, request, render_template, redirect, url_for, make_response
from datetime import datetime, timedelta
app = Flask(__name__)
class UserLogin(object):
@classmethod
def check_cookie(cls):
tmp = request.cookies.get('login')
if tmp == 'you are login in!':
return... | true |
9dfa7556370bd84cb1d28ead67c9e3abf6f19a53 | Python | eggypesela/freecodecamp-exercise-data-analysis | /Exercise Files/boilerplate-mean-variance-standard-deviation-calculator/mean_var_std.py | UTF-8 | 2,201 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
# created by Regina Citra Pesela (reginapasela@gmail.com)
import numpy as np
def calculate(list):
# first, we should check if the list length is 9
# if it's not 9 then raise ValueError and
# return "List must contain nine numbers"
if len(list) != 9:
... | true |
a1943b54a9e2cea5c20089c8801b861544e5efe2 | Python | Rykkata/marsrover | /Python/cards.py | UTF-8 | 3,886 | 3.25 | 3 | [] | no_license | import random
class Card(object):
def __init__(self, value, suite):
super(Card, self).__init__()
self.Value = value
self.Suite = suite
def __str__(self):
return ("%s%c" % (self.Value, self.Suite))
class Deck(object):
def __init__(self):
super(... | true |
0d442f6cfab000650b8e1b971475b292f22047dd | Python | chellya/tfPlayground | /ut.py | UTF-8 | 2,197 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from IPython.display import clear_output, Image, display, HTML
import webbrowser, os
import importlib
import pandas as pd
from pandas import DataFrame
def print_df(df,max_row = 500,max_cols = 100):
with pd.option_context('display.max_rows', max_row, 'display.max_columns',... | true |
795229e3ea995a24f87919d4a796c50c0acb5325 | Python | ChetverikovPavel/Python | /lesson10/task3.py | UTF-8 | 1,065 | 3.84375 | 4 | [] | no_license | class Cell:
def __init__(self, numb):
try:
self.numb = int(numb)
except ValueError:
print('None')
self.numb = None
def __str__(self):
return str(self.numb)
def __add__(self, other):
return Cell(self.numb + other.numb)
def __sub__(sel... | true |
a2f7dac90c0fb95cfa32c8b47335de45dd019e83 | Python | dbradf/dlgo | /src/dlgo/agent/monte_carlo.py | UTF-8 | 3,846 | 3.0625 | 3 | [] | no_license | from __future__ import annotations
import math
import random
from structlog import get_logger
from dlgo.agent.base import Agent
from dlgo.agent.naive import RandomBot
from dlgo.goboard_fast import Move, GameState
from dlgo.gotypes import Player
from dlgo.scoring import compute_game_result
LOGGER = get_logger(__name_... | true |
a32e401ad176761340cc17f4290b91cdf37eca27 | Python | charleshefer/cbiotools | /ncbi/cfasta_from_ncbi.py | UTF-8 | 1,316 | 2.578125 | 3 | [] | no_license | ###############################################################################
#Download a fasta entry from the NCBI using EUTILS
#@requires:biopython
#@author:charles.hefer@agresearch.co.nz
#@version:0.1
###############################################################################
import optparse
from Bio im... | true |
0b94a4488c0e8839661b26438b690420f6421dcc | Python | Innerface/qarobot | /model/nlp_stanford_by_nltk_model.py | UTF-8 | 2,003 | 2.671875 | 3 | [] | no_license | # Author: YuYuE (1019303381@qq.com) 2018.01.18
from nltk.parse.stanford import StanfordParser
from nltk.tokenize import StanfordSegmenter
import os
java_path = "C:/Program Files (x86)/Java/jdk1.8.0_144/bin/java.exe"
os.environ['JAVAHOME'] = java_path
def generate_stanford_parser(sentence, path='D:/NLP/stanford/stanf... | true |