blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
d99b293ea7b3d1229ce7fd965f1002179cef267b | Python | sanderfo/IN1900 | /uke6/oscilating_spring.py | UTF-8 | 938 | 3.390625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
A = -0.3 # Setter A = -0.3 da den trekkes ned, så får i positiv retning opp
k = 4 # resten her er gitt i oppgaven
gamma = 0.15
m = 9
t_array = np.zeros(101) # Fyller arrays med nuller
y_array = np.zeros(101)
# a)
for i in range(len(t_array)): # for-loops for å fyll... | true |
498001274e57ba3e8fcc97341cc29adbd5db0f30 | Python | SibylLab/TOBE | /view/Display.py | UTF-8 | 2,167 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
__author__ = "Akalanka Galappaththi"
__email__ = "a.galappaththi@uleth.ca"
__copyright__ = "Copyright 2020, The Bug Report Summarization Project @ Sybil-Lab"
__license__ = "MIT"
__maintainer__ = "Akalanka Galappaththi"
import pprint
import json
from models.Turn import Turn
from models.Sentence ... | true |
cae780901fffd2637d9ab24aa4d5972d4d3860cf | Python | syedmeesamali/Python | /0_AI_ML_OpenCV/2_OpenCV/2_CAM/faces_train.py | UTF-8 | 1,271 | 2.890625 | 3 | [] | no_license | import os
import cv2 as cv
import numpy as np
people = ['Ahsin', 'Meesam']
DIR = r'C:\Users\SYED\Downloads\Family'
haar_cascade = cv.CascadeClassifier('haarcascade.xml')
features = []
labels = []
def create_train():
for person in people:
path = os.path.join(DIR, person)
label = people.index(perso... | true |
97c2b2af2296764f90c81d2a73d72aa7df98b120 | Python | NHPatterson/bfio | /examples/ScalableTiledTiffConverter.py | UTF-8 | 1,884 | 2.53125 | 3 | [
"MIT"
] | permissive | from bfio import BioReader, BioWriter
import math, requests
from pathlib import Path
from multiprocessing import cpu_count
""" Get an example image """
# Set up the directories
PATH = Path("data")
PATH.mkdir(parents=True, exist_ok=True)
# Download the data if it doesn't exist
URL = "https://github.com/usnistgov/WIPP/... | true |
0bc359cd7eaf4ba2213e2946fefd061d9550f4bf | Python | wing7171/biendata-competition-lizi | /generate_data.py | UTF-8 | 481 | 2.546875 | 3 | [] | no_license | import pandas as pd
from feature_engineering import calculate_feature
test_path = './jet_simple_data/simple_test_R04_jet.csv'
train_path = './jet_simple_data/simple_train_R04_jet.csv'
train = pd.read_csv(train_path,nrows=100)
test = pd.read_csv(test_path,nrows=100)
print('finish data read')
#### add features #####
... | true |
cddcfac7d61a82f05c3a7c0ff8222e4dcd567935 | Python | geoflows/D-Claw | /python/dclaw/get_data.py | UTF-8 | 2,904 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from pyclaw.data import Data
"""
Lightweight functions to get dictionaries of attributes from .data files.
KRB April 2022
"""
def get_tsunami_data(project_path, output="_output", file="settsunami.data"):
data = Data(os.path.join(project_path, output, file))
return {key: data.__dict__[key] for ke... | true |
93375196b6bb57b2c78179dfe4fb6936f9087765 | Python | Dlarej/hydroponics-controller | /components.py | UTF-8 | 2,794 | 2.796875 | 3 | [] | no_license | from enum import Enum
import ConfigParser
from exceptions import *
import abc
from abc import ABCMeta, abstractmethod
class State(Enum):
DISCONNECTED = -2
CONNECTED = -1
OFF = 0
ON = 1
class Component(object):
__metaclass__ = abc.ABCMeta
def __init__(self):
# Initialization behavior f... | true |
55c19d9dae0cb6d0645a844c8e48bf23c06c23ef | Python | wvbraun/TheLab | /python/src/data_structures/code/analysis/sumn.py | UTF-8 | 574 | 4.34375 | 4 | [] | no_license | # this function computes the sum of the first n integers.
import time
def sumOfN(n):
theSum = 0
for i in range(1, n+1):
theSum = theSum + i
return theSum
print(sumOfN(10))
def sumOfN2(n):
start = time.time()
theSum = 0
for i in range(1, n+1):
theSum = theSum + i
end... | true |
2c54a73b9ec691c1d81a693dfd29af831c7084ad | Python | HuajieSong/Python3 | /practice_day6.py | UTF-8 | 4,050 | 4.40625 | 4 | [] | no_license | #usr/bin/python3
'''
Created on Aug 28th 19:28,2018
Author by Vicky
'''
#1、输入一个正整数,输出该正整数的阶乘的值
'''result=1
result_word=''
number=int(input('please input a number: '))
for n in range(1,number+1):
result*=n
if n==number:
result_word+=str(n)
else:
result_word+=str(n)+'*'
print('%d 的阶乘为:%d'%(n... | true |
b00aca866541c99900b93207253d2e7a2fbb7444 | Python | karstendick/project-euler | /euler112/euler112.py | UTF-8 | 303 | 3.40625 | 3 | [] | no_license | #PE #112
def isbouncy(n):
s = str(n)
return list(s) != sorted(s) and list(s) != sorted(s,reverse=True)
N = 10000000
count = 0
for i in range(1,N):
if isbouncy(i):
count += 1
if count/(1.0*i) >= .99:
print(count,i,count/(1.0*i))
break
print 'Nope.'
| true |
f1d642dd663921fae3886bdaabfa75c22ea06e62 | Python | Casualrobin/youtube-playlist | /src/main.py | UTF-8 | 1,465 | 3.21875 | 3 | [] | no_license | import Validator
import keyboard
from OutputManager import OutputManager
from WebScraper import WebScraper
# url = "www.youtube.com/playlist?list=PLvdtkdCcH2D3BWrdv2yMwIJ7-ScsklImS&disable_polymer=true"
print("Hello! This application will save the track list from a YouTube playlist. Ctrl-C to exit.")
while not keybo... | true |
7a49e8a98110ff91d622fe7a3912b789a3b0cb05 | Python | undertherain/nuts-and-bolts | /mlgym/images/counting.py | UTF-8 | 2,410 | 2.515625 | 3 | [] | no_license | import numpy as np
import chainer
import chainer.functions as F
import chainer.links as L
import dagen
import dagen.image
from dagen.image.image import get_ds_counting
import PIL
from mlgym.trainer import train
dim_image=64
params = {}
params["batch_size"] = 10
params["nb_epoch"] = 100
class CNN(chainer.Chain):
... | true |
a7984c9db416805c82e302d96b29593164172fd6 | Python | beard33/Cryptopals | /set1/5.py | UTF-8 | 310 | 2.734375 | 3 | [] | no_license | import binascii
import utils.tools as tools
string = b'Burning \'em, if you ain\'t quick and nimble\nI go crazy when I hear a cymbal'
target = b'0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f'
key = b'ICE'
res = tool... | true |
88d123b7de3c392180bcc48afe63d097eeb74520 | Python | Vasinck/plan-game | /bullet.py | UTF-8 | 669 | 3.21875 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
def __init__(self,game_sets,screen,ships):
super().__init__()
self.screen = screen
self.rect = pygame.Rect(0,0,game_sets.bullet_width,game_sets.bullet_height)
self.rect.centerx = ships.rect.centerx
... | true |
627b65cee399feb79f889d875fc359d31272c3b3 | Python | pradeepodela/selena | /tr.py | UTF-8 | 4,406 | 2.9375 | 3 | [] | no_license | import pyttsx3
import wikipedia
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[len(voices)-1].id)
def speak(audio):
print('Computer: ' + audio)
engine.say(audio)
engine.runAndWait()
questions = {
'hai':'hai sir',
'... | true |
fa172b22bb178ff9a66761a15055a15adacafd8a | Python | helunxing/algs | /leetcode/LCP 3. 机器人大冒险.py | UTF-8 | 686 | 2.765625 | 3 | [] | no_license | class Solution:
def robot(self, command: str, obstacles, x: int, y: int) -> bool:
ps = set()
un, rn = 0, 0
for c in command:
ps.add((rn, un))
if c == 'U':
un += 1
else:
rn += 1
mu = min(x // rn, y // un)
if (... | true |
ed3c33477c4dc9ea1f2b54c11fa34d0ad84c305c | Python | RJTK/dwglasso_cweeds | /src/data/clean_data.py | UTF-8 | 2,320 | 3.0625 | 3 | [
"MIT"
] | permissive | '''
This file loads in data from /data/interim/interim_data.hdf and then
both centers the temperature data and adds in a dT column of temperature
differences.
NOTE: This file is intended to be executed by make from the top
level of the project directory hierarchy. We rely on os.getcwd()
and it will not work if run di... | true |
cc12a2bf24a769af84dc2dcebf3ef226c3eb7ccc | Python | davibrilhante/mcmc-20191 | /lista3/questao2/lista3-q2-1.py | UTF-8 | 484 | 2.734375 | 3 | [] | no_license | from random import uniform
from sys import argv
from math import log
from matplotlib import pyplot as plt
counter = 0
Lambda=[]
n=int(argv[1])
for i in range(int(argv[2])):
Lambda.append(float(argv[i+3]))
for l in Lambda:
dist=[]
for i in range(1,n+1):
u = uniform(0,1)
x_i = -1*log(1-u)/l
... | true |
0cfee5089cde50e8769edbda94f815ea37b32924 | Python | DilbaraAsanalieva/lesson2_hw | /lesson2_hw.py | UTF-8 | 480 | 3.609375 | 4 | [] | no_license | #Calculator
value1 = int(input('Введите цифру: '))
value2 = int(input('Введите цифру: '))
print(value1, '+', value2, '=', value1 + value2)
print(value1, '-', value2, '=', value1 - value2)
print(value1, '*', value2, '=', value1 * value2)
print(value1, '/', value2, '=', value1 / value2)
# Standup
# Что сделала:
# -Напис... | true |
d477da209c38a06eaa71d5d75bb69ba546784764 | Python | Michaelliv/p2pay | /risk_engine_service/main.py | UTF-8 | 2,679 | 2.515625 | 3 | [] | no_license | import asyncio
import json
from concurrent.futures import ThreadPoolExecutor
from aiokafka import AIOKafkaConsumer
import database.crud.payments as payments_crud
from common.config import KAFKA_BOOTSTRAP_SERVERS, KAFKA_CONSUMER_GROUP, KAFKA_TOPIC
from common.logger import get_logger
from common.models import Payment
... | true |
fd7743aca48784b5c447e8f6d988fd72fc6b55b8 | Python | lichengunc/pretrain-vl-data | /prepro/get_excluded_iids.py | UTF-8 | 5,843 | 2.625 | 3 | [
"MIT"
] | permissive | """
We will get to-be-excluded images' ids by checking:
1) Karpathy's test split
2) refcoco/refcoco+/refcocog's val+test split
3) duplicated Flickr30k images in COCO
Note, karpathy's val split will be our val split for pre-training.
"""
import os
import os.path as osp
import json
import pickle
# paths
this_dir = osp.d... | true |
9b82598e68c6c886931e3f9358b510d5732fcb26 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2535/58547/244523.py | UTF-8 | 1,431 | 3.25 | 3 | [] | no_license | def get_next(arr, cursor, temp_arr, to_get_next):
temp_arr.append(arr[cursor[0]])
if cursor[0] == arr[cursor[0]]:
cursor[0] += 1
return True
cursor[0] += 1
while cursor[0] < len(arr):
if arr[cursor[0]] == to_get_next:
temp_arr.append(arr[cursor[0]])
cursor... | true |
3f3bce8573cc87403ebbce7524b829903d5f4290 | Python | lthUniBonn/awe-production-estimation | /aep.py | UTF-8 | 6,246 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
wind_speed_probability_file = "wind_resource/freq_distribution_v3{}.pickle"
power_curve_file = 'output/power_curve{}{}.csv'
def get_mask_discontinuities(df):
"""Identify discontinuities in the power curves. The provided approac... | true |
9628d4c0d62e8784a06d1a0393716e732136ab3c | Python | katero/basic-python-code | /function_default.py | UTF-8 | 82 | 3.0625 | 3 | [] | no_license | def say(messge, times=1):
print(messge * times)
say('hello')
say('world', 5)
| true |
73106be45d3efe4901092d851fe214fea1b35abb | Python | jef771/algorithmic-toolbox | /week3/car_fueling/a.py | UTF-8 | 736 | 3.234375 | 3 | [] | no_license | import sys
def get_stops(d, m, stops, n):
n_r, c_r, r= 0, 0, m
while c_r <= n:
l_r = c_r
while c_r <= n and (stops[c_r + 1] - stops[l_r]) <= m:
c_r+=1
if c_r == l_r:
return -1
else:
n_r+=1
return n_r-1
def main():
s... | true |
0ec24dbe8171656c261be7477b3f2993f73cabc3 | Python | Jun-GwangJin/Python-Programming | /elsePrice.py | UTF-8 | 361 | 3.90625 | 4 | [] | no_license | while True:
# 상품가격 입력받기
price = int(input("가격: "))
if price != 0000:
# 배송비 결정
if price > 20000:
shipping_cost = 0
elif price > 10000:
shipping_cost = 1000
elif price > 5000:
shipping_cost = 500
else:
shipping_cost = 3000
# 배송비 출력
print("배송비: ". shipping_cost)
#else:
# print('Bye')
# break | true |
08ead49e12903ed5f22b681315821d2cd420eaeb | Python | SolessChong/kittipattern | /scratch/rodanalysis.py | UTF-8 | 3,464 | 2.71875 | 3 | [] | no_license | import sys
sys.path.append('../utilities')
from parseTrackletXML import *
from frames import *
from scipy import stats
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import re
import os
import fnmatch
import pickle
class Rod:
def __init__(self, T1, T2, vec):
"""
Init by types of obj... | true |
1203160dc78d5a9a20e45c17fbd1a511fe69b607 | Python | EunsuJeong/Gawi_Bawi_Bo | /game.py | UTF-8 | 918 | 3.75 | 4 | [] | no_license | import random
export LC_ALL=en_US.UTF-8
export LANG = en_US.UTF-8
"""
Traditional gawi-bawi-bo game
@author Eunsu Jeong
@created 12-10-2016
"""
def determine_winner(my_hand, com_hand):
"""
Determine winner of the game.
:param my_hand: my hand parameter
:param com_hand: predefined computer choice
:return None: N... | true |
9daab23a8f0b1fba842055ca157d628a1bd61184 | Python | mohitkhatri611/python-Revision-and-cp | /python programs and projects/python all topics/enumerate and zip function.py | UTF-8 | 1,928 | 4.5625 | 5 | [] | no_license | """how to find the index of each item"""
def exzip1():
Numbers =[1,2,3,4,6,4,3,6,8,5,8]
#problem this will give only index for first 6 if you have duplicates in list.
#print(Numbers.index(6))
"""finding index of all elements even with duplicates"""
#an enumerator provides an index of each element... | true |
1a65fe716cdda335fb96361f8f2871dee5f25fd1 | Python | samuelfujie/LintCode | /1691_Best_Time_to_Buy_and_Sell_Stock_V/solution.py | UTF-8 | 485 | 3.296875 | 3 | [] | no_license | import heapq
class Solution:
"""
@param a: the array a
@return: return the maximum profit
"""
def getAns(self, a):
if not a:
return 0
profit = 0
heap = []
heapq.heapify(heap)
for price in a:
if heap and heap[0] < price:
... | true |
ae1c843529a3e6cc363c9c8868858297b947d107 | Python | FlavrSavr/boring | /lottery/post_change_lottery_analysis.py | UTF-8 | 1,865 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from collections import Counter
import collections
import csv
import re
def lottery_analysis():
counter = 0
list_counter = 0
output_list = []
pre_change_list = []
post_change_list = []
raw_list = np.loadtxt(open("/home/rane/testing/winning_numbers.csv", "rb"), dtype='str', de... | true |
52ceac5b336535ab8f9927c9afc73d5401fef52a | Python | Shyngys03/PP2 | /FINAL/U.py | UTF-8 | 338 | 3.359375 | 3 | [] | no_license | h, a, b = map(int, input().split())
up = True
cnt = 0
m = 0
while True:
if up:
m += a
up = False
cnt += 0.5
if m >= h:
print(int(cnt) + 1)
break
if not up:
m -= b
up = True
cnt += 0.5
if m >= h:
print(int(cnt))... | true |
7108c781ec23c1c1e441e4a26c4866f69dc35201 | Python | ankian27/NLP | /stage1/src/DefinitionGeneration.py | UTF-8 | 7,219 | 3.890625 | 4 | [] | no_license |
#This class is used to generate the defitions for each cluster. The idea of definiton generation is that, we can derive the definition of a word by using the context words neighbouring the target word in a given context. The topics are given by the hdp are used to get the topic words. The topic words along with the ta... | true |
2b34dc358d9d62a5ba32dfd89a8fd29d9e783e17 | Python | mary-alegro/AVID_pipeline | /python/UCSFSlideScan/results/plot_precrec_curve_all.py | UTF-8 | 5,804 | 2.703125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import auc
def find_nearest1(array,value):
idx,val = min(enumerate(array), key=lambda x: abs(x[1]-value))
return idx
def main():
thres = 0.5
#AT100
AT100_test_stats = np.load('/home/maryana/storage2/Posdoc/AVID/AT100/resul... | true |
f19e31be81217984ba92bcbdaf67991676371749 | Python | YumoeZhung/3Dswc | /test/opengl.py | UTF-8 | 1,434 | 2.5625 | 3 | [] | no_license | __author__ = 'Su Lei'
import pyglet
from pyglet.gl import *
window = pyglet.window.Window()
# vertices = [0, 0, window.width, 0, window.width, window.height]
# vertices_gl = (GLfloat * len(vertices))(*vertices)
# print GLfloat * len(vertices)
# print vertices_gl
# print GLfloat * 100
# glEnableClientState(GL_VERTEX_... | true |
bae1a0c33e4713ac4220e43adfe1b5bc9caf44eb | Python | elc1798/project-pepe-server | /meme_learning/preprocessing.py | UTF-8 | 4,812 | 2.515625 | 3 | [] | no_license | from io import BytesIO
from PIL import Image
from imagenet import classify_image
import os
import glob
import numpy as np
import scipy.ndimage as spimg
JPEG_FORMAT = "JPEG"
WILD_PNG = "*.png"
WILD_JPG = "*.jpg"
CLASSIFIER_IMG_SIZE = (299, 299)
DATA_DIR = "data/"
TRAIN_DIR = "train/"
objects_detected = {}
CURRENT_... | true |
4348b4c2480a94cad3d548d3cd283e4a63bf537e | Python | lkmartin90/doubling_agent | /doubling_agent/image_analysis_functions.py | UTF-8 | 27,070 | 2.71875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
from scipy.spatial.distance import euclidean
import matplotlib.patches as mpatches
from scipy import optimize
import pandas as pd
import os
import fnmatch
plt.style.use('ggplot')
def plot_cells(data_df, value, folder_name, r, ... | true |
8066bae3c18dc46e24cab355f21fb29a61e2aa7f | Python | Thxios/ProjectResearch | /Gomoku/board.py | UTF-8 | 1,564 | 3.4375 | 3 | [] | no_license | from lib import *
from .validation import ThreeChecker, FourChecker, FiveChecker, SixChecker
class Board:
def __init__(self, board):
self.board = board
def get(self, x, y):
if x < 0 or x >= 15 or y < 0 or y >= 15:
return -1
return self.board[x, y]
def valid(self, x, y... | true |
94fe41d5aa884df4e241ed926825b993b19d6001 | Python | liangjinhao/Web_Spider_Practice_Code | /MOOC北京理工大学爬虫/01_requests/05_IP地址归属地的自动查询.py | UTF-8 | 314 | 2.609375 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# author: Fangyang time:2017/12/20
import requests
url = 'http://www.ip138.com/ips138.asp?ip='
try:
r = requests.get(url+'202.204.80.112')
r.raise_for_status()
r.encoding = r.apparent_encoding
print(r.text[-500:])
except:
print('爬取失败')
| true |
397a45ac6acddb6c59e3a292805fbcbfb1d7b2b0 | Python | hyunwoo-song/TOT | /algorithm/day16/twoint.py | UTF-8 | 674 | 2.625 | 3 | [] | no_license | import sys
sys.stdin = open('twoint.txt', 'r')
T= int(input())
for t in range(1, T+1):
N, M = map(int, input().split())
A= list(map(int, input().split()))
B= list(map(int, input().split()))
Result=[]
if len(A) > len(B):
while len(A) >= len(B):
result = 0
for i in... | true |
cf7e58a1c1986bf472cc4f1311d2458959038f30 | Python | malihasameen/1mwtt-toy-problems | /toy-problem-003.py | UTF-8 | 1,270 | 3.46875 | 3 | [] | no_license | """
* http://www.pythonchallenge.com/pc/def/0.html
* Python Challenge Level 0
"""
# power operator
print (2**38)
# power function
print(pow(2,38))
# loop
n = 1
for i in range(38):
n *= 2
print(n)
# shift
print(1 << 38)
"""
* http://www.pythonchallenge.com/pc/def/map.html
* Python Challenge Level 1
"""
r... | true |
84c9584a8dd9af400b6de09f064e1acfe7fe6825 | Python | lefterisKl/StockDataCrawler | /DailyCrawler.py | UTF-8 | 2,807 | 2.875 | 3 | [] | no_license | import requests
import time
from bs4 import BeautifulSoup
import datetime
import time
website_url = "https://finance.yahoo.com"
sector_url_prefix = "https://finance.yahoo.com/sector/"
sector_url_suffix = "?offset=0&count=100"
sectors = ["financial","healthcare","services","utilities","industrial_goods","basic_mater... | true |
bb0478f8c895e4bb0ca7f13afe369cea21a238eb | Python | koneb71/bitcoin-twitter-sentiment-analysis | /create_dataset.py | UTF-8 | 1,208 | 3.03125 | 3 | [] | no_license | import csv
file = 'bitcointweets.csv'
neg_tweet = []
pos_tweet = []
neutral_tweet = []
with open(file, encoding="utf8") as fh:
rd = csv.DictReader(fh, delimiter=',')
for row in rd:
if row['sentiment'] == "positive":
pos_tweet.append(row)
if row['sentiment'] == "negative":
... | true |
9b3d8d4c0c853172064707d260f07c030fed8c75 | Python | iankigen/data_stuctures_and_algorithms | /data_structures/arrays.py | UTF-8 | 676 | 3.625 | 4 | [] | no_license | from array import array
# array_name = array(typecode, [Initializers])
"""
Typecode Value
b Represents signed integer of size 1 byte/td>
B Represents unsigned integer of size 1 bytetest_array = array('i', [1, 2, 3])
c Represents character of size 1 byte
i Represents signed integer of size 2 bytes# Insertion Operation... | true |
82fc793180bbf6bb206ca25bc55cb4a85b421ffb | Python | white1107/Python_for_Competition | /WaterBlue/36_Knapsack_Problem.py | UTF-8 | 509 | 2.765625 | 3 | [] | no_license | def get_input(inp):
li = inp.split("\n")
def inner():
return li.pop(0)
return inner
INPUT = """2 20
5 9
4 10
"""
input = get_input(INPUT)
#######
N,W = map(int,input().split())
dp = [[0]*(W+1) for _ in range(N+1)]
L = []
for i in range(N):
ta,tb = map(int,input().split())
L.append([ta,tb]... | true |
2f1b616e4c5a15a862307f544ca64de4aa4a5017 | Python | L200170178/prak_ASD_E | /Modul 6/mergeSort.py | UTF-8 | 1,017 | 3.265625 | 3 | [] | no_license | class Mahasiswa(object):
def __init__ (self,nim) :
self.nim = nim
nim1= "L200170123"
nim2= "L200170124"
nim3= "L200170125"
nim4= "L200170126"
nim5= "L200170127"
Daftar = [nim1,nim2,nim3,nim4,nim5]
def mergeSort(A):
if len(A) > 1 :
mid = len(A) // 2
separuhKiri = A[:mi... | true |
0aa959b9c581c1f72135878b9250c297ae5d4e9a | Python | emilberzins/RTR105 | /lab3.py.py | UTF-8 | 492 | 3.78125 | 4 | [] | no_license | from math import sin, fabs, sqrt
from time import sleep
def f(x):
return sin(sqrt(x))*sin(sqrt(x))
a = 1
b = 5
funa = f(a)
funb = f(b)
if (funa * funb > 0.0):
print("Dotajā intervālā [%s, %s] sakņu nav"%(a,b))
sleep(1); exit()
else:
print("Dotajā intervālā sakne(s) ir!")
deltax ... | true |
6c3bf1a8191f45f8e32e6b6f1136d21c34c755f4 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/d47703431c9e4c6ca551ab7443e1afd2.py | UTF-8 | 94 | 3.109375 | 3 | [] | no_license | def distance(s1, s2):
hamming = sum(x != y for (x, y) in zip(s1, s2))
return hamming
| true |
c485511454e429730254ae8117158cab5c3eaf50 | Python | nicogab34/AudioMNIST | /recording_scripts/adjustCuts.py | UTF-8 | 8,656 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.io import wavfile
import os
import matplotlib.pyplot as plt
import pandas as pd
import scipy.signal
import glob
from matplotlib.lines import Line2D
import scipy.spatial.distance
import argparse
class DragHandler(object):
""" A simple class to handle Drag n Drop.
This is a simple ... | true |
e0649ecb368d01a5cc83ca59c2dc24b224d26015 | Python | paulan94/CTCIPaul | /LL_node.py | UTF-8 | 196 | 3.203125 | 3 | [] | no_license | class LL_node():
def __init__(self,val):
self.val = val
self.next = None
head = LL_node(2)
head.next = LL_node(5)
head.next.next = LL_node(1)
head.next.next.next = LL_node(2)
| true |
8ca1b47967c5d97767146dc66cf9e1895fc6abd2 | Python | tomasjames/Exoplanet-Project | /Data/WASP-22b/aperture.py | UTF-8 | 1,460 | 3.109375 | 3 | [] | no_license | '''
Project: Exoplanetary Detection and Characterisation
Supervisor: Dr. Edward L Gomez
Author: Tomas James
Script: Aperture Determination for WASP-22 b
'''
from numpy import *
from matplotlib.pyplot import *
# Read in data
aperture = genfromtxt('aperture.txt', dtype = 'float')
aperture2 = genfromtxt('aperture2.txt... | true |
8a62c1a828ddc4c8150db5f27e14165c52c1ba68 | Python | astrosilverio/PokeDB | /pokedb/storage/__init__.py | UTF-8 | 1,062 | 2.6875 | 3 | [] | no_license | """
API to access layer:
`get`
`write`
`sync`
"""
import os
from pokedb.storage.pager import Pager
from pokedb.storage.serializer import serialize, deserialize
DBFILE = os.getenv('DBFILE', 'test.db')
_pager = None
# In-memory storage
_storage = dict()
_temp = dict()
_table_schema = {
'main': ('value',),
}
... | true |
ba438dfccfc5e026f76af842655f8fabfa5c6f58 | Python | boyan13/hackbg-dungeons-and-pythons | /Hero.py | UTF-8 | 2,343 | 3.0625 | 3 | [] | no_license | from Weapon import Weapon
from Spell import Spell
class Hero:
def __init__(self, name, title, health, mana, mana_regeneration_rate):
self.name = name
self.title = title
self.health = health
self.MAX_HEALTH = health
self.mana = mana
self.MAX_MANA = mana
self.... | true |
ff18ebf25d5f4ed44f24ac9ccf73670045bb65c2 | Python | azure1016/MyLeetcodePython | /lc56.py | UTF-8 | 1,867 | 3.359375 | 3 | [] | no_license | # Definition for an interval.
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
intervals = intervals[:]
#Always thi... | true |
b68ba87cdebc26ddb11e70d90f46d6f9fda1613e | Python | TeamGraphix/graphix | /examples/qft_with_tn.py | UTF-8 | 2,634 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | """
Large-scale simulations with tensor network simulator
===================
In this example, we demonstrate simulation of MBQC involving 10k+ nodes.
You can also run this code on your browser with `mybinder.org <https://mybinder.org/>`_ - click the badge below.
.. image:: https://mybinder.org/badge_logo.svg
:targ... | true |
fcfe66b7946543c18eca891d6de463579cf3c72a | Python | Jeyabalaganesh/New_Project_23052021 | /Day 21_diamondinher_test.py | UTF-8 | 965 | 3.59375 | 4 | [] | no_license | class BaseClass:
no_of_base_class = 0
def __init__(self):
print("Executed the Base class")
BaseClass.no_of_base_class += 1
class LeftClass(BaseClass):
no_of_Left_class = 0
def __init__(self):
super().__init__()
print("Executed the Left class")
LeftClass.no_of_... | true |
4f6b111532a432d8161e3e38042dfedb4fff05ad | Python | apri-me/python_class00 | /session10/oop1.py | UTF-8 | 90 | 2.71875 | 3 | [] | no_license |
from assignments import Radmehr1
squar = Radmehr1.Square(5, 'Gray')
print(squar.area()) | true |
ddfdf465d37855312a92bd488d915b36e53a5618 | Python | netsus/Rosalind | /HAMM.py | UTF-8 | 333 | 3.171875 | 3 | [] | no_license | '''
문제 : 길이가 같은 두 서열 입력받아 서로 다른 염기 개수가 몇개인지 출력
알고리즘 : 반복하며 비교해서 다르면 cnt += 1 '''
f = open('rosalind_hamm.txt','r')
fl = f.read().split('\n')
cnt=0
seq1,seq2=fl[:-1]
for i in range(len(fl[0])):
if seq1[i]!=seq2[i]:
cnt+=1
print(cnt)
| true |
e03fdc6beb3520dfa9e29dcac6e56b8c4aa199a6 | Python | krammandrea/Mandelbrot | /coloralg.py | UTF-8 | 6,942 | 3.125 | 3 | [] | no_license | import math,testing
class ColorAlg():
def __init__(self, colorscheme = ["000000","338822","883388"]):
"""
initializes algorithms in advance for faster computing time
"""
self.initcolorscheme(colorscheme)
def initcolorscheme(self,colorscheme):
"""
converts
"""
#convert the colorsch... | true |
bc21e781fad2ade9a6d4cfc88431a2e4e45c7fdb | Python | reata/Cryptography | /week5_discrete_log.py | UTF-8 | 3,077 | 3.640625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# python_version: 3.4.0
__author__ = "Ryan Hu"
__date__ = "2015-2-16"
"""
Given prime p. Let g and h be integers in [0, p-1] given h = g ** x (mod p) where 1 <= x <= 2 ** 40. Our goal is to find
x. More precisely, the input to this program is P, G, H and the output is x. The ... | true |
6ffe6c65d7f1b7dfcb2c18e2c367b51a48e6cc3c | Python | hutu1234567/crawlweb | /libs/hdfspython.py | UTF-8 | 4,078 | 2.546875 | 3 | [] | no_license | from hdfs import *
from hdfs.ext.kerberos import KerberosClient
import os
class HdfsClient:
'''hdfs客户端'''
def __init__(self, ip='', root=None, proxy=None):
self.client=self.selectClient(ip)
def selectClient(self, ip='',root=None, proxy=None):
"""寻找可用hdfs链接"""
self.initKerberos()
... | true |
f6130c00fd6c459810d556c4c57137aa70a59160 | Python | kimtaehong/android-malware-detection | /classfication/randomforest.py | UTF-8 | 5,057 | 2.5625 | 3 | [] | no_license | import csv
import numpy as np
from os import makedirs
from os.path import realpath, exists, isabs, dirname, join
from optparse import OptionParser
from sklearn.ensemble import RandomForestClassifier
from context import *
from classfication.log import log
train_dataset = dict()
target_dataset = dict()
def conver_lis... | true |
691f93f1ea6b80af4c80f33ee41765a309558f70 | Python | yeniferBarcoC/4.1-Miscelanea-de-Ciclos | /main.py | UTF-8 | 1,039 | 3.421875 | 3 | [] | no_license | """ Modulo Ciclos
Funciones para practicas con ciclos
Yenifer Barco Castrillón
junio 06-2021 """
#---------------- Zona librerias------------
import funciones_ciclos as fc
#======================================================================
# Algoritmo principal Punto de entrada a la aplicación (Conq... | true |
25fecd00f53a74a28b55efd7c94528a4708ee556 | Python | adriencances/ava_code | /pairs_generation/frame_processing.py | UTF-8 | 7,083 | 2.625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math as m
from torchvision import transforms, utils
import cv2
import sys
import pickle
import tqdm
frames_dir = "/media/hdd/adrien/Ava_v2.2/correct_frames"
shots_dir = "/home/acances/Data/Ava_v2.2/final_shots"
tracks_dir = "... | true |
3c38b95052574f92095e3bd5b92ce52a1f4f7b6f | Python | lpdonofrio/D10 | /presidents.py | UTF-8 | 3,095 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python3
# Exercise: Presidents
# Author GitHub usernames:
# #1: lpdonofrio
# #2: nishapathak
# Instructions:
# Write a program to:
# (1) Load the data from presidents.txt into a dictionary.
# (2) Print the years the greatest and least number of presidents were alive.
# (between 1732 and 2016 (inclus... | true |
f2eca029ee7fe0486ebc4bd436fc80ffa9045397 | Python | snugfox/finfast | /finfast_torch/analyze/metrics_kernels.py | UTF-8 | 2,449 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import torch
def beta(rp: torch.Tensor, rb: torch.Tensor) -> torch.Tensor:
rp_cent = rp - torch.mean(rp, dim=1, keepdim=True)
rb_cent = rb - torch.mean(rb, dim=1, keepdim=True)
rb_var = torch.mean(torch.square(rb_cent), dim=1, keepdim=True)
cov = (rp_cent @ rb_cent.T) / rp.shape[1]
return cov / rb... | true |
64e5cda360046490b4dbc665a94d4729e55dda2a | Python | kembo-net/cropper.py | /cropper.py | UTF-8 | 1,455 | 3.15625 | 3 | [] | no_license | import sys, os, re
from PIL import Image
desc = "1行目に画像ファイルがあるディレクトリ、\n" \
"2行目に画像ファイル名(拡張子含)を表す正規表現、\n" \
"3行目以降に画像を切り出す座標を書いてください。\n" \
"座標は矩形1つ毎に左上x座標, 左上y座標, 右下x座標, 右下y座標を半角カンマ区切りで入れてください。\n" \
"ファイルの入出力は全てJPEGを前提にしています。"
args = sys.argv
if len(args) == 1 or args[1] in {'-h', 'he... | true |
12284d7b1c2f6597af817b4b6382858f28b668a7 | Python | 2020-A-Python-GR1/py-roman-cabrera-bolivar-andres | /proyecto - scrapy 2B/movies/movies/spiders/movie_spyder.py | UTF-8 | 2,639 | 2.71875 | 3 | [] | no_license | import scrapy
import pandas as pd
import numpy as np
import re
class MovieCrawl(scrapy.Spider):
name = 'movie_spyder'
urls = []
size_page = np.arange(1,1000,50)
for num in size_page:
urls.append('https://www.imdb.com/search/title/?groups=top_1000&start={num}'.format(num=num))
m_name = []... | true |
618d0a7ff5d393ad104b73dae22cf12457558d4d | Python | zszzlmt/leetcode | /solutions/1128.py | UTF-8 | 872 | 2.84375 | 3 | [] | no_license | class Solution:
def numEquivDominoPairs(self, dominoes: List[List[int]]) -> int:
from collections import defaultdict
cluster_to_values = defaultdict(set)
cluster_to_idxs = defaultdict(list)
for idx in range(len(dominoes)):
i, j = dominoes[idx]
for idxx in clus... | true |
59cdfc7aa116754f904476caf979060376952f31 | Python | mklomo/school_administration_project | /course.py | UTF-8 | 1,923 | 3.375 | 3 | [] | no_license | """
This script implements the course Class
"""
from professor import Professor
from enrol import Enrol
class Course:
"""
_min_number_of_students : int
_max_number_of_students : int
_course_code : int
_start : date
_end : date
_name : str
_semester : int
is_cancelled() : boolean
get_num_students_enro... | true |
15e3dafa46fdb66062d04b0ed449b89df976b165 | Python | mincloud1501/Python | /Data_Analytics_Pandas/gonggongInfoAnalysis.py | UTF-8 | 3,635 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import sys
import urllib.request
import datetime
import time
import json
import math
# https://www.data.go.kr/
# 관광자원통계서비스
def get_request_url(url):
req = urllib.request.Request(url)
try:
response = urllib.request.urlopen(req)
if response.getcode() == 200:
#print("[%s] Ur... | true |
e11a6dc349084a05f5b5ee2b582f729dd3f8bc33 | Python | brodri4/LearningPython | /duplicate.py | UTF-8 | 284 | 3.171875 | 3 | [] | no_license | def duplicate_remove(array):
return list(dict.fromkeys(array))
answer = duplicate_remove([1,2,3,4,4])
answer2 = duplicate_remove([1,2,3,4,5])
answer3 = duplicate_remove([1,2,1,2,4])
answer4 = duplicate_remove([2,2,2,2])
print(answer)
print(answer2)
print(answer3)
print(answer4) | true |
bf8ed23ddf2cf8004686f6955bff919baf4e5760 | Python | fswzb/sensequant | /ml_model.py | UTF-8 | 3,889 | 2.609375 | 3 | [] | no_license | from keras.models import Model, Sequential
from keras.layers import Input, Dense, Activation, Dropout
from keras.regularizers import l2, l1
import pandas as pd
import numpy as np
from sklearn import linear_model, preprocessing
from sklearn.metrics import classification_report
import configure
RESULT_DIR = configure.re... | true |
45b5925cfc38c86c8ffd2364af88ddc91517e20b | Python | sampoprock/GeeksforGeeks-leetcode | /primalitytest.py | UTF-8 | 1,418 | 4.15625 | 4 | [] | no_license | # Primality Test
# For a given number N check if it is prime or not. A prime number is a number which is only divisible by 1 and itself.
# Input:
# First line contains an integer, the number of test cases 'T'. T testcases follow. Each test case should contain a positive integer N.
# Output:
# For each testcas... | true |
d92548ff195ff80a6130530b36bb2b9f7cba5154 | Python | shiv125/Competetive_Programming | /codechef/snack17/prob3_upd.py | UTF-8 | 2,572 | 2.625 | 3 | [] | no_license | #import timeit
#start = timeit.default_timer()
#corr=open("algo.txt","w+")
def binarysearch(arr,target):
low=0
high=len(arr)-1
while low<=high:
mid=(high+low)/2
val=arr[mid]
if target<=arr[low]:
return low
if target>arr[high]:
return -1
if target==val:
return mid
elif target>val:
low=mid+1
... | true |
c299daf9e32cf705d4760f25f7a27421b50714bb | Python | DianaQuintero459/CP-D | /test.py | UTF-8 | 1,082 | 2.796875 | 3 | [] | no_license | # Estudiante: Diana Carolina Quintero Bedoya
# Correo: diana.quintero01@correo.usa.edu.co
# Carrera: Ciencias de la computación e Inteligencia Artificial
# Fecha: 29 abril 2021
# Ultima Modificación: 5 mayo 2021
# Docente: John Corredor Pdh
# Materia: Computación paralela y distrribuida
# Universidad Sergio Arboleda
#... | true |
dbf738d60fc66a34d32ccc15f3ba13413c36f665 | Python | webclinic017/AF5353 | /Multi-Factor_Model_Regression .py | UTF-8 | 3,678 | 3.265625 | 3 | [] | no_license | ### Step 1. Import the libraries:
import pandas as pd
import yfinance as yf
import statsmodels.formula.api as smf
import pandas_datareader.data as web
### Step 2. Specify the risky asset and the time horizon:
RISKY_ASSET = 'GOOG'
START_DATE = '2010-01-01'
END_DATE = '2020-12-31'
### Step 3. Download the data of the... | true |
c2d540c4c3e0b25d450203bad6aef097e0c078b7 | Python | OScott19/TheMulQuaBio | /code/cfexercises2.py | UTF-8 | 683 | 4.34375 | 4 | [
"CC-BY-3.0",
"MIT"
] | permissive | # What does each of fooXX do?
def foo1(x):
return x ** 0.5
def foo2(x, y):
if x > y:
return x
return y
def foo3(x, y, z):
if x > y:
tmp = y
y = x
x = tmp
if y > z:
tmp = z
z = y
y = tmp
return [x, y, z]
def foo4(x):
result = 1
f... | true |
2b4630ec566f229b9b76191acc3a7c93c2660556 | Python | bgschiller/country-bounding-boxes | /country_bounding_boxes/__init__.py | UTF-8 | 5,691 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import iso3166
import json
from country_bounding_boxes.generated import countries
# The naturalearth dataset we're using contains "subunits" of a variety of
# forms; Some are "full sized" countries, some are historically or
# politically significant divisions within th... | true |
7a8ab9f0bcd31892348a7d88b3ecec79e7b93d4e | Python | afterloe/raspberry-auto | /opencv-integrate/py/four_point_perspective.py | UTF-8 | 466 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from imutils import perspective
import numpy as np
import cv2
img = cv2.imread("../tmp/2.jpg", cv2.IMREAD_COLOR)
img_clone = img.copy()
cv2.imshow("before", img_clone)
pts = np.array([(73, 239), (356, 117), (475, 265), (187, 443)])
for (x, y) in pts:
cv2.circle(img_clone, (x, y), ... | true |
9b91eb61753c64771fef31e4d202d698a31701ec | Python | dstark85/mitPython | /simple_programs/guess_number.py | UTF-8 | 1,307 | 4.40625 | 4 | [] | no_license | # a simple number guessing program
# 0 - 100 (exclusive)
def quick_log(base, n):
''' Rounds up '''
count = 0
while n > 1:
count += 1
n //= base
return count
def guess_number():
print("Think of a number between 0 and 100!")
prompt = '''Enter 'h' to indicate the guess is too hig... | true |
0bd9ef0789717f159ddd05c1f234c1572bb1f032 | Python | tritechsc/minecraft-rpi | /python-examples/turret_cwc.py | UTF-8 | 2,923 | 2.703125 | 3 | [] | no_license | from mcpi.minecraft import Minecraft
from mcpi import block
from time import sleep
def init():
mc = Minecraft.create("127.0.0.1", 4711)
x, y, z = mc.player.getPos()
return mc
def gun(mc,x,y,z,direction,mussle_length):
print("mussle_length ",mussle_length)
#WOOD_PLANKS 5 GLASS 20 gold 41
m = 2... | true |
eb509b4d4127ceb003a7f3191b8f8d0cbfa7840e | Python | sourcery-ai-bot/eniric | /scripts/untar_here.py | UTF-8 | 605 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
untar_here.py
-------------
Bundled script to un-tar the eniric data downloaded.
Uses the tarfile module to extract the data.
"""
import argparse
import sys
import tarfile
def _parser():
"""Take care of all the argparse stuff."""
parser = argparse.ArgumentParser(description="Extra... | true |
dca2c441e2fbd0e934a6dc2f905942cb68841011 | Python | GANESH0080/Python-Practice-Again | /AssignamentOperators/AssignmentSeven.py | UTF-8 | 48 | 2.9375 | 3 | [] | no_license | x = 6
x **= 3
print(x)
xx = 5
xx//=2
print(xx) | true |
5e0446fe3d4073f735e647a0fcdb1ef7b23be240 | Python | kandrosov/correctionlib | /src/correctionlib/schemav2.py | UTF-8 | 8,098 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | from typing import Any, List, Optional, Union
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
try:
from typing import Literal # type: ignore
except ImportError:
from typing_extensions import Literal
VERSION = 2
class Model(BaseModel):
class Config:
extra = "forbid"
cl... | true |
e8f12d8223265d2225aa613fbf2257d2340c2509 | Python | kartikwar/programming_practice | /lists/others/overlapping_intervals.py | UTF-8 | 937 | 4.0625 | 4 | [] | no_license | '''
Given a collection of intervals, merge all overlapping intervals.
For example:
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
Make sure the returned intervals are sorted.
'''
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution:
# @param intervals, a li... | true |
e637e3d6d1f760dca64da849a29a5cbd37fd5f9a | Python | hahalaugh/LeetCode | /509_Fibonacci Number.py | UTF-8 | 854 | 3.203125 | 3 | [] | no_license | class Solution(object):
def fib(self, n):
# Recursive
if n <= 1:
return n
p1 = 1
p2 = 0
fb = 0
for i in range(n - 2 + 1):
fb = p1 + p2
p2 = p1
p1 = fb
return fb
def fibTopDown(self... | true |
cafe98c11b1a75d9dd0a41a34661b7165e7e512b | Python | ricardorohde/price_miner | /extractor/main.py | UTF-8 | 1,643 | 2.53125 | 3 | [
"MIT"
] | permissive | from argparse import ArgumentParser
from config import PRICE_MINER_HOST, BODY_REQUEST
from json.decoder import JSONDecodeError
import requests
import time
import pandas as pd
all_data = list()
def extract(number_of_items=1):
while True:
response = requests.post(PRICE_MINER_HOST + '/mine', json=BODY_REQUE... | true |
bd39c20f7d5ae57eae00d92465564ab930b7158f | Python | yuqiuming2000/Python-code | /爬虫精进/第6关/第6关xlsx文件的读写.py | UTF-8 | 448 | 3.234375 | 3 | [] | no_license | import openpyxl
wb=openpyxl.Workbook()
sheet=wb.active
sheet.title='new title'
sheet['A1'] = '漫威宇宙'
rows= [['美国队长','钢铁侠','蜘蛛侠'],['是','漫威','宇宙', '经典','人物']]
for i in rows:
sheet.append(i)
print(rows)
wb.save('Marvel.xlsx')
wb = openpyxl.load_workbook('Marvel.xlsx')
sheet = wb['new title']
sheetname = wb.sheetname... | true |
270f8d22e4de30b9b46807a90e2e0413b6ab4d49 | Python | kk0walski/Stratego | /Board.py | UTF-8 | 5,456 | 3.15625 | 3 | [] | no_license | import numpy as np
class Board:
board = None
size = 0
player1 = 0
player2 = 0
player1Color = 1
player2Color = 2
def __init__(self, size, player1=0,player2=0,board=None):
self.size = size
if board is None:
self.board = np.zeros(shape=(self.size, self.size), dtype... | true |
06d7d3f0d2222510208f7ce4e83433735bbc4431 | Python | andrewhall123/savedfiles | /lucky.py | UTF-8 | 407 | 2.90625 | 3 | [] | no_license | # python 3
import requests,sys,webbrowser, bs4
print('Googling...')
res=requests.get('http://google.com/search?q=' + ''.join(sys.argv[1:]))
res.raise_for_status()
#retrive top search request
soup=bs4.BeautifulSoup(res.text)
#open a browser fo each result
linkElems=soup.select('.r a')
numOpen=min(5,len(linkElems))
f... | true |
f77b1e4034f1743d41c52f047624ced64499b8b1 | Python | aprebyl1/DSC510Spring2020 | /BLACK_DSC510/JBlack Week 3.py | UTF-8 | 2,411 | 4.34375 | 4 | [] | no_license | # course: DSC510
# assignment: 3.1
# due date: 3/29/2020
# name: Jessica Black
# this program will do the following:
# Display a welcome message for your program
# Retrieve the company name from the user
# Get the number of feet of fiber optic cable to be installed from the user.
# Evaluate the total cost based upon ... | true |
9f4b6220a95b8f1037d4ae13cf1beebfb44a460f | Python | Nixer/lesson02 | /age.py | UTF-8 | 532 | 4.03125 | 4 | [] | no_license | input_age = int(input("Введите свой возраст: "))
def age(age):
if age < 7:
return "Вы ходите в детский сад"
elif 6 < age < 17:
return "Вы учитесь в школе"
elif 16 < age < 21:
return "Вы учитесь в ВУЗе"
elif 20 < age < 60:
return "Вы работаете"
elif age > 59:
... | true |
7ba7fc8e3dcbd8c1a84ed4ab9fbdea122b66f805 | Python | pflun/advancedAlgorithms | /Wish-findTotalCount.py | UTF-8 | 1,100 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 就是有n个人比赛,问你有多少种比赛结果排名,每个人可以独自一人一组,
# 也可以和其他人组成团体,
# 比如n= 2, 两个人A,B,
# 可能的结果有3种
# A 第一,B 第二
# B 第一,A 第二
# A, B 团体第一
# 就是有n个人, 比赛, 问你有多少种比赛结果排名, 每个人可以独自一人一组,
# 也可以和其他人组成团体,
# 比如n = 2, 两个人 A,B,
# 可能的结果有3种
# A 第一, B 第二
# B 第一, A 第二
# A, B 团体第一
# n = 3, 有 13 种可能
# dp[0] = 1;
# dp[1] = 1;
# dp count... | true |
913e96ad475cc9c86076847f4005e26b1484fc96 | Python | JacobHippo/age | /age.py | UTF-8 | 372 | 3.59375 | 4 | [] | no_license | drive = input('你有沒有開過車')
if drive != '有' and drive !='沒有':
print('只能輸入有/沒有')
raise SystemExit
age = input('請問你幾歲')
age = int(age)
if drive == '有':
if age >= 18:
print('你通過測驗了')
else:
print('你犯法了')
elif drive == '沒有':
if age >= 18:
print('爛草莓')
else:
print('滾')
| true |
c5452f3fc04c5b7153ee376ba5e1799444cd3fbd | Python | eraserhead0705/travel_agency | /travel_agency_app/tests/test_factory.py | UTF-8 | 1,218 | 2.734375 | 3 | [] | no_license | from django.test import TestCase
from travel_agency_app.models import Availability, Location, GeoLocation, TourCapacity, TourPackage
class LocationTestCase(TestCase):
def setUp(self):
loc = Location.objects.create(location_name="north pole", is_captial=True)
GeoLocation.objects.create(latitute=10.4... | true |
de306e8ac94b4310081e201d3a091734f342cee9 | Python | YiseBoge/CompetitiveProgramming2 | /Contests/Contest8/p2.py | UTF-8 | 530 | 3.109375 | 3 | [] | no_license | import sys
class Solution:
def minimumDeletions(self, s: str) -> int:
result = sys.maxsize
total_a = 0
for el in s:
if el == 'a':
total_a += 1
a_count = b_count = 0
for el in s:
if el == 'a':
a_count += 1
... | true |
a4a60daa7d186514eb7ab2ee6093ec7ee4a269ee | Python | ehaupt/fastest_pkg | /fastest_pkg/fastest_pkg.py | UTF-8 | 4,572 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Author : Emanuel Haupt <ehaupt@FreeBSD.org>
Purpose : Find the fastest pkg mirror
License : BSD3CLAUSE
"""
import argparse
import json
from operator import itemgetter
from sys import stderr as STREAM
from typing import Dict
from urllib.parse import urlparse
import dns.resolver
import p... | true |
db8ac4b383beb1052fc2f9a59cd95fd7f3d77268 | Python | django/django-localflavor | /localflavor/uy/uy_departments.py | UTF-8 | 532 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | #: A list of Uruguayan departments as `choices` in a formfield.
DEPARTMENT_CHOICES = (
('G', 'Artigas'),
('A', 'Canelones'),
('E', 'Cerro Largo'),
('L', 'Colonia'),
('Q', 'Durazno'),
('N', 'Flores'),
('O', 'Florida'),
('P', 'Lavalleja'),
('B', 'Maldonado'),
('S', 'Montevideo'),
... | true |
d3ee4d64470f084837ee001080e0f2f30663cfcf | Python | mmaduabum/Pi-Epsilon-Psi | /our_svm.py | UTF-8 | 8,157 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import utils
import sys
import random
import time
import features
import operator
import numpy as np
from sklearn import cross_validation
from sklearn import svm
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, classification_report, confusion_matrix
"""Our mul... | true |