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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f017d22d14352a2828d855b7b9afe78015a94ad0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03723/s498389749.py | UTF-8 | 280 | 3.0625 | 3 | [] | no_license | a, b, c = map(int, input().split())
ans = 0
if a == b == c:
if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
pass
else:
ans = -1
else:
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
ans += 1
a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
print(ans)
| true |
724b038c366d966459ccb178e6dff1d151248474 | Python | Shossi/Homework | /python/python6.py | UTF-8 | 4,115 | 4.46875 | 4 | [] | no_license | # 1.What does string slicing mean?
# string1 = "wasabi"
# string1[start:stop:step]
# print(string1[2:1:-1])
# slicing is a method to "play around" with a string,
# you can give parameters where to start the print for example, where to end,
# the steps and work around with it.
# 2.What does string concatenation mean?
#... | true |
3032c7ba41e086d2be4463e79978bd6647999c9d | Python | LingB94/Target-Offer | /38字符串的排列.py | UTF-8 | 705 | 3.4375 | 3 | [] | no_license | import itertools
def permutation(s):
if(not s):
return None
if(len(s) == 1):
return list(s)
l = list(s)
l.sort()
result = []
for i in range(len(l)):
if(i > 0 and l[i] == l[i-1]):
continue
part2 = permutation(''.join(l[:i]) +''.join(l[i+1:])... | true |
4abccf85bd6f8260e50eab8719e86522518a3ad3 | Python | alicebalayan/COMP942 | /jackson_Garcia/Insertion_Sort.py | UTF-8 | 848 | 4.5 | 4 | [] | no_license | #Function receiving an array
def insertion_sort(List):
#for loop from 1 to length of list
for i in range(1, len(List)):
#Getting element from list.
curNum = List[i]
#starts at 0, then increments by -1,to end at -1
for j in range(i-1, -1, -1 ):
#If Comparing number is greater than... | true |
aa284d3483c7c921fb5d7e146a2fbe6837c91b0c | Python | rwpenney/santp | /mkntpgeo | UTF-8 | 2,974 | 2.9375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | #!/usr/bin/python3
# Convert country data into template NTP host list in JSON format
# RW Penney, January 2016
# Countries of World data from http://www.opengeocode.org/download.php
import argparse, csv, json, math
from collections import namedtuple
COWsummary = namedtuple('COWsummary',
('nam... | true |
01d9cadb83f9aa3a89acc294385015b771baf959 | Python | achonor/FightLandlord | /Server/functions.py | UTF-8 | 2,290 | 2.78125 | 3 | [] | no_license | #!usr/bin/env python
#coding=utf-8
import time
import copy
import random
import functools
from proto import cmd_pb2
TIMEOFFSET = 0
poker = [516, 616, 13, 14, 15, 16, 17, 18, 19, 110, 111, 112, 113, 114, 115, 23, 24, 25, 26, 27, 28, 29, 210, 211, 212, 213, 214, 215, 33, 34, 35, 36, 37, 38, 39, 310, 311, 312, 313, 314, ... | true |
f86795196d0325e82f8ffa7e5d2b592ab44733bf | Python | Michieldoesburg/cyber_data_analytics | /assignment3/packet.py | UTF-8 | 1,798 | 2.703125 | 3 | [] | no_license | from pandas import datetime
class packet(object):
def __init__(self, _start_time, _durat, _protocol, _src, _dst, _flags, _tos, _packets, _bytes, _flows, _label):
self.dateformat = '%Y-%m-%d %H:%M:%S.%f'
self.start = datetime.strptime(_start_time, self.dateformat)
self.duration = float(_dur... | true |
e40c1cee6e03963842189465eb5d3e358bf900fd | Python | Procesamiento-imagenes-20212/mini_proyecto_01 | /main_201912614_201914966.py | UTF-8 | 2,810 | 3.296875 | 3 | [] | no_license | import os
import shutil
import glob
import cv2
import matplotlib.pyplot as plt
def abrir_imagen(ruta):
return cv2.imread(ruta)
def es_elefante(num_imagen):
handle_gt1 = open(os.path.join("data_mp1", "elephants_dataset", "gt1", "gt1.csv"))
linea = handle_gt1.readline()
while len(linea) > 0:
i... | true |
7efb1870c469a7992cbf18f4854d3641c7e80851 | Python | vishalbelsare/graphlou | /graphlou/utilities.py | UTF-8 | 1,423 | 3 | 3 | [
"MIT"
] | permissive | def get_lt_adj_matrix_entry(i, j, adj_matrix):
# lt = left-triangular
if len(adj_matrix[i]) <= j:
return adj_matrix[j][i]
return adj_matrix[i][j]
def create_adj_matrix_for_comms(adj_matrix, partition, starting_node):
comm_adj_matrix = []
buffer_edge_vecs = [[0.0] for _ in range(starting_n... | true |
c31e0655ff95506fa924c93afcbaab63e8df797e | Python | raiders032/PS | /python/BOJ/2XXX/2290.py | UTF-8 | 1,726 | 3.359375 | 3 | [] | no_license | """
2290.LCD Test
실버2
구현
풀이1. 68ms
"""
import sys
def paint_1(idx, num):
if num == 1 or num == 4:
return
for i in range(s):
lcd[0][idx * (s + 3) + 1 + i] = '-'
def paint_2(idx, num):
if num == 1 or num == 2 or num == 3 or num == 7:
for i in range(s):
lcd[1 + i][idx * ... | true |
4079b00399159eeb2727f2c49806fe6f3ed0da95 | Python | younheeJang/pythonPractice | /data_structure/python_centered/tuple.py | UTF-8 | 317 | 4.125 | 4 | [] | no_license | tuple1 = ();
tuple2 = (1, 2, 3, 4, 5 );
tuple3 = "a", "b", "c", "d";
print(tuple1);
print(tuple2);
print(tuple3);
#첫번째와 두번째의 차이.
#값만 출력 : 1
print(tuple2[0])
#자료형 그 자체로 출력됨. 같은 값이지만, : (1,)
print(tuple2[:1])
print(tuple3[1:5])
del tuple2
print(tuple2) | true |
50e486c8162d9a71b78bfa23565e87877cad7573 | Python | chankruze/challenges | /sololearn/IsogramDetector/IsogramDetector.py | UTF-8 | 255 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python
word = list(str(input()))
hit = 0
for char in word:
index = word.index(char) + 1
if index < len(word):
if char in word[index:len(word)]:
hit += 1
if hit != 0:
print("false")
else:
print("true") | true |
dafb6d6365cdf0ef43356d9065a3fc728fdb0b39 | Python | rpatil524/rltk | /rltk/io/writer/writer.py | UTF-8 | 384 | 2.75 | 3 | [
"MIT"
] | permissive | import io
class Writer(object):
"""
Writer.
"""
def __init__(self):
pass
def write(self):
"""
Write content.
"""
raise NotImplementedError
def __del__(self):
"""
Same to :meth:`close`.
"""
self.close()
def close(sel... | true |
0a8258c3ad101bfe175589c7a4e35c8e41541f0a | Python | ShantanuBal/Code | /HackerEarth/Lendingkart/will_rick_survive2.py | UTF-8 | 551 | 2.828125 | 3 | [] | no_license | def check(a):
count = 0; i = 1
#print a
while i < len(a):
if a[i]:
count += 1
if not count % 6:
a = a[2:] + [0,0]
a[i-2] -= 1
i -= 2
else:
a = a[1:] + [0]
a[i-1] -= 1
i -= 1
#print a
if a[i] > i:
print "Goodbye Rick"; print count + i; return
else:
i += 1
print "Ric... | true |
55119559c123e58a033dd3a8857b1c16b21c8971 | Python | SimHongSub/Algorithm | /programmers/chuseok_traffic.py | UTF-8 | 1,368 | 3.21875 | 3 | [] | no_license | # datetime 활용 : 추석 트래픽
from datetime import datetime, timedelta
def set_times(process, time, times):
if time in times:
times[time].append(process)
else:
times[time] = [process]
def solution(lines):
answer = 0
processes = [0 for i in range(len(lines))]
times = {}
for i in ra... | true |
c02fbd8b499e1480ab295972d14916c159029087 | Python | svetlana21/Tweet-sentiment-analysis | /tweet_sent_analysis.py | UTF-8 | 4,990 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import xml.etree.ElementTree as et
import numpy as np
import pickle
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import linear_model
from sklearn.metrics import classification_report
from sklearn.metr... | true |
cdc990a61c09d8fa621801dbce98b6a9e4b91d57 | Python | albertcrowley/py-mancala | /evolver.py | UTF-8 | 4,365 | 3.28125 | 3 | [] | no_license | from mancala import Board
from brain import Brain
from math import floor
from numpy import average
class Evolver:
verbosity = 0
scores = []
rounds = []
full_game_list = []
avg_generation = 1
uniques = 0
def getStats(self):
return {
"games played" : len(self.full_game_... | true |
610c47694f5d67aa5fe55230bbe81feeb9118061 | Python | gohkh/advent-of-code | /2019/02/2-1.py | UTF-8 | 443 | 3.453125 | 3 | [] | no_license | with open("2.txt", 'r') as f:
program = f.readlines()[0]
program = [int(x) for x in program.split(",")]
program[1] = 12
program[2] = 2
i = 0
while not program[i] == 99:
x = program[i+1]
y = program[i+2]
z = program[i+3]
if program[i] == 1:
program[z] = program[x] + program[y]
elif pro... | true |
f5e071a8a8e6e23ec46721cac553e63471a34f1f | Python | MinecraftDawn/LeetCode | /Medium/12. Integer to Roman.py | UTF-8 | 1,177 | 3.34375 | 3 | [] | no_license | class Solution:
def intToRoman(self, num: int) -> str:
roman = ''
unit = {1:('I','V','X'),
2:('X','L','C'),
3:('C','D','M'),
4:('M','_','_')}
for i in range(1,5):
if num == 0:
return roman
... | true |
57512d4f8c2cded0e04da657dbc01ffd14b721c8 | Python | brentvollebregt/nitratine.net | /nitratine/tools/new_post.py | UTF-8 | 2,018 | 2.984375 | 3 | [] | no_license | import os
import string
import time
from urllib.parse import quote_plus
from ..config import POST_SOURCE, POST_FILENAME, POST_EXTENSION
from ..site import posts
def new_post():
""" Automatically setup a new posts file structure """
title = input('Title: ')
post_id = quote_plus(''.join(
[i for i i... | true |
b69b663dc68ef604a68b31f6baaa87816f64ab84 | Python | Akitsuyoshi/CarND-Advanced-Lane-Lines | /helper.py | UTF-8 | 12,342 | 2.796875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import cv2
def plot_two_image(image_1, image_2, title_1, title_2):
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image_1)
ax1.set_title(title_1, fontsize=50)
ax2.imshow(image_2)
ax2.set_title(title_2, fontsize... | true |
1cf45df61f579e60316e06e81b1566213c3bbfa4 | Python | akshirapov/think-python | /05-conditionals-and-recursion/ex_5_14_2.py | UTF-8 | 832 | 4.625 | 5 | [] | no_license | # -*- coding: utf-8 -*-
"""
This module contains a code for ex.2 related to ch.5.14 of
Think Python, 2nd Edition
by Allen Downey
http://thinkpython2.com
"""
def check_fermat(a, b, c, n):
"""Checks to see if Fermat's theorem holds.
:param a: positive int
:param b: positive int
:param c: positive int
... | true |
e7c205ab8e58996a9dcaa428574c7c95ba291a20 | Python | bhavanshu-1112/Python-Programming | /operator greater.py | UTF-8 | 291 | 3.78125 | 4 | [] | no_license | class A:
def __init__(self, a):
self.a = a
def __gt__(self, other):
if(self.a>other.a):
return True
else:
return False
ob1 = A(222)
ob2 = A(3)
if(ob1>ob2):
print("ob1 is greater than ob2")
else:
print("ob2 is greater than ob1") | true |
a35e5ac0b6273e240d21afa8eb8d712f978fa087 | Python | RomanVlasenko/adaptive-python | /5_4_Roman_number_to_decimal.py | UTF-8 | 349 | 3.21875 | 3 | [] | no_license | numbers = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
def convert(s):
total = 0
last = 0
for n in map(lambda c: numbers[c], reversed(list(s))):
if n >= last:
total += n
last = n
else:
total -= n
last = n
return tot... | true |
047fa750f9070fa3e097863d73777598619a5a65 | Python | ritata12/test_automation | /features/steps/Login and verify locations presented on opening page .py | UTF-8 | 1,564 | 2.6875 | 3 | [] | no_license | # from behave import then
# from selenium.webdriver.common.by import By
# from time import sleep
#
# ALL_LOCATIONS = (By.CSS_SELECTOR, 'div.obiq-flat-list.obiq-overlay-spinner')
# ACTIONS_LABEL = (By.CSS_SELECTOR, 'div.grouped-openings__options-container')
#
#
# @then("Every location on the page has 'applicants in proc... | true |
bf2f9f51636897373621a1dcd48c511c710a7a0e | Python | Phoenix465/pyosu | /osuSRCalculator/Skills/Speed.py | UTF-8 | 1,712 | 3.140625 | 3 | [] | no_license | from .Skill import Skill
from ..Objects.osu.HitObjects.DifficultyHitObject import DifficultyHitObject
from math import pi, sin
class Speed(Skill):
angle_bonus_begin = 5 * pi / 6
pi_over_4 = pi / 4
pi_over_2 = pi / 2
min_speed_bonus = 75
max_speed_bonus = 45
speed_balancing_factor = 40
def... | true |
5bea97168283519db09f52dcc45c72eb1cad643e | Python | lonely7345/sklearn-demo | /plot_digits_classification.py | UTF-8 | 1,980 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 作者: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# 协议: BSD 3 clause
# Python标准科学计算包导入
import matplotlib.pyplot as plt
# 导入数据集,分类器和评估度量
from sklearn import datasets, svm, metrics
# 数字数据集
digits = datasets.load_digits()
#数据是一个8x8的数字图像,让我们先看看开头的三张图像.图像存储在数据集
#的`images`属性中,如果我们要加载图像文... | true |
4448bd38d71a1ef9cbd9511e787c602bf35f563a | Python | stupidchen/leetcode | /src/leetcode/P921.py | UTF-8 | 481 | 2.984375 | 3 | [] | no_license | class Solution:
def minAddToMakeValid(self, S):
"""
:type S: str
:rtype: int
"""
l = 0
r = 0
ret = 0
for s in S:
if s == '(':
l += 1
else:
r += 1
if l < r:
ret += 1
... | true |
ed1b8db1ee8c01c668c9aebbeadecefd95e966f5 | Python | mrkanet/alg_analysis | /finals/2/2.py | UTF-8 | 1,937 | 3.171875 | 3 | [] | no_license | import random
def cr_vector(n):
vec = []
for i in range(n):
vec.append(random.randint(0,10))
## print(vec)
return vec
def sc_mul_vectors(v1,v2):
_len = len(v1)
if(_len > len(v2)):
_len = len(v2)
mul = 0
for i in range(_len):
mul += v1[i]*v2[i]
return mul
def... | true |
0df2ce195ae80dda790e911c0f96d3b12a012745 | Python | 664120817/python-test | /web+多线程/Socker/application/app.py | UTF-8 | 1,685 | 2.6875 | 3 | [] | no_license | from application import utils
def parse_request(new_client_socket,ip_port):
# 接收客户端浏览器发送的请求
request_data = new_client_socket.recv(1024)
# 判断协议是否为空
if not request_data:
print("{}客户端已下线".format(ip_port))
new_client_socket.close()
return
# 根据客户端浏览器请求的资源路径,返回请求资源,
# 1,把请求协议解码... | true |
a230fca30c6601691327b0e581114c15eaa556de | Python | fressive/koe-server | /src/model/file.py | UTF-8 | 1,520 | 2.578125 | 3 | [
"MIT"
] | permissive | from mongoengine import *
from enum import Enum
from datetime import datetime
from model.config import Config
from util.file_provider import FileProvider
import hashlib
class FileType(Enum):
image = "image"
audio = "audio"
others = "others"
@staticmethod
def parse_from_content_type(content_type):... | true |
1c06bd57d0b78c77a3ace19ae82e64be2e5e03f2 | Python | CarlVillachica/trabajoiapresentar | /legacy_code/perceptual_class.py | UTF-8 | 3,007 | 2.828125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
def L2_loss(x, y):
loss = tf.reduce_mean(tf.square(x - y))
return loss
class Vgg16_perceptual_loss(tf.keras.Model):
def __init__(self, class_vgg16):
super(Vgg16_perceptual_loss, self).__init__(name='Vgg16_perceptual_loss')
# self.vgg16 = Vgg16_class()
self... | true |
d33ce952f1935f0f63fa9a60b8ffc7c575d5b42e | Python | georgem20-meet/Y2L-Flask-Routing | /databases.py | UTF-8 | 1,315 | 2.609375 | 3 | [] | no_license | from model import Base, Product, Cart
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///database.db')
Base.metadata.create_all(engine)
DBSession = sessionmaker(bind=engine)
session = DBSession()
def add_product(Name, Price, Picture_Link, Description):
... | true |
a0cd22091f44433edc5d35acf0e58889317f09b1 | Python | harryQAQ/leetcode | /79.py | UTF-8 | 1,228 | 3.046875 | 3 | [] | no_license | from typing import List
class Solution:
def exist(self, board: List[List[str]], word: str) -> bool:
if not board: return False
if not word: return True
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
m, n = len(board), len(board[0])
self.flag = False
def dfs(tmp_str, x... | true |
4da2ed9288a4e3d4121f26ab898f08e812424886 | Python | BryceEarner/YC-PCA | /PCA.py | UTF-8 | 5,838 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
import quandl
quandl.ApiConfig.api_key = "YOUR KEY HERE"
def get_quandl_data(source='USTREASURY', table='YIELD', start_date='2020-06-1',
end_date=datetime.today().strftime("%Y-%m-%d")):... | true |
40555fd64615580c0fa94c11436f6758b3ca0f71 | Python | FawcettSimiyu/CI-CD-Django | /InvoiceEngineApp/models.py | UTF-8 | 3,250 | 2.6875 | 3 | [] | no_license | from django.db import models
class Tenancy(models.Model):
"""The tenancy defines the organization using the model. All other classes will have an (indirect) reference to the
tenancy, in order to keep track of who is allowed to access the data.
A tenant can manage multiple companies, but one company cann... | true |
312df95f9912c671b3caf5409231ab72d0b81abb | Python | djgriz24/sloan-2019-scraping-code | /p_fangraphs.py | UTF-8 | 2,195 | 3.046875 | 3 | [] | no_license | """
Scrapes FanGraphs top 100 (132, really) prospects list
"""
import csv
from urllib import parse
from requests_html import HTMLSession
SYSTEM_ID = 'fg'
URL = 'https://blogs.fangraphs.com/2019-top-100-prospects/'
def scrape_fg():
"""Extracts player data from FG
"""
# requests are made within a sessi... | true |
d819556f5d248ea12d08b830e6dbc14ae2953000 | Python | chris-greening/coinbase-portfolio | /portfolio.py | UTF-8 | 2,123 | 2.75 | 3 | [
"MIT"
] | permissive | # Author: Chris Greening
# Date: 02/19/2021
# Purpose: Coinbase portfolio contents
from coinbase.wallet.client import Client
import pandas as pd
from wallet import Wallet
class Portfolio:
def __init__(self):
self.client = Client(Portfolio.api_key, Portfolio.api_secret)
self.accounts = self.cl... | true |
4dc02f7e5d493ec0b92fb93d68a5c33b1dcecb7a | Python | jtlai0921/Pi_Python-master | /smart_house/Distance_sensor.py | UTF-8 | 219 | 2.890625 | 3 | [] | no_license | from RPi import GPIO
from gpiozero import DistanceSensor
from time import sleep
sensor = DistanceSensor(23, 24) # echo, trig
while True:
print('Distance to nearest object is', sensor.distance, 'm')
sleep(0.5)
| true |
3f3d8df8abddf8d2c35fdc46a51699dea9ce778a | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_8/mclemi002/question1.py | UTF-8 | 324 | 4.0625 | 4 | [] | no_license | """emile mclennan
6/5/14
A8 Q1"""
def palindrome(s):
if s == '':
print("Palindrome!")
else:
if (ord(s[0]) - ord(s[len(s)-1])) == 0:
return palindrome(s[1:len(s)-1])
else:
print("Not a palindrome!")
word = input("Enter a string:\n")
pali... | true |
ac7ae9e9ee833a224fad3af53074bee6ae1dc5dc | Python | Khan/khan-linter | /contrib/flex_lint.py | UTF-8 | 1,585 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | """Lint rules to make sure we don't add GAE features missing from Flex.
We are planning to move our codebase from AppEngine Classic to
AppEngine Flex. As we go through that process, we'll be
removing/rewriting API calls that are classic-specific, and don't
exist in appengine flex. We want to make sure people don't a... | true |
3e97623f803875706cb230b37b67ce57a8fea775 | Python | 3school5me/cti110 | /M5HW1_TestGrades_NigelGonzaga.py | UTF-8 | 1,366 | 4.375 | 4 | [] | no_license | # Test grade averager.
# 9 July 17
# CTI-110 M5HW1 - Test Average and Grade
# Nigel Gonzaga
#Define Main Function
def main():
avg=calc_average()
determine_grade(avg)
#Function that calculates the average of a user's input.
def calc_average():
List=[]
print('''This Program will ask for 5 tes... | true |
ab6a1899abd13473dabb4eed1391eeb0fa8fc3c6 | Python | kylin-zhuo/data-structure-algorithms | /interview-questions/hackerrank/manager_score.py | UTF-8 | 537 | 2.890625 | 3 | [] | no_license | from collections import defaultdict
def manager_score(n, data):
# employee id from 0 to n-1
scores = [0] * n
subordinates = defaultdict(set)
roots = []
for i, d in enumerate(data):
scores[i] = d[0]
if d[1] == -1:
roots.append(i)
else:
subordinates[d[1]].add(i)
def dfs(node):
# if the employee has... | true |
59f3bdc26bf39c40a9e4b8f41395a95558a526ea | Python | rejector7/python_interview | /leetcode/75.py | UTF-8 | 647 | 3.109375 | 3 | [] | no_license | from collections import defaultdict
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
colors = defaultdict(int)
for i in nums:
if i == 0:
colors[0] += 1
if i == ... | true |
94d1a468537e6b584ab8a1306da93f7827e229b8 | Python | nam685/cosplade | /corpus/sub_id.py | UTF-8 | 755 | 2.734375 | 3 | [] | no_license | from tqdm import tqdm
import sys
if len(sys.argv)!=4:
print("python sub_id <source_tsv> <dest_tsv> <id_file>")
exit(1)
source_tsv = sys.argv[1]
dest_tsv = sys.argv[2]
id_file = sys.argv[3]
i = 0
with open(source_tsv,'r') as source:
with open(dest_tsv,'w') as dest:
with open(id_file,'w') a... | true |
4047ed1698b9a0be9ee0184301c5e5232cf1c518 | Python | maxha97/2020-BigDataCampus-Analysis | /2.카카오맵장소데이터크롤링.py | UTF-8 | 3,921 | 2.671875 | 3 | [] | no_license | import requests
import json
import pandas as pd
from selenium import webdriver
import time
from bs4 import BeautifulSoup
import re
import pickle
import openpyxl
import csv
apiKey = '5f4076c674c97ee9f612217f9e843f6c'
location_name = []
f = open("서울지명.csv", 'r', encoding='utf-8')
rdr = csv.reader(f)
i ... | true |
cf09a47eff15d3e292d47a7d817baf071d9ceb85 | Python | yash-khandelwal/python-wizard | /python the next level/decorators.py | UTF-8 | 552 | 3.9375 | 4 | [] | no_license | # demonstration of state management by decorators
# decorators manages states of different functions differently
def history(func):
return_values = set()
def wrapper(*args, **kwargs):
return_value = func(*args, **kwargs)
return_values.add(return_value)
print(f'Return Values: {str(sorted(return_values))}... | true |
1bb8dc91c179152d02abd57f2260c5fef51c1e18 | Python | yadac/PythonApplication2 | /PythonApplication2/scrapingSample.py | UTF-8 | 767 | 3 | 3 | [] | no_license | import re
with open("python-site.html", encoding="utf-8") as f:
html = f.read()
# retrieve href attribute
# <a href="xxx"></a>
try:
for row in re.findall(r"<a.*?</a>", html, re.DOTALL):
# change expression from text
url = re.search(r"href=[\"'](.*?)[\"']", row).group(1)
print(url)
except AttributeError as e:
... | true |
52eeda14d6b244b4f33e9419a2bb6e50070b231d | Python | HERMANNITY/EECS349 | /hw2/PS2/PS2/PS2.code/graph.py | UTF-8 | 3,424 | 2.875 | 3 | [] | no_license | from random import shuffle
from ID3 import *
from operator import xor
from parse import parse
import matplotlib.pyplot as plt
import os.path
from pruning import validation_accuracy
import random
import copy
# NOTE: these functions are just for your reference, you will NOT be graded on their output
# so you ... | true |
29783821e1080b698965b0ce24c564ecc0305443 | Python | TrendingTechnology/apysc | /tests/type/test_value_util.py | UTF-8 | 3,193 | 3.015625 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | from random import randint
from retrying import retry
from apysc import Array
from apysc import Int
from apysc.type import value_util
from tests.testing_helper import assert_raises
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_get_value_str_for_expression() -> None:
int_v... | true |
ccfc12dbcbab13d9a403e32de21c4f26c602d544 | Python | craigderington/django-drf-examples | /drfexample/bookmarks/models.py | UTF-8 | 1,173 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from django.db import models
from string import ascii_lowercase, digits
from random import choices
class Bookmark(models.Model):
name = models.CharField(max_length=255, null=False, blank=False)
full_url = models.CharField(max_length=255, null=False, blank=False)
short_url = models.CharField(max_length=50,... | true |
9baac79669d97ae80b2c5a2bd2abe9e31e95cbfa | Python | aleclearmind/revng-orchestra | /test/utils/metadata.py | UTF-8 | 433 | 2.8125 | 3 | [] | no_license | def compare_metadata(actual_value, expected_value):
"""Compares the installed metadata against an expected value, ignoring attributes that have no importance for the
testsuite"""
# Test JSON metadata
ignore_keys = [
"install_time",
]
# Exclude those keys from the comparison, but ensure t... | true |
bc61f1614bfba83a70132b1070e29fb4476d55fc | Python | robert-alfaro/genius-lyrics | /custom_components/genius_lyrics/helpers.py | UTF-8 | 411 | 2.703125 | 3 | [] | no_license | """Helpers for the Genius Lyrics integration"""
import logging
_LOGGER = logging.getLogger(__name__)
def entities_exist(hass, entities):
"""Returns list of entities that exist in hass"""
exist = []
for entity in entities:
if hass.states.get(entity) is None:
_LOGGER.error(f"entity_id... | true |
7c20ca4a025e9c06987b8d16dcc9a1875919ae44 | Python | kaviraj333/kavin | /Tocheckrepetationofk.py | UTF-8 | 150 | 2.953125 | 3 | [] | no_license | n,k=map(int,input().split())
sum1=0
x=[int(i) for i in input().split()]
for i in range(0,n):
if(k==x[i]):
sum1=sum1+1
print(sum1)
| true |
3bb5ffbb17cbf62a9af00e4e2e503c480fb64712 | Python | luizirber/sourmash | /src/sourmash/cli/tax/genome.py | UTF-8 | 4,616 | 2.828125 | 3 | [
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | """classify genomes from gather results"""
usage="""
sourmash tax genome --gather-csv <gather_csv> [ ... ] --taxonomy-csv <taxonomy-csv> [ ... ]
The 'tax genome' command reads in genome gather result CSVs and reports likely
classification for each query genome.
By default, classification uses a containment thre... | true |
c58c446927fea1e0f02f577b520af8d74e44ae15 | Python | Hertin/espnet | /egs/low-resource-language/asr1-slavic/local/normalize_or_remove_text_cgn.py | UTF-8 | 1,872 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
from argparse import ArgumentParser
from pathlib import Path
from shutil import move
from sys import stderr
import regex as re
number = re.compile(r"\d")
# Match every punctuation besides hyphens
# https://stackoverflow.com/questions/21209024/
# python-regex-remove-all-punctuation-except-hyphen... | true |
8d47e00ba2bcfe4ef13030f1544c0034fcae2899 | Python | gammasts/attention-ocr | /aocr/util/visualizations.py | UTF-8 | 6,147 | 2.6875 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import
from __future__ import division
import math
import os
from io import BytesIO
import numpy as np
from PIL import Image
def visualize_attention(filename, output_dir, attentions, pred, pad_width,
pad_height, threshold=1, normalize=False,
... | true |
433ec9746cfe4317f913e66c915fbaf562282034 | Python | fusa-development/programa-merceria | /bbdd/leer_ruta_BD.py | UTF-8 | 219 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
def leer_ruta():
manejador=open(".ruta_db.csv","r")
manejador_csv=csv.reader(manejador)
for ruta in manejador_csv:
pass
manejador.close()
return ruta[0]
| true |
29cb2fad9292b00d01c59042b44d813c7ce2bd34 | Python | okeangel/python-project-lvl1 | /brain_games/engine.py | UTF-8 | 1,272 | 4.0625 | 4 | [
"MIT"
] | permissive | """Provide main game flow."""
import prompt
def welcome_user() -> str:
"""Get user name from input.
Returns:
user name.
"""
print('Welcome to the Brain Games!')
name = prompt.string('May I have your name? ')
print('Hello, {0}!'.format(name))
return name
def play(game, rounds: i... | true |
9766e789ac7456f17a845624df8aaaf8bf2df6e3 | Python | kesakeerthi/Linear_Regression | /app.py | UTF-8 | 3,031 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 2020
@author: Sai Keerthi
"""
import pickle
import pandas as pd
from flask import Flask, request
from flask_cors import CORS,cross_origin
from flasgger import Swagger
app = Flask(__name__)
Swagger(app)
pickle_in = open("scaler.pkl", "rb")
scaler = pickle... | true |
75294330f573511d23cce2d4c8e7445381867d19 | Python | TarodBOFH/scripts | /series_renamer2.py | UTF-8 | 4,800 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
#### Series Renamer
# Rename Series files based on the args supplied
#
import glob, os, re, sys, argparse, textwrap,shutil
def main(argv):
src_dir = ''
sample_fileName = ''
series_name = ''
replace_dots = False
delete_double_spaces = True
title = False
season = None
parser = argparse... | true |
d758eea8e96f2852639a7112effd7f49329397fa | Python | Aasthaengg/IBMdataset | /Python_codes/p03129/s308778370.py | UTF-8 | 111 | 2.65625 | 3 | [] | no_license | #Anti-Adjacency
N,K = map(int,input().split())
j = N//2 + N%2
if K <= j:
print("YES")
else:
print("NO") | true |
7665a0d68b957d6ac23f9b22cca987d325a5ff88 | Python | jennyivy/jenny_master | /calculate_ks.py | UTF-8 | 2,866 | 2.703125 | 3 | [] | no_license | #/usr/bin/env python
# -*- coding: utf-8 -*-
'''
> File Name: calculate_KS.py
> Author: rick
> Mail: xurui@herobt.com
> Created Time: Wed 11 Dec 2017 16:19:05 PM CST
'''
import csv
import string
import math
def load_scores(in_file):
inputs = csv.reader(open(in_file, 'rb'))
score_list = []
... | true |
2dbdcc235d49af6781147eb8d4e2797b70286eb2 | Python | maxmarchuk/word-vowel-consonant-analyzer | /vowel_consonant_counter.py | UTF-8 | 1,021 | 3.46875 | 3 | [] | no_license | #!/usr/local/bin/python3
def find(words):
vowels = ['a', 'e', 'i', 'o', 'u']
consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']
vowel_counts = {}
consonant_counts = {}
invalid_characters = {}
#intialize vowels
for v i... | true |
9c5482e937d82262e96a18c4852678719a6743b0 | Python | bklimt/nebulate | /flickr_download_files.py | UTF-8 | 804 | 2.546875 | 3 | [] | no_license |
import errno
import json
import os
import os.path
import urllib
try:
os.mkdir("./flickr_photos")
except OSError, err:
if err.errno != errno.EEXIST:
raise
filenames = os.listdir("./flickr/")
total = len(filenames)
for i, filename in enumerate(filenames):
print "File %d of %d" % (i, total)
f = file("./fli... | true |
9f14b8433fa1153ec384298f8e1cb7dc782c82bc | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc036/B/4095227.py | UTF-8 | 380 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
N = int(input())
h = [int(input()) for _ in range(N)]
ans = 0
for t in range(N):
if t > 0 and h[t - 1] >= h[t]:
continue
if t < N - 1 and h[t] <= h[t + 1]:
continue
s = t
while s > 0 and h[s - 1] < h[s]:
s -= 1
u = t
while u < N - 1 and h[u] > h[u +... | true |
1366f4170b7d888595c357943fd6ab53a3d8894b | Python | d930336/NTUBproject | /0927_KFC_crawl/insert_mysql.py | UTF-8 | 3,023 | 2.828125 | 3 | [] | no_license | import mysql.connector
import datetime
class Set_Mysql():
def __init__(self,_id,_title,_class,_content , _conn , _db):
self._id = _id
self._title = _title
self._class = _class
self._content = _content
self._conn = _conn
self._db = _db
def Connect_To_Sql(self):
... | true |
5e87a58372df8642ec1f4b842cf20aa86147ed85 | Python | silky/bell-ppls | /env/lib/python2.7/site-packages/observations/r/epi.py | UTF-8 | 3,633 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def epi(path):
"""Eysenck Personality Inventory (EPI) data for 3570 parti... | true |
dcec4d2c84d8c2859c52860c9caa00bb41d92e43 | Python | aritraaaa/Competitive_Programming | /Contests/CF1343/1343A.py | UTF-8 | 355 | 2.75 | 3 | [
"MIT"
] | permissive | from bisect import bisect_left as bs
def prefetch():
lis = []
s = 0
p = 0
x = 0
while s < 10**9:
s += (2**p)
p += 1
lis.append(s)
return lis
def main():
lhs = prefetch()
for _ in range(int(input())):
n = int(input().strip())
ind = bs(lhs, n)
for i in range(ind, -1, -1):
if(n % lhs[i] == 0):
... | true |
9e58f8c30617f4d984464a4c70fc16143c20be57 | Python | ValerieNayak/CodingInterview | /arrays_and_strings/question1.1.py | UTF-8 | 321 | 3.765625 | 4 | [] | no_license | # Valerie Nayak
# 4/2/2020
# Cracking the Coding Interview, p. 90
# 1.1: Is Unique
def is_unique(my_str):
chars = set()
for c in my_str:
if c in chars:
return False
else:
chars.add(c)
return True
print(is_unique('abcd'))
print(is_unique('apricot'))
print(is_unique('... | true |
d2026d711bb1ee53a3adc80b45e43ec5a037e920 | Python | keshavkummari/KT_PYTHON_6AM_June19 | /OOPS/poly.py | UTF-8 | 1,020 | 3.859375 | 4 | [] | no_license | class India():
def capital(self):
print("New Delhi")
def language(self):
print("Hindi")
def type(self):
print("Developing")
class USA():
def capital(self):
print("Washington DC")
def language(self):
print("English")
def type(self):
print("De... | true |
0d2a25a882ed2a286f47b63b71c916ad92e2595f | Python | BurnsAndy/aoc-2020 | /3-1/3-1.py | UTF-8 | 653 | 2.953125 | 3 | [] | no_license | #Get info from file
with open("input.txt", "r") as file:
fieldTemplate = [line.strip() for line in file]
field = fieldTemplate
sledPos = [0, 0]
slope = [3, 1]
treeCount = 0
while True:
sledPos[0] += slope[0]
sledPos[1] += slope[1]
if(sledPos[0] > len(field[0])):
for x in range (0,len(field)):
field[x] ... | true |
4395e4a71c99124b12768e0a3aa372325496b737 | Python | Jamshid93/Pytho_Crash_Couse | /Chapter 5/testing.py | UTF-8 | 653 | 2.734375 | 3 | [] | no_license | # bu yerda endi elifni ishlatib bo'lmaydigan xolatlarni ko'ramiz
# deylik bizga bitta pizza larni nomidan iborat list berilgan desak, umuman biron bir odam pizzani buyurtma bermoqchi bo'lsa
# unda elifni ishlatib bo'maydi sababi unda agar elifni ishlatsak faqat birinchisini chiqarib beraveradi
# shu uchun unday xolatla... | true |
7f35a05d6b8bbaa80217c20f19f80b587cfd5f56 | Python | Aasthaengg/IBMdataset | /Python_codes/p03424/s837677828.py | UTF-8 | 185 | 3.140625 | 3 | [] | no_license | N = int(input())
S = list(input().split())
dic = {}
for i in range(N):
if S[i] in dic:
dic[S[i]]+=1
else:
dic[S[i]]=0
print("Four" if len(dic)==4 else "Three") | true |
f137ebe20a2777264baf56a80f1802fe7d275c65 | Python | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/sort/f9e38ff2-e522-4799-8de9-14ded242c7c4__containsNearbyAlmostDuplicate.py | UTF-8 | 790 | 3.28125 | 3 | [] | no_license | class Solution:
# @param {integer[]} nums
# @param {integer} k
# @param {integer} t
# @return {boolean}
def containsNearbyAlmostDuplicate(self, nums, k, t):
if len(nums) == 0:
return False
sorted_array = []
for idx in range(len(nums)):
sor... | true |
9fca76147e91d300d809310c2ff7474bd351f399 | Python | astralis12/python | /course1.py | UTF-8 | 168 | 3.921875 | 4 | [] | no_license | angka1 = float(input('masukan angka pertama:'))
angka2 = float(input('masukan angka kedua:'))
print (f'angka pertama adalah {angka1} dan angka kedua adalah {angka2}')
| true |
bce7a4424209103c3db6e43b596185c94e844530 | Python | flying-sheep/typehinting | /prototyping/test_typing.py | UTF-8 | 21,702 | 2.6875 | 3 | [] | no_license | from unittest import TestCase, mock
from typing import Any
from typing import TypeVar, T, KT, VT, AnyStr
from typing import Union, Optional
from typing import Tuple
from typing import Callable
from typing import Generic
from typing import Undefined
from typing import cast
class Employee:
pass
class Manager(Emp... | true |
90b4398391399914c1e5afa065a6a330ac0cc319 | Python | SarthakDeora/Python-Course-2 | /Exercise_6.py | UTF-8 | 1,767 | 3.65625 | 4 | [] | no_license | # Stone Paper Scissors
# Have to play 10 times
import random
i = 0
loose = 0
won = 0
print("********Play Stone Paper Scissors********")
while i != 11:
list1 = ["Stone", "Paper", "scissors"]
Options = random.choice(list1)
a = input("What do u choose(s=Stone, p=paper, c=scissors):\n")
if a == "s":# If u... | true |
8f155eee7d55207fe0a538245e52b63382221bab | Python | hakandiki/hakan-cw-workshop | /python/coding-challenges/cc-005-create-phonebook/app.py | UTF-8 | 1,739 | 4.375 | 4 | [] | no_license | #Write a program that creates a phonebook, adds requested \
# contacts to the phonebook, finds them, and removes them.
phone_dict = {}
while True:
number_input = input("Welcome to the phonebook application\n\
1. Find phone number\n\
2. Insert a phone number\n\
3. Delete a person from the phon... | true |
25bd151257076831f7fa890036eb302a2d7f8648 | Python | statunited/LC | /LC285.py | UTF-8 | 1,179 | 3.71875 | 4 | [] | no_license | """
Given a binary search tree and a node in it, find the in-order successor of that node in the BST.
Note: If the given node has no in-order successor in the tree, return null.
"""
#recursive not using BST
class Solution(object):
def inorderSuccessor(self, root, p):
"""
:type root: TreeNode
... | true |
0fe30d241ab40081a1a5209efc5bfb8ff3e8d730 | Python | senthilvkumar/PythonTutorials | /001_Harmonograph | UTF-8 | 901 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# Master Math by Coding in Python - Mike X Cohen
# Harmonograph: https://en.wikipedia.org/wiki/Harmonograph
# In[2]:
import numpy as np
import matplotlib.pyplot as plt
# In[3]:
n = 10000
t = np.logspace(np.log10(10),np.log10(500),n)
# In[4]:
A = [ 1, 1, 1.5... | true |
fe803bbe2dfb355b917e19ebce7d80a5fa30e8fa | Python | Anjalkhadka/pycharmproject | /eight.py | UTF-8 | 290 | 3.96875 | 4 | [] | no_license | '''
write a program to print the area of triangle three times.
'''
for i in range(3):
length=int(input('enter the length of the number:'))
breadth=int(input('enter the breadth of the number'))
area=(length*breadth)
print(f'the area of the triangle {length} and {breadth}')
| true |
1a335ca3e06df7644248931ca2407ccbf7094767 | Python | VladKitTort/Michael_Dawson | /4/4.10.py | UTF-8 | 888 | 3.6875 | 4 | [] | no_license | #Напишите проrрамму, которая бы считала по просьбе пользователя. Надо позволить пользователю ввести
#начапо и конец счета, а также интервал между называемыми целыми числами.
account_start = input("Напишите цифру с которой начинать счет:")
if account_start == "":
account_start = int(0)
else:
account_start = int... | true |
587dd19c76f8ade63533283fd5c10931797774c7 | Python | Svtter/Py3kAiml | /gradu/Gendict/getQuestionKey.py | UTF-8 | 1,174 | 2.84375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# coding: utf-8
'''
用于找出问题的关键词,使用简单的词典
'''
import jieba
import jieba.analyse
# jieba字典
FILE = 'test3.aiml'
TOPK = 2
jieba.load_userdict('dict.txt')
jieba.analyse.set_idf_path('idf.txt.big')
output = open(FILE, 'w')
def gentags(ele, content):
return ("<"+ele+">\n") + (content) + ("</"+... | true |
534bb31b1acd75a7820d1fb6dc3c4a2bed02a5eb | Python | jayamandavilli/Python100dayschallenge | /prime.py | UTF-8 | 187 | 3.8125 | 4 | [] | no_license | n=int(input("enter a number:"))
c=0
for i in range(1,n+1):
if n%i==0:
c+=1
if c==2:
print("it is prime",n)
else:
print("not a prime",n)
| true |
b8b4040092f0e768f19a8858e63216be630bbf1f | Python | ShughesDev/Introduction-to-Python---Plotting | /example2.py | UTF-8 | 759 | 3.90625 | 4 | [] | no_license | """
Introduction to programming in Python for plotting and data manipulation.
"""
##################imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
##################program
#get our data
data_file = "Test Data/car_data.csv"
open_file = open(data_file,"r") #open the data file
raw_... | true |
9ea1a9d32d382603d1f61afa203dc66a6d725e2b | Python | I-Agreed/Chess-Engine | /engine/pieces/PieceBase.py | UTF-8 | 1,098 | 3.28125 | 3 | [] | no_license | class PieceBase():
piece = "base"
def __init__(self, colour):
self.x = None
self.y = None
self.board = None
self.tile = None
self.image = self.piece + "_" + colour
self.colour = colour
self.hasMoved = False
self.moves = 0
self.pawnEnPassant... | true |
8353b18b894336209c380334e6844af2a18ad2ca | Python | ge-flight-analytics/emspy | /tests/test_flightphase.py | UTF-8 | 1,181 | 2.671875 | 3 | [
"MIT"
] | permissive | import pytest
from emspy.query import FlightPhase
from mock_connection import MockConnection
from mock_ems import MockEMS
import pandas as pd
@pytest.fixture(scope='session')
def query():
c = MockConnection(user='', pwd='')
FlightPhaseQuery = FlightPhase(c)
return FlightPhaseQuery
def test_data_colnames... | true |
7cd214eb4c3a5bd64a8e0b479d07a93dae077d0a | Python | pethersilva/python | /turtle/turtle-sample.py | UTF-8 | 745 | 4.03125 | 4 | [] | no_license | import turtle
def draw_shapes():
window = turtle.Screen()
window.bgcolor("white")
draw_square()
draw_circle()
draw_triangle()
window.exitonclick()
def draw_square():
leo = turtle.Turtle()
leo.shape("turtle")
leo.speed(2)
leo.color("blue")
i = 1
while(i<=4):
leo... | true |
8560cfc348ce94c85bb2b8d9c93ef657be186d58 | Python | jasmine2018jixun/leetcode2020 | /leetcode2019/merge_sort.py | UTF-8 | 882 | 3.75 | 4 | [] | no_license | def merge_sort(alist):
res = []
if len(alist)<= 1:
res.append(alist)
elif len(alist) == 2:
if alist[0] <= alist[1]:
res = alist
else:
res = alist[::-1]
else:
mid = len(alist) // 2
left = merge_sort(alist[:mid])
right = merge_sort(al... | true |
15bdbd1f0639d01c3358f22f6c781e4e47813365 | Python | andycasey/snob | /snob/slf_mixture/single.py | UTF-8 | 12,493 | 2.96875 | 3 | [
"MIT"
] | permissive |
"""
A single latent factor model.
"""
__all__ = ["SLFModel"]
import logging
import numpy as np
from scipy import optimize as op
logger = logging.getLogger("snob")
class SLFModel(object):
r"""
Model data with a single (multivatiate) latent factor.
:param threshold: [optional]
The relative imp... | true |
3690fa9dce0b82f962969198b9e4d17dd992dfee | Python | Kim-SuYeong/OGP_MasterNode | /Pygame_MainMenu.py | UTF-8 | 2,476 | 3.046875 | 3 | [] | no_license | import Pygame_Opening as Opening
from pygame.locals import *
import pygame
import sys
# 파이게임 시작하기
pygame.init()
# 프로그램 정보 지정
Screen_Width = 1280 # 가로 크기
Screen_Height = 720 # 세로 크기
Screen = pygame.display.set_mode((Screen_Width, Screen_Height))
pygame.display.set_caption("방구석 트레이너")
pygame.mouse.set_visible(False)
... | true |
5917b44a1ae0cb8d771ab5d5d027c430044c359b | Python | nikunj-taneja/pytorch-zoo | /CIFAR10/model.py | UTF-8 | 5,143 | 2.609375 | 3 | [
"MIT"
] | permissive | import torch
from torchvision import datasets
from torch import nn, optim
import torch.nn.functional as F
import torchvision.transforms as transforms
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import DataLoader
import numpy as np
train_on_gpu = torch.cuda.is_available()
if not trai... | true |
c1b16b56afbfd3f4cc9119b2cfb6cc2a35e9ea5e | Python | Leevimseppala/python | /beginner/exercise6_6.py | UTF-8 | 1,310 | 3.796875 | 4 | [] | no_license | # Kysytään käyttäjältä rajat
lowpoint = int(input("Anna alueen alaraja:\n"))
highpoint = int(input("Anna alueen yläraja:\n"))
# Luodaan kaksi boolean muuttujaa, cont ja found
cont = True
found = False
# Mennään looppiin jossa pysytään niin kauan kunnos cont = False
while cont:
# Käydään läpi jokainen luku rajojen s... | true |
ac4899a22cd161831b19d20b74bdce8761a1d923 | Python | hugohammer/Discussion-thread-analysis-ver2 | /database.py | UTF-8 | 2,988 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sqlalchemy as sa
from datetime import datetime
def facebook_table_creator(metadata):
return sa.Table('messages',metadata,\
sa.Column('post_id',sa.String(42),nullable=False),\
#sa.Column('post_id1',sa.BigInteger,autoincreme... | true |
7d2f9c70c2299d9d1dd73c6e78921ca9aec4fe7c | Python | Miksus/system-flow | /tests/test_groups/test_flow.py | UTF-8 | 1,538 | 3.234375 | 3 | [] | no_license |
import pytest
import systemflow as sf
from systemflow.core.computator import ComputatorBase
def get_stocks(n, initial_value=1):
return [
sf.Stock(f"Stock {i}",
initial_value=initial_value if isinstance(initial_value, (float, int)) else initial_value[i])
for i in range(n)
]
d... | true |
3e14d6699fc3bb16d625bf54a1fb50873febf110 | Python | krstfr/SocialMediaCapabilities | /app/blueprints/main/routes.py | UTF-8 | 1,718 | 2.6875 | 3 | [] | no_license | from flask import render_template, request, flash
import requests
from flask_login import login_required
from .import bp as main
#Routes
@main.route('/', methods=['GET'])
@login_required
def index():
#this index function will be passed through the route function
return render_template('index.html.j2')
@main.rout... | true |
4300e84eca11be9ab0a01ad63c9a3d1c30bd8223 | Python | JaxLombard/first-python-code | /Shell/MathHomework.py | UTF-8 | 379 | 4.09375 | 4 | [] | no_license | print("Your Math Homewok")
#Ask the user to enter a math problem
problem = input("Enter a math problem, or 'q' to quit: ")
# Keep going untill the user enters 'q' to quit
while (problem != "q"):
# Show the problem, and the answer using eval()
print("The answer ", problem, "is:" , eval(problem) )
problem ... | true |
9683924638e3e6b3173eecfc32fd1e9cf29baa9b | Python | citizen333/py_intermediate | /scripts/unittest_script.py | UTF-8 | 1,690 | 3.6875 | 4 | [] | no_license | # import unittest
# def factorize(x):
# """
# Factorize positive integer and return its factors.
# :type x: int,>=0
# :rtype: tuple[N],N>0
# """
# pass
class TestFactorize(unittest.TestCase):
def test_wrong_types_raise_exception(self):
for val in ['string', 1.5]:
... | true |
47f32f7741f8fffd2fdeff762f263a2d8b74466e | Python | Matheus-Mazepa/python-socket | /client.py | UTF-8 | 785 | 3.09375 | 3 | [] | no_license | import socket
import time
# Criar o socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Conectar ao servidor com ip e porta
sock.connect(('localhost', 9000))
message = ''
received_data = ''
while message != 'see ya' or received_data != 'see ya':
expected_data_size = int(sock.recv(4).decode())
... | true |